-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(cd): use gradle convention plugin rather than subproject to apply…
… maven publishing configuration That way we can explicitly use "public-lib" gradle plugin on modules that need to be published
- Loading branch information
Showing
4 changed files
with
61 additions
and
49 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,6 +1,5 @@ | ||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
import org.jlleitschuh.gradle.ktlint.reporter.ReporterType | ||
import java.util.Base64 | ||
|
||
buildscript { | ||
dependencies { | ||
|
@@ -20,7 +19,6 @@ val versionNumber = System.getenv("VERSION")?.substringAfter("R-") ?: "0.0.15" | |
println("building current version: $versionNumber") | ||
|
||
allprojects { | ||
|
||
group = "com.izivia" | ||
version = versionNumber | ||
|
||
|
@@ -47,8 +45,6 @@ subprojects { | |
apply { | ||
plugin("java") | ||
plugin("org.jetbrains.kotlin.jvm") | ||
plugin("maven-publish") | ||
plugin("signing") | ||
plugin("org.jlleitschuh.gradle.ktlint") | ||
} | ||
|
||
|
@@ -63,51 +59,6 @@ subprojects { | |
exclude { element -> element.file.path.contains("generated") } | ||
} | ||
} | ||
|
||
extensions.getByType<PublishingExtension>().publications { | ||
create<MavenPublication>("maven") { | ||
pom { | ||
url.set("https://github.com/IZIVIA/ocpi-toolkit") | ||
|
||
scm { | ||
connection.set("scm:git:https://github.com/IZIVIA/ocpi-toolkit.git") | ||
developerConnection.set("scm:git:[email protected]:IZIVIA/ocpi-toolkit.git") | ||
url.set("https://github.com/IZIVIA/ocpi-toolkit") | ||
} | ||
|
||
licenses { | ||
license { | ||
name.set("MIT") | ||
url.set("https://opensource.org/licenses/MIT") | ||
} | ||
} | ||
|
||
developers { | ||
developer { | ||
id.set("IZIVIA") | ||
name.set("IZIVIA") | ||
email.set("[email protected]") | ||
url.set("https://www.izivia.com/") | ||
organization.set("IZIVIA") | ||
organizationUrl.set("https://www.izivia.com/") | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
extensions.getByType<SigningExtension>() | ||
.sign(extensions.getByType<PublishingExtension>().publications.named("maven").get()) | ||
if (System.getenv("GPG_PRIVATE_KEY") != null) { | ||
extensions.getByType<SigningExtension>().useInMemoryPgpKeys( | ||
Base64.getDecoder().decode(System.getenv("GPG_PRIVATE_KEY")).decodeToString(), | ||
System.getenv("GPG_PASSPHRASE") | ||
) | ||
} | ||
|
||
tasks.withType<Sign> { | ||
onlyIf { System.getenv("GPG_PRIVATE_KEY") != null } | ||
} | ||
} | ||
|
||
nexusPublishing { | ||
|
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 |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import org.gradle.api.publish.PublishingExtension | ||
import org.gradle.api.publish.maven.MavenPublication | ||
import org.gradle.kotlin.dsl.* | ||
import org.gradle.plugins.signing.Sign | ||
import org.gradle.plugins.signing.SigningExtension | ||
import java.util.* | ||
|
||
plugins { | ||
id("maven-publish") | ||
id("signing") | ||
} | ||
|
||
extensions.getByType<PublishingExtension>().publications { | ||
create<MavenPublication>("maven") { | ||
pom { | ||
url.set("https://github.com/IZIVIA/ocpi-toolkit") | ||
|
||
scm { | ||
connection.set("scm:git:https://github.com/IZIVIA/ocpi-toolkit.git") | ||
developerConnection.set("scm:git:[email protected]:IZIVIA/ocpi-toolkit.git") | ||
url.set("https://github.com/IZIVIA/ocpi-toolkit") | ||
} | ||
|
||
licenses { | ||
license { | ||
name.set("MIT") | ||
url.set("https://opensource.org/licenses/MIT") | ||
} | ||
} | ||
|
||
developers { | ||
developer { | ||
id.set("IZIVIA") | ||
name.set("IZIVIA") | ||
email.set("[email protected]") | ||
url.set("https://www.izivia.com/") | ||
organization.set("IZIVIA") | ||
organizationUrl.set("https://www.izivia.com/") | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
extensions.getByType<SigningExtension>() | ||
.sign(extensions.getByType<PublishingExtension>().publications.named("maven").get()) | ||
if (System.getenv("GPG_PRIVATE_KEY") != null) { | ||
extensions.getByType<SigningExtension>().useInMemoryPgpKeys( | ||
Base64.getDecoder().decode(System.getenv("GPG_PRIVATE_KEY")).decodeToString(), | ||
System.getenv("GPG_PASSPHRASE") | ||
) | ||
} | ||
|
||
tasks.withType<Sign> { | ||
onlyIf { System.getenv("GPG_PRIVATE_KEY") != null } | ||
} |
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,6 +1,7 @@ | ||
plugins { | ||
id("java-library") | ||
id("com.google.devtools.ksp") | ||
`public-lib` | ||
} | ||
|
||
dependencies { | ||
|
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,7 @@ | ||
plugins { | ||
`public-lib` | ||
} | ||
|
||
java { | ||
withJavadocJar() | ||
withSourcesJar() | ||
|