Skip to content

Commit

Permalink
update buildscript
Browse files Browse the repository at this point in the history
  • Loading branch information
FalsePattern committed Jun 8, 2022
1 parent 65cfcd9 commit bc82df2
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 12 deletions.
35 changes: 23 additions & 12 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//version: 1641429628falsepattern12
//version: 1641429628falsepattern18
/*
DO NOT CHANGE THIS FILE!
Expand Down Expand Up @@ -95,6 +95,7 @@ checkPropertyExists("repositoryName")
checkPropertyExists("mavenGroupId")
checkPropertyExists("mavenArtifactId")
checkPropertyExists("hasMixinDeps")
checkPropertyExists("mixinPreinitConfig")


String javaSourceDir = "src/main/java/"
Expand Down Expand Up @@ -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
]
}
Expand Down Expand Up @@ -545,18 +546,26 @@ 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]
}
}
}

//Publishing
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"
}
Expand All @@ -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
}
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,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 compatability only
# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin
Expand Down

0 comments on commit bc82df2

Please sign in to comment.