Skip to content

Commit 4be841e

Browse files
committed
update buildscript
1 parent 1452afc commit 4be841e

File tree

2 files changed

+96
-29
lines changed

2 files changed

+96
-29
lines changed

build.gradle

Lines changed: 72 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
//version: 8fa7883b6196c1765266f4e6ddf3118d5043aafb
1+
//version: 1641429628falsepattern12
22
/*
33
DO NOT CHANGE THIS FILE!
44
55
Also, you may replace this file at any time if there is an update available.
6-
Please check https://github.com/SinTh0r4s/ExampleMod1.7.10/blob/main/build.gradle for updates.
6+
Please check https://github.com/FalsePattern/ExampleMod1.7.10/blob/main/build.gradle for updates.
77
*/
88

99

@@ -28,11 +28,11 @@ buildscript {
2828
}
2929
maven {
3030
name = "jitpack"
31-
url = "https://jitpack.io"
31+
url = "https://jitpack.falsepattern.com/"
3232
}
3333
}
3434
dependencies {
35-
classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.4'
35+
classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.6'
3636
}
3737
}
3838

@@ -88,6 +88,14 @@ checkPropertyExists("containsMixinsAndOrCoreModOnly")
8888
checkPropertyExists("usesShadowedDependencies")
8989
checkPropertyExists("developmentEnvironmentUserName")
9090

91+
//Properties added in fork
92+
checkPropertyExists("skipBuildScriptUpdateCheck")
93+
checkPropertyExists("repositoryURL")
94+
checkPropertyExists("repositoryName")
95+
checkPropertyExists("mavenGroupId")
96+
checkPropertyExists("mavenArtifactId")
97+
checkPropertyExists("hasMixinDeps")
98+
9199

