-
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
1 parent
dc4a689
commit 5da9671
Showing
8 changed files
with
154 additions
and
75 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,4 +1,4 @@ | ||
plugins { | ||
id("root.publication") | ||
alias(libs.plugins.kotlinMultiplatform).apply(false) | ||
id("org.jetbrains.dokka") version libs.versions.dokka apply false | ||
} |
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Copyright (c) 2024 Adrian Witaszak - CharLEE-X. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
|
||
object AppConfig { | ||
const val projectName = "MaterialWeb-ComposeHtml" | ||
const val groupId = "com.charleex" | ||
const val artifactId = "material-web-compose-html" | ||
const val version = "0.0.1" | ||
const val description = "Kotlin Multiplatform library " | ||
const val url = "https://github.com/CharLEE-X/notifiKations" | ||
|
||
object Developer { | ||
const val id = "charlee-dev" | ||
const val name = "Adrian Witaszak" | ||
const val email = "[email protected]" | ||
const val organization = "CharLEE-X" | ||
const val organizationUrl = "https://github.com/CharLEE-X" | ||
} | ||
|
||
object Licence { | ||
const val name = "Apache 2.0 license" | ||
const val url = "https://www.apache.org/licenses/LICENSE-2.0" | ||
} | ||
} |
114 changes: 114 additions & 0 deletions
114
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,114 @@ | ||
/* | ||
* Copyright (c) 2024 Adrian Witaszak - CharLEE-X. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
|
||
import java.util.Properties | ||
|
||
plugins { | ||
`maven-publish` | ||
signing | ||
id("org.jetbrains.dokka") | ||
} | ||
|
||
ext["signing.key"] = null | ||
ext["signing.password"] = null | ||
ext["ossrh.username"] = null | ||
ext["ossrh.password"] = null | ||
|
||
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["signing.key"] = System.getenv("SIGNING_KEY") | ||
ext["signing.password"] = System.getenv("SIGNING_PASSWORD") | ||
ext["ossrh.username"] = System.getenv("OSSRH_USERNAME") | ||
ext["ossrh.password"] = System.getenv("OSSRH_PASSWORD") | ||
} | ||
|
||
val dokkaOutputDir = "$buildDir/dokka" | ||
|
||
tasks.dokkaHtml { | ||
outputDirectory.set(file(dokkaOutputDir)) | ||
} | ||
|
||
val deleteDokkaOutputDir by tasks.register<Delete>("deleteDokkaOutputDirectory") { | ||
delete(dokkaOutputDir) | ||
} | ||
|
||
val javadocJar = tasks.register<Jar>("javadocJar") { | ||
dependsOn(deleteDokkaOutputDir, tasks.dokkaHtml) | ||
archiveClassifier.set("javadoc") | ||
from(dokkaOutputDir) | ||
} | ||
|
||
tasks.withType<AbstractPublishToMaven>().configureEach { | ||
val signingTasks = tasks.withType<Sign>() | ||
dependsOn(signingTasks) | ||
} | ||
|
||
afterEvaluate { | ||
publishing { | ||
repositories { | ||
maven { | ||
name = "sonatype" | ||
setUrl("https://s01.oss.sonatype.org/service/local/") | ||
credentials { | ||
username = getExtraString("ossrhUsername") | ||
password = getExtraString("ossrhPassword") | ||
} | ||
} | ||
} | ||
publications.withType<MavenPublication> { | ||
// Stub javadoc.jar artifact | ||
artifact(tasks.register("${name}JavadocJar", Jar::class) { | ||
archiveClassifier.set("javadoc") | ||
archiveAppendix.set(this@withType.name) | ||
}) | ||
|
||
// Provide artifacts information required by Maven Central | ||
pom { | ||
name.set(AppConfig.projectName) | ||
description.set(AppConfig.description) | ||
url.set(AppConfig.url) | ||
|
||
licenses { | ||
license { | ||
name.set(AppConfig.Licence.name) | ||
url.set(AppConfig.Licence.url) | ||
} | ||
} | ||
developers { | ||
developer { | ||
id.set(AppConfig.Developer.id) | ||
name.set(AppConfig.Developer.name) | ||
email.set(AppConfig.Developer.email) | ||
organization.set(AppConfig.Developer.organization) | ||
organizationUrl.set(AppConfig.Developer.organizationUrl) | ||
} | ||
} | ||
scm { | ||
url.set(AppConfig.url) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
signing { | ||
useInMemoryPgpKeys( | ||
getExtraString("signing.key"), | ||
getExtraString("signing.password") | ||
) | ||
sign(publishing.publications) | ||
} | ||
|
||
fun getExtraString(name: String): String = ext[name]?.toString() | ||
?: findProperty(name)?.toString() | ||
?: System.getenv(name)?.toString() | ||
?: "" |
51 changes: 0 additions & 51 deletions
51
convention-plugins/src/main/kotlin/module.publication.gradle.kts
This file was deleted.
Oops, something went wrong.
19 changes: 0 additions & 19 deletions
19
convention-plugins/src/main/kotlin/root.publication.gradle.kts
This file was deleted.
Oops, something went wrong.
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