Skip to content

Commit

Permalink
Merge pull request #20498 from wordpress-mobile/issue/fix_react_nativ…
Browse files Browse the repository at this point in the history
…e_bundle_copy_task

fix: React Native bundle source map copy task
  • Loading branch information
wzieba authored Mar 19, 2024
2 parents 2fba552 + 60b2571 commit 6b46937
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions WordPress/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -717,19 +717,22 @@ if (project.hasProperty("debugStoreFile")) {
// Copy React Native JavaScript bundle and source map so they can be upload it to the Crash logging
// service during the build process.
android {
applicationVariants.all { variant ->
variant.mergeAssetsProvider.configure {
doLast {
// Copy bundle and source map files
copy {
from(outputDir)
into("${buildDir}/react-native-bundle-source-map")
include("*.bundle", "*.bundle.map")
}
applicationVariants.configureEach { variant ->
def variantAssets = variant.mergeAssetsProvider.get().outputDir.get()

// Delete source maps
delete(fileTree(dir: outputDir, includes: ['**/*.bundle.map']))
}
tasks.register("delete${variant.name.capitalize()}ReactNativeBundleSourceMap", Delete) {
delete(fileTree(dir: variantAssets, includes: ['**/*.bundle.map']))
}

tasks.register("copy${variant.name.capitalize()}ReactNativeBundleSourceMap", Copy) {
from(variantAssets)
into("${buildDir}/react-native-bundle-source-map")
include("*.bundle", "*.bundle.map")
finalizedBy("delete${variant.name.capitalize()}ReactNativeBundleSourceMap")
}

variant.mergeAssetsProvider.configure {
finalizedBy("copy${variant.name.capitalize()}ReactNativeBundleSourceMap")
}
}
}

0 comments on commit 6b46937

Please sign in to comment.