mirror of
https://github.com/Myzel394/NumberHub.git
synced 2025-06-18 16:25:27 +02:00
Kotlin DSL
Using manifest placeholders now Convert files from Groovy to Kotlin (shouldn't be any errors)
This commit is contained in:
parent
205d849772
commit
1aea22a4b0
168
app/build.gradle
168
app/build.gradle
@ -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'
|
|
||||||
}
|
|
147
app/build.gradle.kts
Normal file
147
app/build.gradle.kts
Normal file
@ -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")
|
||||||
|
}
|
2
app/proguard-rules.pro
vendored
2
app/proguard-rules.pro
vendored
@ -1,6 +1,6 @@
|
|||||||
# Add project specific ProGuard rules here.
|
# Add project specific ProGuard rules here.
|
||||||
# You can control the set of applied configuration files using the
|
# 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
|
# For more details, see
|
||||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||||
|
@ -13,10 +13,10 @@
|
|||||||
android:theme="@style/Theme.Unitto">
|
android:theme="@style/Theme.Unitto">
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="firebase_analytics_collection_deactivated"
|
android:name="firebase_analytics_collection_deactivated"
|
||||||
android:value="@bool/FIREBASE_ANALYTICS_DEACTIVATED" />
|
android:value="${analytics_deactivated}" />
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="firebase_crashlytics_collection_enabled"
|
android:name="firebase_crashlytics_collection_enabled"
|
||||||
android:value="@bool/FIREBASE_CRASHLYTICS_ENABLED" />
|
android:value="${crashlytics_enabled}" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
android:exported="true">
|
android:exported="true">
|
||||||
|
42
build.gradle
42
build.gradle
@ -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
|
|
||||||
}
|
|
46
build.gradle.kts
Normal file
46
build.gradle.kts
Normal file
@ -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<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
|
||||||
|
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)
|
||||||
|
}
|
@ -6,4 +6,4 @@ dependencyResolutionManagement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
rootProject.name = "Unitto"
|
rootProject.name = "Unitto"
|
||||||
include ':app'
|
include(":app")
|
Loading…
x
Reference in New Issue
Block a user