diff --git a/app/build.gradle b/app/build.gradle deleted file mode 100644 index d26f1248..00000000 --- a/app/build.gradle +++ /dev/null @@ -1,168 +0,0 @@ - plugins { - // Basic stuff - id 'com.android.application' - id 'kotlin-android' - - // Hilt - id 'kotlin-kapt' - id 'dagger.hilt.android.plugin' - - // Google Services - id 'com.google.gms.google-services' - - // Firebase Crashlytics - id 'com.google.firebase.crashlytics' -} - -kapt { - correctErrorTypes = true - useBuildCache = true -} - -android { - compileSdkVersion 32 - - defaultConfig { - applicationId "com.sadellie.unitto" - minSdkVersion 21 - targetSdkVersion 32 - versionCode 5 - versionName "Antique bronze" - } - - buildTypes { - debug { - // We don't need analytics for debug builds - resValue("bool", "FIREBASE_ANALYTICS_DEACTIVATED", "true") - resValue("bool", "FIREBASE_CRASHLYTICS_ENABLED", "false") - buildConfigField ("String", "StoreLink", "\"http://play.google.com/store/apps/details?id=com.sadellie.unitto\"") - } - - debugAppGallery { - // We don't need analytics for debug builds - resValue("bool", "FIREBASE_ANALYTICS_DEACTIVATED", "true") - resValue("bool", "FIREBASE_CRASHLYTICS_ENABLED", "false") - buildConfigField ("String", "StoreLink", "\"https://appgallery.huawei.com/app/C105740875\"") - debuggable true - signingConfig signingConfigs.debug - } - - debugRuPlayMarket { - // We don't need analytics for debug builds - resValue("bool", "FIREBASE_ANALYTICS_DEACTIVATED", "true") - resValue("bool", "FIREBASE_CRASHLYTICS_ENABLED", "false") - buildConfigField ("String", "StoreLink", "null") - debuggable true - signingConfig signingConfigs.debug - } - - releaseNoAnal { - // Same as release - // Used for on device testing. Same performance, but no analytics - resValue("bool", "FIREBASE_ANALYTICS_DEACTIVATED", "true") - resValue("bool", "FIREBASE_CRASHLYTICS_ENABLED", "false") - buildConfigField ("String", "StoreLink", "\"http://play.google.com/store/apps/details?id=com.sadellie.unitto\"") - shrinkResources true - minifyEnabled true - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - - releasePlayStore { - resValue("bool", "FIREBASE_ANALYTICS_DEACTIVATED", "false") - resValue("bool", "FIREBASE_CRASHLYTICS_ENABLED", "true") - buildConfigField ("String", "StoreLink", "\"http://play.google.com/store/apps/details?id=com.sadellie.unitto\"") - shrinkResources true - minifyEnabled true - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - - releaseAppGallery { - resValue("bool", "FIREBASE_ANALYTICS_DEACTIVATED", "false") - resValue("bool", "FIREBASE_CRASHLYTICS_ENABLED", "true") - buildConfigField ("String", "StoreLink", "\"https://appgallery.huawei.com/app/C105740875\"") - shrinkResources true - minifyEnabled true - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - - releaseRuPlayMarket { - resValue("bool", "FIREBASE_ANALYTICS_DEACTIVATED", "false") - resValue("bool", "FIREBASE_CRASHLYTICS_ENABLED", "true") - buildConfigField ("String", "StoreLink", "null") - shrinkResources true - minifyEnabled true - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - buildFeatures { - compose true - - // These are unused features - aidl false - renderScript false - shaders false - } - composeOptions { - kotlinCompilerExtensionVersion compose_version - } - packagingOptions { - jniLibs { - excludes += ['META-INF/licenses/**'] - } - resources { - excludes += ['META-INF/licenses/**', 'META-INF/AL2.0', 'META-INF/LGPL2.1'] - } - } -} - -dependencies { - implementation 'androidx.core:core-ktx:1.7.0' - - // Compose and navigation - implementation "androidx.compose.ui:ui:$compose_version" - implementation "androidx.compose.ui:ui-tooling-preview:$compose_version" - debugImplementation "androidx.compose.ui:ui-tooling:$compose_version" - implementation 'androidx.navigation:navigation-compose:2.5.0-beta01' - - // Material Design 3 - implementation "androidx.compose.material3:material3:1.0.0-alpha10" - - // Hilt and navigation - implementation 'androidx.hilt:hilt-navigation-compose:1.0.0' - kapt 'com.google.dagger:dagger-android-processor:2.41' - implementation 'com.google.dagger:hilt-android:2.41' - kapt 'com.google.dagger:hilt-compiler:2.41' - - // There are a lot of icons - implementation "androidx.compose.material:material-icons-extended:$compose_version" - - // DataStore - implementation "androidx.datastore:datastore-preferences:1.0.0" - - // This is for system status bar color - implementation "com.google.accompanist:accompanist-systemuicontroller:0.17.0" - - // Firebase - implementation platform('com.google.firebase:firebase-bom:29.0.4') - implementation 'com.google.firebase:firebase-analytics-ktx' - - // Crashlytics and Analytics - implementation 'com.google.firebase:firebase-crashlytics-ktx' - implementation 'com.google.firebase:firebase-analytics-ktx' - - // Room - implementation "androidx.room:room-runtime:2.4.2" - implementation "androidx.room:room-ktx:2.4.2" - kapt "androidx.room:room-compiler:2.4.2" - - // Moshi - implementation 'com.squareup.moshi:moshi-kotlin:1.13.0' - - // Retrofit with Moshi Converter - implementation 'com.squareup.retrofit2:converter-moshi:2.9.0' -} \ No newline at end of file diff --git a/app/build.gradle.kts b/app/build.gradle.kts new file mode 100644 index 00000000..91d78a7a --- /dev/null +++ b/app/build.gradle.kts @@ -0,0 +1,147 @@ +plugins { + // Basic stuff + id("com.android.application") + id("kotlin-android") + + + // Hilt + id("kotlin-kapt") + id("dagger.hilt.android.plugin") + + // Google Services + id("com.google.gms.google-services") + + // Firebase Crashlytics + id("com.google.firebase.crashlytics") +} + +val composeVersion: String by rootProject.extra + +kapt { + correctErrorTypes = true + useBuildCache = true +} + +android { + compileSdkVersion = "android-32" + + defaultConfig { + applicationId = "com.sadellie.unitto" + minSdk = 21 + targetSdk = 32 + versionCode = 5 + versionName = "Antique bronze" + } + + buildTypes { + // Debug. No Analytics, not minified, debuggable + getByName("debug") { + manifestPlaceholders["analytics_deactivated"] = true + manifestPlaceholders["crashlytics_enabled"] = false + isDebuggable = true + isShrinkResources = false + isMinifyEnabled = false + } + + // Release with analytics and minified, not debuggable + getByName("release") { + initWith(getByName("debug")) + manifestPlaceholders["analytics_deactivated"] = false + manifestPlaceholders["crashlytics_enabled"] = true + isDebuggable = false + isShrinkResources = true + isMinifyEnabled = true + proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") + } + + // Release without analytics and not debuggable, but minified + create("releaseNoAnal") { + initWith(getByName("release")) + manifestPlaceholders["analytics_deactivated"] = true + manifestPlaceholders["crashlytics_enabled"] = false + } + } + + flavorDimensions += "mainFlavorDimension" + productFlavors { + create("playStore") { + buildConfigField("String", "StoreLink", "\"http://play.google.com/store/apps/details?id=com.sadellie.unitto\"") + } + create("appGallery") { + buildConfigField("String", "StoreLink", "\"https://appgallery.huawei.com/app/C105740875\"") + } + create("ruPlayStore") { + buildConfigField("String", "StoreLink", "null") + } + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + + buildFeatures { + compose = true + + // These are unused features + aidl = false + renderScript = false + shaders = false + } + composeOptions { + kotlinCompilerExtensionVersion = composeVersion + } + packagingOptions { + jniLibs.excludes.add("META-INF/licenses/**") + resources.excludes.add("META-INF/licenses/**") + resources.excludes.add("META-INF/AL2.0") + resources.excludes.add("META-INF/LGPL2.1") + } +} + +dependencies { + implementation("androidx.core:core-ktx:1.7.0") + + // Compose and navigation + implementation("androidx.compose.ui:ui:$composeVersion") + implementation("androidx.compose.ui:ui-tooling-preview:$composeVersion") + debugImplementation("androidx.compose.ui:ui-tooling:$composeVersion") + implementation("androidx.navigation:navigation-compose:2.5.0-beta01") + + // Material Design 3 + implementation("androidx.compose.material3:material3:1.0.0-alpha10") + + // Hilt and navigation + implementation("androidx.hilt:hilt-navigation-compose:1.0.0") + kapt("com.google.dagger:dagger-android-processor:2.41") + implementation("com.google.dagger:hilt-android:2.41") + kapt("com.google.dagger:hilt-compiler:2.41") + + // There are a lot of icons + implementation("androidx.compose.material:material-icons-extended:$composeVersion") + + // DataStore + implementation("androidx.datastore:datastore-preferences:1.0.0") + + // This is for system status bar color + implementation("com.google.accompanist:accompanist-systemuicontroller:0.17.0") + + // Firebase + implementation (platform ("com.google.firebase:firebase-bom:29.0.4")) + implementation("com.google.firebase:firebase-analytics-ktx") + + // Crashlytics and Analytics + implementation("com.google.firebase:firebase-crashlytics-ktx") + implementation("com.google.firebase:firebase-analytics-ktx") + + // Room + implementation("androidx.room:room-runtime:2.4.2") + implementation("androidx.room:room-ktx:2.4.2") + kapt("androidx.room:room-compiler:2.4.2") + + // Moshi + implementation("com.squareup.moshi:moshi-kotlin:1.13.0") + + // Retrofit with Moshi Converter + implementation("com.squareup.retrofit2:converter-moshi:2.9.0") +} \ No newline at end of file diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 00ca263b..13c8415e 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/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 53a3f623..96f8142c 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -13,10 +13,10 @@ android:theme="@style/Theme.Unitto"> + android:value="${analytics_deactivated}" /> + android:value="${crashlytics_enabled}" /> diff --git a/build.gradle b/build.gradle deleted file mode 100644 index cd37c211..00000000 --- a/build.gradle +++ /dev/null @@ -1,42 +0,0 @@ -// Top-level build file where you can add configuration options common to all sub-projects/modules. -buildscript { - ext { - compose_version = '1.2.0-alpha08' - } - repositories { - google() - mavenCentral() - } - dependencies { - classpath 'com.android.tools.build:gradle:7.1.3' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.20" - classpath 'com.google.dagger:hilt-android-gradle-plugin:2.38.1' - - // Google services - classpath 'com.google.gms:google-services:4.3.10' - - // Crashlytics - classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1' - - // NOTE: Do not place your application dependencies here; they belong - // in the individual module build.gradle files - } -} - -// This block was added to make opt-in project wide -allprojects { - tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { - kotlinOptions { - freeCompilerArgs += [ - "-opt-in=androidx.compose.material3.ExperimentalMaterial3Api", - "-opt-in=androidx.compose.animation.ExperimentalAnimationApi", - "-opt-in=androidx.compose.foundation.ExperimentalFoundationApi", - "-opt-in=androidx.compose.ui.unit.ExperimentalUnitApi", - ] - } - } -} - -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 00000000..05e2ef9c --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,46 @@ +import org.jetbrains.kotlin.resolve.or + +// Top-level build file where you can add configuration options common to all sub-projects/modules. +buildscript { + + val composeVersion by extra ("1.2.0-alpha08") + + repositories { + google() + mavenCentral() + } + dependencies { + classpath("com.android.tools.build:gradle:7.1.3") + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.20") + classpath("com.google.dagger:hilt-android-gradle-plugin:2.38.1") + + // Google services + classpath("com.google.gms:google-services:4.3.10") + + // Crashlytics + classpath("com.google.firebase:firebase-crashlytics-gradle:2.8.1") + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle.kts files + } +} + +// This block was added to make opt-in project wide +allprojects { + + tasks.withType { + kotlinOptions { + freeCompilerArgs = freeCompilerArgs + listOf( + "-opt-in=androidx.compose.material3.ExperimentalMaterial3Api", + "-opt-in=androidx.compose.animation.ExperimentalAnimationApi", + "-opt-in=androidx.compose.foundation.ExperimentalFoundationApi", + "-opt-in=androidx.compose.ui.unit.ExperimentalUnitApi", + ) + } + } + +} + +tasks.register("clean", Delete::class) { + delete(rootProject.buildDir) +} \ No newline at end of file diff --git a/settings.gradle b/settings.gradle.kts similarity index 92% rename from settings.gradle rename to settings.gradle.kts index 807d4510..3896762a 100644 --- a/settings.gradle +++ b/settings.gradle.kts @@ -6,4 +6,4 @@ dependencyResolutionManagement { } } rootProject.name = "Unitto" -include ':app' +include(":app")