@@ -30,21 +30,20 @@ gradle.projectsEvaluated {
3030
3131 productFlavors. each { productFlavorName ->
3232 buildTypes. each { buildTypeName ->
33- // Create variant and source names
34- def sourceName = " ${ buildTypeName} "
35- def targetName = " ${ sourceName.capitalize()} "
36- if (productFlavorName) {
37- sourceName = " ${ productFlavorName}${ targetName} "
38- }
33+ // Create variant and target names
34+ def targetName = " ${ productFlavorName.capitalize()}${ buildTypeName.capitalize()} "
35+ def targetPath = productFlavorName ?
36+ " ${ productFlavorName} /${ buildTypeName} " :
37+ " ${ buildTypeName} "
3938
4039 // React js bundle directories
4140 def jsBundleDirConfigName = " jsBundleDir${ targetName} "
4241 def jsBundleDir = elvisFile(config. " $jsBundleDirConfigName " ) ?:
43- file(" $buildDir /intermediates/assets/${ sourceName } " )
42+ file(" $buildDir /intermediates/assets/${ targetPath } " )
4443
45- def resourcesDirConfigName = " jsBundleDir ${ targetName} "
44+ def resourcesDirConfigName = " resourcesDir ${ targetName} "
4645 def resourcesDir = elvisFile(config. " ${ resourcesDirConfigName} " ) ?:
47- file(" $buildDir /intermediates/res/merged/${ sourceName } " )
46+ file(" $buildDir /intermediates/res/merged/${ targetPath } " )
4847 def jsBundleFile = file(" $jsBundleDir /$bundleAssetName " )
4948
5049 // Bundle task name for variant
@@ -73,14 +72,16 @@ gradle.projectsEvaluated {
7372 // Set up dev mode
7473 def devEnabled = ! targetName. toLowerCase(). contains(" release" )
7574 if (Os . isFamily(Os . FAMILY_WINDOWS )) {
76- commandLine " cmd" , " /c" , " react-native" , " bundle" , " --platform" , " android" , " --dev" , " ${ devEnabled} " ,
75+ commandLine " cmd" , " /c" , " node " , " node_modules/ react-native/local-cli/cli.js " , " bundle" , " --platform" , " android" , " --dev" , " ${ devEnabled} " ,
7776 " --entry-file" , entryFile, " --bundle-output" , jsBundleFile, " --assets-dest" , resourcesDir
7877 } else {
79- commandLine " react-native" , " bundle" , " --platform" , " android" , " --dev" , " ${ devEnabled} " ,
78+ commandLine " node " , " node_modules/ react-native/local-cli/cli.js " , " bundle" , " --platform" , " android" , " --dev" , " ${ devEnabled} " ,
8079 " --entry-file" , entryFile, " --bundle-output" , jsBundleFile, " --assets-dest" , resourcesDir
8180 }
8281
83- enabled config. " bundleIn${ targetName} " ?: targetName. toLowerCase(). contains(" release" )
82+ enabled config. " bundleIn${ targetName} " ||
83+ config. " bundleIn${ buildTypeName.capitalize()} " ?:
84+ targetName. toLowerCase(). contains(" release" )
8485 }
8586
8687 // Hook bundle${productFlavor}${buildType}JsAndAssets into the android build process
0 commit comments