|
| 1 | +import groovy.json.JsonSlurper |
| 2 | + |
1 | 3 | buildscript { |
2 | 4 |
|
3 | 5 | repositories { |
@@ -50,6 +52,12 @@ if (reactNativeDir.exists()) { |
50 | 52 | }) |
51 | 53 | } |
52 | 54 |
|
| 55 | +def reactNative = reactNativeDir.absolutePath; |
| 56 | +def reactNativeManifest = file("$reactNative/../package.json") |
| 57 | +def reactNativeManifestAsJson = new JsonSlurper().parseText(reactNativeManifest.text) |
| 58 | +def reactNativeVersion = reactNativeManifestAsJson.version as String |
| 59 | +def (major, minor, patch) = reactNativeVersion.tokenize('.') |
| 60 | +def rnMinorVersion = Integer.parseInt(minor) |
53 | 61 |
|
54 | 62 | android { |
55 | 63 | compileSdkVersion getExtOrDefault('compileSdkVersion', 28) |
@@ -116,9 +124,18 @@ dependencies { |
116 | 124 | implementation 'com.facebook.react:react-native:+' |
117 | 125 | implementation "androidx.security:security-crypto:1.1.0-alpha03" |
118 | 126 | implementation 'com.google.code.gson:gson:2.8.6' |
| 127 | + def buildType = "debug" |
| 128 | + tasks.all({ task -> |
| 129 | + if (task.name == "buildCMakeRelease") { |
| 130 | + buildType = "release" |
| 131 | + } |
| 132 | + }) |
| 133 | + def rnAarMatcher = "**/react-native/**/*${buildType}.aar" |
| 134 | + if (rnMinorVersion < 69) { |
| 135 | + rnAarMatcher = "**/**/*.aar" |
| 136 | + } |
119 | 137 |
|
120 | | - def rnAAR = fileTree(reactNativeDir.toString()).matching({ it.include "**/**/*.aar" }).singleFile |
121 | | - |
| 138 | + def rnAAR = fileTree("$reactNative").matching({ it.include rnAarMatcher }).singleFile |
122 | 139 | files(rnAAR).each { |
123 | 140 | def file = it.absoluteFile |
124 | 141 | def aarFolder = new File("$buildDir/../$file.name"); |
|
0 commit comments