Skip to content

Commit

Permalink
Fix setting up paths for debug and instrumentation apks
Browse files Browse the repository at this point in the history
Setting `variant` under `configs` doesn't seem to work: runningcode/fladle#60
  • Loading branch information
wzieba committed Jul 31, 2024
1 parent 99d5c67 commit 4d28935
Showing 1 changed file with 39 additions and 23 deletions.
62 changes: 39 additions & 23 deletions WordPress/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ plugins {
fladle {
configs {
wordpress {
variant.set("wordpressVanillaDebug")
debugApk.set(pathForVariant("wordpress", "debugApk"))
instrumentationApk.set(pathForVariant("wordpress", "instrumentationApk"))
}
jetpack {
variant.set("jetpackVanillaDebug")
debugApk.set(pathForVariant("jetpack", "debugApk"))
instrumentationApk.set(pathForVariant("jetpack", "instrumentationApk"))
}
}
serviceAccountCredentials = new File(System.getProperty("user.home"), ".configure/wordpress-android/secrets/firebase.secrets.json")
Expand All @@ -40,6 +42,18 @@ fladle {
smartFlankGcsPath = "gs://fladle/wordpress-android/smart-flank/JUnitReport.xml"
}

String pathForVariant(String app, String type) {
if (!["debugApk", "instrumentationApk"].contains(type)) {
throw new IllegalArgumentException("Type must be 'debugApk' or 'instrumentationApk', but was '$type'")
}
String appPath = "outputs/apk/${app}Vanilla/debug"
String testPath = "outputs/apk/androidTest/${app}Vanilla/debug"

String path = type == "debugApk" ? appPath : testPath

return new File(layout.buildDirectory.dir(path).get().asFile, '*.apk').absolutePath
}

sentry {
tracingInstrumentation {
enabled = true
Expand Down Expand Up @@ -197,7 +211,7 @@ android {
buildConfigField "boolean", "SYNC_PUBLISHING", "false"
buildConfigField "boolean", "ENABLE_IN_APP_UPDATES", "false"

manifestPlaceholders = [magicLinkScheme:"wordpress"]
manifestPlaceholders = [magicLinkScheme: "wordpress"]
}

// Gutenberg's dependency - react-native-video is using
Expand All @@ -223,7 +237,7 @@ android {
buildConfigField "boolean", "ENABLE_QRCODE_AUTH_FLOW", "false"
buildConfigField "boolean", "ENABLE_OPEN_WEB_LINKS_WITH_JP_FLOW", "true"

manifestPlaceholders = [magicLinkScheme:"wordpress"]
manifestPlaceholders = [magicLinkScheme: "wordpress"]
}

jetpack {
Expand All @@ -243,7 +257,7 @@ android {
buildConfigField "boolean", "ENABLE_QRCODE_AUTH_FLOW", "true"
buildConfigField "boolean", "ENABLE_OPEN_WEB_LINKS_WITH_JP_FLOW", "false"

manifestPlaceholders = [magicLinkScheme:"jetpack"]
manifestPlaceholders = [magicLinkScheme: "jetpack"]

// Limit string resources to Mag16 only for Jetpack
// Note 1: this only affects included _locales_; variants for `values-night`, `values-land` and other configs are _still_ preserved in Jetpack and not filtered by this.
Expand Down Expand Up @@ -281,7 +295,8 @@ android {
// Also dynamically add additional `buildConfigFields` to our app flavors from any `wp.`/`jp.`-prefixed property in `gradle.properties`
def properties = loadPropertiesFromFile(checkGradlePropertiesFile())
addBuildConfigFieldsFromPrefixedProperties(wordpress, properties, ['wp'])
addBuildConfigFieldsFromPrefixedProperties(jetpack, properties, ['wp', 'jp']) // Inherit same properties used from WP first then overwrite with JP-specific ones
addBuildConfigFieldsFromPrefixedProperties(jetpack, properties, ['wp', 'jp'])
// Inherit same properties used from WP first then overwrite with JP-specific ones
}

buildTypes {
Expand Down Expand Up @@ -379,15 +394,15 @@ dependencies {
implementation "androidx.navigation:navigation-compose:$androidxComposeNavigationVersion"
compileOnly project(path: ':libs:annotations')
ksp project(':libs:processors')
implementation (project(path:':libs:networking')) {
implementation(project(path: ':libs:networking')) {
exclude group: "com.android.volley"
exclude group: 'org.wordpress', module: 'utils'
}
implementation (project(path:':libs:analytics')) {
implementation(project(path: ':libs:analytics')) {
exclude group: 'org.wordpress', module: 'utils'
}
implementation project(path:':libs:image-editor')
implementation (project(path:':libs:editor')) {
implementation project(path: ':libs:image-editor')
implementation(project(path: ':libs:editor')) {
exclude group: 'org.wordpress', module: 'utils'
}
implementation("$gradle.ext.fluxCBinaryPath:$wordPressFluxCVersion") {
Expand All @@ -398,12 +413,12 @@ dependencies {
exclude group: 'org.wordpress', module: 'utils'
exclude group: 'com.android.support', module: 'support-annotations'
}
implementation ("$gradle.ext.wputilsBinaryPath:$wordPressUtilsVersion") {
implementation("$gradle.ext.wputilsBinaryPath:$wordPressUtilsVersion") {
version {
strictly wordPressUtilsVersion
}
}
implementation ("$gradle.ext.loginFlowBinaryPath:$wordPressLoginVersion") {
implementation("$gradle.ext.loginFlowBinaryPath:$wordPressLoginVersion") {
exclude group: 'com.github.bumptech.glide'
exclude group: 'org.wordpress', module: 'utils'
}
Expand All @@ -415,7 +430,7 @@ dependencies {
}
}

implementation ("com.automattic:rest:$automatticRestVersion") {
implementation("com.automattic:rest:$automatticRestVersion") {
exclude group: 'com.mcxiaoke.volley'
}
implementation "org.wordpress:persistentedittext:$wordPressPersistentEditTextVersion"
Expand Down Expand Up @@ -477,7 +492,7 @@ dependencies {
implementation "org.apache.commons:commons-text:$apacheCommonsTextVersion"
implementation "com.airbnb.android:lottie:$lottieVersion"
implementation "com.facebook.shimmer:shimmer:$facebookShimmerVersion"
implementation ("com.github.yalantis:ucrop:$uCropVersion") {
implementation("com.github.yalantis:ucrop:$uCropVersion") {
exclude group: 'androidx.core', module: 'core'
exclude group: 'androidx.constraintlayout', module: 'constraintlayout'
exclude group: 'androidx.appcompat', module: 'appcompat'
Expand All @@ -488,12 +503,12 @@ dependencies {
implementation "com.github.indexos.media-for-mobile:domain:$indexosMediaForMobileVersion"
implementation "com.github.indexos.media-for-mobile:android:$indexosMediaForMobileVersion"
implementation "com.zendesk:support:$zendeskVersion"
implementation (name:'tenor-android-core-jetified', ext:'aar') // Jetified Tenor Gif library
implementation(name: 'tenor-android-core-jetified', ext: 'aar') // Jetified Tenor Gif library
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinxCoroutinesVersion"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlinxCoroutinesVersion"
implementation "com.github.PhilJay:MPAndroidChart:$philjayMpAndroidChartVersion"
implementation "org.jsoup:jsoup:$jsoupVersion"
implementation ("com.google.android.exoplayer:exoplayer:$googleExoPlayerVersion") {
implementation("com.google.android.exoplayer:exoplayer:$googleExoPlayerVersion") {
exclude group: 'com.android.support', module: 'support-annotations'
}
implementation "com.google.dagger:dagger-android-support:$gradle.ext.daggerVersion"
Expand All @@ -512,7 +527,7 @@ dependencies {
testImplementation "org.assertj:assertj-core:$assertjVersion"
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$kotlinxCoroutinesVersion"

androidTestImplementation project(path:':libs:mocks')
androidTestImplementation project(path: ':libs:mocks')

androidTestImplementation "org.mockito:mockito-android:$mockitoAndroidVersion"
androidTestImplementation "org.mockito.kotlin:mockito-kotlin:$mockitoKotlinVersion"
Expand Down Expand Up @@ -540,10 +555,11 @@ dependencies {
androidTestImplementation "androidx.test:runner:$androidxTestCoreVersion"
androidTestImplementation "androidx.test:rules:$androidxTestCoreVersion"
androidTestImplementation "androidx.test.ext:junit:$androidxTestExtJunitVersion"
androidTestImplementation "tools.fastlane:screengrab:$screengrabVersion", {
androidTestImplementation "tools.fastlane:screengrab:$screengrabVersion", {
exclude group: 'com.android.support.test.uiautomator', module: 'uiautomator-v18'
}
androidTestImplementation (name:'cloudtestingscreenshotter_lib', ext:'aar') // Screenshots on Firebase Cloud Testing
androidTestImplementation(name: 'cloudtestingscreenshotter_lib', ext: 'aar')
// Screenshots on Firebase Cloud Testing
androidTestImplementation "androidx.work:work-testing:$androidxWorkManagerVersion"
androidTestImplementation "com.google.dagger:hilt-android-testing:$gradle.ext.daggerVersion"
kspAndroidTest "com.google.dagger:hilt-android-compiler:$gradle.ext.daggerVersion"
Expand Down Expand Up @@ -593,12 +609,12 @@ dependencies {
implementation "com.automattic.tracks:crashlogging:$automatticTracksVersion"

// - Flipper
debugImplementation ("com.facebook.flipper:flipper:$flipperVersion") {
exclude group:'org.jetbrains.kotlinx', module:'kotlinx-serialization-json-jvm'
debugImplementation("com.facebook.flipper:flipper:$flipperVersion") {
exclude group: 'org.jetbrains.kotlinx', module: 'kotlinx-serialization-json-jvm'
}
debugImplementation "com.facebook.soloader:soloader:$soLoaderVersion"
debugImplementation ("com.facebook.flipper:flipper-network-plugin:$flipperVersion"){
exclude group:'org.jetbrains.kotlinx', module:'kotlinx-serialization-json-jvm'
debugImplementation("com.facebook.flipper:flipper-network-plugin:$flipperVersion") {
exclude group: 'org.jetbrains.kotlinx', module: 'kotlinx-serialization-json-jvm'
}
releaseImplementation "com.facebook.flipper:flipper-noop:$flipperVersion"
}
Expand Down

0 comments on commit 4d28935

Please sign in to comment.