92100
String javaSourceDir = "src/main/java/"
93101
String scalaSourceDir = "src/main/scala/"
@@ -153,7 +161,7 @@ configurations.all {
153161
'git config core.fileMode false'.execute()
154162
// Pulls version from git tag
155163
try {
156-
version = minecraftVersion + "-" + gitVersion()
164+
version = gitVersion()
157165
}
158166
catch (Exception e) {
159167
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) {
166174
else {
167175
archivesBaseName = modId
168176
}
177+
archivesBaseName += "-mc" + minecraftVersion
169178

170179
minecraft {
171180
version = minecraftVersion + "-" + forgeVersion + "-" + minecraftVersion
@@ -205,13 +214,13 @@ repositories {
205214
name = "Overmind forge repo mirror"
206215
url = "https://gregtech.overminddl1.com/"
207216
}
208-
if(usesMixins.toBoolean()) {
217+
if(usesMixins.toBoolean() || hasMixinDeps.toBoolean()) {
209218
maven {
210219
name = "sponge"
211-
url = "https://repo.spongepowered.org/repository/maven-public"
220+
url = "https://sponge.falsepattern.com/"
212221
}
213222
maven {
214-
url = "https://jitpack.io"
223+
url = "https://jitpack.falsepattern.com/"
215224
}
216225
}
217226
}
@@ -233,6 +242,17 @@ dependencies {
233242
}
234243
compile("com.github.GTNewHorizons:SpongeMixins:1.3.3:dev")
235244
}
245+
if(hasMixinDeps.toBoolean()) {
246+
runtime("org.spongepowered:mixin:0.7.11-SNAPSHOT") {
247+
// Mixin includes a lot of dependencies that are too up-to-date
248+
exclude module: "launchwrapper"
249+
exclude module: "guava"
250+
exclude module: "gson"
251+
exclude module: "commons-io"
252+
exclude module: "log4j-core"
253+
}
254+
runtime("com.github.GTNewHorizons:SpongeMixins:1.3.3:dev")
255+
}
236256
}
237257

238258
apply from: 'dependencies.gradle'
@@ -318,11 +338,20 @@ afterEvaluate {
318338

319339
runClient {
320340
def arguments = []
341+
def jvmArguments = []
321342

322-
if(usesMixins.toBoolean()) {
343+
if (usesMixins.toBoolean()) {
323344
arguments += [
324-
"--mods=../build/libs/$modId-${version}.jar",
325-
"--tweakClass org.spongepowered.asm.launch.MixinTweaker"
345+
"--mods=../build/libs/$archivesBaseName-${version}.jar"
346+
]
347+
}
348+
349+
if(usesMixins.toBoolean() || hasMixinDeps.toBoolean()) {
350+
arguments += [
351+
"--tweakClass", "org.spongepowered.asm.launch.MixinTweaker"
352+
]
353+
jvmArguments += [
354+
"-Dmixin.debug=true", "-Dmixin.debug.countInjections=true", "-Dmixin.debug.verbose=true", "-Dmixin.debug.export=true"
326355
]
327356
}
328357

@@ -334,19 +363,30 @@ runClient {
334363
}
335364

336365
args(arguments)
366+
jvmArgs(jvmArguments)
337367
}
338368

339369
runServer {
340370
def arguments = []
371+
def jvmArguments = []
341372

342373
if (usesMixins.toBoolean()) {
343374
arguments += [
344-
"--mods=../build/libs/$modId-${version}.jar",
345-
"--tweakClass org.spongepowered.asm.launch.MixinTweaker"
375+
"--mods=../build/libs/$archivesBaseName-${version}.jar"
376+
]
377+
}
378+
379+
if (usesMixins.toBoolean() || hasMixinDeps.toBoolean()) {
380+
arguments += [
381+
"--tweakClass", "org.spongepowered.asm.launch.MixinTweaker"
382+
]
383+
jvmArguments += [
384+
"-Dmixin.debug=true", "-Dmixin.debug.countInjections=true", "-Dmixin.debug.verbose=true", "-Dmixin.debug.export=true"
346385
]
347386
}
348387

349388
args(arguments)
389+
jvmArgs(jvmArguments)
350390
}
351391

352392
tasks.withType(JavaExec).configureEach {
@@ -488,6 +528,7 @@ artifacts {
488528
}
489529

490530
// publishing
531+
491532
def getMavenSettingsCredentials = {
492533
String userHome = System.getProperty( "user.home" );
493534
File mavenSettings = new File(userHome, ".m2/settings.xml")
@@ -497,14 +538,19 @@ def getMavenSettingsCredentials = {
497538
}
498539

499540
def getCredentials = {
500-
def entries = getMavenSettingsCredentials()
501-
for (entry in entries) {
502-
if ( entry."id".text() == "mavenpattern" ) {
503-
return [username: entry.username.text(), password: entry.password.text()]
541+
try {
542+
def entries = getMavenSettingsCredentials()
543+
for (entry in entries) {
544+
if (entry."id".text() == repositoryName) {
545+
return [username: entry.username.text(), password: entry.password.text()]
546+
}
504547
}
548+
} catch (Exception ignored) {
549+
return [username: "none", password: "none"]
505550
}
506551
}
507552

553+
//Publishing
508554
publishing {
509555
publications {
510556
maven(MavenPublication) {
@@ -515,16 +561,16 @@ publishing {
515561
artifact source: apiJar, classifier: "api"
516562
}
517563

518-
groupId = group
519-
artifactId = modId
520-
version = project.version
564+
groupId = mavenGroupId
565+
artifactId = mavenArtifactId + "-mc" + minecraftVersion
566+
version = gitVersion()
521567
}
522568
}
523-
569+
524570
repositories {
525571
maven {
526-
name = "mavenpattern"
527-
url = "https://maven.falsepattern.com/"
572+
name = repositoryName
573+
url = repositoryURL
528574
def creds = getCredentials()
529575
credentials {
530576
username = creds == null ? "none" : creds.username
@@ -543,7 +589,7 @@ task updateBuildScript {
543589
}
544590
}
545591

546-
if (isNewBuildScriptVersionAvailable(projectDir.toString())) {
592+
if (!skipBuildScriptUpdateCheck.toBoolean() && isNewBuildScriptVersionAvailable(projectDir.toString())) {
547593
if (autoUpdateBuildScript.toBoolean()) {
548594
performBuildScriptUpdate(projectDir.toString())
549595
} else {
@@ -552,7 +598,7 @@ if (isNewBuildScriptVersionAvailable(projectDir.toString())) {
552598
}
553599

554600
static URL availableBuildScriptUrl() {
555-
new URL("https://raw.githubusercontent.com/SinTh0r4s/ExampleMod1.7.10/main/build.gradle")
601+
new URL("https://raw.githubusercontent.com/FalsePattern/ExampleMod1.7.10/main/build.gradle")
556602
}
557603

558604
boolean performBuildScriptUpdate(String projectDir) {
@@ -594,7 +640,7 @@ configure(updateBuildScript) {
594640

595641
def checkPropertyExists(String propertyName) {
596642
if (project.hasProperty(propertyName) == false) {
597-
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")
643+
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")
598644
}
599645
}
600646

gradle.properties

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,33 @@ modName = FalsePatternLib
33
# This is a case-sensitive string to identify your mod. Convention is to use lower case.
44
modId = falsepatternlib
55

6-
modGroup = com.falsepattern
6+
modGroup = com.falsepattern.lib
77

88
# WHY is there no version field?
99
# The build script relies on git to provide a version via tags. It is super easy and will enable you to always know the
1010
# code base or your binary. Check out this tutorial: https://blog.mattclemente.com/2017/10/13/versioning-with-git-tags/
1111

12+
#
13+
# Publishing settings
14+
#
15+
16+
# The server to upload the artifacts to
17+
repositoryURL = https://maven.falsepattern.com
18+
19+
# What name is the login information inside ~/.m2/settings.xml stored under
20+
# (see https://gist.github.com/FalsePattern/82d93e3cfab01f671cc5f4a95931cfe3 for an example)
21+
repositoryName = mavenpattern
22+
23+
# 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).
24+
# For instance, the default values this example ships with would turn into com.myname:mymodid-mc1.7.10:version
25+
# The version is determined automatically from the git version.
26+
mavenGroupId = com.falsepattern
27+
mavenArtifactId = falsepatternlib
28+
1229
# Will update your build.gradle automatically whenever an update is available
1330
autoUpdateBuildScript = false
31+
# Disable checking of buildscript updates.
32+
skipBuildScriptUpdateCheck = false
1433

1534
minecraftVersion = 1.7.10
1635
forgeVersion = 10.13.4.1614
@@ -35,22 +54,24 @@ gradleTokenGroupName = GRADLETOKEN_GROUPNAME
3554
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise you can
3655
# leave this property empty.
3756
# Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api
38-
apiPackage = lib.api
57+
apiPackage = api
3958

4059
# Specify the configuration file for Forge's access transformers here. I must be placed into /src/main/resources/META-INF/
4160
# Example value: mymodid_at.cfg
4261
accessTransformersFile =
4362

4463
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
4564
usesMixins = false
65+
# Enable this if one of the dependencies uses SpongeMixins.
66+
hasMixinDeps = false
4667
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
4768
mixinPlugin =
4869
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
4970
mixinsPackage =
5071
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
5172
# This parameter is for legacy compatability only
5273
# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin
53-
coreModClass = lib.CoreLoadingPlugin
74+
coreModClass = CoreLoadingPlugin
5475
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class
5576
# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false!
5677
containsMixinsAndOrCoreModOnly = true

0 commit comments

Comments
 (0)