-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extracted library publishing commons to buildlogic.java-library-conve…
…ntions.gradle.kts
- Loading branch information
Showing
2 changed files
with
62 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,12 @@ | ||
plugins { | ||
id("buildlogic.java-api-conventions") | ||
id("buildlogic.java-library-conventions") | ||
} | ||
|
||
description = "Jqwik2 core module" | ||
|
||
val jqwik2Version: String = "${rootProject.extra.get("jqwik2Version")}" | ||
val isSnapshotRelease = isSnapshotRelease(jqwik2Version) | ||
val artifactName = "jqwik2-core" | ||
|
||
fun isSnapshotRelease(versionString: String): Boolean { | ||
return versionString.endsWith("SNAPSHOT") | ||
} | ||
|
||
dependencies { | ||
api(libs.apiguardian) | ||
//implementation(project(":utilities")) | ||
|
@@ -21,50 +16,13 @@ dependencies { | |
} | ||
|
||
tasks.jar { | ||
archiveBaseName.set("jqwik2-core") | ||
archiveBaseName.set(artifactName) | ||
archiveVersion.set("${rootProject.extra.get("jqwik2Version")}") | ||
manifest { | ||
attributes("Automatic-Module-Name" to "net.jqwik2.core") | ||
} | ||
} | ||
|
||
publishing { | ||
publications { | ||
create<MavenPublication>("jqwik2Core") { | ||
groupId = "net.jqwik" | ||
artifactId = artifactName | ||
from(components["java"]) | ||
pom { | ||
version = jqwik2Version | ||
groupId = "net.jqwik" | ||
name = artifactId | ||
description = "$description" | ||
url = "https://github.org/jqwik-team/jqwik2" | ||
licenses { | ||
license { | ||
name = "Eclipse Public License - v 2.0" | ||
url = "http://www.eclipse.org/legal/epl-v20.html" | ||
} | ||
} | ||
developers { | ||
developer { | ||
id = "jlink" | ||
name = "Johannes Link" | ||
email = "[email protected]" | ||
} | ||
} | ||
scm { | ||
connection = "scm:git:git://github.com/jqwik-team/jqwik2.git" | ||
developerConnection = "scm:git:git://github.com/jqwik-team/jqwik2.git" | ||
url = "https://github.com/jqwik-team/jqwik2" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
signing { | ||
if (!isSnapshotRelease) { | ||
sign(publishing.publications["jqwik2Core"]) | ||
} | ||
publishLibrary { | ||
artifactId = artifactName | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
import groovy.lang.ExpandoMetaClassCreationHandle.disable | ||
|
||
plugins { | ||
id("buildlogic.java-common-conventions") | ||
`java-library` | ||
|
@@ -19,6 +21,14 @@ tasks.withType<Javadoc> { | |
val jqwik2Version: String = "${rootProject.extra.get("jqwik2Version")}" | ||
val isSnapshotRelease = jqwik2Version.endsWith("SNAPSHOT") | ||
|
||
|
||
interface PublishLibraryExtension { | ||
val artifactId: Property<String> | ||
} | ||
|
||
val publishLibraryExtension = project.extensions.create<PublishLibraryExtension>("publishLibrary") | ||
publishLibraryExtension.artifactId.convention("artifactId-not-set") | ||
|
||
publishing { | ||
repositories { | ||
maven { | ||
|
@@ -33,7 +43,54 @@ publishing { | |
|
||
val releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/" | ||
val snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/" | ||
url = uri(if (isSnapshotRelease) { snapshotsRepoUrl } else { releasesRepoUrl }) | ||
url = uri( | ||
if (isSnapshotRelease) { | ||
snapshotsRepoUrl | ||
} else { | ||
releasesRepoUrl | ||
} | ||
) | ||
} | ||
} | ||
publications { | ||
create<MavenPublication>("jqwikModule") { | ||
groupId = "net.jqwik" | ||
artifactId = "placeholder" | ||
from(components["java"]) | ||
pom { | ||
version = jqwik2Version | ||
groupId = "net.jqwik" | ||
name = artifactId | ||
description = "$description" | ||
url = "https://github.org/jqwik-team/jqwik2" | ||
licenses { | ||
license { | ||
name = "Eclipse Public License - v 2.0" | ||
url = "http://www.eclipse.org/legal/epl-v20.html" | ||
} | ||
} | ||
developers { | ||
developer { | ||
id = "jlink" | ||
name = "Johannes Link" | ||
email = "[email protected]" | ||
} | ||
} | ||
scm { | ||
connection = "scm:git:git://github.com/jqwik-team/jqwik2.git" | ||
developerConnection = "scm:git:git://github.com/jqwik-team/jqwik2.git" | ||
url = "https://github.com/jqwik-team/jqwik2" | ||
} | ||
} | ||
afterEvaluate { | ||
artifactId = publishLibraryExtension.artifactId.get() | ||
} | ||
} | ||
} | ||
} | ||
|
||
signing { | ||
if (!isSnapshotRelease) { | ||
sign(publishing.publications["jqwikModule"]) | ||
} | ||
} |