diff --git a/app/build.gradle b/app/build.gradle deleted file mode 100644 index 14493b0..0000000 --- a/app/build.gradle +++ /dev/null @@ -1,65 +0,0 @@ -plugins { - id 'com.android.application' - id 'kotlin-android' -} - -android { - compileSdk 31 - - defaultConfig { - applicationId "com.ericampire.android.androidstudycase" - minSdk 21 - targetSdk 31 - versionCode 1 - versionName "1.0" - - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - vectorDrawables { - useSupportLibrary true - } - } - - buildTypes { - release { - minifyEnabled 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' - useIR = true - } - buildFeatures { - compose true - } - composeOptions { - kotlinCompilerExtensionVersion compose_version - kotlinCompilerVersion '1.5.10' - } - packagingOptions { - resources { - excludes += '/META-INF/{AL2.0,LGPL2.1}' - } - } -} - -dependencies { - - implementation 'androidx.core:core-ktx:1.6.0' - implementation 'androidx.appcompat:appcompat:1.3.1' - implementation 'com.google.android.material:material:1.4.0' - implementation "androidx.compose.ui:ui:$compose_version" - implementation "androidx.compose.material:material:$compose_version" - implementation "androidx.compose.ui:ui-tooling-preview:$compose_version" - implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.1' - implementation 'androidx.activity:activity-compose:1.3.1' - testImplementation 'junit:junit:4.+' - androidTestImplementation 'androidx.test.ext:junit:1.1.3' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' - androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version" - debugImplementation "androidx.compose.ui:ui-tooling:$compose_version" -} \ No newline at end of file diff --git a/app/build.gradle.kts b/app/build.gradle.kts new file mode 100644 index 0000000..b2eec64 --- /dev/null +++ b/app/build.gradle.kts @@ -0,0 +1,136 @@ +import de.fayard.refreshVersions.core.versionFor + + +plugins { + id("com.android.application") + kotlin("android") + kotlin("kapt") + id("dagger.hilt.android.plugin") + id("kotlin-android") + id("com.google.devtools.ksp") version "1.5.21-1.0.0-beta07" +} + +kapt { + correctErrorTypes = true + javacOptions { + option("-Adagger.fastInit=ENABLED") + option("-Adagger.hilt.android.internal.disableAndroidSuperclassValidation=true") + } +} + +tasks.withType { + useJUnitPlatform() +} + +android { + compileSdk = Apps.compileSdk + buildToolsVersion = Apps.buildToolsVersion + + defaultConfig { + applicationId = Apps.applicationId + minSdk = Apps.minSdk + targetSdk = Apps.targetSdk + versionCode = Apps.versionCode + versionName = Apps.versionName + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + vectorDrawables { + useSupportLibrary = true + } + } + + buildTypes { + getByName("release") { + isMinifyEnabled = true + isShrinkResources = true + proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") + } + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 + } + buildFeatures { + compose = true + } + composeOptions { + kotlinCompilerExtensionVersion = versionFor(AndroidX.compose.ui) + } + lint { + isAbortOnError = false + } + packagingOptions { + resources { + excludes += "META-INF/AL2.0" + excludes += "META-INF/licenses/ASM" + excludes += "META-INF/LICENSE.md" + excludes += "META-INF/LICENSE-notice.md" + excludes += "META-INF/LGPL2.1" + excludes += "win32-x86/attach_hotspot_windows.dll" + excludes += "win32-x86-64/attach_hotspot_windows.dll" + } + } +} + +dependencies { + + implementation(Libs.activity_compose) + implementation(Libs.navigation_compose) + implementation(Libs.core_ktx) + implementation(Libs.preference_ktx) + implementation(Libs.appcompat) + implementation(Libs.startup_runtime) + implementation(Libs.google_material) + + implementation(Libs.compose_compiler) + implementation(Libs.compose_ui_tooling) + implementation(Libs.compose_ui_tooling_preview) + implementation(Libs.compose_ui) + implementation(Libs.compose_ui_viewbinding) + implementation(Libs.compose_material) + implementation(Libs.compose_runtime_livedata) + implementation(Libs.compose_material_icons_extended) + androidTestImplementation(Libs.compose_ui_test_junit4) + + implementation(Libs.accompanist_insets) + implementation(Libs.accompanist_pager) + implementation(Libs.accompanist_glide) + implementation(Libs.accompanist_pager_indicators) + implementation(Libs.accompanist_placeholder) + implementation(Libs.accompanist_navigation_animation) + + implementation(kotlin("reflect")) + + implementation(platform(Libs.kotlin_coroutine_bom)) + testImplementation(Libs.kotlin_coroutine_test) + + implementation(Libs.hilt_android) + kapt(Libs.hilt_android_compiler) + + implementation(Libs.lifecycle_runtime_ktx) + + testImplementation(Libs.junit_jupiter_api) + testImplementation(Libs.junit_jupiter_engine) + + implementation(Libs.koin_android) + implementation(Libs.koin_androidx_compose) + implementation(Libs.koin_androidx_workmanager) + testImplementation(Libs.koin_test_junit5) + + implementation(Libs.ksp_api) + + implementation(Libs.orbit_mvi_core) + implementation(Libs.orbit_mvi_viewmodel) + testImplementation(Libs.orbit_mvi_test) + + ksp(Libs.room_compiler) + implementation(Libs.room_runtime) + testImplementation(Libs.room_testing) + + testImplementation(Libs.mockk_core) + androidTestImplementation(Libs.mockk_android) + + debugImplementation(Libs.leakcanary_android) + + implementation(Libs.timber) +} \ No newline at end of file diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 481bb43..ff59496 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 124e3a2..0000000 --- a/build.gradle +++ /dev/null @@ -1,18 +0,0 @@ -// Top-level build file where you can add configuration options common to all sub-projects/modules. -buildscript { - ext { - compose_version = '1.0.0' - } - repositories { - google() - mavenCentral() - } - dependencies { - classpath "com.android.tools.build:gradle:7.0.0" - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.10" - } -} - -task clean(type: Delete) { - delete rootProject.buildDir -} \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..ca9abcc --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,21 @@ +buildscript { + repositories { + google() + mavenCentral() + gradlePluginPortal() + maven { + url = uri("https://oss.sonatype.org/content/repositories/snapshots") + } + } + dependencies { + classpath(Libs.kotlin_gradle_plugin) + classpath(Libs.gradle_plugin) + classpath(Libs.hilt_gradle_plugin) + classpath(Libs.play_service_plugin) + classpath(Libs.firebase_crashlytics_plugin) + } +} + +tasks.register("clean", Delete::class) { + delete(rootProject.buildDir) +} \ No newline at end of file diff --git a/buildSrc/.gitignore b/buildSrc/.gitignore new file mode 100644 index 0000000..192221b --- /dev/null +++ b/buildSrc/.gitignore @@ -0,0 +1,2 @@ +.gradle/ +build/ \ No newline at end of file diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts new file mode 100644 index 0000000..88cd14f --- /dev/null +++ b/buildSrc/build.gradle.kts @@ -0,0 +1,6 @@ +plugins { + `kotlin-dsl` +} +repositories { + mavenCentral() +} \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/Apps.kt b/buildSrc/src/main/kotlin/Apps.kt new file mode 100644 index 0000000..4672ac3 --- /dev/null +++ b/buildSrc/src/main/kotlin/Apps.kt @@ -0,0 +1,11 @@ +object Apps { + const val compileSdk = 30 + const val buildToolsVersion = "30.0.3" + + const val applicationId = "com.ericampire.android.androidstudycase" + const val minSdk = 21 + const val targetSdk = 30 + const val versionCode = 1 + const val versionName = "1.0" + const val jvmTarget = "1.8" +} \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/Libs.kt b/buildSrc/src/main/kotlin/Libs.kt new file mode 100644 index 0000000..1b0c302 --- /dev/null +++ b/buildSrc/src/main/kotlin/Libs.kt @@ -0,0 +1,140 @@ +/** + * Generated by + * $ ./gradlew buildSrcLibs + * Re-run when you add a new dependency to the build + * + * Find which updates are available by running + * $ ./gradlew refreshVersions + * And edit the file `versions.properties` + * + * See https://github.com/jmfayard/refreshVersions + */ +object Libs { + const val gradle_plugin = "com.android.tools.build:gradle:_" + + // Todo put at the right place + const val play_service_plugin = "com.google.gms:google-services:4.3.8" + const val firebase_crashlytics_plugin = "com.google.firebase:firebase-crashlytics-gradle:2.2.0" + + const val activity_compose = "androidx.activity:activity-compose:_" + const val startup_runtime = "androidx.startup:startup-runtime:_" + const val navigation_compose = "androidx.navigation:navigation-compose:2.4.0-alpha06" + const val appcompat = "androidx.appcompat:appcompat:_" + const val preference_ktx = "androidx.preference:preference-ktx:_" + + const val compose_compiler = "androidx.compose.compiler:compiler:_" + const val compose_material = "androidx.compose.material:material:_" + const val compose_runtime_livedata = "androidx.compose.runtime:runtime-livedata:_" + const val compose_material_icons_extended = "androidx.compose.material:material-icons-extended:_" + const val compose_ui = "androidx.compose.ui:ui:_" + const val compose_ui_viewbinding = "androidx.compose.ui:ui-viewbinding:_" + const val compose_ui_test_junit4 = "androidx.compose.ui:ui-test-junit4:_" + const val compose_ui_tooling = "androidx.compose.ui:ui-tooling:_" + const val compose_ui_tooling_preview = "androidx.compose.ui:ui-tooling-preview:_" + + const val core_ktx = "androidx.core:core-ktx:_" + const val lifecycle_runtime_ktx = "androidx.lifecycle:lifecycle-runtime-ktx:_" + const val androidx_test_ext_junit = "androidx.test.ext:junit:_" + const val google_material = "com.google.android.material:material:_" + + const val coil_core = "io.coil-kt:coil:1.3.0" + const val coil_compose = "io.coil-kt:coil-compose:1.3.0" + + + // Todo: this lib is about glide + private const val accompanist = "com.google.accompanist" + const val accompanist_glide = "$accompanist:accompanist-glide:0.13.0" + const val accompanist_flowlayout = "$accompanist:accompanist-flowlayout:_" + const val accompanist_pager = "$accompanist:accompanist-pager:_" + const val accompanist_pager_indicators = "$accompanist:accompanist-pager-indicators:_" + const val accompanist_swiperefresh = "$accompanist:accompanist-swiperefresh:_" + const val accompanist_insets = "$accompanist:accompanist-insets:_" + const val accompanist_navigation_animation = "$accompanist:accompanist-navigation-animation:_" + const val accompanist_placeholder_material = "$accompanist:accompanist-placeholder-material:_" + const val accompanist_placeholder = "$accompanist:accompanist-placeholder:_" + const val accompanist_permissions = "$accompanist:accompanist-permissions:_" + + const val hilt_gradle_plugin = "com.google.dagger:hilt-android-gradle-plugin:_" + const val hilt_android = "com.google.dagger:hilt-android:_" + const val hilt_android_compiler = "com.google.dagger:hilt-android-compiler:_" + + const val junit4 = "junit:junit:_" + const val junit_jupiter_api = "org.junit.jupiter:junit-jupiter-api:_" + const val junit_jupiter_engine = "org.junit.jupiter:junit-jupiter-engine:_" + + // Todo: Put this in the version.properties file + const val firebase_bom = "com.google.firebase:firebase-bom:28.1.0" + const val firebase_messaging_directboot = + "com.google.firebase:firebase-messaging-directboot:20.2.0" + const val firebase_crashlytics = "com.google.firebase:firebase-crashlytics-ktx" + const val firebase_analytics = "com.google.firebase:firebase-analytics-ktx" + const val firebase_auth = "com.google.firebase:firebase-auth-ktx" + const val firebase_firestore = "com.google.firebase:firebase-firestore-ktx" + const val firebase_storage = "com.google.firebase:firebase-storage-ktx" + const val firebase_config = "com.google.firebase:firebase-config-ktx" + const val firebase_messaging = "com.google.firebase:firebase-messaging-ktx" + const val firebase_in_app_messaging = "com.google.firebase:firebase-inappmessaging-display-ktx" + + const val kotlin_gradle_plugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:_" + + const val kotlin_coroutine_bom = "org.jetbrains.kotlinx:kotlinx-coroutines-bom:_" + const val kotlin_coroutine_core = "org.jetbrains.kotlinx:kotlinx-coroutines-core" + const val kotlin_coroutine_android = "org.jetbrains.kotlinx:kotlinx-coroutines-android" + const val kotlin_coroutine_play_service = "org.jetbrains.kotlinx:kotlinx-coroutines-play-services" + const val kotlin_coroutine_test = "org.jetbrains.kotlinx:kotlinx-coroutines-test" + + // Todo : Put the version in the right place + const val google_maps_ktx = "com.google.maps.android:maps-ktx:2.1.1" + const val google_maps_utils_ktx = "com.google.maps.android:maps-utils-ktx:2.1.1" + + const val google_place_ktx = "com.google.maps.android:places-ktx:_" + + const val play_service_auth = "com.google.android.gms:play-services-auth:19.0.0" + const val play_service_core = "com.google.android.play:core:1.10.0" + const val play_service_core_ktx = "com.google.android.play:core-ktx:1.8.1" + const val play_service_maps = "com.google.android.gms:play-services-maps:17.0.0" + const val play_service_location = "com.google.android.gms:play-services-location:17.0.0" + + const val mavericks_testing = "com.airbnb.android:mavericks-testing:_" + const val mavericks_core = "com.airbnb.android:mavericks:_" + const val mavericks_mocking = "com.airbnb.android:mavericks-mocking:_" + const val mavericks_compose = "com.airbnb.android:mavericks-compose:_" + + const val kotest_runner_junit5 = "io.kotest:kotest-runner-junit5:_" + const val kotest_property = "io.kotest:kotest-property:_" + const val kotest_core = "io.kotest:kotest-assertions-core:_" + const val kotest_gradle_plugin = "io.kotest:kotest-plugins-pitest:_" + const val kotest_engine_jvm = "io.kotest:kotest-framework-engine-jvm:_" + const val kotest_assertions_core = "io.kotest:kotest-assertions-core:_" + + const val mockk_core = "io.mockk:mockk:_" + const val mockk_android = "io.mockk:mockk-android:_" + + // Todo: Put this in the version.properties file + const val prettytime = "org.ocpsoft.prettytime:prettytime:4.0.4.Final" + const val landscapist_glide = "com.github.skydoves:landscapist-glide:_" + const val timber = "com.jakewharton.timber:timber:_" + const val smartlocation = "io.nlopez.smartlocation:library:_" + const val leku = "com.schibstedspain.android:leku:8.0.0" + const val localization = "com.zeugmasolutions.localehelper:locale-helper-android:_" + const val ksp_api = "com.google.devtools.ksp:symbol-processing-api:1.5.21-1.0.0-beta07" + const val leakcanary_android = "com.squareup.leakcanary:leakcanary-android:2.7" + + const val lottie_compose = "com.airbnb.android:lottie-compose:_" + const val lottie = "com.airbnb.android:lottie:3.7.0" + + const val room_compiler = "androidx.room:room-compiler:_" + const val room_runtime = "androidx.room:room-runtime:_" + const val room_testing = "androidx.room:room-testing:_" + + const val koin_core = "io.insert-koin:koin-core:_" + const val koin_test_junit5 = "io.insert-koin:koin-test-junit5:_" + const val koin_android = "io.insert-koin:koin-android:_" + const val koin_androidx_workmanager = "io.insert-koin:koin-androidx-workmanager:_" + const val koin_androidx_compose = "io.insert-koin:koin-androidx-compose:_" + + // Todo : Put this in version.properties file + const val orbit_mvi_viewmodel = "org.orbit-mvi:orbit-viewmodel:4.2.0" + const val orbit_mvi_core = "org.orbit-mvi:orbit-core:4.2.0" + const val orbit_mvi_test = "org.orbit-mvi:orbit-test:4.2.0" +} diff --git a/settings.gradle b/settings.gradle.kts similarity index 68% rename from settings.gradle rename to settings.gradle.kts index 186abfd..edbbb7f 100644 --- a/settings.gradle +++ b/settings.gradle.kts @@ -1,3 +1,11 @@ +plugins { + id("de.fayard.refreshVersions") version "0.11.0" +} + +refreshVersions { + enableBuildSrcLibs() +} + dependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) repositories { @@ -7,4 +15,4 @@ dependencyResolutionManagement { } } rootProject.name = "android-study-case" -include ':app' +include(":app") diff --git a/versions.properties b/versions.properties new file mode 100644 index 0000000..d4abd22 --- /dev/null +++ b/versions.properties @@ -0,0 +1,66 @@ +#### Dependencies and Plugin versions with their available updates. +#### Generated by `./gradlew refreshVersions` version 0.10.1 +#### +#### Don't manually edit or split the comments that start with four hashtags (####), +#### they will be overwritten by refreshVersions. +#### +#### suppress inspection "SpellCheckingInspection" for whole file +#### suppress inspection "UnusedProperty" for whole file + +plugin.android=7.0.0 +## # available=7.1.0-alpha01 +## # available=7.1.0-alpha02 +## # available=7.1.0-alpha03 +## # available=7.1.0-alpha04 +## # available=7.1.0-alpha05 +## # available=7.1.0-alpha06 +version.androidx.activity=1.3.0-alpha08 +version.androidx.preference=1.1.1 +version.androidx.appcompat=1.3.0 +version.androidx.compose.compiler=1.0.1 +version.androidx.compose.material-icons-extended=1.0.1 + +version.androidx.compose.material=1.0.1 +version.androidx.compose.runtime=1.0.1 +version.google.accompanist=0.16.1 +version.androidx.compose.ui=1.0.1 +version.androidx.compose.ui-viewbinding=1.0.1 +version.androidx.core=1.5.0 +version.androidx.room=2.3.0 +version.androidx.startup=1.0.0 +version.androidx.lifecycle=2.3.1 +version.androidx.test.espresso=3.3.0 +version.androidx.test.ext.junit=1.1.2 +version.google.android.material=1.4.0 +version.google.dagger=2.38.1 +version.kotest=4.4.3 +version.mockk=1.11.0 +version.kotlin=1.5.21 +## # available=1.5.30-M1 +version.junit.junit=4.13 +version.junit=5.7.2 +version.kotlinx.coroutines=1.5.1 +version.com.airbnb.android..mavericks=2.3.0 +version.com.airbnb.android..mavericks-testing=2.3.0 +version.com.airbnb.android..mavericks-mocking=2.3.0 +version.com.airbnb.android..mavericks-compose=2.1.0-alpha02 +version.org.jacoco..org.jacoco.ant=0.8.3 +version.com.jakewharton.timber..timber=4.7.1 +version.com.zeugmasolutions.localehelper..locale-helper-android=1.1.4 +version.com.google.maps.android..places-ktx=0.4.0 +version.androidx.navigation-compose=2.4.0-alpha02 +version.com.google.maps.android..maps-ktx=2.1.1 +version.com.google.maps.android..maps-utils-ktx=2.1.1 +version.com.google.devtools.ksp..symbol-processing-api=1.5.10-1.0.0-beta01 +version.com.google.android.gms..play-services-auth=19.0.0 +version.com.google.android.play..core=1.10.0 +version.com.google.android.play..core-ktx=1.8.1 +version.com.google.android.gms..play-services-maps=17.0.0 +version.com.google.android.gms..play-services-location=17.0.0 +version.io.nlopez.smartlocation..library=3.3.3 +version.io.insert-koin..koin-core=3.1.2 +version.io.insert-koin..koin-test-junit5=3.1.2 +version.io.insert-koin..koin-android=3.1.2 +version.io.insert-koin..koin-androidx-viewmodel=3.1.2 +version.io.insert-koin..koin-androidx-compose=3.1.2 +version.io.insert-koin..koin-androidx-workmanager=3.1.2