From 5ddd4078842212fc49b2224d39ee64383890d9f7 Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Sun, 11 Dec 2022 15:06:05 +0000 Subject: [PATCH] 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'