Skip to content

Commit

Permalink
buildscripts: use withJavadocJar() and withSourcesJar()
Browse files Browse the repository at this point in the history
  • Loading branch information
stephengold committed May 19, 2024
1 parent 2cbc09e commit 0657d38
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 20 deletions.
16 changes: 0 additions & 16 deletions common.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,3 @@ tasks.withType(JavaExec).configureEach { // Java runtime options:
//jvmArgs '-Xms512m', '-Xmx512m' // to enlarge the Java heap
//jvmArgs '-XX:+UseG1GC', '-XX:MaxGCPauseMillis=10'
}

// Register custom tasks for creating source/javadoc JARs:

tasks.register('javadocJar', Jar) {
archiveClassifier = 'javadoc'
dependsOn 'javadoc'
description 'Creates a JAR of javadoc.'
from javadoc.destinationDir
}

tasks.register('sourcesJar', Jar) {
archiveClassifier = 'sources'
description 'Creates a JAR of sourcecode.'
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from sourceSets.main.allJava
}
5 changes: 5 additions & 0 deletions moon-ccbysa/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ ext {
baseName = "${artifact}-${version}" // for artifacts
}

java {
withJavadocJar()
withSourcesJar()
}

jar { archiveBaseName = project.ext.baseName }
javadocJar { archiveBaseName = project.ext.baseName }
sourcesJar { archiveBaseName = project.ext.baseName }
Expand Down
7 changes: 5 additions & 2 deletions nifty/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ dependencies {
api acorusCoordinates
}

java {
withJavadocJar()
withSourcesJar()
}

javadoc {
// Disable doclint for JDK15+ to avoid "no comment" warnings.
if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_15)) {
Expand Down Expand Up @@ -87,8 +92,6 @@ tasks.register('pomAsc', Copy) {
publishing {
publications {
maven(MavenPublication) {
artifact javadocJar
artifact sourcesJar
artifactId artifact
from components.java
groupId rootProject.ext.group
Expand Down
7 changes: 5 additions & 2 deletions x/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ dependencies {
api heartCoordinates
}

java {
withJavadocJar()
withSourcesJar()
}

// Register publishing tasks:

tasks.register('install') {
Expand Down Expand Up @@ -76,8 +81,6 @@ tasks.register('pomAsc', Copy) {
publishing {
publications {
maven(MavenPublication) {
artifact javadocJar
artifact sourcesJar
artifactId artifact
from components.java
groupId rootProject.ext.group
Expand Down

0 comments on commit 0657d38

Please sign in to comment.