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 committed Sep 7, 2019
1 parent ada66c4 commit bf46ff1
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 @@ -80,6 +80,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 @@ -93,8 +96,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

1 comment on commit bf46ff1

@sbrannen
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Please sign in to comment.