diff --git a/app/build.gradle b/app/build.gradle deleted file mode 100644 index dfdbfedd..00000000 --- a/app/build.gradle +++ /dev/null @@ -1,105 +0,0 @@ -plugins { - alias libs.plugins.android.application - alias libs.plugins.jetbrains.kotlin.android - alias libs.plugins.androidx.room - alias libs.plugins.google.dagger.hilt.android - alias libs.plugins.google.devtools.ksp -} - -kotlin { - jvmToolchain(17) - compilerOptions { - freeCompilerArgs.add('-opt-in=kotlin.RequiresOptIn') - } -} - -def keystorePropertiesFile = rootProject.file('keystore.properties') -def keystoreProperties = new Properties() -if (keystorePropertiesFile.exists()) keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) - -def version = ['major': 1, 'minor': 4, 'patch': 0] - -android { - namespace 'ru.spbu.depnav' - - compileSdk 34 - - signingConfigs { - release { - if (!keystoreProperties.isEmpty()) { - storeFile file(keystoreProperties['storeFile']) - storePassword keystoreProperties['storePassword'] - keyAlias keystoreProperties['keyAlias'] - keyPassword keystoreProperties['keyPassword'] - } - } - } - - defaultConfig { - applicationId 'ru.spbu.depnav' - minSdk 21 - targetSdk 34 - versionCode version.major * 10000 + version.minor * 100 + version.patch - versionName "${version.major}.${version.minor}.${version.patch}" - - testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' - } - - buildTypes { - release { - minifyEnabled true - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - signingConfig signingConfigs.release - } - } - - buildFeatures { - compose true - } - composeOptions { - kotlinCompilerExtensionVersion libs.versions.composeCompiler.get() - } - packagingOptions { - resources { - excludes += '/META-INF/{AL2.0,LGPL2.1}' - } - } -} - -dependencies { - implementation libs.androidx.lifecycle.runtimeKtx - implementation libs.androidx.lifecycle.runtimeCompose - implementation libs.androidx.lifecycle.viewmodelCompose - - implementation libs.androidx.room.runtime - implementation libs.androidx.room.ktx - annotationProcessor libs.androidx.room.compiler - ksp libs.androidx.room.compiler - - implementation libs.google.dagger.hilt - ksp libs.google.dagger.hiltCompiler - - implementation platform(libs.androidx.compose.bom) - implementation libs.androidx.compose.material3 - implementation libs.androidx.compose.ui - implementation libs.androidx.compose.ui.tooling.preview - debugImplementation libs.androidx.compose.ui.tooling - - implementation libs.androidx.core.ktx - implementation libs.androidx.activity.compose - implementation libs.plrapps.mapcompose - - testImplementation libs.junit - androidTestImplementation libs.androidx.test.runner - androidTestImplementation libs.androidx.test.rules - androidTestImplementation libs.androidx.test.extJunit -} - -ksp { - arg 'room.incremental', 'true' - arg 'room.generateKotlin', 'true' -} - -room { - schemaDirectory "$projectDir/schemas" -} diff --git a/app/build.gradle.kts b/app/build.gradle.kts new file mode 100644 index 00000000..a3267f2b --- /dev/null +++ b/app/build.gradle.kts @@ -0,0 +1,116 @@ +import java.util.Properties + +plugins { + alias(libs.plugins.android.application) + alias(libs.plugins.jetbrains.kotlin.android) + alias(libs.plugins.androidx.room) + alias(libs.plugins.google.dagger.hilt.android) + alias(libs.plugins.google.devtools.ksp) +} + +object Version { + private const val MAJOR = 1 + private const val MINOR = 4 + private const val PATCH = 0 + + const val CODE = MAJOR * 10000 + MINOR * 100 + PATCH + const val NAME = "$MAJOR.$MINOR.$PATCH" +} + +kotlin { + jvmToolchain(17) + compilerOptions { + freeCompilerArgs.add("-opt-in=kotlin.RequiresOptIn") + } +} + +android { + namespace = "ru.spbu.depnav" + compileSdk = 34 + + defaultConfig { + applicationId = "ru.spbu.depnav" + minSdk = 21 + targetSdk = 34 + versionCode = Version.CODE + versionName = Version.NAME + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + signingConfigs { + val keystorePropertiesFile = rootProject.file("keystore.properties") + if (keystorePropertiesFile.exists()) { + val keystoreProperties = Properties().apply { + load(keystorePropertiesFile.inputStream()) + } + create("release") { + storeFile = file(keystoreProperties.getProperty("storeFile")) + storePassword = keystoreProperties.getProperty("storePassword") + keyAlias = keystoreProperties.getProperty("keyAlias") + keyPassword = keystoreProperties.getProperty("keyPassword") + } + } + } + + buildTypes { + release { + isMinifyEnabled = true + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro" + ) + signingConfig = signingConfigs.findByName("release") + } + } + + buildFeatures { + compose = true + } + composeOptions { + kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get() + } + packaging { + resources { + excludes += "/META-INF/{AL2.0,LGPL2.1}" + } + } +} + +dependencies { + implementation(libs.androidx.lifecycle.runtimeKtx) + implementation(libs.androidx.lifecycle.runtimeCompose) + implementation(libs.androidx.lifecycle.viewmodelCompose) + + implementation(libs.androidx.room.runtime) + implementation(libs.androidx.room.ktx) + annotationProcessor(libs.androidx.room.compiler) + ksp(libs.androidx.room.compiler) + + implementation(libs.google.dagger.hilt) + ksp(libs.google.dagger.hiltCompiler) + + implementation(platform(libs.androidx.compose.bom)) + implementation(libs.androidx.compose.material3) + implementation(libs.androidx.compose.ui) + implementation(libs.androidx.compose.ui.tooling.preview) + debugImplementation(libs.androidx.compose.ui.tooling) + + implementation(libs.androidx.core.ktx) + implementation(libs.androidx.activity.compose) + implementation(libs.plrapps.mapcompose) + + testImplementation(libs.junit) + androidTestImplementation(libs.androidx.test.runner) + androidTestImplementation(libs.androidx.test.rules) + androidTestImplementation(libs.androidx.test.extJunit) +} + +ksp { + arg("room.incremental", "true") + arg("room.generateKotlin", "true") +} + +room { + schemaDirectory("$projectDir/schemas") +} diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 43a5bd2b..3f1d6fb7 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -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 diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 0a9d4ecb..00000000 --- a/build.gradle +++ /dev/null @@ -1,9 +0,0 @@ -plugins { - alias libs.plugins.android.application apply false - alias libs.plugins.jetbrains.kotlin.android apply false - - // Must be declared in the same scope as AGP to fix https://github.com/google/dagger/issues/3068 - alias libs.plugins.google.dagger.hilt.android apply false - // Must be declared in the same scope as Hilt - alias libs.plugins.google.devtools.ksp apply false -} diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 00000000..33714b6e --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,9 @@ +plugins { + alias(libs.plugins.android.application) apply false + alias(libs.plugins.jetbrains.kotlin.android) apply false + + // Must be declared in the same scope as AGP to fix https://github.com/google/dagger/issues/3068 + alias(libs.plugins.google.dagger.hilt.android) apply false + // Must be declared in the same scope as Hilt + alias(libs.plugins.google.devtools.ksp) apply false +} diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index e9fb9fd8..00000000 --- a/settings.gradle +++ /dev/null @@ -1,18 +0,0 @@ -pluginManagement { - repositories { - google() - mavenCentral() - gradlePluginPortal() - } -} - -dependencyResolutionManagement { - repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) - repositories { - google() - mavenCentral() - } -} - -rootProject.name = 'DepNav' -include ':app' diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 00000000..79e985b3 --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,24 @@ +pluginManagement { + repositories { + google { + content { + includeGroupAndSubgroups("com.android") + includeGroupAndSubgroups("com.google") + includeGroupAndSubgroups("androidx") + } + } + mavenCentral() + gradlePluginPortal() + } +} + +dependencyResolutionManagement { + repositoriesMode = RepositoriesMode.FAIL_ON_PROJECT_REPOS + repositories { + google() + mavenCentral() + } +} + +rootProject.name = "DepNav" +include(":app")