Skip to content

Commit 5addacb

Browse files
bmaluffAnatolyPristenskyMikhailSuendukovDmitriyKirakosyan
authored
Update codepush.gradle (#2471)
* Update codepush.gradle config was receiving an ArrayList as a false case, but ArrayLists don't support get() method, so it should receive a Map instance. * Fix get on null object Add more verifications for config variable --------- Co-authored-by: Anatoly Pristensky <[email protected]> Co-authored-by: MikhailSuendukov <[email protected]> Co-authored-by: Dima <[email protected]>
1 parent ca3fd56 commit 5addacb

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

android/codepush.gradle

+7-7
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
import java.nio.file.Paths;
44

5-
def config = project.extensions.findByName("react") ?: []
6-
def bundleAssetName = config.bundleAssetName.get() ?: "index.android.bundle"
5+
def config = project.extensions.findByName("react") ?: [:]
6+
def bundleAssetName = config.bundleAssetName ? config.bundleAssetName.get() : "index.android.bundle"
77

88
// because elvis operator
99
def elvisFile(thing) {
@@ -24,7 +24,7 @@ android.buildTypes.each { buildType ->
2424
}
2525

2626
gradle.projectsEvaluated {
27-
def debuggableVariants = config.debuggableVariants.get() ?: ['debug']
27+
def debuggableVariants = config.debuggableVariants ? config.debuggableVariants.get() : ['debug']
2828

2929
android.applicationVariants.all { variant ->
3030
// No code push for debuggable variants
@@ -49,8 +49,8 @@ gradle.projectsEvaluated {
4949
def jsBundleFile;
5050

5151
// Additional node commandline arguments
52-
def nodeExecutableAndArgs = config.nodeExecutableAndArgs.get() ?: ["node"]
53-
def extraPackagerArgs = config.extraPackagerArgs.get() ?: []
52+
def nodeExecutableAndArgs = config.nodeExecutableAndArgs ? config.nodeExecutableAndArgs.get(): ["node"]
53+
def extraPackagerArgs = config.extraPackagerArgs ? config.extraPackagerArgs.get() : []
5454

5555
// Make this task run right after the bundle task
5656
def generateBundledResourcesHash;
@@ -77,11 +77,11 @@ gradle.projectsEvaluated {
7777
runBefore("merge${targetName}Assets", generateBundledResourcesHash)
7878
} else {
7979
def jsBundleDirConfigName = "jsBundleDir${targetName}"
80-
jsBundleDir = elvisFile(config."$jsBundleDirConfigName").get() ?:
80+
jsBundleDir = elvisFile(config."$jsBundleDirConfigName") ? elvisFile(config."$jsBundleDirConfigName").get():
8181
file("$buildDir/intermediates/assets/${targetPath}")
8282

8383
def resourcesDirConfigName = "resourcesDir${targetName}"
84-
resourcesDir = elvisFile(config."${resourcesDirConfigName}").get() ?:
84+
resourcesDir = elvisFile(config."${resourcesDirConfigName}") ? elvisFile(config."${resourcesDirConfigName}").get():
8585
file("$buildDir/intermediates/res/merged/${targetPath}")
8686

8787
// In case version of 'Android Plugin for Gradle'' is lower than 1.3.0

0 commit comments

Comments
 (0)