@@ -2,19 +2,42 @@ def safeExtGet(prop, fallback) {
2
2
rootProject. ext. has(prop) ? rootProject. ext. get(prop) : fallback
3
3
}
4
4
5
+ def useDedicatedExecutor = rootProject. hasProperty(' AsyncStorage_dedicatedExecutor' )
6
+ ? rootProject. properties[' AsyncStorage_dedicatedExecutor' ]
7
+ : false
8
+
9
+
5
10
buildscript {
6
- // The Android Gradle plugin is only required when opening the android folder stand-alone.
7
- // This avoids unnecessary downloads and potential conflicts when the library is included as a
8
- // module dependency in an application project.
9
- if (project == rootProject) {
10
- repositories {
11
- google()
11
+ def isRootProject = project == rootProject
12
+
13
+ ext. ktCoroutinesVersion = " 1.3.8"
14
+
15
+ // kotlin version can be set by setting ext.kotlinVersion or having it in gradle.properties in root
16
+ ext. asyncStorageKtVersion = rootProject. ext. has(' kotlinVersion' )
17
+ ? rootProject. ext. get(' kotlinVersion' )
18
+ : properties[' kotlinVersion' ]
19
+ ? properties[' kotlinVersion' ]
20
+ : " 1.3.72"
21
+
22
+ repositories {
23
+ if (isRootProject) {
12
24
jcenter()
13
25
}
14
- dependencies {
26
+ google()
27
+ mavenCentral()
28
+ }
29
+
30
+ dependencies {
31
+ classpath " org.jetbrains.kotlin:kotlin-gradle-plugin:$asyncStorageKtVersion "
32
+ if (isRootProject) {
33
+ // The Android Gradle plugin is only required when opening the android folder stand-alone.
34
+ // This avoids unnecessary downloads and potential conflicts when the library is included as a
35
+ // module dependency in an application project.
15
36
classpath ' com.android.tools.build:gradle:3.5.0'
16
37
}
17
38
}
39
+
40
+
18
41
}
19
42
20
43
// AsyncStorage has default size of 6MB.
@@ -24,16 +47,12 @@ buildscript {
24
47
long dbSizeInMB = 6L
25
48
26
49
def newDbSize = rootProject. properties[' AsyncStorage_db_size_in_MB' ]
27
-
28
- if ( newDbSize != null && newDbSize. isLong()) {
50
+ if (newDbSize != null && newDbSize. isLong()) {
29
51
dbSizeInMB = newDbSize. toLong()
30
52
}
31
53
32
- def useDedicatedExecutor = rootProject. hasProperty(' AsyncStorage_dedicatedExecutor' )
33
- ? rootProject. properties[' AsyncStorage_dedicatedExecutor' ]
34
- : false
35
-
36
54
apply plugin : ' com.android.library'
55
+ apply plugin : ' kotlin-android'
37
56
38
57
android {
39
58
compileSdkVersion safeExtGet(' compileSdkVersion' , 28 )
@@ -62,4 +81,6 @@ repositories {
62
81
dependencies {
63
82
// noinspection GradleDynamicVersion
64
83
implementation ' com.facebook.react:react-native:+' // From node_modules
84
+ implementation " org.jetbrains.kotlin:kotlin-stdlib-jdk8:$asyncStorageKtVersion "
85
+ implementation " org.jetbrains.kotlinx:kotlinx-coroutines-android:$ktCoroutinesVersion "
65
86
}
0 commit comments