-
Notifications
You must be signed in to change notification settings - Fork 100
/
Copy pathbuild.gradle
82 lines (69 loc) · 2.36 KB
/
build.gradle
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
apply plugin: 'com.android.library'
apply from: './jacoco.gradle'
apply from: './native.gradle'
apply from: './sourcemaps.gradle'
String getExtOrDefault(String name) {
def defaultPropertyKey = 'InstabugReactNative_' + name
if (rootProject.ext.has(name)) {
return rootProject.ext.get(name)
}
return project.properties[defaultPropertyKey]
}
static boolean supportsNamespace() {
return false
def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
def major = parsed[0].toInteger()
def minor = parsed[1].toInteger()
// Namespace support was added in 7.3.0
return false
}
void updateManifestPackage() {
def packageProp = 'package="com.instabug.reactlibrary"'
def manifestFile = file("$projectDir/src/main/AndroidManifest.xml")
def currentContent = manifestFile.getText()
def content = currentContent
def hasPackage = currentContent.contains(packageProp)
if (supportsNamespace()) {
content = content.replaceAll(packageProp, '')
} else if (!hasPackage) {
content = content.replace(
'<manifest',
"<manifest $packageProp "
)
}
def shouldUpdateManifest = content != currentContent
if (shouldUpdateManifest) {
manifestFile.write(content)
}
}
updateManifestPackage()
android {
if (supportsNamespace()) {
namespace "com.instabug.reactlibrary"
}
compileSdkVersion getExtOrDefault('compileSdkVersion').toInteger()
buildToolsVersion getExtOrDefault('buildToolsVersion')
defaultConfig {
minSdkVersion getExtOrDefault('minSdkVersion').toInteger()
targetSdkVersion getExtOrDefault('targetSdkVersion').toInteger()
versionCode 1
versionName "14.0.2"
multiDexEnabled true
ndk {
abiFilters "armeabi-v7a", "x86"
}
consumerProguardFiles 'proguard-rules.txt'
}
lintOptions {
warning 'InvalidPackage'
abortOnError true
// SuppressLint WrongConstant was used to suppress errors when using arrays of ints to represent annotations.
}
}
dependencies {
implementation "androidx.multidex:multidex:2.0.1"
implementation 'com.facebook.react:react-native:+'
testImplementation "org.mockito:mockito-inline:3.12.1"
testImplementation "org.mockito:mockito-android:3.4.0"
testImplementation 'junit:junit:4.13.2'
}