Migrate project-level Gradle build script to Kotlin DSL

This commit is contained in:
thunderbiscuit 2022-02-11 15:53:45 -05:00
parent bd13eca0f3
commit 4e66758048
No known key found for this signature in database
GPG Key ID: 88253696EB836462
2 changed files with 52 additions and 51 deletions

View File

@ -1,51 +0,0 @@
buildscript {
ext.kotlin_version = '1.6.10'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
plugins {
id "signing"
id "maven-publish"
id "io.github.gradle-nexus.publish-plugin" version "1.1.0"
}
signing {
def signingKey = findProperty("signingKey")
def signingPassword = findProperty("signingPassword")
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications
}
nexusPublishing {
packageGroup = "org.bitcoindevkit"
repositories {
sonatype {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
username = project.findProperty("ossrhUsername")
password = project.findProperty("ossrhPassword")
}
}
}
allprojects {
repositories {
google()
mavenCentral()
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
freeCompilerArgs += [
"-Xopt-in=kotlin.ExperimentalUnsignedTypes",
]
}
}
}

52
build.gradle.kts Normal file
View File

@ -0,0 +1,52 @@
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:7.0.4")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10")
}
}
plugins {
id("signing")
id("maven-publish")
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
}
signing {
val signingKey: String? by project
val signingPassword: String? by project
useInMemoryPgpKeys(signingKey, signingPassword)
sign(publishing.publications)
}
// does this need to be defined here? Not sure
// it used to be defined in the nexusPublishing block but is not required
// I think the group ID is defined in the specific publishing blocks in the respective build.gradle.kts
group = "org.bitcoindevkit"
nexusPublishing {
repositories {
create("sonatype") {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
val ossrhUsername: String? by project
val ossrhPassword: String? by project
username.set(ossrhUsername)
password.set(ossrhPassword)
}
}
}
allprojects {
repositories {
google()
mavenCentral()
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
kotlinOptions.freeCompilerArgs += "-opt-in=kotlin.ExperimentalUnsignedTypes"
}
}