forked from DroidsOnRoids/jspoon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.gradle
40 lines (36 loc) · 1.18 KB
/
settings.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
include ':jspoon', ':retrofit-converter-jspoon', ':advanced-example'
if (findSdkLocation(getRootDir()) != null) include ":android-example"
private static def findSdkLocation(File rootDir) {
def localProperty = readLocalProperties(rootDir)
if (localProperty != null) {
return localProperty
}
def envVar = System.getenv('ANDROID_HOME')
if (envVar != null) {
return envVar
}
def systemProperty = System.getProperty('android.home')
if (systemProperty != null) {
return systemProperty
}
return null
}
private static String readLocalProperties(File rootDir) {
def file = new File(rootDir, 'local.properties')
if (file.isFile()) {
return file.withReader('UTF-8') {
def properties = new Properties()
properties.load(it)
String sdkDirProp = properties['sdk.dir']
if (sdkDirProp != null) {
File sdkFolder = new File(sdkDirProp)
if (!sdkFolder.absolute) {
sdkFolder = new File(rootDir, sdkDirProp)
}
return sdkFolder.absolutePath
}
return null
}
}
return null
}