diff --git a/build.gradle b/build.gradle index 119dfdd..ff1cf25 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -//version: 1641429628falsepattern12 +//version: 1641429628falsepattern18 /* DO NOT CHANGE THIS FILE! @@ -95,6 +95,7 @@ checkPropertyExists("repositoryName") checkPropertyExists("mavenGroupId") checkPropertyExists("mavenArtifactId") checkPropertyExists("hasMixinDeps") +checkPropertyExists("mixinPreinitConfig") String javaSourceDir = "src/main/java/" @@ -441,7 +442,7 @@ def getManifestAttributes() { if(usesMixins.toBoolean()) { manifestAttributes += [ "TweakClass" : "org.spongepowered.asm.launch.MixinTweaker", - "MixinConfigs" : "mixins." + modId + ".json", + "MixinConfigs" : "mixins." + modId + ".json" + (mixinPreinitConfig ? "," + mixinPreinitConfig : ""), "ForceLoadAsMod" : containsMixinsAndOrCoreModOnly.toBoolean() == false ] } @@ -545,8 +546,16 @@ def getCredentials = { return [username: entry.username.text(), password: entry.password.text()] } } + throw new Exception(); } catch (Exception ignored) { - return [username: "none", password: "none"] + //Try from environment variables if file does not exist + String username = System.getenv("MAVEN_DEPLOY_USER") + String password = System.getenv("MAVEN_DEPLOY_PASSWORD") + if (username == null || password == null) { + return [username: null, password: null] + } else { + return [username: username, password: password] + } } } @@ -554,9 +563,9 @@ def getCredentials = { publishing { publications { maven(MavenPublication) { - artifact source: jar + artifact source: (jar.enabled ? jar : shadowJar) artifact source: sourcesJar, classifier: "src" - artifact source: devJar, classifier: "dev" + artifact source: (devJar.enabled ? devJar : shadowDevJar), classifier: "dev" if (apiPackage) { artifact source: apiJar, classifier: "api" } @@ -568,13 +577,15 @@ publishing { } repositories { - maven { - name = repositoryName - url = repositoryURL - def creds = getCredentials() - credentials { - username = creds == null ? "none" : creds.username - password = creds == null ? "none" : creds.password + if (repositoryURL.trim() != "") { + maven { + name = repositoryName + url = repositoryURL + def creds = getCredentials() + credentials { + username = creds == null ? "none" : creds.username + password = creds == null ? "none" : creds.password + } } } } diff --git a/gradle.properties b/gradle.properties index a740809..4ea1945 100644 --- a/gradle.properties +++ b/gradle.properties @@ -68,6 +68,8 @@ hasMixinDeps = false mixinPlugin = mixin.plugin.MixinPlugin # Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail! mixinsPackage = mixin.mixins +# Specify a preinit mixin here. Preinit mixins should be used very rarely, if at all, so this mixin config will not be managed by the buildscript, only included. +mixinPreinitConfig = # Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin! # This parameter is for legacy compatibility only # Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin