diff --git a/build.gradle b/build.gradle index 610879cb..3d3fd926 100644 --- a/build.gradle +++ b/build.gradle @@ -1,11 +1,14 @@ -//version: 1643844119 +//version: 1644510936 /* DO NOT CHANGE THIS FILE! Also, you may replace this file at any time if there is an update available. Please check https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/main/build.gradle for updates. - */ +*/ +import org.gradle.internal.logging.text.StyledTextOutput +import org.gradle.internal.logging.text.StyledTextOutputFactory +import org.gradle.internal.logging.text.StyledTextOutput.Style import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar @@ -15,20 +18,20 @@ import java.util.concurrent.TimeUnit buildscript { repositories { maven { - name = "forge" - url = "https://maven.minecraftforge.net" + name 'forge' + url 'https://maven.minecraftforge.net' } maven { - name = "sonatype" - url = "https://oss.sonatype.org/content/repositories/snapshots/" + name 'sonatype' + url 'https://oss.sonatype.org/content/repositories/snapshots/' } maven { - name = "Scala CI dependencies" - url = "https://repo1.maven.org/maven2/" + name 'Scala CI dependencies' + url 'https://repo1.maven.org/maven2/' } maven { - name = "jitpack" - url = "https://jitpack.io" + name 'jitpack' + url 'https://jitpack.io' } } dependencies { @@ -37,21 +40,24 @@ buildscript { } plugins { + id 'java-library' id 'idea' id 'eclipse' id 'scala' + id 'maven-publish' id('org.jetbrains.kotlin.jvm') version ('1.6.10') apply false id('org.ajoberstar.grgit') version('4.1.1') id('com.github.johnrengelman.shadow') version('4.0.4') id('com.palantir.git-version') version('0.13.0') apply false id('de.undercouch.download') version('5.0.1') - id('maven-publish') } if (project.file('.git/HEAD').isFile()) { apply plugin: 'com.palantir.git-version' } +def out = services.get(StyledTextOutputFactory).create("an-output") + apply plugin: 'forge' def projectJavaVersion = JavaLanguageVersion.of(8) @@ -168,7 +174,7 @@ try { 'git config core.fileMode false'.execute() } catch (Exception e) { - logger.error("\u001B[31mgit isn't installed at all\u001B[0m") + out.style(Style.Failure).println("git isn't installed at all") } // Pulls version first from the VERSION env and then git tag @@ -178,18 +184,19 @@ try { identifiedVersion = versionOverride == null ? gitVersion() : versionOverride } catch (Exception e) { - logger.error("\n\u001B[1;31mThis mod must be version controlled by Git AND the repository must provide at least one tag,\n" + - "or the VERSION override must be set! \u001B[32m(Don't download from GitHub using the ZIP option, instead\n" + - "clone the repository, see\u001B[33m https://gtnh.miraheze.org/wiki/Development \u001B[32mfor details.)\u001B[0m\n"); + out.style(Style.Failure).text( + 'This mod must be version controlled by Git AND the repository must provide at least one tag,\n' + + 'or the VERSION override must be set! ').style(Style.SuccessHeader).text('(Do NOT download from GitHub using the ZIP option, instead\n' + + 'clone the repository, see ').style(Style.Info).text('https://gtnh.miraheze.org/wiki/Development').style(Style.SuccessHeader).println(' for details.)' + ) versionOverride = 'NO-GIT-TAG-SET' identifiedVersion = versionOverride } version = minecraftVersion + '-' + identifiedVersion -String modVersion = version +String modVersion = identifiedVersion if( identifiedVersion.equals(versionOverride) ) { - logger.error('\u001B[31m\u001B[7mWe hope you know what you\'re doing using\u001B[0m\u001B[1;34m ' + modVersion + '\u001B[0m\n'); - logger.error('\7\u001B[31mGoing to blindly try to use\u001B[1;34m ' + modVersion + '\u001B[0m\u001B[31m, this probably won\'t work the way you expect!!\u001B[0m\n'); + out.style(Style.Failure).text('Override version to ').style(Style.Identifier).text(modVersion).style(Style.Failure).println('!\7') } group = modGroup @@ -262,36 +269,36 @@ configurations { repositories { maven { - name = "Overmind forge repo mirror" - url = "https://gregtech.overminddl1.com/" + name 'Overmind forge repo mirror' + url 'https://gregtech.overminddl1.com/' } if(usesMixins.toBoolean()) { maven { - name = "sponge" - url = "https://repo.spongepowered.org/repository/maven-public" + name 'sponge' + url 'https://repo.spongepowered.org/repository/maven-public' } maven { - url = "https://jitpack.io" + url 'https://jitpack.io' } } } dependencies { if(usesMixins.toBoolean()) { - annotationProcessor("org.ow2.asm:asm-debug-all:5.0.3") - annotationProcessor("com.google.guava:guava:24.1.1-jre") - annotationProcessor("com.google.code.gson:gson:2.8.6") - annotationProcessor("org.spongepowered:mixin:0.8-SNAPSHOT") + annotationProcessor('org.ow2.asm:asm-debug-all:5.0.3') + annotationProcessor('com.google.guava:guava:24.1.1-jre') + annotationProcessor('com.google.code.gson:gson:2.8.6') + annotationProcessor('org.spongepowered:mixin:0.8-SNAPSHOT') // using 0.8 to workaround a issue in 0.7 which fails mixin application - compile("com.github.GTNewHorizons:SpongePoweredMixin:0.7.12-GTNH") { + compile('com.github.GTNewHorizons:SpongePoweredMixin:0.7.12-GTNH') { // Mixin includes a lot of dependencies that are too up-to-date - exclude module: "launchwrapper" - exclude module: "guava" - exclude module: "gson" - exclude module: "commons-io" - exclude module: "log4j-core" + exclude module: 'launchwrapper' + exclude module: 'guava' + exclude module: 'gson' + exclude module: 'commons-io' + exclude module: 'log4j-core' } - compile("com.github.GTNewHorizons:SpongeMixins:1.5.0") + compile('com.github.GTNewHorizons:SpongeMixins:1.5.0') } } @@ -411,7 +418,7 @@ processResources from(sourceSets.main.resources.srcDirs) { include 'mcmod.info' - // replace version and mcversion + // replace modVersion and minecraftVersion expand "minecraftVersion": project.minecraft.version, "modVersion": modVersion, "modId": modId, @@ -422,7 +429,7 @@ processResources from refMap } - // copy everything else, thats not the mcmod.info + // copy everything else that's not the mcmod.info from(sourceSets.main.resources.srcDirs) { exclude 'mcmod.info' } @@ -539,8 +546,6 @@ tasks.withType(GenerateModuleMetadata) { enabled = false } - -// publishing publishing { publications { maven(MavenPublication) { @@ -561,13 +566,16 @@ publishing { // Using the identified version, not project.version as it has the prepended 1.7.10 version = System.getenv("RELEASE_VERSION") ?: identifiedVersion - // Remove all non GTNH deps here. - // Original intention was to remove an invalid forgeBin being generated without a groupId (mandatory), but - // it also removes all of the MC deps + // remove extra garbage from who knows where pom.withXml { + def badPomGroup = ['net.minecraft', 'com.google.code.findbugs', 'org.ow2.asm', 'com.typesafe.akka', 'com.typesafe', 'org.scala-lang', + 'org.scala-lang.plugins', 'net.sf.jopt-simple', 'lzma', 'com.mojang', 'org.apache.commons', 'org.apache.httpcomponents', + 'commons-logging', 'java3d', 'net.sf.trove4j', 'com.ibm.icu', 'com.paulscode', 'io.netty', 'com.google.guava', + 'commons-io', 'commons-codec', 'net.java.jinput', 'net.java.jutils', 'com.google.code.gson', 'org.apache.logging.log4j', + 'org.lwjgl.lwjgl', 'tv.twitch', ''] Node pomNode = asNode() pomNode.dependencies.'*'.findAll() { - it.groupId.text() != 'com.github.GTNewHorizons' + badPomGroup.contains(it.groupId.text()) }.each() { it.parent().remove(it) } @@ -599,7 +607,7 @@ if (isNewBuildScriptVersionAvailable(projectDir.toString())) { if (autoUpdateBuildScript.toBoolean()) { performBuildScriptUpdate(projectDir.toString()) } else { - println("Build script update available! Run 'gradle updateBuildScript'") + out.style(Style.SuccessHeader).println("Build script update available! Run 'gradle updateBuildScript'") } } @@ -611,7 +619,7 @@ boolean performBuildScriptUpdate(String projectDir) { if (isNewBuildScriptVersionAvailable(projectDir)) { def buildscriptFile = getFile("build.gradle") availableBuildScriptUrl().withInputStream { i -> buildscriptFile.withOutputStream { it << i } } - print("Build script updated. Please REIMPORT the project or RESTART your IDE!") + out.style(Style.Success).print("Build script updated. Please REIMPORT the project or RESTART your IDE!") return true } return false @@ -673,7 +681,7 @@ def deobf(String sourceURL) { } } -// The method above is to be prefered. Use this method if the filename is not at the end of the URL. +// The method above is to be preferred. Use this method if the filename is not at the end of the URL. def deobf(String sourceURL, String fileName) { String cacheDir = System.getProperty("user.home") + "/.gradle/caches/" String bon2Dir = cacheDir + "forge_gradle/deobf" @@ -685,14 +693,14 @@ def deobf(String sourceURL, String fileName) { return files(deobfFile) } - download { + download.run { src 'https://github.com/GTNewHorizons/BON2/releases/download/2.5.0/BON2-2.5.0.CUSTOM-all.jar' dest bon2File quiet true overwrite false } - download { + download.run { src sourceURL dest obfFile quiet true diff --git a/dependencies.gradle b/dependencies.gradle index d37c6a2f..db8fff15 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -1,10 +1,6 @@ // Add your dependencies here dependencies { - compileOnly("com.github.GTNewHorizons:TinkersConstruct:1.9.0.13-GTNH:dev") { - transitive = false - } - compileOnly("curse.maven:dynamic-lights-227874:2337326") { - transitive = false - } + compileOnly('com.github.GTNewHorizons:TinkersConstruct:1.9.0.13-GTNH:dev') {transitive = false} + compileOnly('curse.maven:dynamic-lights-227874:2337326') } diff --git a/repositories.gradle b/repositories.gradle index 77f2a1b9..9634a2ec 100644 --- a/repositories.gradle +++ b/repositories.gradle @@ -2,13 +2,17 @@ repositories { maven { - name = "GTNH Maven" - url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/" + name 'GTNH Maven' + url 'http://jenkins.usrv.eu:8081/nexus/content/groups/public/' + allowInsecureProtocol } maven { - url "https://cursemaven.com" + url 'https://cursemaven.com' + content { + includeGroup 'curse.maven' + } } maven { - url = "https://jitpack.io" + url 'https://jitpack.io' } } diff --git a/src/main/java/mods/battlegear2/coremod/BattlegearLoadingPlugin.java b/src/main/java/mods/battlegear2/coremod/BattlegearLoadingPlugin.java index 65a0eb62..353aeb7c 100644 --- a/src/main/java/mods/battlegear2/coremod/BattlegearLoadingPlugin.java +++ b/src/main/java/mods/battlegear2/coremod/BattlegearLoadingPlugin.java @@ -4,6 +4,7 @@ import cpw.mods.fml.relauncher.IFMLLoadingPlugin.Name; import cpw.mods.fml.relauncher.IFMLLoadingPlugin.SortingIndex; import cpw.mods.fml.relauncher.IFMLLoadingPlugin.TransformerExclusions; +import cpw.mods.fml.relauncher.IFMLLoadingPlugin.MCVersion; import mods.battlegear2.api.core.BattlegearTranslator; import java.io.File; @@ -12,6 +13,7 @@ @TransformerExclusions({"mods.battlegear2.coremod"}) @Name("Mine and Blade: Battlegear2") @SortingIndex(1500) +@MCVersion("1.7.10") public final class BattlegearLoadingPlugin implements IFMLLoadingPlugin { public static final String EntityPlayerTransformer = "mods.battlegear2.coremod.transformers.EntityPlayerTransformer"; diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index ca2e768f..cd8dc9e2 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -1,15 +1,12 @@ -[ - { - "modid": "${modId}", - "name": "${modName}", - "description": "A WIP, open-source combat mod, focusing on groundbreaking features and balanced combat", - "version": "${modVersion}", - "mcversion": "${minecraftVersion}", - "logoFile": "bg-logo.png", - "url": "http://www.curse.com/mc-mods/minecraft/mb-battlegear-2", - "updateUrl": "", - "authorList": ["nerd-boy", "GotoLink", "coolAlias"], - "credits": "By nerd-boy & GotoLink, with help from coolAlias" - } - ] - \ No newline at end of file +[{ + "modid": "${modId}", + "name": "${modName}", + "description": "A WIP, open-source combat mod, focusing on groundbreaking features and balanced combat", + "version": "${modVersion}", + "mcversion": "${minecraftVersion}", + "logoFile": "bg-logo.png", + "url": "http://www.curse.com/mc-mods/minecraft/mb-battlegear-2", + "updateUrl": "", + "authorList": ["nerd-boy", "GotoLink", "coolAlias"], + "credits": "By nerd-boy & GotoLink, with help from coolAlias" +}]