Skip to content

Commit 8ea9085

Browse files
committed
Straight from the source
- Fix source jars from transitive source sets and jar sets not containing upstream sources they depend on - Bump version
1 parent 610b168 commit 8ea9085

File tree

3 files changed

+26
-21
lines changed

3 files changed

+26
-21
lines changed

buildSrc/src/main/kotlin/dev/engine_room/gradle/jarset/JarTaskSet.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,10 @@ class JarTaskSet(
174174
// In the platform projects we inject common sources into these tasks to avoid polluting the
175175
// source set itself, but that bites us here, and we need to roll in all the sources in this kinda
176176
// ugly way. There's probably a better way to do this but JarTaskSet can't easily accommodate it.
177-
from(project.tasks.named<ProcessResources>(set.processResourcesTaskName).map { it.source })
178-
from(project.tasks.named<JavaCompile>(set.compileJavaTaskName).map { it.source })
177+
from(project.tasks.named<ProcessResources>(set.processResourcesTaskName))
178+
from(project.tasks.named<JavaCompile>(set.compileJavaTaskName).map { it.source.asFileTree })
179179
}
180-
excludeDuplicatePackageInfos(this)
180+
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
181181
}
182182
}
183183

@@ -192,7 +192,7 @@ class JarTaskSet(
192192

193193
for (set in sourceSetSet) {
194194
// See comment in #createSourcesJar.
195-
source(project.tasks.named<JavaCompile>(set.compileJavaTaskName).map { it.source })
195+
source(project.tasks.named<JavaCompile>(set.compileJavaTaskName).map { it.source.asFileTree })
196196
classpath += set.compileClasspath
197197
}
198198
excludeDuplicatePackageInfos(this)

buildSrc/src/main/kotlin/dev/engine_room/gradle/transitive/TransitiveSourceSetConfigurator.kt

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package dev.engine_room.gradle.transitive
22

33
import dev.engine_room.gradle.jarset.JarTaskSet
44
import org.gradle.api.Project
5+
import org.gradle.api.file.DuplicatesStrategy
56
import org.gradle.api.tasks.SourceSet
67
import org.gradle.api.tasks.SourceSetContainer
78
import org.gradle.api.tasks.compile.JavaCompile
@@ -83,20 +84,17 @@ class TransitiveSourceSetConfigurator(private val parent: TransitiveSourceSetsEx
8384
}
8485

8586
fun bundleFrom(otherProject: Project, vararg names: String) {
86-
val otherSourceSets = otherProject.the<SourceSetContainer>()
87+
val otherSourceSets = names.map { otherProject.the<SourceSetContainer>().getByName(it) }.toTypedArray()
8788

88-
bundleFrom(*names.map { otherSourceSets.getByName(it) }.toTypedArray())
89-
}
89+
from(*otherSourceSets)
9090

91-
fun bundleFrom(vararg sourceSets: SourceSet) {
92-
from(*sourceSets)
9391
// The external sourceSets will be included in the jar by default since we bring it into the java compile task,
9492
// however we need to make sure that the javadoc and sources jars also include the external sourceSets
95-
bundleJavadocAndSources(*sourceSets)
93+
bundleJavadocAndSources(otherProject, *otherSourceSets)
9694
}
9795

9896
fun bundleOutput(vararg sourceSets: SourceSet) {
99-
bundleJavadocAndSources(*sourceSets)
97+
bundleJavadocAndSources(parent.project, *sourceSets)
10098

10199
parent.project.tasks.apply {
102100
named<Jar>(sourceSet.jarTaskName).configure {
@@ -107,19 +105,26 @@ class TransitiveSourceSetConfigurator(private val parent: TransitiveSourceSetsEx
107105
}
108106
}
109107

110-
private fun bundleJavadocAndSources(vararg sourceSets: SourceSet) {
111-
parent.project.tasks.apply {
112-
named<Javadoc>(sourceSet.javadocTaskName).configure {
113-
sourceSets.forEach { source(it.allJava) }
114-
115-
JarTaskSet.excludeDuplicatePackageInfos(this)
108+
private fun bundleJavadocAndSources(project: Project, vararg sourceSets: SourceSet) {
109+
parent.project.tasks.named<Javadoc>(sourceSet.javadocTaskName).configure {
110+
sourceSets.forEach { sourceSetToBundle ->
111+
source(
112+
project.tasks.named<JavaCompile>(sourceSetToBundle.compileJavaTaskName)
113+
.map { it.source.asFileTree })
116114
}
117115

118-
named<Jar>(sourceSet.sourcesJarTaskName).configure {
119-
sourceSets.forEach { from(it.allJava) }
116+
JarTaskSet.excludeDuplicatePackageInfos(this)
117+
}
120118

121-
JarTaskSet.excludeDuplicatePackageInfos(this)
119+
parent.project.tasks.named<Jar>(sourceSet.sourcesJarTaskName).configure {
120+
sourceSets.forEach { sourceSetToBundle ->
121+
from(project.tasks.named<ProcessResources>(sourceSetToBundle.processResourcesTaskName))
122+
from(
123+
project.tasks.named<JavaCompile>(sourceSetToBundle.compileJavaTaskName)
124+
.map { it.source.asFileTree })
122125
}
126+
127+
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
123128
}
124129
}
125130

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ mod_homepage = https://github.com/Engine-Room/Flywheel
88
# Flywheel metadata
99
flywheel_id=flywheel
1010
flywheel_name=Flywheel
11-
flywheel_version=1.0.5
11+
flywheel_version=1.0.6-beta
1212
flywheel_description=An overhauled entity and block entity rendering API.
1313
# Vanillin metadata
1414
vanillin_id=vanillin

0 commit comments

Comments
 (0)