Skip to content

Commit b544a05

Browse files
committed
Merge branch 'api-12' into api-13
2 parents bb21ed1 + 9791af5 commit b544a05

File tree

17 files changed

+445
-284
lines changed

17 files changed

+445
-284
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# Build #
22
#########
3-
MANIFEST.MF
43
dependency-reduced-pom.xml
54

65
# Compiled #

build-logic/src/main/java/org/spongepowered/gradle/impl/SpongeImplementationExtension.java

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -93,18 +93,16 @@ public void copyModulesExcludingProvided(final Configuration source, final Confi
9393
}
9494
}
9595

96-
public void applyNamedDependencyOnOutput(final Project originProject, final SourceSet sourceAdding, final SourceSet targetSource, final Project implProject, final String dependencyConfigName) {
97-
implProject.getLogger().lifecycle(
98-
"[{}] Adding {}({}) to {}({}).{}",
99-
implProject.getName(),
100-
originProject.getPath(),
101-
sourceAdding.getName(),
102-
implProject.getPath(),
103-
targetSource.getName(),
104-
dependencyConfigName
105-
);
106-
107-
implProject.getDependencies().add(dependencyConfigName, sourceAdding.getOutput());
96+
public void addDependencyToRuntimeOnly(final SourceSet source, final SourceSet target) {
97+
this.addDependencyTo(source, target.getRuntimeOnlyConfigurationName());
98+
}
99+
100+
public void addDependencyToImplementation(final SourceSet source, final SourceSet target) {
101+
this.addDependencyTo(source, target.getImplementationConfigurationName());
102+
}
103+
104+
public void addDependencyTo(final SourceSet source, final String targetConfig) {
105+
this.project.getDependencies().add(targetConfig, source.getOutput());
108106
}
109107

110108
public String generateImplementationVersionString(final String apiVersion, final String minecraftVersion, final String implRecommendedVersion) {

build.gradle.kts

Lines changed: 17 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -57,33 +57,33 @@ val mixinsConfig by configurations.register("mixins") {
5757
val main by sourceSets
5858

5959
val applaunch by sourceSets.registering {
60-
spongeImpl.applyNamedDependencyOnOutput(project, this, main, project, main.implementationConfigurationName)
60+
spongeImpl.addDependencyToImplementation(this, main)
6161

6262
configurations.named(implementationConfigurationName) {
6363
extendsFrom(applaunchConfig)
6464
}
6565
}
6666
val launch by sourceSets.registering {
67-
spongeImpl.applyNamedDependencyOnOutput(project, applaunch.get(), this, project, this.implementationConfigurationName)
68-
spongeImpl.applyNamedDependencyOnOutput(project, this, main, project, main.implementationConfigurationName)
67+
spongeImpl.addDependencyToImplementation(applaunch.get(), this)
68+
spongeImpl.addDependencyToImplementation(this, main)
6969

7070
configurations.named(implementationConfigurationName) {
7171
extendsFrom(launchConfig)
7272
}
7373
}
7474
val accessors by sourceSets.registering {
75-
spongeImpl.applyNamedDependencyOnOutput(project, launch.get(), this, project, this.implementationConfigurationName)
76-
spongeImpl.applyNamedDependencyOnOutput(project, this, main, project, main.implementationConfigurationName)
75+
spongeImpl.addDependencyToImplementation(launch.get(), this)
76+
spongeImpl.addDependencyToImplementation(this, main)
7777

7878
configurations.named(implementationConfigurationName) {
7979
extendsFrom(accessorsConfig)
8080
}
8181
}
8282
val mixins by sourceSets.registering {
83-
spongeImpl.applyNamedDependencyOnOutput(project, launch.get(), this, project, this.implementationConfigurationName)
84-
spongeImpl.applyNamedDependencyOnOutput(project, applaunch.get(), this, project, this.implementationConfigurationName)
85-
spongeImpl.applyNamedDependencyOnOutput(project, accessors.get(), this, project, this.implementationConfigurationName)
86-
spongeImpl.applyNamedDependencyOnOutput(project, main, this, project, this.implementationConfigurationName)
83+
spongeImpl.addDependencyToImplementation(launch.get(), this)
84+
spongeImpl.addDependencyToImplementation(applaunch.get(), this)
85+
spongeImpl.addDependencyToImplementation(accessors.get(), this)
86+
spongeImpl.addDependencyToImplementation(main, this)
8787

8888
configurations.named(implementationConfigurationName) {
8989
extendsFrom(mixinsConfig)
@@ -176,25 +176,6 @@ dependencies {
176176
}
177177
}
178178

179-
indraSpotlessLicenser {
180-
licenseHeaderFile(rootProject.file("HEADER.txt"))
181-
182-
property("name", "Sponge")
183-
property("organization", organization)
184-
property("url", projectUrl)
185-
}
186-
187-
idea {
188-
if (project != null) {
189-
(project as ExtensionAware).extensions["settings"].run {
190-
(this as ExtensionAware).extensions.getByType(org.jetbrains.gradle.ext.TaskTriggersConfig::class).run {
191-
afterSync(":modlauncher-transformers:build")
192-
afterSync(":library-manager:build")
193-
}
194-
}
195-
}
196-
}
197-
198179
allprojects {
199180
configurations.configureEach {
200181
resolutionStrategy.dependencySubstitution {
@@ -285,6 +266,14 @@ allprojects {
285266
}
286267
}
287268

269+
indraSpotlessLicenser {
270+
licenseHeaderFile(rootProject.file("HEADER.txt"))
271+
272+
property("name", "Sponge")
273+
property("organization", organization)
274+
property("url", projectUrl)
275+
}
276+
288277
val spongeSnapshotRepo: String? by project
289278
val spongeReleaseRepo: String? by project
290279
tasks {

forge/build.gradle.kts

Lines changed: 37 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ val apiVersion: String by project
2626
val minecraftVersion: String by project
2727
val forgeVersion: String by project
2828
val recommendedVersion: String by project
29-
val organization: String by project
3029
val projectUrl: String by project
3130

3231
description = "The SpongeAPI implementation for MinecraftForge"
@@ -80,63 +79,67 @@ val mixins: NamedDomainObjectProvider<SourceSet> = commonProject.sourceSets.name
8079
val main: NamedDomainObjectProvider<SourceSet> = commonProject.sourceSets.named("main")
8180

8281
// SpongeForge source sets
83-
val forgeMain by sourceSets.named("main") {
84-
// implementation (compile) dependencies
85-
spongeImpl.applyNamedDependencyOnOutput(commonProject, accessors.get(), this, project, this.implementationConfigurationName)
86-
spongeImpl.applyNamedDependencyOnOutput(commonProject, launch.get(), this, project, this.implementationConfigurationName)
87-
spongeImpl.applyNamedDependencyOnOutput(commonProject, applaunch.get(), this, project, this.implementationConfigurationName)
82+
// Service layer
83+
val forgeAppLaunch by sourceSets.register("applaunch") {
84+
spongeImpl.addDependencyToImplementation(applaunch.get(), this)
8885

8986
configurations.named(implementationConfigurationName) {
90-
extendsFrom(gameLayerConfig.get())
87+
extendsFrom(serviceLayerConfig.get())
9188
}
9289
}
90+
91+
// Lang layer
92+
val forgeLang by sourceSets.register("lang") {
93+
configurations.named(implementationConfigurationName) {
94+
extendsFrom(langLayerConfig.get())
95+
}
96+
}
97+
98+
// Game layer
9399
val forgeLaunch by sourceSets.register("launch") {
94-
// implementation (compile) dependencies
95-
spongeImpl.applyNamedDependencyOnOutput(commonProject, launch.get(), this, project, this.implementationConfigurationName)
96-
spongeImpl.applyNamedDependencyOnOutput(commonProject, applaunch.get(), this, project, this.implementationConfigurationName)
97-
spongeImpl.applyNamedDependencyOnOutput(commonProject, main.get(), this, project, this.implementationConfigurationName)
98-
spongeImpl.applyNamedDependencyOnOutput(project, this, forgeMain, project, forgeMain.implementationConfigurationName)
100+
spongeImpl.addDependencyToImplementation(applaunch.get(), this)
101+
spongeImpl.addDependencyToImplementation(launch.get(), this)
102+
spongeImpl.addDependencyToImplementation(main.get(), this)
103+
spongeImpl.addDependencyToImplementation(forgeAppLaunch, this)
99104

100105
configurations.named(implementationConfigurationName) {
101106
extendsFrom(gameLayerConfig.get())
102107
}
103108
}
104109
val forgeAccessors by sourceSets.register("accessors") {
105-
spongeImpl.applyNamedDependencyOnOutput(commonProject, mixins.get(), this, project, this.implementationConfigurationName)
106-
spongeImpl.applyNamedDependencyOnOutput(commonProject, accessors.get(), this, project, this.implementationConfigurationName)
107-
spongeImpl.applyNamedDependencyOnOutput(project, this, forgeLaunch, project, forgeLaunch.implementationConfigurationName)
110+
spongeImpl.addDependencyToImplementation(accessors.get(), this)
108111

109112
configurations.named(implementationConfigurationName) {
110113
extendsFrom(gameLayerConfig.get())
111114
}
112115
}
113116
val forgeMixins by sourceSets.register("mixins") {
114-
// implementation (compile) dependencies
115-
spongeImpl.applyNamedDependencyOnOutput(commonProject, mixins.get(), this, project, this.implementationConfigurationName)
116-
spongeImpl.applyNamedDependencyOnOutput(commonProject, accessors.get(), this, project, this.implementationConfigurationName)
117-
spongeImpl.applyNamedDependencyOnOutput(commonProject, launch.get(), this, project, this.implementationConfigurationName)
118-
spongeImpl.applyNamedDependencyOnOutput(commonProject, applaunch.get(), this, project, this.implementationConfigurationName)
119-
spongeImpl.applyNamedDependencyOnOutput(commonProject, main.get(), this, project, this.implementationConfigurationName)
120-
spongeImpl.applyNamedDependencyOnOutput(project, forgeMain, this, project, this.implementationConfigurationName)
121-
spongeImpl.applyNamedDependencyOnOutput(project, forgeAccessors, this, project, this.implementationConfigurationName)
122-
spongeImpl.applyNamedDependencyOnOutput(project, forgeLaunch, this, project, this.implementationConfigurationName)
117+
spongeImpl.addDependencyToImplementation(applaunch.get(), this)
118+
spongeImpl.addDependencyToImplementation(launch.get(), this)
119+
spongeImpl.addDependencyToImplementation(accessors.get(), this)
120+
spongeImpl.addDependencyToImplementation(mixins.get(), this)
121+
spongeImpl.addDependencyToImplementation(main.get(), this)
122+
spongeImpl.addDependencyToImplementation(forgeAppLaunch, this)
123+
spongeImpl.addDependencyToImplementation(forgeLaunch, this)
124+
spongeImpl.addDependencyToImplementation(forgeAccessors, this)
123125

124126
configurations.named(implementationConfigurationName) {
125127
extendsFrom(gameLayerConfig.get())
126128
}
127129
}
128-
val forgeLang by sourceSets.register("lang") {
129-
configurations.named(implementationConfigurationName) {
130-
extendsFrom(langLayerConfig.get())
131-
}
132-
}
133-
val forgeAppLaunch by sourceSets.register("applaunch") {
134-
// implementation (compile) dependencies
135-
spongeImpl.applyNamedDependencyOnOutput(commonProject, applaunch.get(), this, project, this.implementationConfigurationName)
136-
spongeImpl.applyNamedDependencyOnOutput(project, this, forgeLaunch, project, forgeLaunch.implementationConfigurationName)
130+
val forgeMain by sourceSets.named("main") {
131+
spongeImpl.addDependencyToImplementation(applaunch.get(), this)
132+
spongeImpl.addDependencyToImplementation(launch.get(), this)
133+
spongeImpl.addDependencyToImplementation(accessors.get(), this)
134+
spongeImpl.addDependencyToImplementation(main.get(), this)
135+
spongeImpl.addDependencyToImplementation(forgeAppLaunch, this)
136+
spongeImpl.addDependencyToImplementation(forgeLaunch, this)
137+
spongeImpl.addDependencyToImplementation(forgeAccessors, this)
138+
139+
spongeImpl.addDependencyToImplementation(this, forgeMixins)
137140

138141
configurations.named(implementationConfigurationName) {
139-
extendsFrom(serviceLayerConfig.get())
142+
extendsFrom(gameLayerConfig.get())
140143
}
141144
}
142145

@@ -195,18 +198,6 @@ dependencies {
195198
}
196199
})
197200

198-
api(project(":", configuration = "launch")) {
199-
exclude(group = "org.spongepowered", module = "mixin")
200-
}
201-
implementation(project(":", configuration = "accessors")) {
202-
exclude(group = "org.spongepowered", module = "mixin")
203-
}
204-
implementation(project(commonProject.path)) {
205-
exclude(group = "org.spongepowered", module = "mixin")
206-
}
207-
208-
forgeMixins.implementationConfigurationName(project(commonProject.path))
209-
210201
val service = serviceLibrariesConfig.name
211202
service(apiLibs.pluginSpi)
212203
service(project(transformersProject.path)) {
@@ -441,14 +432,6 @@ sourceSets {
441432
}
442433
}
443434

444-
indraSpotlessLicenser {
445-
licenseHeaderFile(rootProject.file("HEADER.txt"))
446-
447-
property("name", "Sponge")
448-
property("organization", organization)
449-
property("url", projectUrl)
450-
}
451-
452435
publishing {
453436
publications {
454437
register("sponge", MavenPublication::class) {

generator/build.gradle.kts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@ plugins {
22
id("org.spongepowered.gradle.vanilla")
33
}
44

5-
val apiVersion: String by project
6-
val organization: String by project
7-
val projectUrl: String by project
8-
95
description = "Code generator for automatically producing API catalog classes based off of Vanilla MC data"
106

117
minecraft {
@@ -30,14 +26,6 @@ dependencies {
3026
runtimeOnly(libs.tinylog.slf4j)
3127
}
3228

33-
indraSpotlessLicenser {
34-
licenseHeaderFile(rootProject.file("HEADER.txt"))
35-
36-
property("name", "Sponge")
37-
property("organization", organization)
38-
property("url", projectUrl)
39-
}
40-
4129
val apiBase = rootProject.file("SpongeAPI/src/main/java/")
4230
val temporaryLicenseHeader = project.layout.buildDirectory.file("api-gen-license-header.txt")
4331
tasks.register("generateApiData", JavaExec::class) {

gradle/libs.versions.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ log4j-api = { module = "org.apache.logging.log4j:log4j-api", version.ref = "log4
3131
log4j-core = { module = "org.apache.logging.log4j:log4j-core", version.ref = "log4j" }
3232
log4j-jpl = { module = "org.apache.logging.log4j:log4j-jpl", version.ref = "log4j" }
3333
log4j-slf4j2 = { module = "org.apache.logging.log4j:log4j-slf4j2-impl", version.ref = "log4j" }
34+
bootstrap-api = { module = "net.minecraftforge:bootstrap-api", version.ref = "bootstrap" }
3435
bootstrap = { module = "net.minecraftforge:bootstrap", version.ref = "bootstrap" }
3536
modlauncher = { module = "net.minecraftforge:modlauncher", version.ref = "modlauncher" }
3637
neo-modlauncher = { module = "cpw.mods:modlauncher", version.ref = "neo-modlauncher" }

library-manager/build.gradle.kts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,3 @@
1-
val organization: String by project
2-
val projectUrl: String by project
3-
4-
indraSpotlessLicenser {
5-
licenseHeaderFile(rootProject.file("HEADER.txt"))
6-
7-
property("name", "Sponge")
8-
property("organization", organization)
9-
property("url", projectUrl)
10-
}
11-
121
dependencies {
132
implementation(apiLibs.gson)
143
}

modlauncher-transformers/build.gradle.kts

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,3 @@
1-
plugins {
2-
eclipse
3-
idea
4-
}
5-
// Make sure jar is present for other projects
6-
eclipse {
7-
synchronizationTasks(tasks.jar)
8-
}
9-
10-
val organization: String by project
11-
val projectUrl: String by project
12-
13-
indraSpotlessLicenser {
14-
licenseHeaderFile(rootProject.file("HEADER.txt"))
15-
16-
property("name", "Sponge")
17-
property("organization", organization)
18-
property("url", projectUrl)
19-
}
20-
21-
221
dependencies {
232
// AccessWidener transformer
243
implementation(libs.accessWidener) {
@@ -48,3 +27,11 @@ dependencies {
4827
// And finally, compile only annotations
4928
compileOnly(apiLibs.checkerQual)
5029
}
30+
31+
tasks {
32+
jar {
33+
manifest {
34+
attributes("Automatic-Module-Name" to "sponge.modlauncher.transformers")
35+
}
36+
}
37+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Automatic-Module-Name: sponge.modlauncher.transformers

0 commit comments

Comments
 (0)