From 627771d4b1aa028faebb8ba191399e8f610139a9 Mon Sep 17 00:00:00 2001 From: Maksim Karasev Date: Fri, 17 Jan 2025 15:38:40 +0300 Subject: [PATCH] Migrate build config to Kotlin --- .idea/compiler.xml | 2 +- app/build.gradle | 86 ----------------------- app/build.gradle.kts | 88 ++++++++++++++++++++++++ build.gradle | 23 ------- build.gradle.kts | 19 +++++ gradle/wrapper/gradle-wrapper.properties | 2 +- settings.gradle => settings.gradle.kts | 2 +- 7 files changed, 110 insertions(+), 112 deletions(-) delete mode 100644 app/build.gradle create mode 100644 app/build.gradle.kts delete mode 100644 build.gradle create mode 100644 build.gradle.kts rename settings.gradle => settings.gradle.kts (93%) diff --git a/.idea/compiler.xml b/.idea/compiler.xml index b589d56..b86273d 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle deleted file mode 100644 index ff42dc4..0000000 --- a/app/build.gradle +++ /dev/null @@ -1,86 +0,0 @@ -plugins { - id 'com.android.application' - id 'kotlin-android' - id 'com.google.devtools.ksp' - id 'org.jetbrains.kotlin.plugin.serialization' -} - -android { - compileSdk 34 - androidResources { - generateLocaleConfig true - } - defaultConfig { - applicationId "ru.karasevm.privatednstoggle" - versionCode 17 - versionName "1.9.0" - - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - targetSdkVersion 34 - minSdkVersion 28 - } - buildFeatures { - viewBinding true - } - buildTypes { - release { - minifyEnabled true - shrinkResources true - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - debug { - applicationIdSuffix ".dev" - } - } - compileOptions { - sourceCompatibility JavaVersion.VERSION_17 - targetCompatibility JavaVersion.VERSION_17 - } - kotlinOptions { - jvmTarget = '17' - } - dependenciesInfo { - // Disables dependency metadata when building APKs. - includeInApk = false - // Disables dependency metadata when building Android App Bundles. - includeInBundle = false - } - namespace 'ru.karasevm.privatednstoggle' -} - -dependencies { - - implementation 'androidx.core:core-ktx:1.13.1' - implementation 'androidx.appcompat:appcompat:1.7.0' - implementation 'androidx.recyclerview:recyclerview:1.3.2' - implementation 'androidx.activity:activity-ktx:1.9.2' - implementation 'androidx.fragment:fragment-ktx:1.8.4' - implementation 'com.google.android.material:material:1.12.0' - implementation 'androidx.constraintlayout:constraintlayout:2.1.4' - implementation 'com.google.guava:guava:33.1.0-android' - implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.3' - - - def shizuku_version = '13.1.5' - implementation "dev.rikka.shizuku:api:$shizuku_version" - implementation "dev.rikka.shizuku:provider:$shizuku_version" - - implementation 'org.lsposed.hiddenapibypass:hiddenapibypass:4.3' - compileOnly 'dev.rikka.hidden:stub:4.3.2' - - // Room components - def roomVersion = '2.6.1' - implementation "androidx.room:room-ktx:$roomVersion" - ksp "androidx.room:room-compiler:$roomVersion" - androidTestImplementation "androidx.room:room-testing:$roomVersion" - - // Lifecycle components - def lifecycleVersion = '2.8.6' - implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycleVersion" - implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycleVersion" - implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycleVersion" - - testImplementation 'junit:junit:4.13.2' - androidTestImplementation 'androidx.test.ext:junit:1.2.1' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1' -} \ No newline at end of file diff --git a/app/build.gradle.kts b/app/build.gradle.kts new file mode 100644 index 0000000..438062a --- /dev/null +++ b/app/build.gradle.kts @@ -0,0 +1,88 @@ +plugins { + id("com.android.application") + id("kotlin-android") + id("com.google.devtools.ksp") + id("org.jetbrains.kotlin.plugin.serialization") +} + +android { + compileSdk = 35 + androidResources { + generateLocaleConfig = true + } + defaultConfig { + applicationId = "ru.karasevm.privatednstoggle" + versionCode = 18 + versionName = "1.10.0" + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + targetSdk = 35 + minSdk = 28 + } + buildFeatures { + viewBinding = true + buildConfig = true + } + buildTypes { + release { + isMinifyEnabled = true + isShrinkResources = true + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro" + ) + } + debug { + applicationIdSuffix = ".dev" + } + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + kotlinOptions { + jvmTarget = "17" + } + dependenciesInfo { + // Disables dependency metadata when building APKs. + includeInApk = false + // Disables dependency metadata when building Android App Bundles. + includeInBundle = false + } + namespace = "ru.karasevm.privatednstoggle" +} + +dependencies { + implementation("androidx.core:core-ktx:1.15.0") + implementation("androidx.appcompat:appcompat:1.7.0") + implementation("androidx.recyclerview:recyclerview:1.4.0") + implementation("androidx.activity:activity-ktx:1.10.0") + implementation("androidx.fragment:fragment-ktx:1.8.5") + implementation("com.google.android.material:material:1.12.0") + implementation("androidx.constraintlayout:constraintlayout:2.2.0") + implementation("com.google.guava:guava:33.1.0-android") + implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.3") + + val shizukuVersion = "13.1.5" + implementation("dev.rikka.shizuku:api:$shizukuVersion") + implementation("dev.rikka.shizuku:provider:$shizukuVersion") + compileOnly("dev.rikka.hidden:stub:4.3.3") + + implementation("org.lsposed.hiddenapibypass:hiddenapibypass:4.3") + + // Room components + val roomVersion = "2.6.1" + implementation("androidx.room:room-ktx:$roomVersion") + ksp("androidx.room:room-compiler:$roomVersion") + androidTestImplementation("androidx.room:room-testing:$roomVersion") + + // Lifecycle components + val lifecycleVersion = "2.8.7" + implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycleVersion") + implementation("androidx.lifecycle:lifecycle-livedata-ktx:$lifecycleVersion") + implementation("androidx.lifecycle:lifecycle-common-java8:$lifecycleVersion") + + testImplementation("junit:junit:4.13.2") + androidTestImplementation("androidx.test.ext:junit:1.2.1") + androidTestImplementation("androidx.test.espresso:espresso-core:3.6.1") +} \ No newline at end of file diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 5ba942e..0000000 --- a/build.gradle +++ /dev/null @@ -1,23 +0,0 @@ -// Top-level build file where you can add configuration options common to all sub-projects/modules. -buildscript { - repositories { - google() - mavenCentral() - } - dependencies { - classpath 'com.android.tools.build:gradle:8.5.2' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:2.0.20" - - // NOTE: Do not place your application dependencies here; they belong - // in the individual module build.gradle files - } -} -plugins { - id 'org.jetbrains.kotlin.android' version '2.0.20' apply false - id 'org.jetbrains.kotlin.plugin.serialization' version '2.0.20' - id "com.google.devtools.ksp" version "2.0.20-1.0.25" apply false -} - -tasks.register('clean', Delete) { - delete rootProject.layout.buildDirectory -} \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..461e086 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,19 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +buildscript { + repositories { + google() + mavenCentral() + } + dependencies { + classpath("com.android.tools.build:gradle:8.8.0") + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:2.0.20") + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files + } +} +plugins { + id("org.jetbrains.kotlin.android") version "2.0.20" apply false + id("org.jetbrains.kotlin.plugin.serialization") version "2.0.20" + id("com.google.devtools.ksp") version "2.0.20-1.0.25" apply false +} diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 0725b7c..f537c92 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Mon Aug 16 15:36:35 MSK 2021 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip distributionPath=wrapper/dists zipStorePath=wrapper/dists zipStoreBase=GRADLE_USER_HOME diff --git a/settings.gradle b/settings.gradle.kts similarity index 93% rename from settings.gradle rename to settings.gradle.kts index 4ccd1ba..72cb6bf 100644 --- a/settings.gradle +++ b/settings.gradle.kts @@ -6,4 +6,4 @@ dependencyResolutionManagement { } } rootProject.name = "Private DNS Quick Toggle" -include ':app' +include("app")