build: convert remaining .gradle files to Kotlin DSL

Converts the last four Groovy build scripts to Kotlin DSL so the entire
build is consistent with the rest of the modules (commons, quartz, etc.).

- settings.gradle -> settings.gradle.kts
- build.gradle (root) -> build.gradle.kts
- amethyst/build.gradle -> amethyst/build.gradle.kts
- benchmark/build.gradle -> benchmark/build.gradle.kts

Notes:
- Switched the per-subproject spotless format from groovyGradle to
  kotlinGradle now that the only gradle scripts are .gradle.kts.
- benchmark module: moved targetSdk from defaultConfig to testOptions —
  AGP 9 removed targetSdk from library defaultConfig.
- Reimplemented getCurrentBranch() with ProcessBuilder (Groovy's
  String.execute() isn't available in Kotlin DSL).
This commit is contained in:
Claude
2026-05-20 14:17:47 +00:00
parent a4be1d21fe
commit ebfd066d5c
6 changed files with 566 additions and 549 deletions
-73
View File
@@ -1,73 +0,0 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins {
alias(libs.plugins.androidLibrary)
alias(libs.plugins.androidBenchmark)
}
android {
namespace = 'com.vitorpamplona.amethyst.benchmark'
compileSdk = libs.versions.android.compileSdk.get().toInteger()
defaultConfig {
minSdk = libs.versions.android.minSdk.get().toInteger()
targetSdk = libs.versions.android.targetSdk.get().toInteger()
// Enable measuring on an emulator, or devices with low battery
testInstrumentationRunner 'androidx.benchmark.junit4.AndroidBenchmarkRunner'
testInstrumentationRunnerArguments["androidx.benchmark.suppressErrors"] = "EMULATOR,LOW-BATTERY"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_21
targetCompatibility JavaVersion.VERSION_21
}
sourceSets.androidTest.resources.srcDirs += ["../quartz/src/androidDeviceTest/resources"]
testBuildType = "benchmark"
buildTypes {
debug {
// Since debuggable can"t be modified by gradle for library modules,
// it must be done in a manifest - see src/androidTest/AndroidManifest.xml
minifyEnabled false
proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "benchmark-proguard-rules.pro"
}
release {
isDefault = false
minifyEnabled = true
}
create("benchmark") {
isDefault = true
initWith(getByName("release"))
signingConfig = signingConfigs.debug
}
}
}
kotlin {
compilerOptions {
jvmTarget = JvmTarget.JVM_21
}
}
dependencies {
implementation libs.androidx.core.ktx
androidTestImplementation platform(libs.androidx.compose.bom)
androidTestImplementation libs.androidx.runner
androidTestImplementation libs.androidx.junit
androidTestImplementation libs.junit
androidTestImplementation libs.androidx.benchmark.junit4
androidTestImplementation project(path: ':quartz')
androidTestImplementation project(path: ':commons')
// Custom C secp256k1 (libschnorr256k1) for the 3-way Android benchmark
androidTestImplementation libs.schnorr256k1.kmp
androidTestImplementation libs.androidx.compose.foundation
// Add your dependencies here. Note that you cannot benchmark code
// in an app module this way - you will need to move any code you
// want to benchmark to a library module:
// https://developer.android.com/studio/projects/android-library#Convert
}
+80
View File
@@ -0,0 +1,80 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins {
alias(libs.plugins.androidLibrary)
alias(libs.plugins.androidBenchmark)
}
android {
namespace = "com.vitorpamplona.amethyst.benchmark"
compileSdk = libs.versions.android.compileSdk.get().toInt()
defaultConfig {
minSdk = libs.versions.android.minSdk.get().toInt()
// Enable measuring on an emulator, or devices with low battery
testInstrumentationRunner = "androidx.benchmark.junit4.AndroidBenchmarkRunner"
testInstrumentationRunnerArguments["androidx.benchmark.suppressErrors"] = "EMULATOR,LOW-BATTERY"
}
testOptions {
targetSdk = libs.versions.android.targetSdk.get().toInt()
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
sourceSets {
getByName("androidTest") {
resources.srcDirs("../quartz/src/androidDeviceTest/resources")
}
}
testBuildType = "benchmark"
buildTypes {
getByName("debug") {
// Since debuggable can"t be modified by gradle for library modules,
// it must be done in a manifest - see src/androidTest/AndroidManifest.xml
isMinifyEnabled = false
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "benchmark-proguard-rules.pro")
}
getByName("release") {
isDefault = false
isMinifyEnabled = true
}
create("benchmark") {
isDefault = true
initWith(getByName("release"))
signingConfig = signingConfigs.getByName("debug")
}
}
}
kotlin {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_21)
}
}
dependencies {
implementation(libs.androidx.core.ktx)
androidTestImplementation(platform(libs.androidx.compose.bom))
androidTestImplementation(libs.androidx.runner)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.junit)
androidTestImplementation(libs.androidx.benchmark.junit4)
androidTestImplementation(project(":quartz"))
androidTestImplementation(project(":commons"))
// Custom C secp256k1 (libschnorr256k1) for the 3-way Android benchmark
androidTestImplementation(libs.schnorr256k1.kmp)
androidTestImplementation(libs.androidx.compose.foundation)
// Add your dependencies here. Note that you cannot benchmark code
// in an app module this way - you will need to move any code you
// want to benchmark to a library module:
// https://developer.android.com/studio/projects/android-library#Convert
}