Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-12-25 10:30:04 +01:00
Migrate Forge to Kotlin DSL
Dieser Commit ist enthalten in:
Ursprung
47b9716bdc
Commit
3d4025c757
@ -1,6 +1,12 @@
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.plugins.ExtraPropertiesExtension
|
||||
import org.gradle.api.plugins.JavaPluginConvention
|
||||
import org.gradle.api.tasks.SourceSetContainer
|
||||
import org.gradle.kotlin.dsl.getByType
|
||||
import org.gradle.kotlin.dsl.the
|
||||
|
||||
val Project.ext: ExtraPropertiesExtension
|
||||
get() = extensions.getByType()
|
||||
|
||||
val Project.sourceSets: SourceSetContainer
|
||||
get() = the<JavaPluginConvention>().sourceSets
|
||||
|
@ -11,11 +11,9 @@ import org.gradle.kotlin.dsl.apply
|
||||
import org.gradle.kotlin.dsl.configure
|
||||
import org.gradle.kotlin.dsl.get
|
||||
import org.gradle.kotlin.dsl.getByName
|
||||
import org.gradle.kotlin.dsl.getPlugin
|
||||
import org.gradle.kotlin.dsl.register
|
||||
import org.gradle.kotlin.dsl.the
|
||||
import org.gradle.kotlin.dsl.withType
|
||||
import org.gradle.kotlin.dsl.named
|
||||
import org.gradle.kotlin.dsl.register
|
||||
import org.gradle.kotlin.dsl.withType
|
||||
|
||||
fun Project.applyPlatformAndCoreConfiguration() {
|
||||
applyCommonConfiguration()
|
||||
@ -64,7 +62,7 @@ fun Project.applyPlatformAndCoreConfiguration() {
|
||||
tasks.register<Jar>("sourcesJar") {
|
||||
dependsOn("classes")
|
||||
archiveClassifier.set("sources")
|
||||
from(project.the<JavaPluginConvention>().sourceSets["main"].allSource)
|
||||
from(sourceSets["main"].allSource)
|
||||
}
|
||||
|
||||
artifacts {
|
||||
|
@ -53,8 +53,6 @@ configure<BasePluginConvention> {
|
||||
archivesBaseName = "$archivesBaseName-mc$minecraftVersion"
|
||||
}
|
||||
|
||||
val sourceSets = project.the<JavaPluginConvention>().sourceSets
|
||||
|
||||
tasks.named<Copy>("processResources") {
|
||||
// this will ensure that this task is redone when the versions change.
|
||||
inputs.property("version", project.ext["internalVersion"])
|
||||
|
@ -1,106 +0,0 @@
|
||||
PlatformConfigKt.applyPlatformAndCoreConfiguration(project)
|
||||
PlatformConfigKt.applyShadowConfiguration(project)
|
||||
|
||||
apply plugin: 'eclipse'
|
||||
apply plugin: 'net.minecraftforge.gradle'
|
||||
|
||||
def minecraftVersion = "1.14.3"
|
||||
def forgeVersion = "27.0.13"
|
||||
|
||||
configurations.all { Configuration it ->
|
||||
it.resolutionStrategy { ResolutionStrategy rs ->
|
||||
rs.force("com.google.guava:guava:21.0")
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile project(':worldedit-core')
|
||||
compile 'org.apache.logging.log4j:log4j-slf4j-impl:2.11.2'
|
||||
|
||||
minecraft "net.minecraftforge:forge:${minecraftVersion}-${forgeVersion}"
|
||||
|
||||
testCompile group: 'org.mockito', name: 'mockito-core', version: '1.9.0-rc1'
|
||||
}
|
||||
|
||||
sourceCompatibility = 1.8
|
||||
targetCompatibility = 1.8
|
||||
|
||||
minecraft {
|
||||
mappings channel: 'snapshot', version: "20190626-${minecraftVersion}"
|
||||
|
||||
runs {
|
||||
client = {
|
||||
// recommended logging data for a userdev environment
|
||||
properties 'forge.logging.markers': 'SCAN,REGISTRIES,REGISTRYDUMP'
|
||||
// recommended logging level for the console
|
||||
properties 'forge.logging.console.level': 'debug'
|
||||
workingDirectory project.file('run').canonicalPath
|
||||
source sourceSets.main
|
||||
}
|
||||
server = {
|
||||
// recommended logging data for a userdev environment
|
||||
properties 'forge.logging.markers': 'SCAN,REGISTRIES,REGISTRYDUMP'
|
||||
// recommended logging level for the console
|
||||
properties 'forge.logging.console.level': 'debug'
|
||||
workingDirectory project.file('run').canonicalPath
|
||||
source sourceSets.main
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
project.archivesBaseName = "${project.archivesBaseName}-mc${minecraftVersion}"
|
||||
|
||||
processResources {
|
||||
// this will ensure that this task is redone when the versions change.
|
||||
inputs.property 'version', project.internalVersion
|
||||
inputs.property 'forgeVersion', forgeVersion
|
||||
|
||||
// replace stuff in mcmod.info, nothing else
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
include 'META-INF/mods.toml'
|
||||
|
||||
// replace version and mcversion
|
||||
expand 'version': project.internalVersion, 'forgeVersion': forgeVersion
|
||||
}
|
||||
|
||||
// copy everything else except the mcmod.info
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
exclude 'META-INF/mods.toml'
|
||||
}
|
||||
}
|
||||
|
||||
jar {
|
||||
manifest {
|
||||
attributes("WorldEdit-Version": version)
|
||||
}
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
dependencies {
|
||||
relocate "org.slf4j", "com.sk89q.worldedit.slf4j"
|
||||
relocate "org.apache.logging.slf4j", "com.sk89q.worldedit.log4jbridge"
|
||||
|
||||
include(dependency('org.slf4j:slf4j-api'))
|
||||
include(dependency("org.apache.logging.log4j:log4j-slf4j-impl"))
|
||||
include(dependency("de.schlichtherle:truezip"))
|
||||
include(dependency("org.mozilla:rhino"))
|
||||
}
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
reobf {
|
||||
shadowJar {
|
||||
mappings = createMcpToSrg.output
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task deobfJar(type: Jar) {
|
||||
from sourceSets.main.output
|
||||
getArchiveClassifier().set("dev")
|
||||
}
|
||||
|
||||
artifacts {
|
||||
archives deobfJar
|
||||
}
|
110
worldedit-forge/build.gradle.kts
Normale Datei
110
worldedit-forge/build.gradle.kts
Normale Datei
@ -0,0 +1,110 @@
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
import net.minecraftforge.gradle.common.util.RunConfig
|
||||
import net.minecraftforge.gradle.userdev.UserDevExtension
|
||||
import net.minecraftforge.gradle.userdev.tasks.GenerateSRG
|
||||
import net.minecraftforge.gradle.userdev.tasks.RenameJarInPlace
|
||||
|
||||
plugins {
|
||||
id("net.minecraftforge.gradle")
|
||||
}
|
||||
|
||||
applyPlatformAndCoreConfiguration()
|
||||
applyShadowConfiguration()
|
||||
|
||||
val minecraftVersion = "1.14.3"
|
||||
val forgeVersion = "27.0.13"
|
||||
|
||||
configurations.all {
|
||||
resolutionStrategy {
|
||||
force("com.google.guava:guava:21.0")
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
"compile"(project(":worldedit-core"))
|
||||
"compile"("org.apache.logging.log4j:log4j-slf4j-impl:2.11.2")
|
||||
|
||||
"minecraft"("net.minecraftforge:forge:$minecraftVersion-$forgeVersion")
|
||||
|
||||
"testCompile"("org.mockito:mockito-core:1.9.0-rc1")
|
||||
}
|
||||
|
||||
configure<UserDevExtension> {
|
||||
mappings(mapOf(
|
||||
"channel" to "snapshot",
|
||||
"version" to "20190626-$minecraftVersion"
|
||||
))
|
||||
|
||||
runs {
|
||||
val runConfig = Action<RunConfig> {
|
||||
properties(mapOf(
|
||||
"forge.logging.markers" to "SCAN,REGISTRIES,REGISTRYDUMP",
|
||||
"forge.logging.console.level" to "debug"
|
||||
))
|
||||
workingDirectory = project.file("run").canonicalPath
|
||||
source(sourceSets["main"])
|
||||
}
|
||||
create("client", runConfig)
|
||||
create("server", runConfig)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
configure<BasePluginConvention> {
|
||||
archivesBaseName = "$archivesBaseName-mc$minecraftVersion"
|
||||
}
|
||||
|
||||
tasks.named<Copy>("processResources") {
|
||||
// this will ensure that this task is redone when the versions change.
|
||||
inputs.property("version", project.ext["internalVersion"])
|
||||
inputs.property("forgeVersion", forgeVersion)
|
||||
|
||||
// replace stuff in mcmod.info, nothing else
|
||||
from(sourceSets["main"].resources.srcDirs) {
|
||||
include("META-INF/mods.toml")
|
||||
|
||||
// replace version and mcversion
|
||||
expand(
|
||||
"version" to project.ext["internalVersion"],
|
||||
"forgeVersion" to forgeVersion
|
||||
)
|
||||
}
|
||||
|
||||
// copy everything else except the mcmod.info
|
||||
from(sourceSets["main"].resources.srcDirs) {
|
||||
exclude("META-INF/mods.toml")
|
||||
}
|
||||
}
|
||||
|
||||
tasks.named<Jar>("jar") {
|
||||
manifest {
|
||||
attributes("Class-Path" to "truezip.jar WorldEdit/truezip.jar js.jar WorldEdit/js.jar",
|
||||
"WorldEdit-Version" to project.version)
|
||||
}
|
||||
}
|
||||
|
||||
tasks.named<ShadowJar>("shadowJar") {
|
||||
dependencies {
|
||||
relocate("org.slf4j", "com.sk89q.worldedit.slf4j")
|
||||
relocate("org.apache.logging.slf4j", "com.sk89q.worldedit.log4jbridge")
|
||||
|
||||
include(dependency("org.slf4j:slf4j-api"))
|
||||
include(dependency("org.apache.logging.log4j:log4j-slf4j-impl"))
|
||||
}
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
val reobf = extensions.getByName<NamedDomainObjectContainer<RenameJarInPlace>>("reobf")
|
||||
reobf.maybeCreate("shadowJar").run {
|
||||
mappings = tasks.getByName<GenerateSRG>("createMcpToSrg").output
|
||||
}
|
||||
}
|
||||
|
||||
tasks.register<Jar>("deobfJar") {
|
||||
from(sourceSets["main"].output)
|
||||
archiveClassifier.set("dev")
|
||||
}
|
||||
|
||||
artifacts {
|
||||
add("archives", tasks.named("deobfJar"))
|
||||
}
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren