Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ jobs:
build:
docker:
# https://circleci.com/developer/images/image/cimg/android
- image: cimg/android:2024.09-ndk
- image: cimg/android:2026.03.1-ndk

environment:
GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError"'
steps:
Expand Down
32 changes: 0 additions & 32 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -49,40 +49,8 @@ subprojects {
}
}
}

plugins.withType<MavenPublishPlugin>().configureEach {
extensions.configure<PublishingExtension> {
repositories {
val repositoryUrl = if (isReleaseBuild) {
requireNotNull(property("RELEASE_REPOSITORY_URL")?.toString())
} else {
requireNotNull(property("SNAPSHOT_REPOSITORY_URL")?.toString())
}

maven {
url = uri(repositoryUrl)

credentials {
username = findStringPropertyOrDefault("NEXUS_USERNAME")
password = findStringPropertyOrDefault("NEXUS_PASSWORD")
}
}
}
}
}

plugins.withType<SigningPlugin>().configureEach {
extensions.configure<SigningExtension> {
isRequired = isReleaseBuild
}
}
}

val clean by tasks.registering(type = Delete::class) {
delete(rootProject.layout.buildDirectory)
}

private val Project.isReleaseBuild get() = !version.toString().endsWith("SNAPSHOT")

private fun Project.findStringPropertyOrDefault(propertyName: String, default: String? = "") =
findProperty(propertyName)?.toString() ?: default
10 changes: 7 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
org.gradle.jvmargs=-Xms1024m -Xmx4096m -Dfile.encoding=UTF-8

# Enable Gradle configuration and build cache to speed up builds on developer machines.
org.gradle.configuration-cache=true
org.gradle.configuration-cache=false
org.gradle.caching=true

# When configured, Gradle will run in incubating parallel mode.
Expand All @@ -33,6 +33,8 @@ kotlin.code.style=official
VERSION_NAME=0.1.2
VERSION_CODE=12
GROUP=com.scottyab
POM_NAME=Rootbeer Lib
POM_INCEPTION_YEAR=2016
POM_DESCRIPTION=A tasty root checker library. We've scoured the internets for different methods of answering that age old question... Has this device got root?
POM_URL=https://github.com/scottyab/rootbeer.git
POM_SCM_URL=https://github.com/scottyab/rootbeer.git
Expand All @@ -43,5 +45,7 @@ POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
POM_LICENCE_DIST=repo
POM_DEVELOPER_ID=scottyab
POM_DEVELOPER_NAME=Scott Alexander-Bown, Mat Rollings
RELEASE_REPOSITORY_URL=https://oss.sonatype.org/service/local/staging/deploy/maven2
SNAPSHOT_REPOSITORY_URL=https://oss.sonatype.org/content/repositories/snapshots
POM_DEVELOPER_URL=https://github.com/scottyab

# RELEASE_REPOSITORY_URL=https://oss.sonatype.org/service/local/staging/deploy/maven2
# SNAPSHOT_REPOSITORY_URL=https://oss.sonatype.org/content/repositories/snapshots
4 changes: 3 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ android-min-sdk = "21"
android-target-sdk = "35"
android-build-tools = "35"
android-ndk = "27.0.12077973"
agp = "8.6.1"
agp = "8.13.2"
kotlin = "1.9.23"

corektxVersion = '1.13.1'
Expand All @@ -17,6 +17,7 @@ nineoldandroidsVersion = '2.4.0'

junit = "4.13.2"
mockito = "3.9.0"
vanniktechMavenPublish = "0.30.0"

[libraries]
androidx-core-ktx = { module = "androidx.core:core-ktx", version.ref = "corektxVersion" }
Expand All @@ -37,3 +38,4 @@ mockito = { module = "org.mockito:mockito-core", version.ref = "mockito" }
android-application = { id = "com.android.application", version.ref = "agp" }
android-library = { id = "com.android.library", version.ref = "agp" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
vanniktech-maven-publish = { id = "com.vanniktech.maven.publish", version.ref = "vanniktechMavenPublish" }
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
61 changes: 7 additions & 54 deletions rootbeerlib/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
plugins {
alias(libs.plugins.android.library)
`maven-publish`
signing
alias(libs.plugins.vanniktech.maven.publish)
}

android {
Expand Down Expand Up @@ -39,64 +38,18 @@ android {
path = file("src/main/cpp/CMakeLists.txt")
}
}

publishing {
singleVariant("release") {
withSourcesJar()
withJavadocJar()
}
}
}

dependencies {
testImplementation(libs.junit)
testImplementation(libs.mockito)
}

publishing {
publications {
register<MavenPublication>("release") {
artifactId = findStringPropertyOrDefault("POM_ARTIFACT_ID")

afterEvaluate {
from(components["release"])
}

pom {
name = findStringPropertyOrDefault("POM_NAME")
packaging = findStringPropertyOrDefault("POM_PACKAGING")
description = findStringPropertyOrDefault("POM_DESCRIPTION")
url = findStringPropertyOrDefault("POM_URL")

scm {
url = findStringPropertyOrDefault("POM_SCM_URL")
connection = findStringPropertyOrDefault("POM_SCM_CONNECTION")
developerConnection = findStringPropertyOrDefault("POM_SCM_DEV_CONNECTION")
}
mavenPublishing {
coordinates(
artifactId = "rootbeer-lib"
)

licenses {
license {
name = findStringPropertyOrDefault("POM_LICENCE_NAME")
url = findStringPropertyOrDefault("POM_LICENCE_URL")
distribution = findStringPropertyOrDefault("POM_LICENCE_DIST")
}
}

developers {
developer {
id = findStringPropertyOrDefault("POM_DEVELOPER_ID")
name = findStringPropertyOrDefault("POM_DEVELOPER_NAME")
organizationUrl = findStringPropertyOrDefault("POM_URL")
}
}
}
}
}
publishToMavenCentral(com.vanniktech.maven.publish.SonatypeHost.CENTRAL_PORTAL)
signAllPublications()
}

signing {
sign(publishing.publications["release"])
}

private fun Project.findStringPropertyOrDefault(propertyName: String, default: String? = "") =
findProperty(propertyName)?.toString() ?: default