Skip to content

Commit

Permalink
allow bom publication
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaudgiuliani committed Aug 30, 2023
1 parent cc91d15 commit 8009a55
Show file tree
Hide file tree
Showing 5 changed files with 141 additions and 9 deletions.
8 changes: 0 additions & 8 deletions bom/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,4 @@ allprojects {
javaPlatform {
allowDependencies()
}

publishing {
publications {
maven(MavenPublication) {
from components.javaPlatform
}
}
}
}
129 changes: 129 additions & 0 deletions bom/gradle/publish.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
apply plugin: 'maven-publish'
apply plugin: 'signing'

// --- Prepare Settings ---
static def isReleaseBuild() {
return System.getenv('IS_RELEASE') == "true" ?: false
}
def getRepositoryUsername() {
return findProperty('OSSRH_USERNAME') ?: System.getenv('OSSRH_USERNAME') ?: ""
}
def getRepositoryPassword() {
return findProperty('OSSRH_PASSWORD') ?: System.getenv('OSSRH_PASSWORD') ?: ""
}
def getSigningKeyId() {
return findProperty('SIGNING_KEY_ID') ?: System.getenv('SIGNING_KEY_ID') ?: ""
}
def getSigningKey() {
return findProperty('SIGNING_KEY') ?: System.getenv('SIGNING_KEY') ?: ""
}
def getSigningPassword() {
return findProperty('SIGNING_PASSWORD') ?: System.getenv('SIGNING_PASSWORD') ?: ""
}

//if (!project.tasks.findByName('sourcesJar')) {
// task sourcesJar(type: Jar) {
// archiveClassifier.set('sources')
// if (pluginManager.hasPlugin('com.android.library')) {
// from android.sourceSets.main.java.srcDirs
// } else {
// from sourceSets.main.allSource.srcDirs
// }
// }
//}
//
//artifacts {
// archives dokkaJar
// archives sourcesJar
//}

// --- Publish ---

// OSS Sonatype Repo
// s01.oss.sonatype.com
def OSSRepo = "s01.oss.sonatype.org"
//def OSSRepo = "oss.sonatype.org"

afterEvaluate {
publishing {
repositories {
maven {
name "snapshot"
url = "https://$OSSRepo/content/repositories/snapshots"
credentials {
username = getRepositoryUsername()
password = getRepositoryPassword()
}
}
maven {
name "staging"
url = "https://$OSSRepo/service/local/staging/deploy/maven2"
credentials {
username = getRepositoryUsername()
password = getRepositoryPassword()
}
}
}

// if (!pluginManager.hasPlugin('org.jetbrains.kotlin.multiplatform')) {
publications {
release(MavenPublication) {
from components.javaPlatform
// artifact sourcesJar
artifactId = project.name
}
}
// }

publications.all {
// artifact dokkaJar

pom.withXml {
def root = asNode()

root.children().last() + {
resolveStrategy = Closure.DELEGATE_FIRST

description "KOIN - Kotlin simple Dependency Injection Framework"
name project.name
url "https://insert-koin.io/"
licenses {
license {
name "The Apache Software License, Version 2.0"
url "http://www.apache.org/licenses/LICENSE-2.0.txt"
}
}
scm {
url "https://github.com/InsertKoinIO/koin"
connection "scm:git:git://github.com/InsertKoinIO/koin.git"
developerConnection "scm:git:git://github.com/InsertKoinIO/koin.git"
}
developers {
developer {
id "arnaudgiuliani"
name "Arnaud Giuliani"
}
}
}
}
}
}

if (isReleaseBuild()) {
signing {
useInMemoryPgpKeys(
getSigningKeyId(),
getSigningKey(),
getSigningPassword(),
)

if (pluginManager.hasPlugin('org.jetbrains.kotlin.multiplatform')) {
publishing.publications.all {
sign it
}
} else {
sign publishing.publications.release
}
}
}
}
4 changes: 4 additions & 0 deletions bom/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh

../gradlew publishToMavenLocal

4 changes: 3 additions & 1 deletion bom/koin-annotations-bom/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ dependencies {
api "io.insert-koin:koin-annotations:$koin_ksp_version"
api "io.insert-koin:koin-ksp-compiler:$koin_ksp_version"
}
}
}

apply from: '../gradle/publish.gradle'
5 changes: 5 additions & 0 deletions bom/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

../gradlew publishAllPublicationsToStagingRepository --max-workers 1


0 comments on commit 8009a55

Please sign in to comment.