react-native-mmkv 1.5.2 → 1.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -28,6 +28,50 @@ def getExtOrIntegerDefault(name) {
28
28
  return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties['Mmkv_' + name]).toInteger()
29
29
  }
30
30
 
31
+ def found = false
32
+ def defaultDir = null
33
+ def androidSourcesDir = null
34
+ def androidSourcesName = 'React Native sources'
35
+
36
+ if (rootProject.ext.has('reactNativeAndroidRoot')) {
37
+ defaultDir = rootProject.ext.get('reactNativeAndroidRoot')
38
+ androidSourcesDir = defaultDir.parentFile.toString()
39
+ } else {
40
+ defaultDir = new File(
41
+ projectDir,
42
+ '/../../../node_modules/react-native/android'
43
+ )
44
+ androidSourcesDir = defaultDir.parentFile.toString()
45
+ }
46
+
47
+ if (defaultDir.exists()) {
48
+ found = true
49
+ } else {
50
+ def parentDir = rootProject.projectDir
51
+ defaultDir = new File(parentDir, '../node_modules/react-native/android')
52
+
53
+ 1.upto(5, {
54
+ if (found) return true
55
+ parentDir = parentDir.parentFile
56
+
57
+ androidSourcesDir = new File(
58
+ parentDir,
59
+ 'node_modules/react-native'
60
+ )
61
+
62
+ def androidPrebuiltBinaryDir = new File(
63
+ parentDir,
64
+ 'node_modules/react-native/android'
65
+ )
66
+
67
+ if (androidPrebuiltBinaryDir.exists()) {
68
+ found = true
69
+ } else if (androidSourcesDir.exists()) {
70
+ found = true
71
+ }
72
+ })
73
+ }
74
+
31
75
  android {
32
76
  compileSdkVersion getExtOrIntegerDefault('compileSdkVersion')
33
77
  buildToolsVersion getExtOrDefault('buildToolsVersion')
@@ -43,7 +87,7 @@ android {
43
87
  cppFlags "-fexceptions", "-frtti", "-std=c++1y", "-DONANDROID"
44
88
  abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a'
45
89
  arguments '-DANDROID_STL=c++_shared',
46
- "-DNODE_MODULES_DIR=${rootDir}/../node_modules"
90
+ "-DNODE_MODULES_DIR=${defaultDir.parentFile.parentFile.toString()}"
47
91
  }
48
92
  }
49
93
  }
@@ -85,19 +129,6 @@ repositories {
85
129
  mavenCentral()
86
130
  google()
87
131
 
88
- def found = false
89
- def defaultDir = null
90
- def androidSourcesName = 'React Native sources'
91
-
92
- if (rootProject.ext.has('reactNativeAndroidRoot')) {
93
- defaultDir = rootProject.ext.get('reactNativeAndroidRoot')
94
- } else {
95
- defaultDir = new File(
96
- projectDir,
97
- '/../../../node_modules/react-native/android'
98
- )
99
- }
100
-
101
132
  if (defaultDir.exists()) {
102
133
  maven {
103
134
  url defaultDir.toString()
@@ -105,24 +136,11 @@ repositories {
105
136
  }
106
137
 
107
138
  logger.info(":${project.name}:reactNativeAndroidRoot ${defaultDir.canonicalPath}")
108
- found = true
109
139
  } else {
110
140
  def parentDir = rootProject.projectDir
111
-
112
- 1.upto(5, {
113
- if (found) return true
114
- parentDir = parentDir.parentFile
115
-
116
- def androidSourcesDir = new File(
117
- parentDir,
118
- 'node_modules/react-native'
119
- )
120
-
121
- def androidPrebuiltBinaryDir = new File(
122
- parentDir,
123
- 'node_modules/react-native/android'
124
- )
125
-
141
+ defaultDir = new File(parentDir, '../node_modules/react-native/android')
142
+
143
+ 1.upto(5, {
126
144
  if (androidPrebuiltBinaryDir.exists()) {
127
145
  maven {
128
146
  url androidPrebuiltBinaryDir.toString()
@@ -130,7 +148,6 @@ repositories {
130
148
  }
131
149
 
132
150
  logger.info(":${project.name}:reactNativeAndroidRoot ${androidPrebuiltBinaryDir.canonicalPath}")
133
- found = true
134
151
  } else if (androidSourcesDir.exists()) {
135
152
  maven {
136
153
  url androidSourcesDir.toString()
@@ -138,7 +155,6 @@ repositories {
138
155
  }
139
156
 
140
157
  logger.info(":${project.name}:reactNativeAndroidRoot ${androidSourcesDir.canonicalPath}")
141
- found = true
142
158
  }
143
159
  })
144
160
  }
@@ -160,17 +176,18 @@ dependencies {
160
176
  //noinspection GradleDynamicVersion
161
177
  extractJNI("com.facebook.fbjni:fbjni:+")
162
178
 
163
- def rnAAR = fileTree("${rootDir}/../node_modules/react-native/android").matching({ it.include "**/**/*.aar" }).singleFile
179
+ def rnAAR = fileTree("${defaultDir.toString()}").matching({ it.include "**/**/*.aar" }).singleFile
164
180
  extractJNI(files(rnAAR))
165
181
  }
166
182
 
167
-
168
183
  // third-party-ndk deps headers
169
184
  // mostly a copy of https://github.com/software-mansion/react-native-reanimated/blob/master/android/build.gradle#L115
170
185
 
186
+
187
+
171
188
  def downloadsDir = new File("$buildDir/downloads")
172
189
  def thirdPartyNdkDir = new File("$buildDir/third-party-ndk")
173
- def thirdPartyVersionsFile = new File("${rootDir}/../node_modules/react-native/ReactAndroid/gradle.properties")
190
+ def thirdPartyVersionsFile = new File("${androidSourcesDir.toString()}/ReactAndroid/gradle.properties")
174
191
  def thirdPartyVersions = new Properties()
175
192
  thirdPartyVersions.load(new FileInputStream(thirdPartyVersionsFile))
176
193
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-mmkv",
3
- "version": "1.5.2",
3
+ "version": "1.5.3",
4
4
  "description": "An efficient, small mobile key-value storage framework developed by WeChat. Works on Android and iOS.",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -10,7 +10,7 @@ Pod::Spec.new do |s|
10
10
  s.license = package["license"]
11
11
  s.authors = package["author"]
12
12
 
13
- s.platforms = { :ios => "11.0" }
13
+ s.platforms = { :ios => "11.0", :tvos => "12.0" }
14
14
  s.source = { :git => "https://github.com/mrousavy/react-native-mmkv.git", :tag => "#{s.version}" }
15
15
 
16
16
  # All source files that should be publicly visible