From f3600290c85610e5c36b6bc7b66964e843cc87b7 Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Sun, 11 Dec 2022 12:49:30 +0000 Subject: [PATCH] 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' +}