Skip to content

Commit

Permalink
Set up Gradle (#3)
Browse files Browse the repository at this point in the history
* Migrate from Groovy to Kotlin DSL

* Implement Gradle Version Catalog

* Configure gradle.properties
  • Loading branch information
AfigAliyev committed Aug 10, 2022
1 parent 701615d commit bebd078
Show file tree
Hide file tree
Showing 6 changed files with 130 additions and 83 deletions.
77 changes: 0 additions & 77 deletions app/build.gradle

This file was deleted.

74 changes: 74 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/*
* Copyright 2022 Maximillian Leonov
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
}

android {
compileSdk = 32

defaultConfig {
applicationId = "com.maximillianleonov.cinemax"
minSdk = 21
targetSdk = 32
versionCode = 1
versionName = "1.0"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary = true
}
}

buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
buildFeatures {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = libs.versions.androidx.compose.compiler.get()
}
packagingOptions {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}
}

dependencies {
implementation(libs.androidx.core.ktx)
implementation(libs.bundles.androidx.compose)
implementation(libs.bundles.androidx.lifecycle)
testImplementation(libs.bundles.test)
androidTestImplementation(libs.bundles.android.test)
debugImplementation(libs.bundles.debug)
}
10 changes: 5 additions & 5 deletions build.gradle → build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
*/

plugins {
id "com.android.application" version "7.2.2" apply false
id "com.android.library" version "7.2.2" apply false
id "org.jetbrains.kotlin.android" version "1.7.10" apply false
alias(libs.plugins.android.application) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.kotlin.android) apply false
}

task clean(type: Delete) {
delete rootProject.buildDir
tasks.register<Delete>("clean") {
delete(rootProject.buildDir)
}
4 changes: 4 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ kotlin.code.style=official
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true

org.gradle.caching=true
org.gradle.configureondemand=true
org.gradle.parallel=true
43 changes: 43 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
[versions]
kotlin = "1.7.10"
android-gradle-plugin = "7.2.2"

androidx-compose = "1.2.0"
androidx-compose-compiler = "1.3.0-rc02"
androidx-core = "1.8.0"
androidx-activity = "1.5.1"
androidx-lifecycle = "2.5.1"
androidx-test-ext = "1.1.3"
androidx-test-espresso = "3.4.0"
junit = "4.13.2"

[libraries]
androidx-core-ktx = { module = "androidx.core:core-ktx", version.ref = "androidx-core" }
androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activity" }
androidx-compose-ui = { module = "androidx.compose.ui:ui", version.ref = "androidx-compose" }
androidx-compose-material = { module = "androidx.compose.material:material", version.ref = "androidx-compose" }
androidx-compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "androidx-compose" }
androidx-compose-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview", version.ref = "androidx-compose" }
androidx-compose-ui-test-junit4 = { module = "androidx.compose.ui:ui-test-junit4", version.ref = "androidx-compose" }
androidx-compose-ui-test-manifest = { module = "androidx.compose.ui:ui-test-manifest", version.ref = "androidx-compose" }
androidx-lifecycle-runtime-ktx = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version.ref = "androidx-lifecycle" }
androidx-test-ext-junit = { module = "androidx.test.ext:junit", version.ref = "androidx-test-ext" }
androidx-test-espresso-core = { module = "androidx.test.espresso:espresso-core", version.ref = "androidx-test-espresso" }
junit = { module = "junit:junit", version.ref = "junit" }

[bundles]
androidx-compose = [
"androidx-activity-compose",
"androidx-compose-ui",
"androidx-compose-material",
"androidx-compose-ui-tooling-preview"
]
androidx-lifecycle = ["androidx-lifecycle-runtime-ktx"]
test = ["junit"]
android-test = ["androidx-test-ext-junit", "androidx-test-espresso-core", "androidx-compose-ui-test-junit4"]
debug = ["androidx-compose-ui-tooling", "androidx-compose-ui-test-manifest"]

[plugins]
android-application = { id = "com.android.application", version.ref = "android-gradle-plugin" }
android-library = { id = "com.android.library", version.ref = "android-gradle-plugin" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
5 changes: 4 additions & 1 deletion settings.gradle → settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,15 @@ pluginManagement {
mavenCentral()
}
}

dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}

rootProject.name = "Cinemax"
include ":app"

include(":app")

0 comments on commit bebd078

Please sign in to comment.