forked from outfoxx/typescriptpoet
-
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.
- Loading branch information
Showing
6 changed files
with
133 additions
and
107 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
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
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 |
---|---|---|
|
@@ -137,4 +137,4 @@ gradle-app.setting | |
|
||
run | ||
/.idea | ||
/bin | ||
bin/ |
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 |
---|---|---|
|
@@ -108,112 +108,23 @@ tasks { | |
} | ||
} | ||
|
||
|
||
// | ||
// DOCS | ||
// | ||
|
||
tasks { | ||
dokkaHtml { | ||
outputDirectory.set(file("$buildDir/javadoc/$releaseVersion")) | ||
} | ||
|
||
javadoc { | ||
dependsOn(dokkaHtml) | ||
} | ||
} | ||
|
||
// | ||
// PUBLISHING | ||
// | ||
|
||
publishing { | ||
|
||
publications { | ||
|
||
create<MavenPublication>("library") { | ||
create<MavenPublication>("maven") { | ||
from(components["java"]) | ||
|
||
pom { | ||
name.set("TypeScript Poet") | ||
description.set("TypeScriptPoet is a Kotlin and Java API for generating .ts source files.") | ||
url.set("https://github.com/voize-gmbh/typescriptpoet") | ||
|
||
scm { | ||
url.set("https://github.com/voize-gmbh/reakt-native-toolkit") | ||
} | ||
|
||
licenses { | ||
license { | ||
name.set("Apache-2.0") | ||
url.set("https://opensource.org/licenses/Apache-2.0") | ||
} | ||
} | ||
developers { | ||
developer { | ||
id.set("LeonKiefer") | ||
name.set("Leon Kiefer") | ||
email.set("[email protected]") | ||
} | ||
developer { | ||
id.set("ErikZiegler") | ||
name.set("Erik Ziegler") | ||
email.set("[email protected]") | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
repositories { | ||
|
||
maven { | ||
name = "MavenCentral" | ||
val snapshotUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/" | ||
val releaseUrl = "https://s01.oss.sonatype.org/service/local/" | ||
url = uri(if (isSnapshot) snapshotUrl else releaseUrl) | ||
|
||
credentials { | ||
username = project.findProperty("ossrhUsername")?.toString() | ||
password = project.findProperty("ossrhPassword")?.toString() | ||
} | ||
} | ||
|
||
} | ||
|
||
} | ||
|
||
signing { | ||
if (!hasProperty("signing.keyId")) { | ||
val signingKey: String? by project | ||
val signingPassword: String? by project | ||
useInMemoryPgpKeys(signingKey, signingPassword) | ||
} | ||
sign(publishing.publications["library"]) | ||
} | ||
|
||
tasks.withType<Sign>().configureEach { | ||
onlyIf { !isSnapshot } | ||
} | ||
|
||
|
||
// | ||
// RELEASING | ||
// | ||
|
||
|
||
tasks { | ||
|
||
register("publishMavenRelease") { | ||
dependsOn( | ||
"publishAllPublicationsToMavenCentralRepository" | ||
) | ||
} | ||
|
||
register("publishRelease") { | ||
dependsOn( | ||
"publishMavenRelease", | ||
) | ||
} | ||
|
||
} |
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,13 @@ | ||
plugins { | ||
`kotlin-dsl` | ||
} | ||
|
||
dependencies { | ||
implementation("org.jetbrains.dokka:dokka-gradle-plugin:1.9.10") | ||
implementation("io.github.gradle-nexus:publish-plugin:1.1.0") | ||
} | ||
|
||
repositories { | ||
gradlePluginPortal() | ||
mavenCentral() | ||
} |
113 changes: 113 additions & 0 deletions
113
convention-plugins/src/main/kotlin/convention.publication.gradle.kts
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,113 @@ | ||
import java.util.* | ||
|
||
plugins { | ||
`maven-publish` | ||
signing | ||
id("org.jetbrains.dokka") | ||
id("io.github.gradle-nexus.publish-plugin") | ||
} | ||
|
||
val signingKey: String? = System.getenv("SIGNING_SIGNING_KEY") | ||
val signingPassword: String? = System.getenv("SIGNING_PASSWORD") | ||
|
||
// Stub secrets to let the project sync and build without the publication values set up | ||
ext["ossrhUsername"] = null | ||
ext["ossrhPassword"] = null | ||
|
||
// Grabbing secrets from local.properties file or from environment variables, which could be used on CI | ||
val secretPropsFile = project.rootProject.file("local.properties") | ||
if (secretPropsFile.exists()) { | ||
secretPropsFile.reader().use { | ||
Properties().apply { | ||
load(it) | ||
} | ||
}.onEach { (name, value) -> | ||
ext[name.toString()] = value | ||
} | ||
} else { | ||
ext["ossrhUsername"] = System.getenv("OSSRH_USERNAME") | ||
ext["ossrhPassword"] = System.getenv("OSSRH_PASSWORD") | ||
} | ||
|
||
fun getExtraString(name: String) = ext[name]?.toString() | ||
|
||
nexusPublishing { | ||
repositories { | ||
sonatype { | ||
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/")) | ||
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")) | ||
username.set(getExtraString("ossrhUsername")) | ||
password.set(getExtraString("ossrhPassword")) | ||
} | ||
} | ||
} | ||
|
||
subprojects { | ||
apply(plugin = "org.jetbrains.dokka") | ||
apply(plugin = "maven-publish") | ||
apply(plugin = "signing") | ||
|
||
tasks { | ||
val dokkaOutputDir = "$buildDir/dokka" | ||
|
||
dokkaHtml { | ||
outputDirectory.set(file(dokkaOutputDir)) | ||
} | ||
} | ||
|
||
publishing { | ||
// Configure all publications | ||
publications.withType<MavenPublication> { | ||
val publication = this | ||
val dokkaJar = tasks.register<Jar>("${publication.name}DokkaJar") { | ||
group = JavaBasePlugin.DOCUMENTATION_GROUP | ||
description = "Assembles Kotlin docs with Dokka into a Javadoc jar" | ||
archiveClassifier.set("javadoc") | ||
from(tasks.named("dokkaHtml")) | ||
// Each archive name should be distinct, to avoid implicit dependency issues. | ||
// We use the same format as the sources Jar tasks. | ||
// https://youtrack.jetbrains.com/issue/KT-46466 | ||
archiveBaseName.set("${archiveBaseName.get()}-${publication.name}") | ||
} | ||
|
||
artifact(dokkaJar) | ||
|
||
// Provide artifacts information required by Maven Central | ||
pom { | ||
url.set("https://github.com/voize-gmbh/typescriptpoet") | ||
|
||
licenses { | ||
license { | ||
name.set("Apache-2.0") | ||
url.set("https://opensource.org/licenses/Apache-2.0") | ||
} | ||
} | ||
developers { | ||
developer { | ||
id.set("LeonKiefer") | ||
name.set("Leon Kiefer") | ||
email.set("[email protected]") | ||
} | ||
developer { | ||
id.set("ErikZiegler") | ||
name.set("Erik Ziegler") | ||
email.set("[email protected]") | ||
} | ||
} | ||
scm { | ||
url.set("https://github.com/voize-gmbh/typescriptpoet") | ||
} | ||
} | ||
} | ||
} | ||
|
||
if (signingPassword != null) { | ||
signing { | ||
if (signingKey != null) { | ||
useInMemoryPgpKeys(signingKey, signingPassword) | ||
} | ||
sign(publishing.publications) | ||
} | ||
} | ||
} | ||
|