Skip to content

Commit

Permalink
Migrate to AGP namespaces (#5569)
Browse files Browse the repository at this point in the history
  • Loading branch information
Goooler committed Nov 26, 2022
1 parent e834c0a commit b1b7a21
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -589,9 +589,8 @@ class DetektAndroidSpec {
internal fun isAndroidSdkInstalled() =
System.getenv("ANDROID_SDK_ROOT") != null || System.getenv("ANDROID_HOME") != null

internal fun manifestContent(packageName: String = "io.gitlab.arturbosch.detekt.app") = """
<manifest package="$packageName"
xmlns:android="http://schemas.android.com/apk/res/android"/>
internal fun manifestContent() = """
<manifest xmlns:android="http://schemas.android.com/apk/res/android"/>
""".trimIndent()

private val APP_PLUGIN_BLOCK = """
Expand Down Expand Up @@ -620,12 +619,14 @@ private val KOTLIN_ONLY_LIB_PLUGIN_BLOCK = """
private val ANDROID_BLOCK = """
android {
compileSdk = 30
namespace = "io.gitlab.arturbosch.detekt.app"
}
""".trimIndent()

private val ANDROID_BLOCK_WITH_FLAVOR = """
android {
compileSdk = 30
namespace = "io.gitlab.arturbosch.detekt.app"
flavorDimensions("age", "name")
productFlavors {
create("harry") {
Expand All @@ -644,6 +645,7 @@ private val ANDROID_BLOCK_WITH_FLAVOR = """
private val ANDROID_BLOCK_WITH_VIEW_BINDING = """
android {
compileSdk = 30
namespace = "io.gitlab.arturbosch.detekt.app"
defaultConfig {
applicationId = "io.gitlab.arturbosch.detekt.app"
minSdk = 24
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ class DetektMultiplatformSpec {
}
android {
compileSdk = 30
namespace = "io.gitlab.arturbosch.detekt.app"
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
buildTypes {
release {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ class ReportMergeSpec {
}
android {
compileSdk = 30
namespace = "io.github.detekt.app"
}
dependencies {
implementation(project(":lib"))
Expand All @@ -122,6 +123,7 @@ class ReportMergeSpec {
}
android {
compileSdk = 30
namespace = "io.github.detekt.lib"
}
""".trimIndent(),
srcDirs = listOf("src/main/java", "src/debug/java", "src/test/java", "src/androidTest/java")
Expand Down Expand Up @@ -174,11 +176,11 @@ class ReportMergeSpec {
gradleRunner.setupProject()
gradleRunner.writeProjectFile(
"app/src/main/AndroidManifest.xml",
manifestContent("io.github.detekt.app")
manifestContent()
)
gradleRunner.writeProjectFile(
"lib/src/main/AndroidManifest.xml",
manifestContent("io.github.detekt.lib")
manifestContent()
)
gradleRunner.runTasksAndCheckResult("detektMain", "reportMerge", "--continue") { result ->
projectLayout.submodules.forEach { submodule ->
Expand Down

0 comments on commit b1b7a21

Please sign in to comment.