forked from microsoft/react-native-code-push
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
98 lines (77 loc) · 2.43 KB
/
build.gradle
File metadata and controls
98 lines (77 loc) · 2.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
import groovy.json.JsonSlurper
apply plugin: "com.android.library"
def safeExtGet(prop, fallback) {
return rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}
def DEFAULT_COMPILE_SDK_VERSION = 26
def DEFAULT_TARGET_SDK_VERSION = 26
def DEFAULT_MIN_SDK_VERSION = 16
def findReactNativePackageJson() {
File currentDir = projectDir
while (currentDir != null) {
File packageJson = new File(currentDir, "node_modules/react-native/package.json")
if (packageJson.exists()) {
return packageJson
}
currentDir = currentDir.parentFile
}
return null
}
def getReactNativeVersion() {
File packageJson = findReactNativePackageJson()
if (packageJson == null) {
return null
}
def version = new JsonSlurper().parseText(packageJson.text).version
return version.tokenize("-")[0]
}
def getReactNativeMinorVersion() {
def reactNativeVersion = getReactNativeVersion()
if (reactNativeVersion == null) {
return null
}
def versionParts = reactNativeVersion.tokenize(".")
if (versionParts.size() < 2) {
return null
}
return versionParts[1].toInteger()
}
def reactNativeVersion = getReactNativeVersion()
def reactNativeMinorVersion = getReactNativeMinorVersion()
def reactNativeDependency = reactNativeMinorVersion != null && reactNativeMinorVersion < 71
? "com.facebook.react:react-native:${reactNativeVersion ?: '+'}"
: "com.facebook.react:react-android:${reactNativeVersion ?: '+'}"
android {
if (project.android.hasProperty("namespace")) {
namespace "com.microsoft.codepush.react"
}
compileSdkVersion safeExtGet("compileSdkVersion", DEFAULT_COMPILE_SDK_VERSION)
defaultConfig {
minSdkVersion safeExtGet("minSdkVersion", DEFAULT_MIN_SDK_VERSION)
targetSdkVersion safeExtGet("targetSdkVersion", DEFAULT_TARGET_SDK_VERSION)
versionCode 1
versionName "1.0"
consumerProguardFiles "../proguard-rules.pro"
}
sourceSets {
main {
java.srcDirs = ["../src/main/java"]
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
lintOptions {
abortOnError false
}
}
repositories {
google()
mavenCentral()
mavenLocal()
}
dependencies {
implementation(reactNativeDependency)
implementation "com.nimbusds:nimbus-jose-jwt:9.37.3"
}