aboutsummaryrefslogtreecommitdiff
path: root/build.gradle
diff options
context:
space:
mode:
authorGlease <4586901+Glease@users.noreply.github.com>2022-03-02 01:29:49 +0800
committerGlease <4586901+Glease@users.noreply.github.com>2022-03-02 01:29:49 +0800
commit11a61c3c2c32ac47bc2d63e1fc0c8734f8acc285 (patch)
tree9011c314818fc2d68c62471436b4f26d0e1be71a /build.gradle
parent345c435b7b2022f1ba095c44516d0d067d8606f4 (diff)
downloadGT5-Unofficial-11a61c3c2c32ac47bc2d63e1fc0c8734f8acc285.tar.gz
GT5-Unofficial-11a61c3c2c32ac47bc2d63e1fc0c8734f8acc285.tar.bz2
GT5-Unofficial-11a61c3c2c32ac47bc2d63e1fc0c8734f8acc285.zip
structurelib support for LSC
Diffstat (limited to 'build.gradle')
-rw-r--r--build.gradle74
1 files changed, 44 insertions, 30 deletions
diff --git a/build.gradle b/build.gradle
index 9cbcb8e51c..656f439f7a 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,4 +1,4 @@
-//version: 1644612407
+//version: 1644894948
/*
DO NOT CHANGE THIS FILE!
@@ -6,12 +6,11 @@ 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
+import org.gradle.internal.logging.text.StyledTextOutput.Style
+import org.gradle.internal.logging.text.StyledTextOutputFactory
import java.util.concurrent.TimeUnit
@@ -51,7 +50,7 @@ plugins {
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 'com.github.gmazzo.buildconfig' version '3.0.3' apply false
+ id 'com.github.gmazzo.buildconfig' version '3.0.3' apply false
}
if (project.file('.git/HEAD').isFile()) {
@@ -175,7 +174,7 @@ configurations.all {
try {
'git config core.fileMode false'.execute()
}
-catch (Exception e) {
+catch (Exception ignored) {
out.style(Style.Failure).println("git isn't installed at all")
}
@@ -185,7 +184,7 @@ String versionOverride = System.getenv("VERSION") ?: null
try {
identifiedVersion = versionOverride == null ? gitVersion() : versionOverride
}
-catch (Exception e) {
+catch (Exception ignored) {
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' +
@@ -199,7 +198,7 @@ ext {
modVersion = identifiedVersion
}
-if( identifiedVersion.equals(versionOverride) ) {
+if(identifiedVersion == versionOverride) {
out.style(Style.Failure).text('Override version to ').style(Style.Identifier).text(modVersion).style(Style.Failure).println('!\7')
}
@@ -214,13 +213,17 @@ else {
def arguments = []
def jvmArguments = []
-if(usesMixins.toBoolean()) {
+if (usesMixins.toBoolean()) {
arguments += [
- "--tweakClass org.spongepowered.asm.launch.MixinTweaker"
- ]
- jvmArguments += [
- "-Dmixin.debug.countInjections=true", "-Dmixin.debug.verbose=true", "-Dmixin.debug.export=true"
+ "--tweakClass org.spongepowered.asm.launch.MixinTweaker"
]
+ if (!project.hasProperty(usesMixinDebug) || usesMixinDebug.toBoolean()) {
+ jvmArguments += [
+ "-Dmixin.debug.countInjections=true",
+ "-Dmixin.debug.verbose=true",
+ "-Dmixin.debug.export=true"
+ ]
+ }
}
minecraft {
@@ -275,7 +278,6 @@ repositories {
name 'Overmind forge repo mirror'
url 'https://gregtech.overminddl1.com/'
}
- mavenCentral()
if(usesMixins.toBoolean()) {
maven {
name 'sponge'
@@ -313,18 +315,23 @@ def refMap = "${tasks.compileJava.temporaryDir}" + File.separator + mixingConfig
def mixinSrg = "${tasks.reobf.temporaryDir}" + File.separator + "mixins.srg"
task generateAssets {
- if(usesMixins.toBoolean()) {
- getFile("/src/main/resources/mixins." + modId + ".json").text = """{
+ if (usesMixins.toBoolean()) {
+ def mixinConfigFile = getFile("/src/main/resources/mixins." + modId + ".json");
+ if (!mixinConfigFile.exists()) {
+ mixinConfigFile.text = """{
"required": true,
"minVersion": "0.7.11",
"package": "${modGroup}.${mixinsPackage}",
"plugin": "${modGroup}.${mixinPlugin}",
"refmap": "${mixingConfigRefMap}",
"target": "@env(DEFAULT)",
- "compatibilityLevel": "JAVA_8"
+ "compatibilityLevel": "JAVA_8",
+ "mixins": [],
+ "client": [],
+ "server": []
}
-
"""
+ }
}
}
@@ -440,7 +447,7 @@ processResources {
def getManifestAttributes() {
def manifestAttributes = [:]
- if(containsMixinsAndOrCoreModOnly.toBoolean() == false && (usesMixins.toBoolean() || coreModClass)) {
+ if(!containsMixinsAndOrCoreModOnly.toBoolean() && (usesMixins.toBoolean() || coreModClass)) {
manifestAttributes += ["FMLCorePluginContainsFMLMod": true]
}
@@ -456,14 +463,14 @@ def getManifestAttributes() {
manifestAttributes += [
"TweakClass" : "org.spongepowered.asm.launch.MixinTweaker",
"MixinConfigs" : "mixins." + modId + ".json",
- "ForceLoadAsMod" : containsMixinsAndOrCoreModOnly.toBoolean() == false
+ "ForceLoadAsMod" : !containsMixinsAndOrCoreModOnly.toBoolean()
]
}
return manifestAttributes
}
task sourcesJar(type: Jar) {
- from (sourceSets.main.allJava)
+ from (sourceSets.main.allSource)
from (file("$projectDir/LICENSE"))
getArchiveClassifier().set('sources')
}
@@ -518,7 +525,7 @@ task devJar(type: Jar) {
}
task apiJar(type: Jar) {
- from (sourceSets.main.allJava) {
+ from (sourceSets.main.allSource) {
include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**'
}
@@ -549,6 +556,9 @@ tasks.withType(GenerateModuleMetadata) {
enabled = false
}
+// workaround variable hiding in pom processing
+def projectConfigs = project.configurations
+
publishing {
publications {
maven(MavenPublication) {
@@ -569,16 +579,20 @@ publishing {
// Using the identified version, not project.version as it has the prepended 1.7.10
version = System.getenv("RELEASE_VERSION") ?: identifiedVersion
- // remove extra garbage from who knows where
+ // remove extra garbage from minecraft and minecraftDeps configuration
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', 'org.jetbrains.kotlin', '']
+ def badArtifacts = [:].withDefault {[] as Set<String>}
+ for (configuration in [projectConfigs.minecraft, projectConfigs.minecraftDeps]) {
+ for (dependency in configuration.allDependencies) {
+ badArtifacts[dependency.group == null ? "" : dependency.group] += dependency.name
+ }
+ }
+ // example for specifying extra stuff to ignore
+ // badArtifacts["org.example.group"] += "artifactName"
+
Node pomNode = asNode()
pomNode.dependencies.'*'.findAll() {
- badPomGroup.contains(it.groupId.text())
+ badArtifacts[it.groupId.text()].contains(it.artifactId.text())
}.each() {
it.parent().remove(it)
}
@@ -722,7 +736,7 @@ def deobf(String sourceURL, String fileName) {
// Helper methods
def checkPropertyExists(String propertyName) {
- if (project.hasProperty(propertyName) == false) {
+ if (!project.hasProperty(propertyName)) {
throw new GradleException("This project requires a property \"" + propertyName + "\"! Please add it your \"gradle.properties\". You can find all properties and their description here: https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/main/gradle.properties")
}
}