From 0128de4bac5cfe42214fe13b017bd9744ce163b1 Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Sat, 10 Dec 2022 15:28:37 +0000 Subject: [PATCH 1/5] remove no longer needed deps --- dependencies.gradle | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/dependencies.gradle b/dependencies.gradle index fdd095b..a4ec37d 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -135,17 +135,11 @@ ext.Dependencies.with { leakCanary = 'com.squareup.leakcanary:leakcanary-android:2.10' ktorAndroid = "io.ktor:ktor-client-android:${ktorVer}" - ktorCore = "io.ktor:ktor-client-core:${ktorVer}" - ktorSerialization = "io.ktor:ktor-client-serialization:${ktorVer}" - ktorJson = "io.ktor:ktor-serialization-kotlinx-json:${ktorVer}" - ktorLogging = "io.ktor:ktor-client-logging-jvm:${ktorVer}" - ktorJava = "io.ktor:ktor-client-java:${ktorVer}" - ktorContentNegotiation = "io.ktor:ktor-client-content-negotiation:${ktorVer}" coil = "io.coil-kt:coil-compose:2.2.2" accompanistSystemuicontroller = "com.google.accompanist:accompanist-systemuicontroller:0.27.1" - junit = "junit:junit:4.13.2" + junit = "juniFt:junit:4.13.2" kluent = "org.amshove.kluent:kluent:1.72" mockk = 'io.mockk:mockk:1.13.2' From f3600290c85610e5c36b6bc7b66964e843cc87b7 Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Sun, 11 Dec 2022 12:49:30 +0000 Subject: [PATCH 2/5] create convention plugins for common config --- buildSrc/build.gradle | 14 +++++++++ buildSrc/settings.gradle | 7 +++++ ...android-compose-library-conventions.gradle | 18 ++++++++++++ .../main/groovy/st-android-conventions.gradle | 29 +++++++++++++++++++ .../st-android-library-conventions.gradle | 22 ++++++++++++++ .../groovy/st-application-conventions.gradle | 4 +++ .../main/groovy/st-feature-conventions.gradle | 3 ++ 7 files changed, 97 insertions(+) create mode 100644 buildSrc/build.gradle create mode 100644 buildSrc/settings.gradle create mode 100644 buildSrc/src/main/groovy/st-android-compose-library-conventions.gradle create mode 100644 buildSrc/src/main/groovy/st-android-conventions.gradle create mode 100644 buildSrc/src/main/groovy/st-android-library-conventions.gradle create mode 100644 buildSrc/src/main/groovy/st-application-conventions.gradle create mode 100644 buildSrc/src/main/groovy/st-feature-conventions.gradle diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle new file mode 100644 index 0000000..114aa43 --- /dev/null +++ b/buildSrc/build.gradle @@ -0,0 +1,14 @@ +plugins { + id 'groovy-gradle-plugin' +} + +repositories { + gradlePluginPortal() + google() +} + +dependencies { + println(libs.versions.android.gp.get()) + implementation "com.android.tools.build:gradle:${libs.versions.android.gp.get()}" +// implementation "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.20" +} \ No newline at end of file diff --git a/buildSrc/settings.gradle b/buildSrc/settings.gradle new file mode 100644 index 0000000..fa8bc74 --- /dev/null +++ b/buildSrc/settings.gradle @@ -0,0 +1,7 @@ +dependencyResolutionManagement { + versionCatalogs { + create("libs") { + from(files("../gradle/libs.versions.toml")) + } + } +} \ No newline at end of file diff --git a/buildSrc/src/main/groovy/st-android-compose-library-conventions.gradle b/buildSrc/src/main/groovy/st-android-compose-library-conventions.gradle new file mode 100644 index 0000000..446e682 --- /dev/null +++ b/buildSrc/src/main/groovy/st-android-compose-library-conventions.gradle @@ -0,0 +1,18 @@ +plugins { + id 'st-android-library-conventions' +} + +android { + buildFeatures.compose = true + composeOptions { + kotlinCompilerExtensionVersion = libs.versions.compose.compiler.get() + } +} + +dependencies { + implementation libs.compose.ui + implementation libs.compose.foundation + implementation libs.compose.material.three + implementation libs.compose.icons.extended + implementation libs.compose.activity +} diff --git a/buildSrc/src/main/groovy/st-android-conventions.gradle b/buildSrc/src/main/groovy/st-android-conventions.gradle new file mode 100644 index 0000000..43e5e15 --- /dev/null +++ b/buildSrc/src/main/groovy/st-android-conventions.gradle @@ -0,0 +1,29 @@ +plugins { +// id "kotlin-android" +} + +// +//tasks.withType(Class.forName("org.jetbrains.kotlin.gradle.tasks.KotlinCompile.KotlinCompile")).configureEach { +// kotlinOptions { +// jvmTarget = "1.8" +// freeCompilerArgs = [ +// '-opt-in=kotlin.contracts.ExperimentalContracts', +// '-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi', +// ] +// } +//} + +def androidSdkVersion = 33 + +android { + compileSdk androidSdkVersion + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + incremental = true + } + defaultConfig { + minSdkVersion 24 + targetSdkVersion androidSdkVersion + } +} \ No newline at end of file diff --git a/buildSrc/src/main/groovy/st-android-library-conventions.gradle b/buildSrc/src/main/groovy/st-android-library-conventions.gradle new file mode 100644 index 0000000..d9de1fe --- /dev/null +++ b/buildSrc/src/main/groovy/st-android-library-conventions.gradle @@ -0,0 +1,22 @@ +plugins { + id "com.android.library" + id "st-android-conventions" +} + +android { + variantFilter { variant -> + if (variant.name == "debug") { + variant.ignore = true + } + } + + buildFeatures { + buildConfig = false + dataBinding = false + aidl = false + renderScript = false + resValues = false + shaders = false + viewBinding = false + } +} diff --git a/buildSrc/src/main/groovy/st-application-conventions.gradle b/buildSrc/src/main/groovy/st-application-conventions.gradle new file mode 100644 index 0000000..f66867f --- /dev/null +++ b/buildSrc/src/main/groovy/st-application-conventions.gradle @@ -0,0 +1,4 @@ +plugins { + id "com.android.application" + id "st-android-conventions" +} diff --git a/buildSrc/src/main/groovy/st-feature-conventions.gradle b/buildSrc/src/main/groovy/st-feature-conventions.gradle new file mode 100644 index 0000000..5bba5bd --- /dev/null +++ b/buildSrc/src/main/groovy/st-feature-conventions.gradle @@ -0,0 +1,3 @@ +plugins { + id 'st-android-compose-library-conventions' +} From f1077efc17a72992d18a402ab1c935b4357e38cd Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Sun, 11 Dec 2022 12:49:48 +0000 Subject: [PATCH 3/5] convert to version catalog --- app/build.gradle | 18 ++- build.gradle | 132 ++---------------- chat-engine | 2 +- core/build.gradle | 12 +- dependencies.gradle | 84 +---------- design-library/build.gradle | 8 +- domains/android/compose-core/build.gradle | 4 +- domains/android/core/build.gradle | 4 +- domains/android/imageloader/build.gradle | 6 +- domains/android/push/build.gradle | 10 +- domains/android/stub/build.gradle | 4 +- domains/android/tracking/build.gradle | 4 +- domains/android/viewmodel-stub/build.gradle | 4 +- domains/android/viewmodel/build.gradle | 8 +- domains/android/work/build.gradle | 4 +- .../firebase/crashlytics-noop/build.gradle | 4 +- domains/firebase/crashlytics/build.gradle | 6 +- domains/firebase/messaging-noop/build.gradle | 4 +- domains/firebase/messaging/build.gradle | 6 +- domains/store/build.gradle | 11 +- features/directory/build.gradle | 6 +- features/home/build.gradle | 6 +- features/login/build.gradle | 4 +- features/messenger/build.gradle | 8 +- features/navigator/build.gradle | 6 +- features/notifications/build.gradle | 6 +- features/profile/build.gradle | 4 +- features/settings/build.gradle | 4 +- features/share-entry/build.gradle | 4 +- features/verification/build.gradle | 4 +- gradle/libs.versions.toml | 59 ++++++++ screen-state | 2 +- settings.gradle | 10 +- 33 files changed, 193 insertions(+), 265 deletions(-) create mode 100644 gradle/libs.versions.toml diff --git a/app/build.gradle b/app/build.gradle index 419e3ba..5a8a4d6 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,9 +1,7 @@ plugins { - id 'com.android.application' - id 'kotlin-android' + id "st-application-conventions" } -applyCommonAndroidParameters(project) applyCrashlyticsIfRelease(project) android { @@ -70,7 +68,7 @@ if (isDebugBuild) { } dependencies { - coreLibraryDesugaring Dependencies.google.jdkLibs + coreLibraryDesugaring libs.android.desugar implementation project(":features:home") implementation project(":features:directory") @@ -98,11 +96,11 @@ dependencies { implementation "chat-engine:matrix-chat-engine" implementation "chat-engine.matrix:store" - implementation Dependencies.google.androidxComposeUi - implementation Dependencies.mavenCentral.ktorAndroid - implementation Dependencies.mavenCentral.sqldelightAndroid - implementation Dependencies.mavenCentral.matrixOlm + implementation libs.compose.ui + implementation libs.ktor.android + implementation libs.sqldelight.android + implementation libs.matrix.olm - implementation Dependencies.mavenCentral.kotlinSerializationJson - debugImplementation Dependencies.mavenCentral.leakCanary + implementation libs.kotlin.serialization + debugImplementation libs.leakcanary } diff --git a/build.gradle b/build.gradle index 944d6f1..45e77b8 100644 --- a/build.gradle +++ b/build.gradle @@ -1,16 +1,6 @@ -buildscript { - apply from: "dependencies.gradle" - - repositories { - Dependencies._repositories.call(it) - } - dependencies { - classpath Dependencies.google.androidGradlePlugin - classpath Dependencies.mavenCentral.kotlinGradlePlugin - classpath Dependencies.mavenCentral.sqldelightGradlePlugin - classpath Dependencies.mavenCentral.kotlinSerializationGradlePlugin - classpath Dependencies.google.firebaseCrashlyticsPlugin - } +plugins { +// alias(libs.plugins.android.application) apply false +// alias(libs.plugins.android.library) apply false } def launchTask = getGradle() @@ -18,107 +8,19 @@ def launchTask = getGradle() .getTaskRequests() .toString() .toLowerCase() -def isReleaseBuild = launchTask.contains("release") +def isReleaseBuild = launchTask.contains("bundleRelease") || launchTask.contains("assembleRelease") ext.isDebugBuild = !isReleaseBuild -subprojects { - tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach { - kotlinOptions { - jvmTarget = "1.8" - freeCompilerArgs = [ - '-opt-in=kotlin.contracts.ExperimentalContracts', - '-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi', - ] - } - } -} - task clean(type: Delete) { delete rootProject.buildDir } -ext.applyMatrixServiceModule = { project -> - project.apply plugin: 'kotlin' - project.apply plugin: 'org.jetbrains.kotlin.plugin.serialization' - - def dependencies = project.dependencies - - dependencies.api project.project(":matrix:matrix") - dependencies.api project.project(":matrix:common") - dependencies.implementation project.project(":matrix:matrix-http") - dependencies.implementation Dependencies.mavenCentral.kotlinSerializationJson -} - -ext.applyLibraryPlugins = { project -> - project.apply plugin: 'com.android.library' - project.apply plugin: 'kotlin-android' -} - -ext.androidSdkVersion = 33 - -ext.applyCommonAndroidParameters = { project -> - def android = project.android - android.compileSdk androidSdkVersion - android.compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - incremental = true - } - android.defaultConfig { - minSdkVersion 24 - targetSdkVersion androidSdkVersion - } -} - -ext.applyLibraryModuleOptimisations = { project -> - project.android { - variantFilter { variant -> - if (variant.name == "debug") { - variant.ignore = true - } - } - - buildFeatures { - buildConfig = false - dataBinding = false - aidl = false - renderScript = false - resValues = false - shaders = false - viewBinding = false - } - } -} - -ext.applyCompose = { project -> - def dependencies = project.dependencies - - dependencies.implementation Dependencies.google.androidxComposeUi - dependencies.implementation Dependencies.google.androidxComposeFoundation - dependencies.implementation Dependencies.google.androidxComposeMaterial - dependencies.implementation Dependencies.google.androidxComposeIconsExtended - dependencies.implementation Dependencies.google.androidxActivityCompose - - def android = project.android - android.buildFeatures.compose = true - android.composeOptions { - kotlinCompilerExtensionVersion = Dependencies.google.kotlinCompilerExtensionVersion - } -} - -ext.applyAndroidComposeLibraryModule = { project -> - applyAndroidLibraryModule(project) - applyCompose(project) -} - -ext.applyAndroidLibraryModule = { project -> - applyLibraryPlugins(project) - applyCommonAndroidParameters(project) - applyLibraryModuleOptimisations(project) -} - ext.applyCrashlyticsIfRelease = { project -> + println("is release $isReleaseBuild") + println("is foss ${isFoss()}") if (isReleaseBuild && !isFoss()) { + println("run craslytics") + project.apply plugin: 'com.google.firebase.crashlytics' project.afterEvaluate { project.tasks.withType(com.google.firebase.crashlytics.buildtools.gradle.tasks.UploadMappingFileTask).configureEach { @@ -129,20 +31,16 @@ ext.applyCrashlyticsIfRelease = { project -> } ext.kotlinTest = { dependencies -> - dependencies.testImplementation Dependencies.mavenCentral.kluent - dependencies.testImplementation Dependencies.mavenCentral.kotlinTest - dependencies.testImplementation "org.jetbrains.kotlin:kotlin-test-junit:1.7.20" - dependencies.testImplementation Dependencies.mavenCentral.mockk - dependencies.testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.4' - - dependencies.testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.1' - dependencies.testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.1' + dependencies.testImplementation libs.kluent + dependencies.testImplementation libs.kotlin.test + dependencies.testImplementation libs.mockk + dependencies.testImplementation libs.kotlin.coroutines.test } ext.kotlinFixtures = { dependencies -> - dependencies.testFixturesImplementation Dependencies.mavenCentral.mockk - dependencies.testFixturesImplementation Dependencies.mavenCentral.kluent - dependencies.testFixturesImplementation Dependencies.mavenCentral.kotlinCoroutinesCore + dependencies.testFixturesImplementation libs.mockk + dependencies.testFixturesImplementation libs.kluent + dependencies.testFixturesImplementation libs.kotlin.coroutines } ext.androidImportFixturesWorkaround = { project, fixtures -> diff --git a/chat-engine b/chat-engine index 0439dc6..3c8d06a 160000 --- a/chat-engine +++ b/chat-engine @@ -1 +1 @@ -Subproject commit 0439dc648c91af643dd480b359ce48bd11700d89 +Subproject commit 3c8d06ad1c22bbca69718e9b9eef3c053b1a7c2d diff --git a/core/build.gradle b/core/build.gradle index b573f32..6cb67ca 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -1,12 +1,12 @@ plugins { - id 'kotlin' + alias libs.plugins.kotlin id 'java-test-fixtures' } dependencies { - api Dependencies.mavenCentral.kotlinCoroutinesCore - testFixturesImplementation Dependencies.mavenCentral.kotlinCoroutinesCore - testFixturesImplementation Dependencies.mavenCentral.kluent - testFixturesImplementation Dependencies.mavenCentral.mockk - testFixturesImplementation Dependencies.mavenCentral.kotlinCoroutinesTest + api libs.kotlin.coroutines + testFixturesImplementation libs.kotlin.coroutines + testFixturesImplementation libs.kluent + testFixturesImplementation libs.mockk + testFixturesImplementation libs.kotlin.coroutines.test } \ No newline at end of file diff --git a/dependencies.gradle b/dependencies.gradle index a4ec37d..bc6db05 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -1,8 +1,6 @@ -ext.Dependencies = new DependenciesContainer() - -ext.Dependencies.with { - _repositories = { repositories -> - repositories.google { +ext.applyRepositories = { dependencyResolutionManagement -> + dependencyResolutionManagement.repositories { + google { content { includeGroupByRegex "com\\.android.*" includeGroupByRegex "com\\.google.*" @@ -10,14 +8,14 @@ ext.Dependencies.with { } } - repositories.maven { + maven { url 'https://jitpack.io' content { includeGroup "com.github.UnifiedPush" } } - repositories.mavenCentral { + mavenCentral { content { includeGroupByRegex "org\\.jetbrains.*" includeGroupByRegex "com\\.google.*" @@ -96,76 +94,4 @@ ext.Dependencies.with { } } } - - def kotlinVer = "1.7.20" - def sqldelightVer = "1.5.4" - def composeVer = "1.2.1" - def ktorVer = "2.1.3" - - google = new DependenciesContainer() - google.with { - androidGradlePlugin = "com.android.tools.build:gradle:7.3.1" - - androidxComposeUi = "androidx.compose.ui:ui:${composeVer}" - androidxComposeFoundation = "androidx.compose.foundation:foundation:${composeVer}" - androidxComposeMaterial = "androidx.compose.material3:material3:1.0.0-rc01" - androidxComposeIconsExtended = "androidx.compose.material:material-icons-extended:${composeVer}" - androidxActivityCompose = "androidx.activity:activity-compose:1.6.0" - kotlinCompilerExtensionVersion = "1.3.2" - - firebaseCrashlyticsPlugin = "com.google.firebase:firebase-crashlytics-gradle:2.9.2" - firebaseBom = "com.google.firebase:firebase-bom:31.0.1" - - jdkLibs = "com.android.tools:desugar_jdk_libs:1.1.5" - } - - mavenCentral = new DependenciesContainer() - mavenCentral.with { - kotlinGradlePlugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVer}" - kotlinSerializationGradlePlugin = "org.jetbrains.kotlin:kotlin-serialization:${kotlinVer}" - kotlinSerializationJson = "org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1" - kotlinCoroutinesCore = "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4" - kotlinCoroutinesTest = 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.4' - kotlinTest = "org.jetbrains.kotlin:kotlin-test-junit:${kotlinVer}" - - sqldelightGradlePlugin = "com.squareup.sqldelight:gradle-plugin:${sqldelightVer}" - sqldelightAndroid = "com.squareup.sqldelight:android-driver:${sqldelightVer}" - sqldelightInMemory = "com.squareup.sqldelight:sqlite-driver:${sqldelightVer}" - - leakCanary = 'com.squareup.leakcanary:leakcanary-android:2.10' - - ktorAndroid = "io.ktor:ktor-client-android:${ktorVer}" - - coil = "io.coil-kt:coil-compose:2.2.2" - accompanistSystemuicontroller = "com.google.accompanist:accompanist-systemuicontroller:0.27.1" - - junit = "juniFt:junit:4.13.2" - kluent = "org.amshove.kluent:kluent:1.72" - mockk = 'io.mockk:mockk:1.13.2' - - matrixOlm = "org.matrix.android:olm-sdk:3.2.12" - } - - jitPack = new DependenciesContainer() - jitPack.with { - unifiedPush = "com.github.UnifiedPush:android-connector:2.0.1" - } - } - -class DependenciesContainer extends GroovyObjectSupport { - - private final Map storage = new HashMap(); - - @Override - Object getProperty(String name) { - return storage.get(name); - } - - @Override - void setProperty(String name, Object newValue) { - storage.put(name, newValue); - } -} - - diff --git a/design-library/build.gradle b/design-library/build.gradle index 578435a..c266d21 100644 --- a/design-library/build.gradle +++ b/design-library/build.gradle @@ -1,7 +1,9 @@ -applyAndroidComposeLibraryModule(project) +plugins { + id "st-android-compose-library-conventions" +} dependencies { implementation project(":core") - implementation Dependencies.mavenCentral.coil - implementation Dependencies.mavenCentral.accompanistSystemuicontroller + implementation libs.compose.coil + implementation libs.accompanist.systemuicontroller } \ No newline at end of file diff --git a/domains/android/compose-core/build.gradle b/domains/android/compose-core/build.gradle index e04cf9f..a16dc93 100644 --- a/domains/android/compose-core/build.gradle +++ b/domains/android/compose-core/build.gradle @@ -1,4 +1,6 @@ -applyAndroidComposeLibraryModule(project) +plugins { + id "st-android-compose-library-conventions" +} dependencies { implementation project(":core") diff --git a/domains/android/core/build.gradle b/domains/android/core/build.gradle index 6a11a06..5da881b 100644 --- a/domains/android/core/build.gradle +++ b/domains/android/core/build.gradle @@ -1,4 +1,6 @@ -plugins { id 'kotlin' } +plugins { + alias libs.plugins.kotlin +} dependencies { compileOnly project(":domains:android:stub") diff --git a/domains/android/imageloader/build.gradle b/domains/android/imageloader/build.gradle index 45821be..da7037a 100644 --- a/domains/android/imageloader/build.gradle +++ b/domains/android/imageloader/build.gradle @@ -1,6 +1,8 @@ -applyAndroidLibraryModule(project) +plugins { + id "st-android-library-conventions" +} dependencies { implementation project(":core") - implementation Dependencies.mavenCentral.coil + implementation libs.compose.coil } diff --git a/domains/android/push/build.gradle b/domains/android/push/build.gradle index d2f9b95..3fa616d 100644 --- a/domains/android/push/build.gradle +++ b/domains/android/push/build.gradle @@ -1,5 +1,7 @@ -applyAndroidLibraryModule(project) -apply plugin: "org.jetbrains.kotlin.plugin.serialization" +plugins { + id "st-android-library-conventions" + alias libs.plugins.kotlin.serialization +} dependencies { implementation "chat-engine:chat-engine" @@ -9,8 +11,8 @@ dependencies { firebase(it, "messaging") - implementation Dependencies.mavenCentral.kotlinSerializationJson - implementation Dependencies.jitPack.unifiedPush + implementation libs.kotlin.serialization + implementation libs.unifiedpush kotlinTest(it) testImplementation 'chat-engine:chat-engine-test' diff --git a/domains/android/stub/build.gradle b/domains/android/stub/build.gradle index 4a7ad4a..f2a5b8d 100644 --- a/domains/android/stub/build.gradle +++ b/domains/android/stub/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'kotlin' + alias libs.plugins.kotlin id 'java-test-fixtures' } @@ -12,7 +12,7 @@ if (localProperties.exists()) { } dependencies { - def androidVer = androidSdkVersion + def androidVer = 33 api files("${properties.getProperty("sdk.dir")}/platforms/android-${androidVer}/android.jar") kotlinFixtures(it) diff --git a/domains/android/tracking/build.gradle b/domains/android/tracking/build.gradle index 25e3ca2..793ba27 100644 --- a/domains/android/tracking/build.gradle +++ b/domains/android/tracking/build.gradle @@ -1,4 +1,6 @@ -applyAndroidLibraryModule(project) +plugins { + id "st-android-library-conventions" +} dependencies { implementation project(':core') diff --git a/domains/android/viewmodel-stub/build.gradle b/domains/android/viewmodel-stub/build.gradle index 8ae4bae..23723ec 100644 --- a/domains/android/viewmodel-stub/build.gradle +++ b/domains/android/viewmodel-stub/build.gradle @@ -1 +1,3 @@ -plugins { id 'kotlin' } +plugins { + alias libs.plugins.kotlin +} diff --git a/domains/android/viewmodel/build.gradle b/domains/android/viewmodel/build.gradle index c3cce48..5a4f375 100644 --- a/domains/android/viewmodel/build.gradle +++ b/domains/android/viewmodel/build.gradle @@ -1,15 +1,15 @@ plugins { - id 'kotlin' + alias libs.plugins.kotlin id 'java-test-fixtures' } dependencies { compileOnly project(":domains:android:viewmodel-stub") - implementation Dependencies.mavenCentral.kotlinCoroutinesCore + implementation libs.kotlin.coroutines kotlinFixtures(it) - testFixturesImplementation Dependencies.mavenCentral.kotlinCoroutinesCore - testFixturesImplementation Dependencies.mavenCentral.kotlinCoroutinesTest + testFixturesImplementation libs.kotlin.coroutines + testFixturesImplementation libs.kotlin.coroutines.test testFixturesImplementation testFixtures(project(":core")) testFixturesCompileOnly project(":domains:android:viewmodel-stub") } \ No newline at end of file diff --git a/domains/android/work/build.gradle b/domains/android/work/build.gradle index ee78269..9b21339 100644 --- a/domains/android/work/build.gradle +++ b/domains/android/work/build.gradle @@ -1,4 +1,6 @@ -applyAndroidLibraryModule(project) +plugins { + id "st-android-library-conventions" +} dependencies { implementation project(':core') diff --git a/domains/firebase/crashlytics-noop/build.gradle b/domains/firebase/crashlytics-noop/build.gradle index 132fe20..1b34c7d 100644 --- a/domains/firebase/crashlytics-noop/build.gradle +++ b/domains/firebase/crashlytics-noop/build.gradle @@ -1,4 +1,6 @@ -plugins { id 'kotlin' } +plugins { + alias libs.plugins.kotlin +} dependencies { implementation project(':core') diff --git a/domains/firebase/crashlytics/build.gradle b/domains/firebase/crashlytics/build.gradle index cbb5990..7b968a0 100644 --- a/domains/firebase/crashlytics/build.gradle +++ b/domains/firebase/crashlytics/build.gradle @@ -1,7 +1,9 @@ -applyAndroidLibraryModule(project) +plugins { + id "st-android-library-conventions" +} dependencies { implementation project(':core') - implementation platform(Dependencies.google.firebaseBom) + implementation platform(libs.firebase.bom) implementation 'com.google.firebase:firebase-crashlytics' } diff --git a/domains/firebase/messaging-noop/build.gradle b/domains/firebase/messaging-noop/build.gradle index 6ed2375..3a564a9 100644 --- a/domains/firebase/messaging-noop/build.gradle +++ b/domains/firebase/messaging-noop/build.gradle @@ -1,4 +1,6 @@ -applyAndroidLibraryModule(project) +plugins { + id "st-android-library-conventions" +} dependencies { implementation project(':core') diff --git a/domains/firebase/messaging/build.gradle b/domains/firebase/messaging/build.gradle index f768b98..bcf36f6 100644 --- a/domains/firebase/messaging/build.gradle +++ b/domains/firebase/messaging/build.gradle @@ -1,9 +1,11 @@ -applyAndroidLibraryModule(project) +plugins { + id "st-android-library-conventions" +} dependencies { implementation project(':core') implementation project(':domains:android:core') implementation "chat-engine:chat-engine" - implementation platform('com.google.firebase:firebase-bom:29.0.3') + implementation platform(libs.firebase.bom) implementation 'com.google.firebase:firebase-messaging' } diff --git a/domains/store/build.gradle b/domains/store/build.gradle index 8abe3e9..88e1673 100644 --- a/domains/store/build.gradle +++ b/domains/store/build.gradle @@ -1,7 +1,7 @@ plugins { - id 'kotlin' - id 'com.squareup.sqldelight' - id 'org.jetbrains.kotlin.plugin.serialization' + alias libs.plugins.kotlin + alias libs.plugins.kotlin.serialization + alias libs.plugins.sqldelight id 'java-test-fixtures' } @@ -15,9 +15,8 @@ sqldelight { dependencies { implementation project(":core") implementation "chat-engine:chat-engine" - implementation Dependencies.mavenCentral.kotlinSerializationJson - implementation Dependencies.mavenCentral.kotlinCoroutinesCore - implementation "com.squareup.sqldelight:coroutines-extensions:1.5.4" + implementation libs.kotlin.serialization + implementation libs.sqldelight.extensions kotlinFixtures(it) testImplementation(testFixtures(project(":core"))) diff --git a/features/directory/build.gradle b/features/directory/build.gradle index 5b34ce1..2291b1b 100644 --- a/features/directory/build.gradle +++ b/features/directory/build.gradle @@ -1,4 +1,6 @@ -applyAndroidComposeLibraryModule(project) +plugins { + id "st-feature-conventions" +} dependencies { implementation project(":domains:android:compose-core") @@ -7,7 +9,7 @@ dependencies { implementation project(":features:messenger") implementation project(":core") implementation project(":design-library") - implementation Dependencies.mavenCentral.coil + implementation libs.compose.coil kotlinTest(it) diff --git a/features/home/build.gradle b/features/home/build.gradle index e45d07a..d08f22c 100644 --- a/features/home/build.gradle +++ b/features/home/build.gradle @@ -1,4 +1,6 @@ -applyAndroidComposeLibraryModule(project) +plugins { + id "st-feature-conventions" +} dependencies { implementation "chat-engine:chat-engine" @@ -12,5 +14,5 @@ dependencies { implementation 'screen-state:screen-android' implementation project(":core") implementation project(":design-library") - implementation Dependencies.mavenCentral.coil + implementation libs.compose.coil } \ No newline at end of file diff --git a/features/login/build.gradle b/features/login/build.gradle index 848ec0f..9e909f8 100644 --- a/features/login/build.gradle +++ b/features/login/build.gradle @@ -1,4 +1,6 @@ -applyAndroidComposeLibraryModule(project) +plugins { + id "st-feature-conventions" +} dependencies { implementation "chat-engine:chat-engine" diff --git a/features/messenger/build.gradle b/features/messenger/build.gradle index 2c4a0e3..d242f8a 100644 --- a/features/messenger/build.gradle +++ b/features/messenger/build.gradle @@ -1,5 +1,7 @@ -applyAndroidComposeLibraryModule(project) -apply plugin: 'kotlin-parcelize' +plugins { + id "st-feature-conventions" + alias libs.plugins.kotlin.parcelize +} dependencies { implementation "chat-engine:chat-engine" @@ -10,7 +12,7 @@ dependencies { implementation project(":core") implementation project(":features:navigator") implementation project(":design-library") - implementation Dependencies.mavenCentral.coil + implementation libs.compose.coil kotlinTest(it) diff --git a/features/navigator/build.gradle b/features/navigator/build.gradle index 1aee7ce..ed63e6a 100644 --- a/features/navigator/build.gradle +++ b/features/navigator/build.gradle @@ -1,5 +1,7 @@ -applyAndroidLibraryModule(project) -apply plugin: 'kotlin-parcelize' +plugins { + id "st-feature-conventions" + alias libs.plugins.kotlin.parcelize +} dependencies { compileOnly project(":domains:android:stub") diff --git a/features/notifications/build.gradle b/features/notifications/build.gradle index 58fa4b4..21b02a1 100644 --- a/features/notifications/build.gradle +++ b/features/notifications/build.gradle @@ -1,4 +1,6 @@ -applyAndroidLibraryModule(project) +plugins { + id "st-android-library-conventions" +} dependencies { implementation "chat-engine:chat-engine" @@ -12,7 +14,7 @@ dependencies { implementation project(":features:navigator") - implementation Dependencies.mavenCentral.kotlinSerializationJson + implementation libs.kotlin.serialization kotlinTest(it) testImplementation 'chat-engine:chat-engine-test' diff --git a/features/profile/build.gradle b/features/profile/build.gradle index 3857e60..600ec17 100644 --- a/features/profile/build.gradle +++ b/features/profile/build.gradle @@ -1,4 +1,6 @@ -applyAndroidComposeLibraryModule(project) +plugins { + id "st-feature-conventions" +} dependencies { implementation "chat-engine:chat-engine" diff --git a/features/settings/build.gradle b/features/settings/build.gradle index 05f55c8..29fc211 100644 --- a/features/settings/build.gradle +++ b/features/settings/build.gradle @@ -1,4 +1,6 @@ -applyAndroidComposeLibraryModule(project) +plugins { + id "st-feature-conventions" +} dependencies { implementation "chat-engine:chat-engine" diff --git a/features/share-entry/build.gradle b/features/share-entry/build.gradle index 235b2e9..3be412b 100644 --- a/features/share-entry/build.gradle +++ b/features/share-entry/build.gradle @@ -1,4 +1,6 @@ -applyAndroidComposeLibraryModule(project) +plugins { + id "st-feature-conventions" +} dependencies { implementation "chat-engine:chat-engine" diff --git a/features/verification/build.gradle b/features/verification/build.gradle index 21d6274..d90df6f 100644 --- a/features/verification/build.gradle +++ b/features/verification/build.gradle @@ -1,4 +1,6 @@ -applyAndroidComposeLibraryModule(project) +plugins { + id "st-feature-conventions" +} dependencies { implementation "chat-engine:chat-engine" diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..04716d3 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,59 @@ +[versions] +kotlin = "1.7.20" +coroutines = "1.6.4" +sqldelight = "1.5.4" +ktor = "2.2.1" +compose = "1.2.1" +compose-compiler = "1.3.2" +android-gp = "7.3.1" + +[plugins] + +android-application = { id = "com.android.application", version.ref = "android-gp" } +android-library = { id = "com.android.library", version.ref = "android-gp" } +android-kotlin = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } +kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } +kotlin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = "kotlin" } +crashlytics = { id = "org.jetbrains.kotlin.plugin.parcelize", version = "1.8.0-RC" } + +firebase-crashlytics = { id = "com.google.firebase.crashlytics", version = "2.9.2" } + +kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } +sqldelight = { id = "com.squareup.sqldelight", version.ref = "sqldelight" } + +[libraries] + +compose-ui = { group = "androidx.compose.ui", name = "ui", version.ref = "compose" } +compose-foundation = { group = "androidx.compose.foundation", name = "foundation", version.ref = "compose" } +compose-material-three = { group = "androidx.compose.material3", name = "material3", version = "1.0.0-rc01" } +compose-icons-extended = { group = "androidx.compose.material", name = "material-icons-extended", version.ref = "compose" } +compose-activity = { group = "androidx.activity", name = "activity-compose", version = "1.6.0" } +compose-coil = { group = "io.coil-kt", name = "coil-compose", version = "2.2.2" } + +android-desugar = { group = "com.android.tools", name = "desugar_jdk_libs", version = "1.1.5" } + +accompanist-systemuicontroller = { group = "com.google.accompanist", name = "accompanist-systemuicontroller", version = "0.27.1" } + +matrix-olm = { group = "org.matrix.android", name = "olm-sdk", version = "3.2.12" } + +unifiedpush = { group = "com.github.UnifiedPush", name = "android-connector", version = "2.0.1" } + +firebase-bom = { module = "com.google.firebase:firebase-bom", version = "31.0.1" } + +kotlin-serialization = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version = "1.4.1" } + +kotlin-coroutines = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "coroutines" } +kotlin-coroutines-test = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-test", version.ref = "coroutines" } +kotlin-test = { group = "org.jetbrains.kotlin", name = "kotlin-test-junit", version.ref = "kotlin" } + +sqldelight-android = { group = "com.squareup.sqldelight", name = "android-driver", version.ref = "sqldelight" } +sqldelight-test = { group = "com.squareup.sqldelight", name = "sqlite-driver", version.ref = "sqldelight" } +sqldelight-extensions = { group = "com.squareup.sqldelight", name = "coroutines-extensions", version.ref = "sqldelight" } + +ktor-android = { group = "io.ktor", name = "ktor-client-android", version.ref = "ktor" } + +junit = { group = "junit", name = "junit", version = "4.13.2" } +kluent = { group = "org.amshove.kluent", name = "kluent", version = "1.72" } +mockk = { group = "io.mockk", name = "mockk", version = "1.13.3" } + +leakcanary = { group = "com.squareup.leakcanary", name = "leakcanary-android", version = "2.10" } diff --git a/screen-state b/screen-state index 4e92f14..adb986f 160000 --- a/screen-state +++ b/screen-state @@ -1 +1 @@ -Subproject commit 4e92f14031cc8be907cba09b3bfc1d9dbd380072 +Subproject commit adb986fdfd81011978785de08b6faf37adba08aa diff --git a/settings.gradle b/settings.gradle index d368353..7d1d0bb 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,9 +1,13 @@ +pluginManagement { + repositories { + gradlePluginPortal() + google() + } +} dependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) apply from: "dependencies.gradle" - repositories { - Dependencies._repositories.call(it) - } + applyRepositories(it) } rootProject.name = "SmallTalk" From 7e1ff25968dca1d04c7c322eaece59b55556610f Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Sun, 11 Dec 2022 13:10:00 +0000 Subject: [PATCH 4/5] fix missing crashlytics plugin --- app/build.gradle | 14 +++++++++++++- build.gradle | 22 +--------------------- gradle/libs.versions.toml | 2 -- 3 files changed, 14 insertions(+), 24 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 5a8a4d6..996b46a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,8 +1,9 @@ plugins { id "st-application-conventions" + alias libs.plugins.firebase.crashlytics apply false } -applyCrashlyticsIfRelease(project) +applyCrashlyticsIfRelease() android { ndkVersion "25.0.8141415" @@ -104,3 +105,14 @@ dependencies { implementation libs.kotlin.serialization debugImplementation libs.leakcanary } + +def applyCrashlyticsIfRelease() { + if (isReleaseBuild && !isFoss()) { + project.apply plugin: libs.plugins.firebase.crashlytics.get().pluginId + project.afterEvaluate { + project.tasks.withType(com.google.firebase.crashlytics.buildtools.gradle.tasks.UploadMappingFileTask).configureEach { + it.googleServicesResourceRoot.set(project.file("src/release/res/")) + } + } + } +} diff --git a/build.gradle b/build.gradle index 45e77b8..03337c3 100644 --- a/build.gradle +++ b/build.gradle @@ -1,35 +1,15 @@ -plugins { -// alias(libs.plugins.android.application) apply false -// alias(libs.plugins.android.library) apply false -} - def launchTask = getGradle() .getStartParameter() .getTaskRequests() .toString() .toLowerCase() -def isReleaseBuild = launchTask.contains("bundleRelease") || launchTask.contains("assembleRelease") +ext.isReleaseBuild = launchTask.contains("bundlerelease") || launchTask.contains("assemblerelease") ext.isDebugBuild = !isReleaseBuild task clean(type: Delete) { delete rootProject.buildDir } -ext.applyCrashlyticsIfRelease = { project -> - println("is release $isReleaseBuild") - println("is foss ${isFoss()}") - if (isReleaseBuild && !isFoss()) { - println("run craslytics") - - project.apply plugin: 'com.google.firebase.crashlytics' - project.afterEvaluate { - project.tasks.withType(com.google.firebase.crashlytics.buildtools.gradle.tasks.UploadMappingFileTask).configureEach { - it.googleServicesResourceRoot.set(project.file("src/release/res/")) - } - } - } -} - ext.kotlinTest = { dependencies -> dependencies.testImplementation libs.kluent dependencies.testImplementation libs.kotlin.test diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 04716d3..37bddf1 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -14,8 +14,6 @@ android-library = { id = "com.android.library", version.ref = "android-gp" } android-kotlin = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } kotlin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = "kotlin" } -crashlytics = { id = "org.jetbrains.kotlin.plugin.parcelize", version = "1.8.0-RC" } - firebase-crashlytics = { id = "com.google.firebase.crashlytics", version = "2.9.2" } kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } From 5ddd4078842212fc49b2224d39ee64383890d9f7 Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Sun, 11 Dec 2022 15:06:05 +0000 Subject: [PATCH 5/5] avoiding versioned plugins and making the buildSrc the main plugin classloader --- app/build.gradle | 52 +--------------- app/src/debug/AndroidManifest.xml | 3 +- app/src/main/AndroidManifest.xml | 3 +- build.gradle | 12 ++++ buildSrc/build.gradle | 3 +- ...android-compose-library-conventions.gradle | 4 +- .../main/groovy/st-android-conventions.gradle | 13 +--- .../groovy/st-application-conventions.gradle | 60 +++++++++++++++++++ chat-engine | 2 +- core/build.gradle | 2 +- design-library/build.gradle | 6 +- design-library/src/main/AndroidManifest.xml | 2 - domains/android/core/build.gradle | 2 +- domains/android/stub/build.gradle | 2 +- domains/android/viewmodel-stub/build.gradle | 2 +- domains/android/viewmodel/build.gradle | 2 +- .../firebase/crashlytics-noop/build.gradle | 2 +- domains/store/build.gradle | 2 +- features/directory/build.gradle | 4 ++ .../directory/src/main/AndroidManifest.xml | 2 - features/home/build.gradle | 4 ++ features/home/src/main/AndroidManifest.xml | 2 +- features/login/build.gradle | 4 ++ features/login/src/main/AndroidManifest.xml | 2 - features/messenger/build.gradle | 6 +- .../messenger/src/main/AndroidManifest.xml | 3 +- features/navigator/build.gradle | 6 +- .../navigator/src/main/AndroidManifest.xml | 2 - features/notifications/build.gradle | 6 +- .../src/main/AndroidManifest.xml | 2 +- features/profile/build.gradle | 4 ++ features/profile/src/main/AndroidManifest.xml | 2 - screen-state | 2 +- settings.gradle | 1 + 34 files changed, 128 insertions(+), 98 deletions(-) delete mode 100644 design-library/src/main/AndroidManifest.xml delete mode 100644 features/directory/src/main/AndroidManifest.xml delete mode 100644 features/login/src/main/AndroidManifest.xml delete mode 100644 features/navigator/src/main/AndroidManifest.xml delete mode 100644 features/profile/src/main/AndroidManifest.xml diff --git a/app/build.gradle b/app/build.gradle index 996b46a..08b6437 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -6,66 +6,16 @@ plugins { applyCrashlyticsIfRelease() android { - ndkVersion "25.0.8141415" - defaultConfig { - applicationId "app.dapk.st" - def versionJson = new groovy.json.JsonSlurper().parseText(rootProject.file('version.json').text) - versionCode versionJson.code - versionName versionJson.name - - if (isDebugBuild) { - resConfigs "en", "xxhdpi" - } else { - resConfigs "en" - } - - if (isFoss()) { - archivesBaseName = "$archivesBaseName-foss" - } - } - - bundle { - abi.enableSplit true - density.enableSplit true - language.enableSplit true - } + namespace "app.dapk.st" buildTypes { - debug { - versionNameSuffix = " [debug]" - matchingFallbacks = ['release'] - signingConfig.storeFile rootProject.file("tools/debug.keystore") - } release { - minifyEnabled true - shrinkResources true proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard/app.pro', "proguard/serializationx.pro", "proguard/olm.pro" - - if (project.hasProperty("unsigned")) { - // releases are signed externally - } else { - signingConfig = buildTypes.debug.signingConfig - } } } - - compileOptions { - coreLibraryDesugaringEnabled true - } - - packagingOptions { - resources.excludes += "DebugProbesKt.bin" - } -} - -if (isDebugBuild) { - androidComponents { - def release = selector().withBuildType("release") - beforeVariants(release) { it.enabled = false } - } } dependencies { diff --git a/app/src/debug/AndroidManifest.xml b/app/src/debug/AndroidManifest.xml index b2bbec0..e467a56 100644 --- a/app/src/debug/AndroidManifest.xml +++ b/app/src/debug/AndroidManifest.xml @@ -1,6 +1,5 @@ - + - + diff --git a/build.gradle b/build.gradle index 03337c3..872de51 100644 --- a/build.gradle +++ b/build.gradle @@ -6,6 +6,18 @@ def launchTask = getGradle() ext.isReleaseBuild = launchTask.contains("bundlerelease") || launchTask.contains("assemblerelease") ext.isDebugBuild = !isReleaseBuild +subprojects { + tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach { + kotlinOptions { + jvmTarget = "1.8" + freeCompilerArgs = [ + '-opt-in=kotlin.contracts.ExperimentalContracts', + '-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi', + ] + } + } +} + task clean(type: Delete) { delete rootProject.buildDir } diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index 114aa43..5e6682e 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -8,7 +8,6 @@ repositories { } dependencies { - println(libs.versions.android.gp.get()) + implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:${libs.versions.kotlin.get()}") implementation "com.android.tools.build:gradle:${libs.versions.android.gp.get()}" -// implementation "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.20" } \ No newline at end of file diff --git a/buildSrc/src/main/groovy/st-android-compose-library-conventions.gradle b/buildSrc/src/main/groovy/st-android-compose-library-conventions.gradle index 446e682..30ef556 100644 --- a/buildSrc/src/main/groovy/st-android-compose-library-conventions.gradle +++ b/buildSrc/src/main/groovy/st-android-compose-library-conventions.gradle @@ -3,7 +3,9 @@ plugins { } android { - buildFeatures.compose = true + buildFeatures { + compose = true + } composeOptions { kotlinCompilerExtensionVersion = libs.versions.compose.compiler.get() } diff --git a/buildSrc/src/main/groovy/st-android-conventions.gradle b/buildSrc/src/main/groovy/st-android-conventions.gradle index 43e5e15..59ef606 100644 --- a/buildSrc/src/main/groovy/st-android-conventions.gradle +++ b/buildSrc/src/main/groovy/st-android-conventions.gradle @@ -1,18 +1,7 @@ plugins { -// id "kotlin-android" + id "kotlin-android" } -// -//tasks.withType(Class.forName("org.jetbrains.kotlin.gradle.tasks.KotlinCompile.KotlinCompile")).configureEach { -// kotlinOptions { -// jvmTarget = "1.8" -// freeCompilerArgs = [ -// '-opt-in=kotlin.contracts.ExperimentalContracts', -// '-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi', -// ] -// } -//} - def androidSdkVersion = 33 android { diff --git a/buildSrc/src/main/groovy/st-application-conventions.gradle b/buildSrc/src/main/groovy/st-application-conventions.gradle index f66867f..d0b6a35 100644 --- a/buildSrc/src/main/groovy/st-application-conventions.gradle +++ b/buildSrc/src/main/groovy/st-application-conventions.gradle @@ -2,3 +2,63 @@ plugins { id "com.android.application" id "st-android-conventions" } + +android { + ndkVersion "25.0.8141415" + defaultConfig { + applicationId "app.dapk.st" + def versionJson = new groovy.json.JsonSlurper().parseText(rootProject.file('version.json').text) + versionCode versionJson.code + versionName versionJson.name + + if (isDebugBuild) { + resConfigs "en", "xxhdpi" + } else { + resConfigs "en" + } + + if (isFoss()) { + archivesBaseName = "$archivesBaseName-foss" + } + } + + bundle { + abi.enableSplit true + density.enableSplit true + language.enableSplit true + } + + buildTypes { + debug { + versionNameSuffix = " [debug]" + matchingFallbacks = ['release'] + signingConfig.storeFile rootProject.file("tools/debug.keystore") + } + release { + minifyEnabled true + shrinkResources true + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt') + + if (project.hasProperty("unsigned")) { + // releases are signed externally + } else { + signingConfig = buildTypes.debug.signingConfig + } + } + } + + compileOptions { + coreLibraryDesugaringEnabled true + } + + packagingOptions { + resources.excludes += "DebugProbesKt.bin" + } +} + +if (isDebugBuild) { + androidComponents { + def release = selector().withBuildType("release") + beforeVariants(release) { it.enabled = false } + } +} diff --git a/chat-engine b/chat-engine index 3c8d06a..8139eaa 160000 --- a/chat-engine +++ b/chat-engine @@ -1 +1 @@ -Subproject commit 3c8d06ad1c22bbca69718e9b9eef3c053b1a7c2d +Subproject commit 8139eaaf57cee4ce9d0616d617e8aff7eb1480e3 diff --git a/core/build.gradle b/core/build.gradle index 6cb67ca..b83ef43 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -1,5 +1,5 @@ plugins { - alias libs.plugins.kotlin + id 'kotlin' id 'java-test-fixtures' } diff --git a/design-library/build.gradle b/design-library/build.gradle index c266d21..2854c00 100644 --- a/design-library/build.gradle +++ b/design-library/build.gradle @@ -2,8 +2,12 @@ plugins { id "st-android-compose-library-conventions" } +android { + namespace "app.dapk.st.design" +} + dependencies { implementation project(":core") implementation libs.compose.coil implementation libs.accompanist.systemuicontroller -} \ No newline at end of file +} diff --git a/design-library/src/main/AndroidManifest.xml b/design-library/src/main/AndroidManifest.xml deleted file mode 100644 index 03faabd..0000000 --- a/design-library/src/main/AndroidManifest.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/domains/android/core/build.gradle b/domains/android/core/build.gradle index 5da881b..d3781c1 100644 --- a/domains/android/core/build.gradle +++ b/domains/android/core/build.gradle @@ -1,5 +1,5 @@ plugins { - alias libs.plugins.kotlin + id "kotlin" } dependencies { diff --git a/domains/android/stub/build.gradle b/domains/android/stub/build.gradle index f2a5b8d..28b2175 100644 --- a/domains/android/stub/build.gradle +++ b/domains/android/stub/build.gradle @@ -1,5 +1,5 @@ plugins { - alias libs.plugins.kotlin + id "kotlin" id 'java-test-fixtures' } diff --git a/domains/android/viewmodel-stub/build.gradle b/domains/android/viewmodel-stub/build.gradle index 23723ec..5e66da6 100644 --- a/domains/android/viewmodel-stub/build.gradle +++ b/domains/android/viewmodel-stub/build.gradle @@ -1,3 +1,3 @@ plugins { - alias libs.plugins.kotlin + id "kotlin" } diff --git a/domains/android/viewmodel/build.gradle b/domains/android/viewmodel/build.gradle index 5a4f375..0bfcb26 100644 --- a/domains/android/viewmodel/build.gradle +++ b/domains/android/viewmodel/build.gradle @@ -1,5 +1,5 @@ plugins { - alias libs.plugins.kotlin + id "kotlin" id 'java-test-fixtures' } diff --git a/domains/firebase/crashlytics-noop/build.gradle b/domains/firebase/crashlytics-noop/build.gradle index 1b34c7d..0321dd4 100644 --- a/domains/firebase/crashlytics-noop/build.gradle +++ b/domains/firebase/crashlytics-noop/build.gradle @@ -1,5 +1,5 @@ plugins { - alias libs.plugins.kotlin + id "kotlin" } dependencies { diff --git a/domains/store/build.gradle b/domains/store/build.gradle index 88e1673..56790db 100644 --- a/domains/store/build.gradle +++ b/domains/store/build.gradle @@ -1,5 +1,5 @@ plugins { - alias libs.plugins.kotlin + id 'kotlin' alias libs.plugins.kotlin.serialization alias libs.plugins.sqldelight id 'java-test-fixtures' diff --git a/features/directory/build.gradle b/features/directory/build.gradle index 2291b1b..b3b02ef 100644 --- a/features/directory/build.gradle +++ b/features/directory/build.gradle @@ -2,6 +2,10 @@ plugins { id "st-feature-conventions" } +android { + namespace "app.dapk.st.directory" +} + dependencies { implementation project(":domains:android:compose-core") implementation "chat-engine:chat-engine" diff --git a/features/directory/src/main/AndroidManifest.xml b/features/directory/src/main/AndroidManifest.xml deleted file mode 100644 index 49d4f8a..0000000 --- a/features/directory/src/main/AndroidManifest.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/features/home/build.gradle b/features/home/build.gradle index d08f22c..fc94fe6 100644 --- a/features/home/build.gradle +++ b/features/home/build.gradle @@ -2,6 +2,10 @@ plugins { id "st-feature-conventions" } +android { + namespace "app.dapk.st.home" +} + dependencies { implementation "chat-engine:chat-engine" implementation project(":features:directory") diff --git a/features/home/src/main/AndroidManifest.xml b/features/home/src/main/AndroidManifest.xml index e9b8247..67144a8 100644 --- a/features/home/src/main/AndroidManifest.xml +++ b/features/home/src/main/AndroidManifest.xml @@ -1,5 +1,5 @@ - + diff --git a/features/login/build.gradle b/features/login/build.gradle index 9e909f8..098fa20 100644 --- a/features/login/build.gradle +++ b/features/login/build.gradle @@ -2,6 +2,10 @@ plugins { id "st-feature-conventions" } +android { + namespace "app.dapk.st.login" +} + dependencies { implementation "chat-engine:chat-engine" implementation project(":domains:android:compose-core") diff --git a/features/login/src/main/AndroidManifest.xml b/features/login/src/main/AndroidManifest.xml deleted file mode 100644 index 403513e..0000000 --- a/features/login/src/main/AndroidManifest.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/features/messenger/build.gradle b/features/messenger/build.gradle index d242f8a..66277a9 100644 --- a/features/messenger/build.gradle +++ b/features/messenger/build.gradle @@ -1,6 +1,10 @@ plugins { id "st-feature-conventions" - alias libs.plugins.kotlin.parcelize + id "org.jetbrains.kotlin.plugin.parcelize" +} + +android { + namespace "app.dapk.st.messenger" } dependencies { diff --git a/features/messenger/src/main/AndroidManifest.xml b/features/messenger/src/main/AndroidManifest.xml index d81f786..04e5197 100644 --- a/features/messenger/src/main/AndroidManifest.xml +++ b/features/messenger/src/main/AndroidManifest.xml @@ -1,6 +1,5 @@ - + diff --git a/features/navigator/build.gradle b/features/navigator/build.gradle index ed63e6a..92f9797 100644 --- a/features/navigator/build.gradle +++ b/features/navigator/build.gradle @@ -1,6 +1,10 @@ plugins { id "st-feature-conventions" - alias libs.plugins.kotlin.parcelize + id "org.jetbrains.kotlin.plugin.parcelize" +} + +android { + namespace "app.dapk.st.navigator" } dependencies { diff --git a/features/navigator/src/main/AndroidManifest.xml b/features/navigator/src/main/AndroidManifest.xml deleted file mode 100644 index 9926105..0000000 --- a/features/navigator/src/main/AndroidManifest.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/features/notifications/build.gradle b/features/notifications/build.gradle index 21b02a1..e186dd5 100644 --- a/features/notifications/build.gradle +++ b/features/notifications/build.gradle @@ -2,9 +2,12 @@ plugins { id "st-android-library-conventions" } +android { + namespace "app.dapk.st.notifications" +} + dependencies { implementation "chat-engine:chat-engine" -// implementation project(':domains:store') implementation project(":domains:android:work") implementation project(':domains:android:push') implementation project(":domains:android:core") @@ -13,7 +16,6 @@ dependencies { implementation project(":features:messenger") implementation project(":features:navigator") - implementation libs.kotlin.serialization kotlinTest(it) diff --git a/features/notifications/src/main/AndroidManifest.xml b/features/notifications/src/main/AndroidManifest.xml index ebdd9bb..ffb7f70 100644 --- a/features/notifications/src/main/AndroidManifest.xml +++ b/features/notifications/src/main/AndroidManifest.xml @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/features/profile/build.gradle b/features/profile/build.gradle index 600ec17..921a30d 100644 --- a/features/profile/build.gradle +++ b/features/profile/build.gradle @@ -2,6 +2,10 @@ plugins { id "st-feature-conventions" } +android { + namespace "app.dapk.st.profile" +} + dependencies { implementation "chat-engine:chat-engine" implementation project(":features:settings") diff --git a/features/profile/src/main/AndroidManifest.xml b/features/profile/src/main/AndroidManifest.xml deleted file mode 100644 index 8f0f1fd..0000000 --- a/features/profile/src/main/AndroidManifest.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/screen-state b/screen-state index adb986f..088fd0e 160000 --- a/screen-state +++ b/screen-state @@ -1 +1 @@ -Subproject commit adb986fdfd81011978785de08b6faf37adba08aa +Subproject commit 088fd0e720acf5bc23eb8458469e782c5c10fcc7 diff --git a/settings.gradle b/settings.gradle index 7d1d0bb..91c4343 100644 --- a/settings.gradle +++ b/settings.gradle @@ -9,6 +9,7 @@ dependencyResolutionManagement { apply from: "dependencies.gradle" applyRepositories(it) } + rootProject.name = "SmallTalk" includeBuild 'screen-state'