@@ -24,47 +24,6 @@ def isHmsEnabled() {
24
24
return (rootProject. hasProperty(" airshipHmsEnabled" ) && rootProject. getProperty(" airshipHmsEnabled" ) == " true" ) || (rootProject. ext. has(" airshipHmsEnabled" ) && rootProject. ext. get(" airshipHmsEnabled" ) == " true" )
25
25
}
26
26
27
- def resolveReactNativeDirectory () {
28
- def reactNativeLocation = rootProject. hasProperty(" reactNativeDir" ) ? rootProject. getProperty(" reactNativeDir" ) : null
29
-
30
- if (reactNativeLocation != null ) {
31
- return file(reactNativeLocation)
32
- }
33
-
34
- try {
35
- // Resolve React Native location with Node
36
- // This will make sure that we get installation location correctly in monorepos
37
- def reactNativePackageJsonPathStdout = new ByteArrayOutputStream ()
38
-
39
- exec {
40
- commandLine(" node" , " -p" , " require.resolve('react-native/package.json')" )
41
- ignoreExitValue true
42
- standardOutput = reactNativePackageJsonPathStdout
43
- }
44
-
45
- def reactNativeFromProjectNodeModules = file(reactNativePackageJsonPathStdout. toString(). trim()). getParentFile();
46
-
47
- if (reactNativeFromProjectNodeModules. exists()) {
48
- return reactNativeFromProjectNodeModules
49
- }
50
- } catch (e) {
51
- // Ignore
52
- }
53
-
54
- throw new Exception (
55
- " react-native-airship: Failed to resolve 'react-native' in the project. " +
56
- " If you have a non-standard project structure, you can specify 'reactNativeDir' with the path to 'react-native' in your 'gradle.properties' file."
57
- )
58
- }
59
-
60
-
61
- def reactNativeRootDir = resolveReactNativeDirectory()
62
- def reactProperties = new Properties ()
63
- file(" $reactNativeRootDir /ReactAndroid/gradle.properties" ). withInputStream { reactProperties. load(it) }
64
-
65
- def reactNativeVersion = reactProperties. getProperty(" VERSION_NAME" )
66
- def (reactNativeMajorVersion, reactNativeMinorVersion) = reactNativeVersion. split(" \\ ." ). collect { it. isInteger() ? it. toInteger() : it }
67
-
68
27
69
28
apply plugin : " com.android.library"
70
29
apply plugin : " kotlin-android"
@@ -81,6 +40,7 @@ def getExtOrIntegerDefault(name) {
81
40
return rootProject. ext. has(name) ? rootProject. ext. get(name) : (project. properties[" Airship_" + name]). toInteger()
82
41
}
83
42
43
+
84
44
android {
85
45
compileSdkVersion getExtOrIntegerDefault(" compileSdkVersion" )
86
46
@@ -111,12 +71,13 @@ android {
111
71
main {
112
72
if (isNewArchitectureEnabled()) {
113
73
java. srcDirs + = [
114
- " src/newarch/java" ,
115
- // This is needed to build Kotlin project with NewArch enabled
116
- " ${ project.buildDir} /generated/source/codegen/java"
74
+ " src/newarch" ,
75
+ // Codegen specs
76
+ " generated/java" ,
77
+ " generated/jni"
117
78
]
118
79
} else {
119
- java. srcDirs + = [" src/oldarch/java " ]
80
+ java. srcDirs + = [" src/oldarch" ]
120
81
}
121
82
}
122
83
}
@@ -142,14 +103,12 @@ def proxy_version = getExtOrDefault("airshipProxyVersion")
142
103
def airship_version = getExtOrDefault(" airshipVersion" )
143
104
144
105
dependencies {
145
- if (reactNativeMajorVersion == 0 && reactNativeMinorVersion < 71 ) {
146
- // noinspection GradleDynamicVersion
147
- implementation " com.facebook.react:react-native:+"
148
- } else {
149
- implementation " com.facebook.react:react-android"
150
- }
151
-
106
+ // For < 0.71, this will be from the local maven repo
107
+ // For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
108
+ // noinspection GradleDynamicVersion
109
+ implementation " com.facebook.react:react-native:+"
152
110
implementation " org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version "
111
+
153
112
api " com.urbanairship.android:airship-framework-proxy:$proxy_version "
154
113
155
114
if (isHmsEnabled()) {
0 commit comments