From 58ff1a3d8f2831d4f5e193e86afad125ebe4f233 Mon Sep 17 00:00:00 2001 From: nikky Date: Wed, 11 Jul 2018 23:29:02 +0200 Subject: [PATCH] cleanup gradle stuff --- 1.10.2/build.gradle | 42 ++++++++-------- 1.11.2/build.gradle | 48 ++++++++++--------- 1.12.2/build.gradle | 34 ++++++------- .../src/main/kotlin/matterlink/MatterLink.kt | 5 -- 1.7.10/build.gradle | 48 +++++++++---------- build.gradle | 15 +++++- core/build.gradle | 11 +---- gradle.properties | 3 ++ 8 files changed, 108 insertions(+), 98 deletions(-) diff --git a/1.10.2/build.gradle b/1.10.2/build.gradle index 71400f8..129c5a2 100644 --- a/1.10.2/build.gradle +++ b/1.10.2/build.gradle @@ -1,24 +1,26 @@ buildscript { repositories { jcenter() - maven { url = "http://files.minecraftforge.net/maven" } + maven { + url = 'http://files.minecraftforge.net/maven' + } mavenCentral() maven { url 'https://plugins.gradle.org/m2/' } } dependencies { - classpath "net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT" - classpath "com.github.jengelman.gradle.plugins:shadow:2.0.0" - classpath "gradle.plugin.com.matthewprenger:CurseGradle:1.0.10" + classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '2.2-SNAPSHOT' + classpath group: 'com.github.jengelman.gradle.plugins', name: 'shadow', version: shadow_version + classpath group: 'gradle.plugin.com.matthewprenger', name: 'CurseGradle', version: cursegradle_version } } apply plugin: 'net.minecraftforge.gradle.forge' -apply plugin: "com.github.johnrengelman.shadow" +apply plugin: 'com.github.johnrengelman.shadow' apply plugin: 'com.matthewprenger.cursegradle' -version = project.mc_version + "-" + project.mod_version +version = project.mc_version + '-' + project.mod_version archivesBaseName = project.mod_name @@ -26,18 +28,18 @@ sourceCompatibility = targetCompatibility = '1.8' dependencies { compile project(':core') - compile group: "net.shadowfacts", name: "Forgelin", version: project.forgelin_version + compile group: 'net.shadowfacts', name: 'Forgelin', version: project.forgelin_version } shadowJar { classifier '' - relocate "blue.endless", "matterlink.repack.blue.endless" + relocate 'blue.endless', 'matterlink.repack.blue.endless' dependencies { - include project(":core") - include project(":api") - include project(":Jankson") + include project(':core') + include project(':api') + include project(':Jankson') } exclude 'dummyThing' @@ -55,7 +57,7 @@ for (set in sourceSets) { source = set.getKotlin() output = dir } - def compileTask = tasks[set.getCompileTaskName("kotlin")] + def compileTask = tasks[set.getCompileTaskName('kotlin')] compileTask.source = dir compileTask.dependsOn taskName def dirPath = dir.toPath() @@ -66,8 +68,8 @@ for (set in sourceSets) { sourceJar.from sourceSets.main.kotlin minecraft { - version = project.mc_version + "-" + project.forge_version - runDir = "run" + version = project.mc_version + '-' + project.forge_version + runDir = 'run' mappings = project.mcp_mappings @@ -80,11 +82,11 @@ minecraft { processResources { // this will ensure that this task is redone when the versions change. - inputs.property "version", project.mod_version - inputs.property "mcversion", project.minecraft.version + inputs.property 'version', project.mod_version + inputs.property 'mcversion', project.minecraft.version // replace stuff in mcmod.info, nothing else - from(project(":core").sourceSets.main.resources.srcDirs) { + from(project(':core').sourceSets.main.resources.srcDirs) { include 'mcmod.info' // replace version and mcversion @@ -92,7 +94,7 @@ processResources { } // copy everything else except the mcmod.info - from(project(":core").sourceSets.main.resources.srcDirs) { + from(project(':core').sourceSets.main.resources.srcDirs) { exclude 'mcmod.info' } @@ -104,7 +106,7 @@ sourceJar { from sourceSets.main.allSource // copy everything else except the mcmod.info - from(project(":core").sourceSets.main.allSource) { + from(project(':core').sourceSets.main.allSource) { exclude 'mcmod.info' } } @@ -125,7 +127,7 @@ curseforge { releaseType = project.curse_release_type if (project.hasProperty('changelog_file')) { println("changelog = $changelog_file") - changelogType = "markdown" + changelogType = 'markdown' changelog = file(changelog_file) } relations { diff --git a/1.11.2/build.gradle b/1.11.2/build.gradle index fcae3a0..91ea2fb 100644 --- a/1.11.2/build.gradle +++ b/1.11.2/build.gradle @@ -3,27 +3,29 @@ import net.minecraftforge.gradle.user.TaskSourceCopy buildscript { repositories { jcenter() - maven { url = "http://files.minecraftforge.net/maven" } + maven { + url = 'http://files.minecraftforge.net/maven' + } mavenCentral() maven { url = 'https://oss.sonatype.org/content/groups/public' } maven { - url = "https://plugins.gradle.org/m2/" + url = 'https://plugins.gradle.org/m2/' } } dependencies { - classpath "net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT" - classpath "com.github.jengelman.gradle.plugins:shadow:2.0.0" - classpath "gradle.plugin.com.matthewprenger:CurseGradle:1.0.10" + classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '2.2-SNAPSHOT' + classpath group: 'com.github.jengelman.gradle.plugins', name: 'shadow', version: shadow_version + classpath group: 'gradle.plugin.com.matthewprenger', name: 'CurseGradle', version: cursegradle_version } } apply plugin: 'net.minecraftforge.gradle.forge' -apply plugin: "com.github.johnrengelman.shadow" +apply plugin: 'com.github.johnrengelman.shadow' apply plugin: 'com.matthewprenger.cursegradle' -version = project.mc_version + "-" + project.mod_version +version = project.mc_version + '-' + project.mod_version archivesBaseName = project.mod_name @@ -31,18 +33,18 @@ sourceCompatibility = targetCompatibility = '1.8' dependencies { compile project(':core') - compile group: "net.shadowfacts", name: "Forgelin", version: project.forgelin_version + compile group: 'net.shadowfacts', name: 'Forgelin', version: project.forgelin_version } shadowJar { - classifier '' + classifier = '' - relocate "blue.endless", "matterlink.repack.blue.endless" + relocate 'blue.endless', 'matterlink.repack.blue.endless' dependencies { - include project(":core") - include project(":api") - include project(":Jankson") + include project(':core') + include project(':api') + include project(':Jankson') } exclude 'dummyThing' @@ -57,7 +59,7 @@ for (set in sourceSets) { source = set.getKotlin() output = dir } - def compileTask = tasks[set.getCompileTaskName("kotlin")] + def compileTask = tasks[set.getCompileTaskName('kotlin')] compileTask.source = dir compileTask.dependsOn taskName def dirPath = dir.toPath() @@ -68,8 +70,8 @@ for (set in sourceSets) { sourceJar.from sourceSets.main.kotlin minecraft { - version = project.mc_version + "-" + project.forge_version - runDir = "run" + version = project.mc_version + '-' + project.forge_version + runDir = 'run' mappings = project.mcp_mappings @@ -82,11 +84,11 @@ minecraft { processResources { // this will ensure that this task is redone when the versions change. - inputs.property "version", project.mod_version - inputs.property "mcversion", project.minecraft.version + inputs.property 'version', project.mod_version + inputs.property 'mcversion', project.minecraft.version // replace stuff in mcmod.info, nothing else - from(project(":core").sourceSets.main.resources.srcDirs) { + from(project(':core').sourceSets.main.resources.srcDirs) { include 'mcmod.info' // replace version and mcversion @@ -94,19 +96,19 @@ processResources { } // copy everything else except the mcmod.info - from(project(":core").sourceSets.main.resources.srcDirs) { + from(project(':core').sourceSets.main.resources.srcDirs) { exclude 'mcmod.info' } } sourceJar { - classifier 'sources' + classifier = 'sources' // copy all the minecraftforge specific classes from sourceSets.main.allSource // copy everything else except the mcmod.info - from(project(":core").sourceSets.main.allSource) { + from(project(':core').sourceSets.main.allSource) { exclude 'mcmod.info' } } @@ -127,7 +129,7 @@ curseforge { releaseType = project.curse_release_type if (project.hasProperty('changelog_file')) { println("changelog = $changelog_file") - changelogType = "markdown" + changelogType = 'markdown' changelog = file(changelog_file) } relations { diff --git a/1.12.2/build.gradle b/1.12.2/build.gradle index 6a8f2f4..f36af1b 100644 --- a/1.12.2/build.gradle +++ b/1.12.2/build.gradle @@ -1,27 +1,29 @@ buildscript { repositories { jcenter() - maven { url = "http://files.minecraftforge.net/maven" } + maven { + url = 'http://files.minecraftforge.net/maven' + } mavenCentral() maven { url = 'https://oss.sonatype.org/content/groups/public' } maven { - url = "https://plugins.gradle.org/m2/" + url = 'https://plugins.gradle.org/m2/' } } dependencies { - classpath "net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT" - classpath "com.github.jengelman.gradle.plugins:shadow:2.0.0" - classpath "gradle.plugin.com.matthewprenger:CurseGradle:1.0.10" + classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '2.3-SNAPSHOT' + classpath group: 'com.github.jengelman.gradle.plugins', name: 'shadow', version: shadow_version + classpath group: 'gradle.plugin.com.matthewprenger', name: 'CurseGradle', version: cursegradle_version } } apply plugin: 'net.minecraftforge.gradle.forge' -apply plugin: "com.github.johnrengelman.shadow" +apply plugin: 'com.github.johnrengelman.shadow' apply plugin: 'com.matthewprenger.cursegradle' -version = project.mc_version + "-" + project.mod_version +version = project.mc_version + '-' + project.mod_version archivesBaseName = project.mod_name @@ -29,26 +31,26 @@ sourceCompatibility = targetCompatibility = '1.8' dependencies { compile project(':core') - compile group: "net.shadowfacts", name: "Forgelin", version: project.forgelin_version + compile group: 'net.shadowfacts', name: 'Forgelin', version: project.forgelin_version } shadowJar { - classifier '' + classifier = '' - relocate "blue.endless", "matterlink.repack.blue.endless" + relocate 'blue.endless', 'matterlink.repack.blue.endless' dependencies { include project(':core') - include project(":api") - include project(":Jankson") + include project(':api') + include project(':Jankson') } exclude 'dummyThing' } minecraft { - version = project.mc_version + "-" + project.forge_version - runDir = "run" + version = project.mc_version + '-' + project.forge_version + runDir = 'run' mappings = project.mcp_mappings @@ -80,7 +82,7 @@ processResources { } sourceJar { - classifier 'sources' + classifier = 'sources' // copy all the minecraftforge specific classes from sourceSets.main.allSource @@ -105,7 +107,7 @@ curseforge { releaseType = project.curse_release_type if (project.hasProperty('changelog_file')) { println("changelog = $changelog_file") - changelogType = "markdown" + changelogType = 'markdown' changelog = file(changelog_file) } relations { diff --git a/1.12.2/src/main/kotlin/matterlink/MatterLink.kt b/1.12.2/src/main/kotlin/matterlink/MatterLink.kt index 6b4eb23..00c27a7 100644 --- a/1.12.2/src/main/kotlin/matterlink/MatterLink.kt +++ b/1.12.2/src/main/kotlin/matterlink/MatterLink.kt @@ -41,7 +41,6 @@ object MatterLink : IMatterLink() { @Mod.EventHandler fun preInit(event: FMLPreInitializationEvent) { logger = event.modLog as org.apache.logging.log4j.core.Logger - logger.level = Level.DEBUG logger.info("Building bridge!") cfg = BaseConfig(event.modConfigurationDirectory).load() @@ -98,7 +97,6 @@ object MatterLink : IMatterLink() { private fun playerByProfile(gameProfile: GameProfile): EntityPlayerMP? = FMLCommonHandler.instance().minecraftServerInstance.playerList.getPlayerByUUID(gameProfile.id) - private fun profileByUUID(uuid: UUID): GameProfile? = try { FMLCommonHandler.instance().minecraftServerInstance.playerProfileCache.getProfileByUUID(uuid) } catch (e: IllegalArgumentException) { @@ -117,9 +115,6 @@ object MatterLink : IMatterLink() { override fun uuidToName(uuid: UUID): String? = profileByUUID(uuid)?.name -// override fun log(level: String, formatString: String, vararg data: Any) = -// logger.log(Level.toLevel(level, Level.INFO), formatString, *data) - override fun commandSenderFor( user: String, env: IBridgeCommand.CommandEnvironment, diff --git a/1.7.10/build.gradle b/1.7.10/build.gradle index 5d2c296..7f2bfda 100644 --- a/1.7.10/build.gradle +++ b/1.7.10/build.gradle @@ -1,22 +1,24 @@ buildscript { repositories { jcenter() - maven { url = "http://files.minecraftforge.net/maven" } + maven { + url = 'http://files.minecraftforge.net/maven' + } mavenCentral() maven { - url = "https://plugins.gradle.org/m2/" + url = 'https://plugins.gradle.org/m2/' } } dependencies { - classpath "net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT" - classpath "gradle.plugin.com.matthewprenger:CurseGradle:1.0.10" + classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '1.2-SNAPSHOT' + classpath group: 'gradle.plugin.com.matthewprenger', name: 'CurseGradle', version: cursegradle_version } } apply plugin: 'forge' apply plugin: 'com.matthewprenger.cursegradle' -version = project.mc_version + "-" + project.mod_version +version = project.mc_version + '-' + project.mod_version archivesBaseName = project.mod_name @@ -29,28 +31,26 @@ configurations { dependencies { shade project(':core') - shade project(":api") - shade project(":Jankson") + shade project(':api') + shade project(':Jankson') } minecraft { - version = project.mc_version + "-" + project.forge_version + "-" + project.mc_version - runDir = "run" + version = project.mc_version + '-' + project.forge_version + '-' + project.mc_version + runDir = 'run' mappings = project.mcp_mappings - srgExtra "PK: kotlin matterlink/repack/kotlin" - srgExtra "PK: org/jetbrains/annotations matterlink/repack/org/jetbrains/annotations" -// srgExtra "PK: org/apache/http matterlink/repack/org/apache/http" -// srgExtra "PK: org/apache/commons matterlink/repack/org/apache/commons" - srgExtra "PK: org/intellij matterlink/repack/org/intellij" - srgExtra "PK: blue/endless matterlink/repack/blue/endless" + srgExtra 'PK: kotlin matterlink/repack/kotlin' + srgExtra 'PK: org/jetbrains/annotations matterlink/repack/org/jetbrains/annotations' + srgExtra 'PK: org/intellij matterlink/repack/org/intellij' + srgExtra 'PK: blue/endless matterlink/repack/blue/endless' } compileKotlin.doFirst { - def target = "src/main/kotlin/matterlink/gen" + def target = 'src/main/kotlin/matterlink/gen' copy { - from("src/templates/kotlin/matterlink/Constants.kt") + from('src/templates/kotlin/matterlink/Constants.kt') into(target) } ant.replaceregexp(match: '@MODVERSION@', replace: project.mod_version, flags: 'g', byline: true) { @@ -69,11 +69,11 @@ compileKotlin.doFirst { processResources { // this will ensure that this task is redone when the versions change. - inputs.property "version", project.mod_version - inputs.property "mcversion", project.minecraft.version + inputs.property 'version', project.mod_version + inputs.property 'mcversion', project.minecraft.version // replace stuff in mcmod.info, nothing else - from(project(":core").sourceSets.main.resources.srcDirs) { + from(project(':core').sourceSets.main.resources.srcDirs) { include 'mcmod.info' // replace version and mcversion @@ -81,7 +81,7 @@ processResources { } // copy everything else except the mcmod.info - from(project(":core").sourceSets.main.resources.srcDirs) { + from(project(':core').sourceSets.main.resources.srcDirs) { exclude 'mcmod.info' } } @@ -89,8 +89,8 @@ processResources { jar { configurations.shade.each { dep -> from(project.zipTree(dep)) { - exclude "META-INF", "META-INF/**" - exclude "com/google/gson", "com/google/gson/**" + exclude 'META-INF', 'META-INF/**' + exclude 'com/google/gson', 'com/google/gson/**' } } } @@ -104,7 +104,7 @@ curseforge { releaseType = project.curse_release_type if (project.hasProperty('changelog_file')) { println("changelog = $changelog_file") - changelogType = "markdown" + changelogType = 'markdown' changelog = file(changelog_file) } mainArtifact(jar) { diff --git a/build.gradle b/build.gradle index 12a58db..43f2e5c 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,13 @@ +buildscript { + repositories { + jcenter() + } + dependencies { + classpath group: "org.jetbrains.kotlin", name: "kotlin-gradle-plugin", version: kotlin_version + } +} + plugins { - id "org.jetbrains.kotlin.jvm" version '1.2.41' id 'idea' } @@ -29,6 +37,11 @@ subprojects { name = "shadowfacts" url = "http://maven.shadowfacts.net/" } + ivy { + //Resolves baubles and jankson + name = "endless.blue dependency mirror" + artifactPattern "https://endless.blue/files/ivy/[module]-[revision].[ext]" + } } } \ No newline at end of file diff --git a/core/build.gradle b/core/build.gradle index 9ed1658..723b254 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -1,18 +1,11 @@ buildscript { - ext.kotlin_version = '1.2.41' repositories { jcenter() mavenCentral() - maven { - url = 'https://oss.sonatype.org/content/groups/public' - } - maven { - url = "https://plugins.gradle.org/m2/"; - } } dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath "com.github.jengelman.gradle.plugins:shadow:2.0.0" +// classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath group: "com.github.jengelman.gradle.plugins", name: "shadow", version: shadow_version } } diff --git a/gradle.properties b/gradle.properties index d5f59c8..e735639 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,8 @@ mod_name = MatterLink mod_version = 1.6.3 forgelin_version = 1.6.0 +kotlin_version = 1.2.41 +shadow_version = 2.0.0 +cursegradle_version = 1.0.10 curse_id = 287323 curse_release_type = beta \ No newline at end of file