diff --git a/app/build.gradle b/app/build.gradle deleted file mode 100644 index ad7cf20..0000000 --- a/app/build.gradle +++ /dev/null @@ -1,65 +0,0 @@ -apply plugin: 'com.android.application' -apply plugin: 'com.google.android.gms.oss-licenses-plugin' -apply plugin: "com.ncorti.ktfmt.gradle" -apply plugin: 'kotlin-android' - -def keystorePropertiesFile = rootProject.file("keystore.properties") -def keystoreProperties = new Properties() -try { - keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) -} catch (FileNotFoundException ignored) { - logger.warn('keystore.properties not found') -} - -android { - namespace = 'com.github.shingyx.boomswitch' - signingConfigs { - release { - storeFile = rootProject.file(keystoreProperties['storeFile'] ?: "default.jks") - storePassword = keystoreProperties['storePassword'] - keyAlias = keystoreProperties['keyAlias'] - keyPassword = keystoreProperties['keyPassword'] - } - } - compileSdk = 36 - defaultConfig { - applicationId = "com.github.shingyx.boomswitch" - minSdk = 23 - targetSdk = 36 - versionCode = 13 - versionName = "1.9" - } - buildTypes { - debug { - applicationIdSuffix = ".dev" - versionNameSuffix = "-dev" - } - release { - minifyEnabled = true - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt') - signingConfig = signingConfigs.release - } - } - buildFeatures { - buildConfig = true - viewBinding = true - } - kotlin { - jvmToolchain(21) - } -} - -ktfmt { - googleStyle() -} - -dependencies { - implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - implementation 'androidx.appcompat:appcompat:1.7.1' - implementation 'androidx.constraintlayout:constraintlayout:2.2.1' - implementation 'com.google.android.gms:play-services-oss-licenses:17.2.2' - implementation 'com.google.android.material:material:1.12.0' - implementation 'com.jakewharton.timber:timber:5.0.1' - implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.10.2' -} diff --git a/app/build.gradle.kts b/app/build.gradle.kts new file mode 100644 index 0000000..3e8fb17 --- /dev/null +++ b/app/build.gradle.kts @@ -0,0 +1,67 @@ +import java.io.FileInputStream +import java.io.FileNotFoundException +import java.util.Properties + +plugins { + alias(libs.plugins.android.application) + alias(libs.plugins.oss.licenses.plugin) + alias(libs.plugins.ktfmt) + alias(libs.plugins.kotlin.android) +} + +val keystorePropertiesFile = rootProject.file("keystore.properties") +val keystoreProperties = Properties() + +try { + keystoreProperties.load(FileInputStream(keystorePropertiesFile)) +} catch (_: FileNotFoundException) { + logger.warn("keystore.properties not found") +} + +android { + namespace = "com.github.shingyx.boomswitch" + signingConfigs { + create("release") { + storeFile = rootProject.file(keystoreProperties.getProperty("storeFile") ?: "default.jks") + storePassword = keystoreProperties.getProperty("storePassword") + keyAlias = keystoreProperties.getProperty("keyAlias") + keyPassword = keystoreProperties.getProperty("keyPassword") + } + } + compileSdk = 36 + defaultConfig { + applicationId = "com.github.shingyx.boomswitch" + minSdk = 23 + targetSdk = 36 + versionCode = 13 + versionName = "1.9" + } + buildTypes { + getByName("debug") { + applicationIdSuffix = ".dev" + versionNameSuffix = "-dev" + } + getByName("release") { + isMinifyEnabled = true + proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt")) + signingConfig = signingConfigs["release"] + } + } + buildFeatures { + buildConfig = true + viewBinding = true + } + kotlin { jvmToolchain(21) } +} + +ktfmt { googleStyle() } + +dependencies { + implementation(libs.androidx.appcompat) + implementation(libs.androidx.constraintlayout) + implementation(libs.kotlin.stdlib) + implementation(libs.kotlinx.coroutines.android) + implementation(libs.material) + implementation(libs.oss.licenses) + implementation(libs.timber) +} diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 617aa33..0000000 --- a/build.gradle +++ /dev/null @@ -1,27 +0,0 @@ -// Top-level build file where you can add configuration options common to all sub-projects/modules. - -buildscript { - ext.kotlin_version = '2.2.0' - repositories { - google() - mavenCentral() - maven { - url = "https://plugins.gradle.org/m2/" - } - } - dependencies { - classpath 'com.android.tools.build:gradle:8.12.1' - classpath 'com.google.android.gms:oss-licenses-plugin:0.10.7' - classpath "com.ncorti.ktfmt.gradle:plugin:0.23.0" - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - // NOTE: Do not place your application dependencies here; they belong - // in the individual module build.gradle files - } -} - -allprojects { - repositories { - google() - mavenCentral() - } -} diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..a5c01f1 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,6 @@ +plugins { + alias(libs.plugins.android.application) apply false + alias(libs.plugins.kotlin.android) apply false + alias(libs.plugins.ktfmt) apply false + alias(libs.plugins.oss.licenses.plugin) apply false +} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..29bb9ba --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,26 @@ +[versions] +agp = "8.12.1" +appcompat = "1.7.1" +constraintlayout = "2.2.1" +kotlin = "2.2.10" +kotlinxCoroutines = "1.10.2" +ktfmt = "0.23.0" +material = "1.12.0" +ossLicenses = "17.2.2" +ossLicensesPlugin = "0.10.7" +timber = "5.0.1" + +[libraries] +androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "appcompat" } +androidx-constraintlayout = { module = "androidx.constraintlayout:constraintlayout", version.ref = "constraintlayout" } +kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" } +kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "kotlinxCoroutines" } +material = { module = "com.google.android.material:material", version.ref = "material" } +oss-licenses = { module = "com.google.android.gms:play-services-oss-licenses", version.ref = "ossLicenses" } +timber = { module = "com.jakewharton.timber:timber", version.ref = "timber" } + +[plugins] +android-application = { id = "com.android.application", version.ref = "agp" } +kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } +ktfmt = { id = "com.ncorti.ktfmt.gradle", version.ref = "ktfmt" } +oss-licenses-plugin = { id = "com.google.android.gms.oss-licenses-plugin", version.ref = "ossLicensesPlugin" } diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index e7b4def..0000000 --- a/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -include ':app' diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 0000000..a0a86f5 --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,24 @@ +pluginManagement { + repositories { + google() + mavenCentral() + gradlePluginPortal() + } + resolutionStrategy { + eachPlugin { + if (requested.id.id == "com.google.android.gms.oss-licenses-plugin") { + useModule("com.google.android.gms:oss-licenses-plugin:${requested.version}") + } + } + } +} + +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + } +} + +include(":app")