Skip to content

Commit

Permalink
Fix sources.jar generation for instrumentation & plugin
Browse files Browse the repository at this point in the history
Plugin, Instrumentation-Extensions & Instrumentation-Runner had
essentially empty sources.jar artifacts because the current integration
only looked into src/main/java, but these modules changed to src/main/kotlin already.
Redefining the declaration makes all source folders appear now
  • Loading branch information
mannodermaus committed Apr 11, 2024
1 parent 3931ad3 commit f7971bd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions build-logic/src/main/kotlin/Deployment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,11 @@ fun Project.configureDeployment(deployConfig: Deployed) {
archiveClassifier.set("sources")

if (isAndroid) {
from(android.sourceSets.main.java.srcDirs)
// This declaration includes Java source directories
from(android.sourceSets.main.kotlin.srcDirs)
} else {
from(sourceSets.main.java.srcDirs)
// This declaration includes Kotlin & Groovy source directories
from(sourceSets.main.allJava.srcDirs)
}
}

Expand Down Expand Up @@ -294,11 +296,11 @@ private class AndroidDsl(project: Project) {
class MainDsl(sourceSets: NamedDomainObjectCollection<Any>) {
private val delegate = sourceSets.named("main").get()

val java = JavaDsl(delegate)
val kotlin = KotlinDsl(delegate)

class JavaDsl(main: Any) {
class KotlinDsl(main: Any) {
val srcDirs = main.javaClass
.getDeclaredMethod("getJavaDirectories")
.getDeclaredMethod("getKotlinDirectories")
.invoke(main) as Set<File>
}
}
Expand Down
2 changes: 1 addition & 1 deletion plugin/android-junit5/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ val versionClassTask = tasks.register<Copy>("createVersionClass") {
}
sourceSets {
main {
java.srcDir(genFolder)
kotlin.srcDir(genFolder)
}
}
tasks.withType<DokkaTask> {
Expand Down

0 comments on commit f7971bd

Please sign in to comment.