Skip to content

Commit

Permalink
RUM-4407: Add test for the duplicate resources issue with AGP 8.4.x
Browse files Browse the repository at this point in the history
  • Loading branch information
0xnm committed May 29, 2024
1 parent 7374873 commit e254419
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,21 @@ internal class DdAndroidGradlePluginFunctionalTest {
assertThat(result).hasSuccessfulTaskOutcome(":samples:app:assembleRelease")
}

@Test
fun `M success W assembleRelease { new Variant API is used in buildscript }`() {
// Given
stubGradleBuildFromResourceFile(
"build_with_android_components.gradle",
appBuildGradleFile
)
// When
val result = gradleRunner { withArguments("--stacktrace", ":samples:app:assembleRelease") }
.build()

// Then
assertThat(result).hasSuccessfulTaskOutcome(":samples:app:assembleRelease")
}

@Test
fun `M success W assembleRelease { project with library module }`() {
// Given
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
plugins {
id("com.android.application")
id("kotlin-android")
id("com.datadoghq.dd-sdk-android-gradle-plugin")
}

repositories {
google()
mavenCentral()
}

extensions.configure("androidComponents") { extension ->
extension.onVariants(extension.selector().all()) { variant ->
// just request assets, this will be enough to reproduce
// https://issuetracker.google.com/issues/342428022 when using new Variant API + legacy one
// with AGP 8.4.0
variant.getSources().getAssets()
}
}

android {
compileSdkVersion = rootProject.ext.targetSdkVersion
buildToolsVersion = rootProject.ext.buildToolsVersion

defaultConfig {
applicationId "com.example.variants"
minSdkVersion 21
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
multiDexEnabled = true
}

buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile ('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}

namespace = "com.example.variants"

compileOptions {
sourceCompatibility = rootProject.ext.jvmTarget
targetCompatibility = rootProject.ext.jvmTarget
}

kotlinOptions {
jvmTarget = rootProject.ext.jvmTarget
}
}

dependencies {
implementation(rootProject.ext.datadogSdkDependency)
}

0 comments on commit e254419

Please sign in to comment.