mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
refactor(build): Introduce AndroidLibraryFlavors convention plugin (#4449)
This commit is contained in:
parent
854eff685e
commit
3eefa801d6
13 changed files with 60 additions and 79 deletions
|
|
@ -112,7 +112,7 @@ gradlePlugin {
|
|||
id = "meshtastic.android.application"
|
||||
implementationClass = "AndroidApplicationConventionPlugin"
|
||||
}
|
||||
register("androidFlavors") {
|
||||
register("androidApplicationFlavors") {
|
||||
id = "meshtastic.android.application.flavors"
|
||||
implementationClass = "AndroidApplicationFlavorsConventionPlugin"
|
||||
}
|
||||
|
|
@ -120,6 +120,10 @@ gradlePlugin {
|
|||
id = "meshtastic.android.library"
|
||||
implementationClass = "AndroidLibraryConventionPlugin"
|
||||
}
|
||||
register("androidLibraryFlavors") {
|
||||
id = "meshtastic.android.library.flavors"
|
||||
implementationClass = "AndroidLibraryFlavorsConventionPlugin"
|
||||
}
|
||||
register("androidLint") {
|
||||
id = "meshtastic.android.lint"
|
||||
implementationClass = "AndroidLintConventionPlugin"
|
||||
|
|
@ -167,12 +171,12 @@ gradlePlugin {
|
|||
id = "meshtastic.kmp.library.compose"
|
||||
implementationClass = "KmpLibraryComposeConventionPlugin"
|
||||
}
|
||||
|
||||
|
||||
register("dokka") {
|
||||
id = "meshtastic.dokka"
|
||||
implementationClass = "DokkaConventionPlugin"
|
||||
}
|
||||
|
||||
|
||||
register("kover") {
|
||||
id = "meshtastic.kover"
|
||||
implementationClass = "KoverConventionPlugin"
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ import org.gradle.api.Plugin
|
|||
import org.gradle.api.Project
|
||||
import org.gradle.kotlin.dsl.apply
|
||||
import org.gradle.kotlin.dsl.configure
|
||||
import org.meshtastic.buildlogic.configureFlavors
|
||||
import org.meshtastic.buildlogic.configureKotlinAndroid
|
||||
import org.meshtastic.buildlogic.configureTestOptions
|
||||
import org.meshtastic.buildlogic.disableUnnecessaryAndroidTests
|
||||
|
|
@ -41,7 +40,12 @@ class AndroidLibraryConventionPlugin : Plugin<Project> {
|
|||
configureKotlinAndroid(this)
|
||||
defaultConfig.testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
testOptions.animationsDisabled = true
|
||||
configureFlavors(this)
|
||||
|
||||
defaultConfig {
|
||||
// When flavorless modules depend on flavored modules (like :core:data),
|
||||
// they need a strategy to pick a variant. We default to 'google'.
|
||||
missingDimensionStrategy("marketplace", "google")
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
getByName("debug") {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* Copyright (c) 2025 Meshtastic LLC
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import com.android.build.api.dsl.LibraryExtension
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.kotlin.dsl.configure
|
||||
import org.meshtastic.buildlogic.configureFlavors
|
||||
|
||||
class AndroidLibraryFlavorsConventionPlugin : Plugin<Project> {
|
||||
override fun apply(target: Project) {
|
||||
with(target) {
|
||||
extensions.configure<LibraryExtension> {
|
||||
configureFlavors(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2025 Meshtastic LLC
|
||||
* Copyright (c) 2025-2026 Meshtastic LLC
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -16,24 +16,9 @@
|
|||
*/
|
||||
import com.android.build.api.dsl.LibraryExtension
|
||||
|
||||
/*
|
||||
* Copyright (c) 2025 Meshtastic LLC
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
plugins {
|
||||
alias(libs.plugins.meshtastic.android.library)
|
||||
alias(libs.plugins.meshtastic.android.library.flavors)
|
||||
alias(libs.plugins.meshtastic.android.library.compose)
|
||||
alias(libs.plugins.meshtastic.hilt)
|
||||
alias(libs.plugins.secrets)
|
||||
|
|
|
|||
|
|
@ -30,15 +30,15 @@ configure<com.android.build.api.dsl.LibraryExtension> {
|
|||
minSdk = 21
|
||||
}
|
||||
|
||||
publishing { singleVariant("googleRelease") { withSourcesJar() } }
|
||||
publishing { singleVariant("release") { withSourcesJar() } }
|
||||
}
|
||||
|
||||
// Map the Android component to a Maven publication
|
||||
afterEvaluate {
|
||||
publishing {
|
||||
publications {
|
||||
create<MavenPublication>("googleRelease") {
|
||||
from(components["googleRelease"])
|
||||
create<MavenPublication>("release") {
|
||||
from(components["release"])
|
||||
artifactId = "core-api"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import com.android.build.api.dsl.LibraryExtension
|
|||
|
||||
plugins {
|
||||
alias(libs.plugins.meshtastic.android.library)
|
||||
alias(libs.plugins.meshtastic.android.library.flavors)
|
||||
alias(libs.plugins.meshtastic.hilt)
|
||||
alias(libs.plugins.meshtastic.kotlinx.serialization)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,14 +39,14 @@ configure<LibraryExtension> {
|
|||
|
||||
testOptions { unitTests { isIncludeAndroidResources = true } }
|
||||
|
||||
publishing { singleVariant("googleRelease") { withSourcesJar() } }
|
||||
publishing { singleVariant("release") { withSourcesJar() } }
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
publishing {
|
||||
publications {
|
||||
create<MavenPublication>("googleRelease") {
|
||||
from(components["googleRelease"])
|
||||
create<MavenPublication>("release") {
|
||||
from(components["release"])
|
||||
artifactId = "core-model"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,25 +16,9 @@
|
|||
*/
|
||||
import com.android.build.api.dsl.LibraryExtension
|
||||
|
||||
/*
|
||||
* Copyright (c) 2025 Meshtastic LLC
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
plugins {
|
||||
alias(libs.plugins.meshtastic.android.library)
|
||||
alias(libs.plugins.meshtastic.android.library.flavors)
|
||||
alias(libs.plugins.meshtastic.hilt)
|
||||
alias(libs.plugins.kotlin.serialization)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,25 +16,9 @@
|
|||
*/
|
||||
import com.android.build.api.dsl.LibraryExtension
|
||||
|
||||
/*
|
||||
* Copyright (c) 2025 Meshtastic LLC
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
plugins {
|
||||
alias(libs.plugins.meshtastic.android.library)
|
||||
alias(libs.plugins.meshtastic.android.library.flavors)
|
||||
alias(libs.plugins.meshtastic.hilt)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,25 +16,9 @@
|
|||
*/
|
||||
import com.android.build.api.dsl.LibraryExtension
|
||||
|
||||
/*
|
||||
* Copyright (c) 2025 Meshtastic LLC
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
plugins {
|
||||
alias(libs.plugins.meshtastic.android.library)
|
||||
alias(libs.plugins.meshtastic.android.library.flavors)
|
||||
alias(libs.plugins.meshtastic.android.library.compose)
|
||||
alias(libs.plugins.meshtastic.kotlinx.serialization)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import com.android.build.api.dsl.LibraryExtension
|
|||
|
||||
plugins {
|
||||
alias(libs.plugins.meshtastic.android.library)
|
||||
alias(libs.plugins.meshtastic.android.library.flavors)
|
||||
alias(libs.plugins.meshtastic.android.library.compose)
|
||||
alias(libs.plugins.meshtastic.hilt)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import com.android.build.api.dsl.LibraryExtension
|
|||
|
||||
plugins {
|
||||
alias(libs.plugins.meshtastic.android.library)
|
||||
alias(libs.plugins.meshtastic.android.library.flavors)
|
||||
alias(libs.plugins.meshtastic.android.library.compose)
|
||||
alias(libs.plugins.meshtastic.hilt)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -246,6 +246,7 @@ meshtastic-android-application-compose = { id = "meshtastic.android.application.
|
|||
meshtastic-android-application-flavors = { id = "meshtastic.android.application.flavors" }
|
||||
meshtastic-android-library = { id = "meshtastic.android.library" }
|
||||
meshtastic-android-library-compose = { id = "meshtastic.android.library.compose" }
|
||||
meshtastic-android-library-flavors = { id = "meshtastic.android.library.flavors" }
|
||||
meshtastic-android-lint = { id = "meshtastic.android.lint" }
|
||||
meshtastic-android-room = { id = "meshtastic.android.room" }
|
||||
meshtastic-android-test = { id = "meshtastic.android.test" }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue