Skip to content

Commit d75de43

Browse files
committed
Update buildscript
- Gradle 9.1.0 - GradleUtils 3.3.18 - Use subprojects instead of source sets for multi-versioned projects
1 parent d0f0d74 commit d75de43

File tree

14 files changed

+182
-185
lines changed

14 files changed

+182
-185
lines changed
File renamed without changes.

download-utils/build.gradle

Lines changed: 28 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,57 @@
11
plugins {
22
id 'java-library'
33
id 'idea'
4+
id 'eclipse'
45
id 'maven-publish'
56
alias libs.plugins.licenser
67
alias libs.plugins.gradleutils
8+
alias libs.plugins.gitversion
9+
alias libs.plugins.changelog
710
}
811

9-
final projectDisplayName = 'Download Utils'
10-
final projectVendor = 'Forge Development LLC'
12+
gradleutils.displayName = 'Download Utils'
1113
description = 'Utilities for simple download tasks'
1214
group = 'net.minecraftforge'
1315
version = gitversion.tagOffset
1416

1517
println "Version: $version"
1618

17-
// IDE linting + no need to say 'sourceSets.java11' every time
18-
final java11 = sourceSets.create('java11')
19-
2019
java {
21-
toolchain.languageVersion = JavaLanguageVersion.of 8
20+
toolchain.languageVersion = JavaLanguageVersion.of(8)
2221
withSourcesJar()
23-
24-
registerFeature(java11.name) {
25-
usingSourceSet java11
26-
capability project.group.toString(), project.name, project.version.toString()
27-
disablePublication()
28-
}
29-
}
30-
31-
configurations {
32-
named(java11.implementationConfigurationName) { extendsFrom implementation }
33-
named(java11.compileOnlyConfigurationName) { extendsFrom compileOnly }
3422
}
3523

3624
dependencies {
37-
implementation project(':log-utils')
38-
3925
compileOnly libs.nulls
26+
27+
implementation projects.logUtils
4028
}
4129

30+
final java11 = configurations.detachedConfiguration(
31+
dependencies.create(projects.downloadUtils.java11) {
32+
transitive = false
33+
}
34+
)
35+
4236
tasks.named('jar', Jar) {
37+
dependsOn java11.buildDependencies
38+
4339
manifest {
4440
attributes([
4541
'Automatic-Module-Name': 'net.minecraftforge.utils.download',
4642
'Multi-Release' : 'true'
4743
])
48-
attributes([
49-
'Specification-Title' : projectDisplayName,
50-
'Specification-Vendor' : projectVendor,
51-
'Specification-Version' : gitversion.info.tag,
52-
'Implementation-Title' : projectDisplayName,
53-
'Implementation-Vendor' : projectVendor,
54-
'Implementation-Version': project.version
55-
], 'net/minecraftforge/util/download/')
56-
}
5744

58-
into('META-INF/versions/11') {
59-
from java11.output
45+
gradleutils.manifestDefaults(it, 'net/minecraftforge/util/download/')
6046
}
61-
}
6247

