Skip to content

Commit

Permalink
Move androidComponents to top-level and update packaging options
Browse files Browse the repository at this point in the history
  • Loading branch information
fibelatti committed Nov 23, 2023
1 parent a679172 commit 7e0e3e3
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -105,21 +105,6 @@ android {
}
}

androidComponents {
onVariants { variant ->
val appName = StringBuilder().apply {
append(AppInfo.appName)
if (variant.name.contains("noapi", ignoreCase = true)) append(" NoApi")
if (variant.name.contains("debug", ignoreCase = true)) append(" Dev")
}.toString()

variant.resValues.put(
variant.makeResValueKey("string", "app_name"),
com.android.build.api.variant.ResValue(appName, null),
)
}
}

sourceSets {
forEach { sourceSet -> getByName(sourceSet.name).java.srcDirs("src/${sourceSet.name}/kotlin") }

Expand All @@ -138,10 +123,24 @@ android {
testOptions {
execution = "ANDROIDX_TEST_ORCHESTRATOR"
}
}

androidComponents {
onVariants { variant ->
val appName = StringBuilder().apply {
append(AppInfo.appName)
if (variant.name.contains("noapi", ignoreCase = true)) append(" NoApi")
if (variant.name.contains("debug", ignoreCase = true)) append(" Dev")
}.toString()

variant.resValues.put(
variant.makeResValueKey("string", "app_name"),
com.android.build.api.variant.ResValue(appName, null),
)
}

packaging {
resources.excludes.add("META-INF/LICENSE.md")
resources.excludes.add("META-INF/LICENSE-notice.md")
onVariants(selector().withBuildType("release")) { variant ->
variant.packaging.resources.excludes.add("META-INF/*.version")
}
}

Expand Down

0 comments on commit 7e0e3e3

Please sign in to comment.