Skip to content

Commit a3b798f

Browse files
committed
restore android folder
1 parent 6c7ed2b commit a3b798f

10 files changed

Lines changed: 539 additions & 0 deletions

File tree

android/build.gradle

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
buildscript {
2+
// Buildscript is evaluated before everything else so we can't use getExtOrDefault
3+
def kotlin_version = rootProject.ext.has('kotlinVersion') ? rootProject.ext.get('kotlinVersion') : rootProject.ext.has('kotlin_version') ? rootProject.ext.get('kotlin_version') : project.properties['Ama_kotlinVersion']
4+
5+
repositories {
6+
google()
7+
mavenCentral()
8+
}
9+
10+
dependencies {
11+
classpath 'com.android.tools.build:gradle:3.2.1'
12+
// noinspection DifferentKotlinGradleVersion
13+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
14+
}
15+
}
16+
17+
apply plugin: 'com.android.library'
18+
apply plugin: 'kotlin-android'
19+
20+
def getExtOrDefault(name) {
21+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['Ama_' + name]
22+
}
23+
24+
def getExtOrIntegerDefault(name) {
25+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties['Ama_' + name]).toInteger()
26+
}
27+
28+
android {
29+
compileSdkVersion getExtOrIntegerDefault('compileSdkVersion')
30+
defaultConfig {
31+
minSdkVersion 16
32+
targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
33+
versionCode 1
34+
versionName "1.0"
35+
36+
}
37+
38+
buildTypes {
39+
release {
40+
minifyEnabled false
41+
}
42+
}
43+
lintOptions {
44+
disable 'GradleCompatible'
45+
}
46+
compileOptions {
47+
sourceCompatibility JavaVersion.VERSION_1_8
48+
targetCompatibility JavaVersion.VERSION_1_8
49+
}
50+
}
51+
52+
repositories {
53+
mavenCentral()
54+
google()
55+
56+
def found = false
57+
def defaultDir = null
58+
def androidSourcesName = 'React Native sources'
59+
60+
if (rootProject.ext.has('reactNativeAndroidRoot')) {
61+
defaultDir = rootProject.ext.get('reactNativeAndroidRoot')
62+
} else {
63+
defaultDir = new File(
64+
projectDir,
65+
'/../../../node_modules/react-native/android'
66+
)
67+
}
68+
69+
if (defaultDir.exists()) {
70+
maven {
71+
url defaultDir.toString()
72+
name androidSourcesName
73+
}
74+
75+
logger.info(":${project.name}:reactNativeAndroidRoot ${defaultDir.canonicalPath}")
76+
found = true
77+
} else {
78+
def parentDir = rootProject.projectDir
79+
80+
1.upto(5, {
81+
if (found) return true
82+
parentDir = parentDir.parentFile
83+
84+
def androidSourcesDir = new File(
85+
parentDir,
86+
'node_modules/react-native'
87+
)
88+
89+
def androidPrebuiltBinaryDir = new File(
90+
parentDir,
91+
'node_modules/react-native/android'
92+
)
93+
94+
if (androidPrebuiltBinaryDir.exists()) {
95+
maven {
96+
url androidPrebuiltBinaryDir.toString()
97+
name androidSourcesName
98+
}
99+
100+
logger.info(":${project.name}:reactNativeAndroidRoot ${androidPrebuiltBinaryDir.canonicalPath}")
101+
found = true
102+
} else if (androidSourcesDir.exists()) {
103+
maven {
104+
url androidSourcesDir.toString()
105+
name androidSourcesName
106+
}
107+
108+
logger.info(":${project.name}:reactNativeAndroidRoot ${androidSourcesDir.canonicalPath}")
109+
found = true
110+
}
111+
})
112+
}
113+
114+
if (!found) {
115+
throw new GradleException(
116+
"${project.name}: unable to locate React Native android sources. " +
117+
"Ensure you have you installed React Native as a dependency in your project and try again."
118+
)
119+
}
120+
}
121+
122+
def kotlin_version = getExtOrDefault('kotlinVersion')
123+
124+
dependencies {
125+
// noinspection GradleDynamicVersion
126+
api 'com.facebook.react:react-native:+'
127+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
128+
}

android/gradle.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Ama_kotlinVersion=1.3.50
2+
Ama_compileSdkVersion=29
3+
Ama_targetSdkVersion=29
58.1 KB
Binary file not shown.

android/gradlew

Lines changed: 185 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)