From f7cfeab8f025dfef28cb83cf14326117693fcb4d Mon Sep 17 00:00:00 2001 From: Leon Kiefer Date: Tue, 17 Aug 2021 17:29:18 +0200 Subject: [PATCH] copy bundled js into correct libraries assets dir --- react.gradle | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/react.gradle b/react.gradle index 014d30d69a78e5..0edc7ca3bc5a4f 100644 --- a/react.gradle +++ b/react.gradle @@ -282,20 +282,26 @@ afterEvaluate { if (config."jsBundleDir${targetName}") { from(jsBundleDir) into(file(config."jsBundleDir${targetName}")) - } else { + } else { into ("$buildDir/intermediates") - into ("assets/${targetPath}") { - from(jsBundleDir) - } + if (isAndroidLibrary) { + into ("library_assets/${variant.name}/out") { + from(jsBundleDir) + } + } else { + into ("assets/${targetPath}") { + from(jsBundleDir) + } - // Workaround for Android Gradle Plugin 3.2+ new asset directory - into ("merged_assets/${variant.name}/merge${targetName}Assets/out") { - from(jsBundleDir) - } + // Workaround for Android Gradle Plugin 3.2+ new asset directory + into ("merged_assets/${variant.name}/merge${targetName}Assets/out") { + from(jsBundleDir) + } - // Workaround for Android Gradle Plugin 3.4+ new asset directory - into ("merged_assets/${variant.name}/out") { - from(jsBundleDir) + // Workaround for Android Gradle Plugin 3.4+ new asset directory + into ("merged_assets/${variant.name}/out") { + from(jsBundleDir) + } } } @@ -303,6 +309,7 @@ afterEvaluate { dependsOn(variant.mergeAssetsProvider.get()) enabled(currentBundleTask.enabled) + dependsOn(currentBundleTask) } // mergeResources task runs before the bundle file is copied to the intermediate asset directory from Android plugin 4.1+.