Refactor some modules + add dependency management (still WIP)
This commit is contained in:
14
plugins/build.gradle.kts
Normal file
14
plugins/build.gradle.kts
Normal file
@@ -0,0 +1,14 @@
|
||||
plugins {
|
||||
`kotlin-dsl`
|
||||
`kotlin-dsl-precompiled-script-plugins`
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
google()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(libs.android.gradle.plugin)
|
||||
implementation(libs.kotlin.gradle.plugin)
|
||||
}
|
||||
10
plugins/settings.gradle.kts
Normal file
10
plugins/settings.gradle.kts
Normal file
@@ -0,0 +1,10 @@
|
||||
dependencyResolutionManagement {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
versionCatalogs {
|
||||
create("libs") {
|
||||
from(files("../gradle/libs.versions.toml"))
|
||||
}
|
||||
}
|
||||
}
|
||||
17
plugins/src/main/java/Versions.kt
Normal file
17
plugins/src/main/java/Versions.kt
Normal file
@@ -0,0 +1,17 @@
|
||||
import org.gradle.api.JavaVersion
|
||||
import org.gradle.api.artifacts.VersionCatalog
|
||||
import org.gradle.jvm.toolchain.JavaLanguageVersion
|
||||
|
||||
val VersionCatalog.composeVersion: String
|
||||
get() = findVersion("compose_compiler").get().requiredVersion
|
||||
|
||||
object Versions {
|
||||
const val versionCode = 100100
|
||||
const val versionName = "0.1.0"
|
||||
|
||||
const val compileSdk = 33
|
||||
const val targetSdk = 33
|
||||
const val minSdk = 24
|
||||
val javaCompileVersion = JavaVersion.VERSION_11
|
||||
val javaLanguageVersion: JavaLanguageVersion = JavaLanguageVersion.of(11)
|
||||
}
|
||||
50
plugins/src/main/java/extension/CommonExtension.kt
Normal file
50
plugins/src/main/java/extension/CommonExtension.kt
Normal file
@@ -0,0 +1,50 @@
|
||||
package extension
|
||||
|
||||
import Versions
|
||||
import com.android.build.api.dsl.CommonExtension
|
||||
import com.android.build.api.dsl.LibraryExtension
|
||||
import composeVersion
|
||||
import org.gradle.api.artifacts.VersionCatalog
|
||||
|
||||
fun CommonExtension<*, *, *, *>.androidConfig() {
|
||||
|
||||
|
||||
|
||||
defaultConfig {
|
||||
compileSdk = Versions.compileSdk
|
||||
minSdk = Versions.minSdk
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
testOptions {
|
||||
unitTests.isReturnDefaultValues = true
|
||||
}
|
||||
}
|
||||
|
||||
fun CommonExtension<*, *, *, *>.composeConfig() {
|
||||
buildFeatures {
|
||||
compose = true
|
||||
}
|
||||
|
||||
composeOptions {
|
||||
kotlinCompilerExtensionVersion = "1.3.2"
|
||||
}
|
||||
|
||||
packagingOptions {
|
||||
resources.excludes.apply {
|
||||
add("META-INF/AL2.0")
|
||||
add("META-INF/LGPL2.1")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun LibraryExtension.proguardConfig() {
|
||||
buildTypes {
|
||||
getByName("release") {
|
||||
isMinifyEnabled = true
|
||||
proguardFiles("proguard-android.txt", "proguard-rules.pro")
|
||||
consumerProguardFiles("proguard-rules.pro")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
29
plugins/src/main/java/io.element.android-compose.gradle.kts
Normal file
29
plugins/src/main/java/io.element.android-compose.gradle.kts
Normal file
@@ -0,0 +1,29 @@
|
||||
import extension.androidConfig
|
||||
import extension.composeConfig
|
||||
import extension.proguardConfig
|
||||
|
||||
plugins {
|
||||
id("com.android.library")
|
||||
id("kotlin-android")
|
||||
}
|
||||
|
||||
android {
|
||||
androidConfig()
|
||||
proguardConfig()
|
||||
composeConfig()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(platform("androidx.compose:compose-bom:2022.10.00"))
|
||||
|
||||
implementation("androidx.compose.ui:ui")
|
||||
implementation("androidx.compose.material3:material3")
|
||||
implementation("androidx.compose.ui:ui-tooling-preview")
|
||||
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.5.1")
|
||||
implementation("androidx.activity:activity-compose:1.6.1")
|
||||
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.5.1")
|
||||
implementation("com.airbnb.android:mavericks-compose:3.0.1")
|
||||
debugImplementation("androidx.compose.ui:ui-tooling")
|
||||
debugImplementation("androidx.compose.ui:ui-test-manifest")
|
||||
|
||||
}
|
||||
12
plugins/src/main/java/io.element.android-library.gradle.kts
Normal file
12
plugins/src/main/java/io.element.android-library.gradle.kts
Normal file
@@ -0,0 +1,12 @@
|
||||
import extension.androidConfig
|
||||
import extension.proguardConfig
|
||||
|
||||
plugins {
|
||||
id("com.android.library")
|
||||
id("kotlin-android")
|
||||
}
|
||||
|
||||
android {
|
||||
androidConfig()
|
||||
proguardConfig()
|
||||
}
|
||||
Reference in New Issue
Block a user