mirror of
https://github.com/PhilKes/NotallyX.git
synced 2025-06-28 04:09:54 +00:00
Migrate build.gradle files to Kotlin
This commit is contained in:
parent
5d98773373
commit
b64566af2b
7 changed files with 216 additions and 194 deletions
162
app/build.gradle
162
app/build.gradle
|
@ -1,162 +0,0 @@
|
|||
import com.ncorti.ktfmt.gradle.tasks.KtfmtFormatTask
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
|
||||
plugins {
|
||||
id 'com.android.application'
|
||||
id 'kotlin-android'
|
||||
id 'kotlin-parcelize'
|
||||
id 'com.google.devtools.ksp'
|
||||
id 'com.ncorti.ktfmt.gradle' version '0.20.1'
|
||||
id 'org.jetbrains.kotlin.plugin.serialization' version '1.9.0'
|
||||
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdk 34
|
||||
namespace 'com.philkes.notallyx'
|
||||
|
||||
defaultConfig {
|
||||
applicationId 'com.philkes.notallyx'
|
||||
minSdk 21
|
||||
targetSdk 34
|
||||
versionCode 631
|
||||
versionName "6.4.0-BETA"
|
||||
resourceConfigurations += ['en', 'ca', 'cs', 'da', 'de', 'el', 'es', 'fr', 'hu', 'in', 'it', 'ja', 'my', 'nb', 'nl', 'nn', 'pl', 'pt-rBR', 'pt-rPT', 'ro', 'ru', 'sk', 'sv', 'tl', 'tr', 'uk', 'vi', 'zh-rCN']
|
||||
vectorDrawables.generatedDensities = []
|
||||
}
|
||||
|
||||
ksp {
|
||||
arg("room.generateKotlin", "true")
|
||||
arg("room.schemaLocation", "$projectDir/schemas")
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
release {
|
||||
storeFile file(RELEASE_STORE_FILE)
|
||||
storePassword RELEASE_STORE_PASSWORD
|
||||
keyAlias RELEASE_KEY_ALIAS
|
||||
keyPassword RELEASE_KEY_PASSWORD
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
debug {
|
||||
applicationIdSuffix ".debug"
|
||||
}
|
||||
release {
|
||||
crunchPngs false
|
||||
minifyEnabled true
|
||||
shrinkResources true
|
||||
proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
|
||||
signingConfig signingConfigs.release
|
||||
}
|
||||
}
|
||||
|
||||
dependenciesInfo {
|
||||
// Disables dependency metadata when building APKs.
|
||||
includeInApk = false
|
||||
// Disables dependency metadata when building Android App Bundles.
|
||||
includeInBundle = false
|
||||
}
|
||||
|
||||
kotlinOptions { jvmTarget = "1.8" }
|
||||
|
||||
buildFeatures { viewBinding true }
|
||||
|
||||
packagingOptions.resources {
|
||||
excludes += ["DebugProbesKt.bin", "META-INF/**.version", "kotlin/**.kotlin_builtins", "kotlin-tooling-metadata.json"]
|
||||
}
|
||||
|
||||
testOptions {
|
||||
unitTests {
|
||||
includeAndroidResources true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(KotlinCompile).configureEach {
|
||||
kotlinOptions.jvmTarget = "1.8"
|
||||
}
|
||||
|
||||
ktfmt {
|
||||
kotlinLangStyle()
|
||||
}
|
||||
|
||||
tasks.register('ktfmtPrecommit', KtfmtFormatTask) {
|
||||
source = project.fileTree(rootDir)
|
||||
include("**/*.kt")
|
||||
}
|
||||
|
||||
tasks.register('installLocalGitHooks', Copy) {
|
||||
def scriptsDir = new File(rootProject.rootDir, '.scripts/')
|
||||
def hooksDir = new File(rootProject.rootDir, '.git/hooks')
|
||||
from(scriptsDir) {
|
||||
include 'pre-commit', 'pre-commit.bat'
|
||||
}
|
||||
into { hooksDir }
|
||||
inputs.files(file("${scriptsDir}/pre-commit"), file("${scriptsDir}/pre-commit.bat"))
|
||||
outputs.dir(hooksDir)
|
||||
fileMode 0775
|
||||
}
|
||||
preBuild.dependsOn installLocalGitHooks
|
||||
|
||||
afterEvaluate {
|
||||
bundleRelease.dependsOn testReleaseUnitTest
|
||||
assembleRelease.dependsOn testReleaseUnitTest
|
||||
}
|
||||
|
||||
dependencies {
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
androidTestImplementation 'junit:junit:4.13.2'
|
||||
final def navVersion = "2.3.5"
|
||||
final def roomVersion = "2.6.1"
|
||||
|
||||
ksp "androidx.room:room-compiler:$roomVersion"
|
||||
implementation "androidx.room:room-ktx:$roomVersion"
|
||||
implementation "androidx.room:room-runtime:$roomVersion"
|
||||
implementation "net.zetetic:android-database-sqlcipher:4.5.3"
|
||||
implementation "androidx.sqlite:sqlite-ktx:2.4.0"
|
||||
implementation "androidx.security:security-crypto:1.1.0-alpha06"
|
||||
implementation 'net.lingala.zip4j:zip4j:2.11.5'
|
||||
|
||||
implementation "androidx.work:work-runtime:2.9.1"
|
||||
implementation "androidx.preference:preference-ktx:1.2.1"
|
||||
|
||||
//noinspection GradleDependency
|
||||
implementation "androidx.navigation:navigation-ui-ktx:$navVersion"
|
||||
//noinspection GradleDependency
|
||||
implementation "androidx.navigation:navigation-fragment-ktx:$navVersion"
|
||||
|
||||
implementation "org.ocpsoft.prettytime:prettytime:4.0.6.Final"
|
||||
implementation "com.google.android.material:material:1.12.0"
|
||||
|
||||
implementation 'com.github.zerobranch:SwipeLayout:1.3.1'
|
||||
|
||||
implementation "com.github.bumptech.glide:glide:4.15.1"
|
||||
implementation "com.davemorrissey.labs:subsampling-scale-image-view-androidx:3.10.0"
|
||||
implementation 'me.zhanghai.android.fastscroll:library:1.3.0'
|
||||
|
||||
implementation "com.google.code.findbugs:jsr305:3.0.2"
|
||||
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3"
|
||||
implementation("org.simpleframework:simple-xml:2.7.1") {
|
||||
exclude group: 'xpp3', module: 'xpp3'
|
||||
}
|
||||
implementation 'org.jsoup:jsoup:1.18.1'
|
||||
|
||||
implementation 'cat.ereza:customactivityoncrash:2.4.0'
|
||||
|
||||
testImplementation "junit:junit:4.13.2"
|
||||
testImplementation "androidx.test:core:1.6.1"
|
||||
testImplementation "androidx.test:core-ktx:1.6.1"
|
||||
testImplementation 'androidx.arch.core:core-testing:2.2.0'
|
||||
testImplementation "org.mockito:mockito-core:5.13.0"
|
||||
testImplementation "org.mockito.kotlin:mockito-kotlin:5.4.0"
|
||||
testImplementation "io.mockk:mockk:1.13.12"
|
||||
testImplementation "org.json:json:20180813"
|
||||
testImplementation "org.assertj:assertj-core:3.24.2"
|
||||
testImplementation "org.robolectric:robolectric:4.13"
|
||||
|
||||
androidTestImplementation "androidx.room:room-testing:$roomVersion"
|
||||
androidTestImplementation "androidx.work:work-testing:2.9.1"
|
||||
|
||||
}
|
170
app/build.gradle.kts
Normal file
170
app/build.gradle.kts
Normal file
|
@ -0,0 +1,170 @@
|
|||
import com.android.build.gradle.internal.tasks.factory.dependsOn
|
||||
import com.ncorti.ktfmt.gradle.tasks.KtfmtFormatTask
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
|
||||
plugins {
|
||||
id("com.android.application")
|
||||
id("org.jetbrains.kotlin.android")
|
||||
id("org.jetbrains.kotlin.plugin.parcelize")
|
||||
id("com.google.devtools.ksp")
|
||||
id("com.ncorti.ktfmt.gradle") version "0.20.1"
|
||||
id("org.jetbrains.kotlin.plugin.serialization") version "1.9.0"
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "com.philkes.notallyx"
|
||||
compileSdk = 34
|
||||
|
||||
defaultConfig {
|
||||
applicationId = "com.philkes.notallyx"
|
||||
minSdk = 21
|
||||
targetSdk = 34
|
||||
versionCode = 631
|
||||
versionName = "6.4.0-BETA"
|
||||
resourceConfigurations += listOf(
|
||||
"en", "ca", "cs", "da", "de", "el", "es", "fr", "hu", "in", "it", "ja", "my", "nb", "nl", "nn", "pl", "pt-rBR", "pt-rPT", "ro", "ru", "sk", "sv", "tl", "tr", "uk", "vi", "zh-rCN"
|
||||
)
|
||||
vectorDrawables.generatedDensities?.clear()
|
||||
}
|
||||
|
||||
ksp {
|
||||
arg("room.generateKotlin", "true")
|
||||
arg("room.schemaLocation", "$projectDir/schemas")
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
create("release") {
|
||||
storeFile = file(providers.gradleProperty("RELEASE_STORE_FILE").get())
|
||||
storePassword = providers.gradleProperty("RELEASE_STORE_PASSWORD").get()
|
||||
keyAlias = providers.gradleProperty("RELEASE_KEY_ALIAS").get()
|
||||
keyPassword = providers.gradleProperty("RELEASE_KEY_PASSWORD").get()
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
debug {
|
||||
applicationIdSuffix = ".debug"
|
||||
}
|
||||
release {
|
||||
isCrunchPngs = false
|
||||
isMinifyEnabled = true
|
||||
isShrinkResources = true
|
||||
proguardFiles(
|
||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||
"proguard-rules.pro"
|
||||
)
|
||||
signingConfig = signingConfigs.getByName("release")
|
||||
}
|
||||
}
|
||||
|
||||
dependenciesInfo {
|
||||
includeInApk = false
|
||||
includeInBundle = false
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = "1.8"
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
viewBinding = true
|
||||
}
|
||||
|
||||
packaging {
|
||||
resources.excludes += listOf(
|
||||
"DebugProbesKt.bin",
|
||||
"META-INF/**.version",
|
||||
"kotlin/**.kotlin_builtins",
|
||||
"kotlin-tooling-metadata.json"
|
||||
)
|
||||
}
|
||||
|
||||
testOptions {
|
||||
unitTests.isIncludeAndroidResources = true
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType<KotlinCompile>().configureEach {
|
||||
kotlinOptions.jvmTarget = "1.8"
|
||||
}
|
||||
|
||||
ktfmt {
|
||||
kotlinLangStyle()
|
||||
}
|
||||
|
||||
tasks.register<KtfmtFormatTask>("ktfmtPrecommit") {
|
||||
source = project.fileTree(rootDir)
|
||||
include("**/*.kt")
|
||||
}
|
||||
|
||||
tasks.register<Copy>("installLocalGitHooks") {
|
||||
val scriptsDir = File(rootProject.rootDir, ".scripts/")
|
||||
val hooksDir = File(rootProject.rootDir, ".git/hooks")
|
||||
from(scriptsDir) {
|
||||
include("pre-commit", "pre-commit.bat")
|
||||
}
|
||||
into(hooksDir)
|
||||
inputs.files(file("${scriptsDir}/pre-commit"), file("${scriptsDir}/pre-commit.bat"))
|
||||
outputs.dir(hooksDir)
|
||||
fileMode = 775
|
||||
}
|
||||
|
||||
tasks.preBuild.dependsOn(tasks.named("installLocalGitHooks"))
|
||||
|
||||
afterEvaluate {
|
||||
tasks.named("bundleRelease").configure {
|
||||
dependsOn(tasks.named("testReleaseUnitTest"))
|
||||
}
|
||||
tasks.named("assembleRelease").configure {
|
||||
dependsOn(tasks.named("testReleaseUnitTest"))
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
val navVersion = "2.3.5"
|
||||
val roomVersion = "2.6.1"
|
||||
|
||||
implementation("androidx.navigation:navigation-fragment-ktx:$navVersion")
|
||||
implementation("androidx.navigation:navigation-ui-ktx:$navVersion")
|
||||
implementation("androidx.preference:preference-ktx:1.2.1")
|
||||
ksp("androidx.room:room-compiler:$roomVersion")
|
||||
implementation("androidx.room:room-ktx:$roomVersion")
|
||||
implementation("androidx.room:room-runtime:$roomVersion")
|
||||
implementation("androidx.security:security-crypto:1.1.0-alpha06")
|
||||
implementation("androidx.sqlite:sqlite-ktx:2.4.0")
|
||||
implementation("androidx.work:work-runtime:2.9.1")
|
||||
|
||||
implementation("cat.ereza:customactivityoncrash:2.4.0")
|
||||
implementation("com.davemorrissey.labs:subsampling-scale-image-view-androidx:3.10.0")
|
||||
implementation("com.github.bumptech.glide:glide:4.15.1")
|
||||
implementation("com.github.zerobranch:SwipeLayout:1.3.1")
|
||||
implementation("com.google.android.material:material:1.12.0")
|
||||
implementation("com.google.code.findbugs:jsr305:3.0.2")
|
||||
implementation("me.zhanghai.android.fastscroll:library:1.3.0")
|
||||
implementation("net.lingala.zip4j:zip4j:2.11.5")
|
||||
implementation("net.zetetic:android-database-sqlcipher:4.5.3")
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3")
|
||||
implementation("org.jsoup:jsoup:1.18.1")
|
||||
implementation("org.ocpsoft.prettytime:prettytime:4.0.6.Final")
|
||||
implementation("org.simpleframework:simple-xml:2.7.1") {
|
||||
exclude(group = "xpp3", module = "xpp3")
|
||||
}
|
||||
|
||||
androidTestImplementation("androidx.room:room-testing:$roomVersion")
|
||||
androidTestImplementation("androidx.work:work-testing:2.9.1")
|
||||
testImplementation("androidx.arch.core:core-testing:2.2.0")
|
||||
testImplementation("androidx.test:core-ktx:1.6.1")
|
||||
testImplementation("androidx.test:core:1.6.1")
|
||||
testImplementation("io.mockk:mockk:1.13.12")
|
||||
testImplementation("junit:junit:4.13.2")
|
||||
testImplementation("org.assertj:assertj-core:3.24.2")
|
||||
testImplementation("org.json:json:20180813")
|
||||
testImplementation("org.mockito.kotlin:mockito-kotlin:5.4.0")
|
||||
testImplementation("org.mockito:mockito-core:5.13.0")
|
||||
testImplementation("org.robolectric:robolectric:4.13")
|
||||
}
|
2
app/proguard-rules.pro
vendored
2
app/proguard-rules.pro
vendored
|
@ -1,6 +1,6 @@
|
|||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
# proguardFiles setting in build.gradle.kts.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
|
29
build.gradle
29
build.gradle
|
@ -1,29 +0,0 @@
|
|||
buildscript {
|
||||
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:8.7.0'
|
||||
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.0'
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.google.devtools.ksp' version '1.9.0-1.0.13' apply false
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
maven { url 'https://jitpack.io' }
|
||||
}
|
||||
}
|
||||
|
||||
tasks.register("clean", Delete) {
|
||||
delete layout.buildDirectory.asFile
|
||||
}
|
||||
|
19
build.gradle.kts
Normal file
19
build.gradle.kts
Normal file
|
@ -0,0 +1,19 @@
|
|||
buildscript {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath("com.android.tools.build:gradle:8.7.0")
|
||||
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.0")
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id("com.google.devtools.ksp") version "1.9.0-1.0.13" apply false
|
||||
}
|
||||
|
||||
tasks.register<Delete>("clean") {
|
||||
delete(layout.buildDirectory.asFile)
|
||||
}
|
|
@ -1,2 +0,0 @@
|
|||
include ":app"
|
||||
rootProject.name = "NotallyX"
|
26
settings.gradle.kts
Normal file
26
settings.gradle.kts
Normal file
|
@ -0,0 +1,26 @@
|
|||
pluginManagement {
|
||||
repositories {
|
||||
google {
|
||||
content {
|
||||
includeGroupByRegex("com\\.android.*")
|
||||
includeGroupByRegex("com\\.google.*")
|
||||
includeGroupByRegex("androidx.*")
|
||||
}
|
||||
}
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
}
|
||||
dependencyResolutionManagement {
|
||||
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
maven {
|
||||
url = uri("https://jitpack.io")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.name = "NotallyX"
|
||||
include(":app")
|
Loading…
Add table
Add a link
Reference in a new issue