63-
tasks.named(java11.compileJavaTaskName, JavaCompile) {
64-
javaCompiler = javaToolchains.compilerFor {
65-
languageVersion = JavaLanguageVersion.of 11
48+
into('META-INF/versions/11') {
49+
from(provider { zipTree(java11.singleFile) }) {
50+
exclude 'META-INF/**'
51+
}
6652
}
6753
}
6854

69-
tasks.withType(JavaCompile).configureEach {
70-
options.encoding = 'UTF-8'
71-
}
72-
7355
license {
7456
header = rootProject.file('LICENSE-header.txt')
7557
newLine = false
@@ -78,20 +60,24 @@ license {
7860

7961
changelog {
8062
fromBase()
81-
publishAll = false
8263
}
8364

8465
publishing {
66+
repositories {
67+
maven gradleutils.publishingForgeMaven
68+
}
69+
8570
publications.register('mavenJava', MavenPublication).configure {
8671
from components.java
8772

88-
artifactId = project.name
73+
changelog.publish(it)
74+
gradleutils.promote(it)
8975

9076
pom { pom ->
91-
name = projectDisplayName
77+
name = gradleutils.displayName
9278
description = project.description
9379

94-
gradleutils.pom.setGitHubDetails pom
80+
gradleutils.pom.addRemoteDetails(pom)
9581

9682
licenses {
9783
license gradleutils.pom.licenses.LGPLv2_1
@@ -103,10 +89,4 @@ publishing {
10389
}
10490
}
10591
}
106-
107-
repositories {
108-
maven gradleutils.publishingForgeMaven
109-
}
11092
}
111-
112-
idea.module { downloadSources = downloadJavadoc = true }

download-utils/java11/build.gradle

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
plugins {
2+
id 'java'
3+
id 'idea'
4+
id 'eclipse'
5+
alias libs.plugins.licenser
6+
alias libs.plugins.gradleutils
7+
}
8+
9+
java.toolchain.languageVersion = JavaLanguageVersion.of(11)
10+
11+
dependencies {
12+
compileOnly libs.nulls
13+
14+
implementation projects.logUtils
15+
}
16+
17+
license {
18+
header = rootProject.file('LICENSE-header.txt')
19+
newLine = false
20+
exclude '**/*.properties'
21+
}

file-utils/build.gradle

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
plugins {
22
id 'java-library'
33
id 'idea'
4+
id 'eclipse'
45
id 'maven-publish'
56
alias libs.plugins.licenser
67
alias libs.plugins.gradleutils
8+
alias libs.plugins.gitversion
9+
alias libs.plugins.changelog
710
}
811

9-
final projectDisplayName = 'File Utils'
10-
final projectVendor = 'Forge Development LLC'
12+
gradleutils.displayName = 'File Utils'
1113
description = 'Common utilities for working with files and directories'
1214
group = 'net.minecraftforge'
1315
version = gitversion.tagOffset
1416

1517
println "Version: $version"
1618

1719
java {
18-
toolchain.languageVersion = JavaLanguageVersion.of 17
20+
toolchain.languageVersion = JavaLanguageVersion.of(17)
1921
withSourcesJar()
2022
}
2123

@@ -27,19 +29,9 @@ dependencies {
2729
tasks.named('jar', Jar) {
2830
manifest {
2931
attributes('Automatic-Module-Name': 'net.minecraftforge.utils.file')
30-
attributes([
31-
'Specification-Title' : projectDisplayName,
32-
'Specification-Vendor' : projectVendor,
33-
'Specification-Version' : gitversion.info.tag,
34-
'Implementation-Title' : projectDisplayName,
35-
'Implementation-Vendor' : projectVendor,
36-
'Implementation-Version': project.version
37-
], 'net/minecraftforge/util/file/')
38-
}
39-
}
4032

41-
tasks.withType(JavaCompile).configureEach {
42-
options.encoding = 'UTF-8'
33+
gradleutils.manifestDefaults(it, 'net/minecraftforge/util/file/')
34+
}
4335
}
4436

4537
license {
@@ -50,20 +42,24 @@ license {
5042

5143
changelog {
5244
fromBase()
53-
publishAll = false
5445
}
5546

5647
publishing {
48+
repositories {
49+
maven gradleutils.publishingForgeMaven
50+
}
51+
5752
publications.register('mavenJava', MavenPublication) {
5853
from components.java
5954

60-
artifactId = project.name
55+
changelog.publish(it)
56+
gradleutils.promote(it)
6157

6258
pom { pom ->
63-
name = projectDisplayName
59+
name = gradleutils.displayName
6460
description = project.description
6561

66-
gradleutils.pom.setGitHubDetails pom
62+
gradleutils.pom.addRemoteDetails(pom)
6763

6864
licenses {
6965
license gradleutils.pom.licenses.LGPLv2_1
@@ -75,10 +71,4 @@ publishing {
7571
}
7672
}
7773
}
78-
79-
repositories {
80-
maven gradleutils.publishingForgeMaven
81-
}
8274
}
83-
84-
idea.module { downloadSources = downloadJavadoc = true }

gradle.properties

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,9 @@ org.gradle.caching=true
22
org.gradle.parallel=true
33
org.gradle.configureondemand=true
44

5-
# TODO Enable when Gradle fully supports
6-
#org.gradle.configuration-cache=true
5+
org.gradle.configuration-cache=true
6+
org.gradle.configuration-cache.parallel=true
7+
org.gradle.configuration-cache.problems=warn
8+
9+
net.minecraftforge.gradleutils.ide.automatic.sources=true
10+
net.minecraftforge.gradleutils.compilation.defaults=true

gradle/wrapper/gradle-wrapper.jar

59 Bytes
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

gradlew

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ case "$( uname )" in #(
114114
NONSTOP* ) nonstop=true ;;
115115
esac
116116

117-
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
117+
CLASSPATH="\\\"\\\""
118118

119119

120120
# Determine the Java command to use to start the JVM.
@@ -213,7 +213,7 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
213213
set -- \
214214
"-Dorg.gradle.appname=$APP_BASE_NAME" \
215215
-classpath "$CLASSPATH" \
216-
org.gradle.wrapper.GradleWrapperMain \
216+
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
217217
"$@"
218218

219219
# Stop when "xargs" is not available.

gradlew.bat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ goto fail
7070
:execute
7171
@rem Setup the command line
7272

73-
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73+
set CLASSPATH=
7474

7575

7676
@rem Execute Gradle
77-
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
77+
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
7878

7979
:end
8080
@rem End local scope for the variables with windows NT shell

0 commit comments

Comments
 (0)