Skip to content

Commit

Permalink
Correct file type of module descriptors included in JAR files
Browse files Browse the repository at this point in the history
Prior to this commit, all JAR files generated for a published module
included their compiled module descriptor within the root directory
of the artifact.

This commit a) includes the compiled module descriptor only in JAR
files that have no classifier specified and b) stores the source of
each module descriptor within the matching `*-source.jar` file.

Fixes #2003
  • Loading branch information
sormuras authored and sbrannen committed Sep 7, 2019
1 parent 83bf310 commit e9baa52
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions buildSrc/src/main/kotlin/java-library-conventions.gradle.kts
Expand Up @@ -79,6 +79,9 @@ if (project in mavenizedProjects) {
dependsOn(tasks.classes)
archiveClassifier.set("sources")
from(sourceSets.main.get().allSource)
from("${project.projectDir}/src/module/$javaModuleName") {
include("module-info.java")
}
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}

Expand All @@ -92,8 +95,11 @@ if (project in mavenizedProjects) {
include("LICENSE.md", "LICENSE-notice.md")
into("META-INF")
}
from("$buildDir/classes/java/module/$javaModuleName") {
include("module-info.class")
val suffix = archiveClassifier.getOrElse("")
if (suffix.isBlank() || suffix == "all") { // "all" is used by shadow plugin
from("$buildDir/classes/java/module/$javaModuleName") {
include("module-info.class")
}
}
}

Expand Down

0 comments on commit e9baa52

Please sign in to comment.