Skip to content

Commit

Permalink
FLW citation
Browse files Browse the repository at this point in the history
- Include common source in platform api jars
  • Loading branch information
Jozufozu committed May 21, 2024
1 parent 1e81903 commit 18b6490
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions buildSrc/src/main/kotlin/com/jozufozu/gradle/jarset/JarTaskSet.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@ import org.gradle.api.tasks.AbstractCopyTask
import org.gradle.api.tasks.SourceSet
import org.gradle.api.tasks.SourceTask
import org.gradle.api.tasks.TaskProvider
import org.gradle.api.tasks.compile.JavaCompile
import org.gradle.api.tasks.javadoc.Javadoc
import org.gradle.jvm.tasks.Jar
import org.gradle.kotlin.dsl.named
import org.gradle.kotlin.dsl.register
import org.gradle.kotlin.dsl.the
import org.gradle.language.jvm.tasks.ProcessResources

class JarTaskSet(
private val project: Project,
Expand Down Expand Up @@ -147,7 +150,11 @@ class JarTaskSet(
archiveClassifier.set(SOURCES_CLASSIFIER)

for (set in sourceSetSet) {
from(set.allSource)
// In the platform projects we inject common sources into these tasks to avoid polluting the
// source set itself, but that bites us here, and we need to roll in all the sources in this kinda
// ugly way. There's probably a better way to do this but JarTaskSet can't easily accommodate it.
from(project.tasks.named<ProcessResources>(set.processResourcesTaskName).map { it.source })
from(project.tasks.named<JavaCompile>(set.compileJavaTaskName).map { it.source })
}
excludeDuplicatePackageInfos(this)
}
Expand All @@ -163,7 +170,8 @@ class JarTaskSet(
setDestinationDir(project.layout.buildDirectory.dir("docs/${name}-javadoc").get().asFile)

for (set in sourceSetSet) {
source(set.allJava)
// See comment in #createSourcesJar.
source(project.tasks.named<JavaCompile>(set.compileJavaTaskName).map { it.source })
classpath += set.compileClasspath
}
excludeDuplicatePackageInfos(this)
Expand Down

0 comments on commit 18b6490

Please sign in to comment.