Skip to content

Commit

Permalink
Merge pull request #31 from RedMadRobot/feature/convention_plugin
Browse files Browse the repository at this point in the history
Build: Migrate to ksp and create basic plugin convention
  • Loading branch information
TopHlop authored Sep 25, 2024
2 parents 969f4fc + dd39eb8 commit 07d5b64
Show file tree
Hide file tree
Showing 18 changed files with 75 additions and 225 deletions.
12 changes: 0 additions & 12 deletions buildSrc/src/main/kotlin/Plugins.kt

This file was deleted.

45 changes: 45 additions & 0 deletions buildSrc/src/main/kotlin/convention.debug.panel.plugin.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import internal.Versions
import internal.android
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
id("com.android.library")
id("convention-publish")
kotlin("android")
}

android {
compileSdk = Versions.COMPILE_SDK
lint.targetSdk = Versions.TARGET_SDK

defaultConfig {
minSdk = Versions.MIN_SDK
}

buildTypes {
getByName("release") {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
}

kotlin {
explicitApi()
compilerOptions {
jvmTarget = JvmTarget.JVM_11
}
}

dependencies {
implementation(project(":panel-core"))
implementation(project(":panel-common"))
}
7 changes: 7 additions & 0 deletions buildSrc/src/main/kotlin/internal/Versions.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package internal

internal object Versions {
const val MIN_SDK = 21
const val TARGET_SDK = 34
const val COMPILE_SDK = TARGET_SDK
}
8 changes: 4 additions & 4 deletions buildSrc/src/main/kotlin/internal/accessors.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package internal

import com.android.build.api.dsl.LibraryExtension
import org.gradle.api.plugins.ExtensionAware
import com.android.build.api.dsl.CommonExtension
import org.gradle.api.Project

internal fun ExtensionAware.android(configure: LibraryExtension.() -> Unit) {
extensions.configure<LibraryExtension>("android", configure)
internal fun Project.android(configure: CommonExtension<*, *, *, *, *, *>.() -> Unit) {
extensions.configure("android", configure)
}
6 changes: 2 additions & 4 deletions panel-common/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
plugins {
id(Plugins.Android.libraryPlagin)
kotlin(Plugins.Kotlin.androidPlugin)
kotlin(Plugins.Kotlin.kapt)
id("com.android.library")
kotlin("android")
id("convention-publish")
}

Expand Down Expand Up @@ -69,7 +68,6 @@ dependencies {
api(stack.kotlinx.coroutines.android)
api(stack.okhttp)
api(stack.timber)
kapt(androidx.room.compiler)
// legacy
api(androidx.appcompat)
api(androidx.constraintlayout)
Expand Down
6 changes: 2 additions & 4 deletions panel-core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
plugins {
id(Plugins.Android.libraryPlagin)
kotlin(Plugins.Kotlin.androidPlugin)
kotlin(Plugins.Kotlin.kapt)
id("com.android.library")
kotlin("android")
alias(stack.plugins.kotlin.compose)
id("convention-publish")
}
Expand Down Expand Up @@ -51,5 +50,4 @@ kotlin {

dependencies {
implementation(project(":panel-common"))
kapt(androidx.room.compiler)
}
4 changes: 2 additions & 2 deletions panel-no-op/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id(Plugins.Android.libraryPlagin)
kotlin(Plugins.Kotlin.androidPlugin)
id("com.android.library")
kotlin("android")
id("convention-publish")
}

Expand Down
49 changes: 5 additions & 44 deletions plugins/plugin-accounts/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,58 +1,19 @@
plugins {
id(Plugins.Android.libraryPlagin)
kotlin(Plugins.Kotlin.androidPlugin)
kotlin(Plugins.Kotlin.kapt)
id("convention.debug.panel.plugin")
alias(stack.plugins.ksp)
alias(stack.plugins.kotlin.compose)
id("convention-publish")
}

description = "Plugin for switching user accounts"

android {
compileSdk = Project.COMPILE_SDK
lint.targetSdk = Project.TARGET_SDK

defaultConfig {
minSdk = Project.MIN_SDK

consumerProguardFile("consumer-rules.pro")
}

buildTypes {
getByName(Project.BuildTypes.release) {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile(Project.Proguard.androidOptimizedRules),
Project.Proguard.projectRules
)
}
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.toString()
}

kapt {
arguments {
arg("room.schemaLocation", "$projectDir/schemas")
}
ksp {
arg("room.schemaLocation", "$projectDir/schemas")
}

namespace = "com.redmadrobot.debug.plugin.accounts"
}

kotlin {
explicitApi()
}

dependencies {
implementation(kotlin("stdlib"))
implementation(project(":panel-core"))
implementation(project(":panel-common"))
kapt(androidx.room.compiler)
ksp(androidx.room.compiler)
}
Empty file.
44 changes: 1 addition & 43 deletions plugins/plugin-app-settings/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,52 +1,10 @@
plugins {
id(Plugins.Android.libraryPlagin)
kotlin(Plugins.Kotlin.androidPlugin)
kotlin(Plugins.Kotlin.kapt)
id("convention.debug.panel.plugin")
alias(stack.plugins.kotlin.compose)
id("convention-publish")
}

description = "Plugin that helps to change the values of shared preferences"

android {
compileSdk = Project.COMPILE_SDK
lint.targetSdk = Project.TARGET_SDK

defaultConfig {
minSdk = Project.MIN_SDK

consumerProguardFile("consumer-rules.pro")
}

buildTypes {
getByName(Project.BuildTypes.release) {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile(Project.Proguard.androidOptimizedRules),
Project.Proguard.projectRules
)
}
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.toString()
}

namespace = "com.redmadrobot.debug.plugin.appsettings"
}

kotlin {
explicitApi()
}

dependencies {
implementation(project(":panel-core"))
implementation(project(":panel-common"))
implementation(kotlin("stdlib"))
kapt(androidx.room.compiler)
}
Empty file.
36 changes: 1 addition & 35 deletions plugins/plugin-flipper/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,48 +1,14 @@
plugins {
id(Plugins.Android.libraryPlagin)
kotlin(Plugins.Kotlin.androidPlugin)
kotlin(Plugins.Kotlin.kapt)
id("convention.debug.panel.plugin")
alias(stack.plugins.kotlin.compose)
id("convention-publish")
}

description = "Plugin for flipper library integration"

android {
compileSdk = Project.COMPILE_SDK
lint.targetSdk = Project.TARGET_SDK

defaultConfig {
minSdk = Project.MIN_SDK

consumerProguardFile("consumer-rules.pro")
}

buildTypes {
getByName(Project.BuildTypes.release) {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile(Project.Proguard.androidOptimizedRules),
Project.Proguard.projectRules
)
}
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.toString()
freeCompilerArgs += "-Xexplicit-api=strict"
}

namespace = "com.redmadrobot.debug.plugin.flipper"
}

dependencies {
implementation(project(":panel-core"))
implementation(project(":panel-common"))
implementation(androidx.lifecycle.runtime)
}
Empty file.
36 changes: 1 addition & 35 deletions plugins/plugin-konfeature/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,48 +1,14 @@
plugins {
id(Plugins.Android.libraryPlagin)
kotlin(Plugins.Kotlin.androidPlugin)
kotlin(Plugins.Kotlin.kapt)
id("convention.debug.panel.plugin")
alias(stack.plugins.kotlin.compose)
id("convention-publish")
}

description = "Plugin for konfeature library integration"

android {
compileSdk = Project.COMPILE_SDK
lint.targetSdk = Project.TARGET_SDK

defaultConfig {
minSdk = Project.MIN_SDK

consumerProguardFile("consumer-rules.pro")
}

buildTypes {
getByName(Project.BuildTypes.release) {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile(Project.Proguard.androidOptimizedRules),
Project.Proguard.projectRules
)
}
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.toString()
freeCompilerArgs += "-Xexplicit-api=strict"
}

namespace = "com.redmadrobot.debug.plugin.konfeature"
}

dependencies {
implementation(project(":panel-core"))
implementation(project(":panel-common"))
implementation(androidx.lifecycle.runtime)
}
Empty file.
43 changes: 3 additions & 40 deletions plugins/plugin-servers/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,53 +1,16 @@
plugins {
id(Plugins.Android.libraryPlagin)
kotlin(Plugins.Kotlin.androidPlugin)
kotlin(Plugins.Kotlin.kapt)
id("convention.debug.panel.plugin")
alias(stack.plugins.ksp)
alias(stack.plugins.kotlin.compose)
id("convention-publish")
}

description = "Plugin for switching server hosts"

android {
compileSdk = Project.COMPILE_SDK
lint.targetSdk = Project.TARGET_SDK

defaultConfig {
minSdk = Project.MIN_SDK

consumerProguardFile("consumer-rules.pro")
}

buildTypes {
getByName(Project.BuildTypes.release) {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile(Project.Proguard.androidOptimizedRules),
Project.Proguard.projectRules
)
}
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.toString()
}

namespace = "com.redmadrobot.debug.plugin.servers"
}

kotlin {
explicitApi()
}

dependencies {
implementation(project(":panel-core"))
implementation(project(":panel-common"))
implementation(kotlin("stdlib"))
implementation(stack.kotlinx.serialization.json)
kapt(androidx.room.compiler)
ksp(androidx.room.compiler)
}
Empty file.
Loading

0 comments on commit 07d5b64

Please sign in to comment.