update buildscript

This commit is contained in:
FalsePattern committed 2022-04-17 17:22:24 +02:00
1 parent 1452afc9f7
commit 4be841eb73
2 files changed
+96 -29

No files matched your search

+72 -26
View File
@@ -1,9 +1,9 @@
//version: 8fa7883b6196c1765266f4e6ddf3118d5043aafb
//version: 1641429628falsepattern12
/*
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/SinTh0r4s/ExampleMod1.7.10/blob/main/build.gradle for updates.
Please check https://github.com/FalsePattern/ExampleMod1.7.10/blob/main/build.gradle for updates.
*/
@@ -28,11 +28,11 @@ buildscript {
}
maven {
name = "jitpack"
url = "https://jitpack.io"
url = "https://jitpack.falsepattern.com/"
}
}
dependencies {
classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.4'
classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.6'
}
}
@@ -88,6 +88,14 @@ checkPropertyExists("containsMixinsAndOrCoreModOnly")
checkPropertyExists("usesShadowedDependencies")
checkPropertyExists("developmentEnvironmentUserName")
//Properties added in fork
checkPropertyExists("skipBuildScriptUpdateCheck")
checkPropertyExists("repositoryURL")
checkPropertyExists("repositoryName")
checkPropertyExists("mavenGroupId")
checkPropertyExists("mavenArtifactId")
checkPropertyExists("hasMixinDeps")
String javaSourceDir = "src/main/java/"
String scalaSourceDir = "src/main/scala/"
@@ -153,7 +161,7 @@ configurations.all {
'git config core.fileMode false'.execute()
// Pulls version from git tag
try {
version = minecraftVersion + "-" + gitVersion()
version = gitVersion()
}
catch (Exception e) {
throw new IllegalStateException("This mod must be version controlled by Git AND the repository must provide at least one tag!");
@@ -166,6 +174,7 @@ if(project.hasProperty("customArchiveBaseName") && customArchiveBaseName) {
else {
archivesBaseName = modId
}
archivesBaseName += "-mc" + minecraftVersion
minecraft {
version = minecraftVersion + "-" + forgeVersion + "-" + minecraftVersion
@@ -205,13 +214,13 @@ repositories {
name = "Overmind forge repo mirror"
url = "https://gregtech.overminddl1.com/"
}
if(usesMixins.toBoolean()) {
if(usesMixins.toBoolean() || hasMixinDeps.toBoolean()) {
maven {
name = "sponge"
url = "https://repo.spongepowered.org/repository/maven-public"
url = "https://sponge.falsepattern.com/"
}
maven {
url = "https://jitpack.io"
url = "https://jitpack.falsepattern.com/"
}
}
}
@@ -233,6 +242,17 @@ dependencies {
}
compile("com.github.GTNewHorizons:SpongeMixins:1.3.3:dev")
}
if(hasMixinDeps.toBoolean()) {
runtime("org.spongepowered:mixin:0.7.11-SNAPSHOT") {
// 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"
}
runtime("com.github.GTNewHorizons:SpongeMixins:1.3.3:dev")
}
}
apply from: 'dependencies.gradle'
@@ -318,11 +338,20 @@ afterEvaluate {
runClient {
def arguments = []
def jvmArguments = []
if(usesMixins.toBoolean()) {
if (usesMixins.toBoolean()) {
arguments += [
"--mods=../build/libs/$modId-${version}.jar",
"--tweakClass org.spongepowered.asm.launch.MixinTweaker"
"--mods=../build/libs/$archivesBaseName-${version}.jar"
]
}
if(usesMixins.toBoolean() || hasMixinDeps.toBoolean()) {
arguments += [
"--tweakClass", "org.spongepowered.asm.launch.MixinTweaker"
]
jvmArguments += [
"-Dmixin.debug=true", "-Dmixin.debug.countInjections=true", "-Dmixin.debug.verbose=true", "-Dmixin.debug.export=true"
]
}
@@ -334,19 +363,30 @@ runClient {
}
args(arguments)
jvmArgs(jvmArguments)
}
runServer {
def arguments = []
def jvmArguments = []
if (usesMixins.toBoolean()) {
arguments += [
"--mods=../build/libs/$modId-${version}.jar",
"--tweakClass org.spongepowered.asm.launch.MixinTweaker"
"--mods=../build/libs/$archivesBaseName-${version}.jar"
]
}
if (usesMixins.toBoolean() || hasMixinDeps.toBoolean()) {
arguments += [
"--tweakClass", "org.spongepowered.asm.launch.MixinTweaker"
]
jvmArguments += [
"-Dmixin.debug=true", "-Dmixin.debug.countInjections=true", "-Dmixin.debug.verbose=true", "-Dmixin.debug.export=true"
]
}
args(arguments)
jvmArgs(jvmArguments)
}
tasks.withType(JavaExec).configureEach {
@@ -488,6 +528,7 @@ artifacts {
}
// publishing
def getMavenSettingsCredentials = {
String userHome = System.getProperty( "user.home" );
File mavenSettings = new File(userHome, ".m2/settings.xml")
@@ -497,14 +538,19 @@ def getMavenSettingsCredentials = {
}
def getCredentials = {
def entries = getMavenSettingsCredentials()
for (entry in entries) {
if ( entry."id".text() == "mavenpattern" ) {
return [username: entry.username.text(), password: entry.password.text()]
try {
def entries = getMavenSettingsCredentials()
for (entry in entries) {
if (entry."id".text() == repositoryName) {
return [username: entry.username.text(), password: entry.password.text()]
}
}
} catch (Exception ignored) {
return [username: "none", password: "none"]
}
}
//Publishing
publishing {
publications {
maven(MavenPublication) {
@@ -515,16 +561,16 @@ publishing {
artifact source: apiJar, classifier: "api"
}
groupId = group
artifactId = modId
version = project.version
groupId = mavenGroupId
artifactId = mavenArtifactId + "-mc" + minecraftVersion
version = gitVersion()
}
}
repositories {
maven {
name = "mavenpattern"
url = "https://maven.falsepattern.com/"
name = repositoryName
url = repositoryURL
def creds = getCredentials()
credentials {
username = creds == null ? "none" : creds.username
@@ -543,7 +589,7 @@ task updateBuildScript {
}
}
if (isNewBuildScriptVersionAvailable(projectDir.toString())) {
if (!skipBuildScriptUpdateCheck.toBoolean() && isNewBuildScriptVersionAvailable(projectDir.toString())) {
if (autoUpdateBuildScript.toBoolean()) {
performBuildScriptUpdate(projectDir.toString())
} else {
@@ -552,7 +598,7 @@ if (isNewBuildScriptVersionAvailable(projectDir.toString())) {
}
static URL availableBuildScriptUrl() {
new URL("https://raw.githubusercontent.com/SinTh0r4s/ExampleMod1.7.10/main/build.gradle")
new URL("https://raw.githubusercontent.com/FalsePattern/ExampleMod1.7.10/main/build.gradle")
}
boolean performBuildScriptUpdate(String projectDir) {
@@ -594,7 +640,7 @@ configure(updateBuildScript) {
def checkPropertyExists(String propertyName) {
if (project.hasProperty(propertyName) == false) {
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/SinTh0r4s/ExampleMod1.7.10/blob/main/gradle.properties")
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/FalsePattern/ExampleMod1.7.10/blob/main/gradle.properties")
}
}
+24 -3
View File
@@ -3,14 +3,33 @@ modName = FalsePatternLib
# This is a case-sensitive string to identify your mod. Convention is to use lower case.
modId = falsepatternlib
modGroup = com.falsepattern
modGroup = com.falsepattern.lib
# WHY is there no version field?
# The build script relies on git to provide a version via tags. It is super easy and will enable you to always know the
# code base or your binary. Check out this tutorial: https://blog.mattclemente.com/2017/10/13/versioning-with-git-tags/
#
# Publishing settings
#
# The server to upload the artifacts to
repositoryURL = https://maven.falsepattern.com
# What name is the login information inside ~/.m2/settings.xml stored under
# (see https://gist.github.com/FalsePattern/82d93e3cfab01f671cc5f4a95931cfe3 for an example)
repositoryName = mavenpattern
# What the artifact should be called. These will be the "name" of the published package, suffixed with the minecraft version with a -mc prefix (groupid:artifactid-mcminecraftVersion:version:qualifier).
# For instance, the default values this example ships with would turn into com.myname:mymodid-mc1.7.10:version
# The version is determined automatically from the git version.
mavenGroupId = com.falsepattern
mavenArtifactId = falsepatternlib
# Will update your build.gradle automatically whenever an update is available
autoUpdateBuildScript = false
# Disable checking of buildscript updates.
skipBuildScriptUpdateCheck = false
minecraftVersion = 1.7.10
forgeVersion = 10.13.4.1614
@@ -35,7 +54,7 @@ gradleTokenGroupName = GRADLETOKEN_GROUPNAME
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise you can
# leave this property empty.
# Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api
apiPackage = lib.api
apiPackage = api
# Specify the configuration file for Forge's access transformers here. I must be placed into /src/main/resources/META-INF/
# Example value: mymodid_at.cfg
@@ -43,6 +62,8 @@ accessTransformersFile =
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
usesMixins = false
# Enable this if one of the dependencies uses SpongeMixins.
hasMixinDeps = false
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
mixinPlugin =
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
@@ -50,7 +71,7 @@ mixinsPackage =
# 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
coreModClass = lib.CoreLoadingPlugin
coreModClass = CoreLoadingPlugin
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class
# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false!
containsMixinsAndOrCoreModOnly = true