Skip to content

Commit

Permalink
avoiding versioned plugins and making the buildSrc the main plugin cl…
Browse files Browse the repository at this point in the history
…assloader
  • Loading branch information
ouchadam committed Dec 11, 2022
1 parent 7e1ff25 commit 5ddd407
Show file tree
Hide file tree
Showing 34 changed files with 128 additions and 98 deletions.
52 changes: 1 addition & 51 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 1 addition & 2 deletions app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="app.dapk.st">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application>
<meta-data
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="app.dapk.st">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES"/>
Expand Down
12 changes: 12 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
3 changes: 1 addition & 2 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ plugins {
}

android {
buildFeatures.compose = true
buildFeatures {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = libs.versions.compose.compiler.get()
}
Expand Down
13 changes: 1 addition & 12 deletions buildSrc/src/main/groovy/st-android-conventions.gradle
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
60 changes: 60 additions & 0 deletions buildSrc/src/main/groovy/st-application-conventions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
}
}
2 changes: 1 addition & 1 deletion chat-engine
2 changes: 1 addition & 1 deletion core/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
alias libs.plugins.kotlin
id 'kotlin'
id 'java-test-fixtures'
}

Expand Down
6 changes: 5 additions & 1 deletion design-library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
2 changes: 0 additions & 2 deletions design-library/src/main/AndroidManifest.xml

This file was deleted.

2 changes: 1 addition & 1 deletion domains/android/core/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
alias libs.plugins.kotlin
id "kotlin"
}

dependencies {
Expand Down
2 changes: 1 addition & 1 deletion domains/android/stub/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
alias libs.plugins.kotlin
id "kotlin"
id 'java-test-fixtures'
}

Expand Down
2 changes: 1 addition & 1 deletion domains/android/viewmodel-stub/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
plugins {
alias libs.plugins.kotlin
id "kotlin"
}
2 changes: 1 addition & 1 deletion domains/android/viewmodel/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
alias libs.plugins.kotlin
id "kotlin"
id 'java-test-fixtures'
}

Expand Down
2 changes: 1 addition & 1 deletion domains/firebase/crashlytics-noop/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
alias libs.plugins.kotlin
id "kotlin"
}

dependencies {
Expand Down
2 changes: 1 addition & 1 deletion domains/store/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
alias libs.plugins.kotlin
id 'kotlin'
alias libs.plugins.kotlin.serialization
alias libs.plugins.sqldelight
id 'java-test-fixtures'
Expand Down
4 changes: 4 additions & 0 deletions features/directory/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 0 additions & 2 deletions features/directory/src/main/AndroidManifest.xml

This file was deleted.

4 changes: 4 additions & 0 deletions features/home/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion features/home/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="app.dapk.st.home">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application>
<activity android:name="app.dapk.st.home.MainActivity"/>
Expand Down
4 changes: 4 additions & 0 deletions features/login/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 0 additions & 2 deletions features/login/src/main/AndroidManifest.xml

This file was deleted.

6 changes: 5 additions & 1 deletion features/messenger/build.gradle
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
3 changes: 1 addition & 2 deletions features/messenger/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="app.dapk.st.messenger">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application>

Expand Down
6 changes: 5 additions & 1 deletion features/navigator/build.gradle
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
2 changes: 0 additions & 2 deletions features/navigator/src/main/AndroidManifest.xml

This file was deleted.

6 changes: 4 additions & 2 deletions features/notifications/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -13,7 +16,6 @@ dependencies {
implementation project(":features:messenger")
implementation project(":features:navigator")


implementation libs.kotlin.serialization

kotlinTest(it)
Expand Down
2 changes: 1 addition & 1 deletion features/notifications/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="app.dapk.st.notifications">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
</manifest>
Loading

0 comments on commit 5ddd407

Please sign in to comment.