mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-12-02 08:52:07 +01:00
38 lines
1.1 KiB
Groovy
38 lines
1.1 KiB
Groovy
|
ext {
|
||
|
javaVersion = JavaVersion.VERSION_11
|
||
|
javaMajor = javaVersion.getMajorVersion()
|
||
|
smackMinAndroidSdk = 21
|
||
|
|
||
|
androidBootClasspath = { getAndroidRuntimeJar() }
|
||
|
}
|
||
|
|
||
|
repositories {
|
||
|
mavenLocal()
|
||
|
mavenCentral()
|
||
|
}
|
||
|
|
||
|
def getAndroidRuntimeJar() {
|
||
|
def androidApiLevel = ext.smackMinAndroidSdk
|
||
|
def androidHome = getAndroidHome()
|
||
|
def androidJar = new File("$androidHome/platforms/android-${androidApiLevel}/android.jar")
|
||
|
if (androidJar.isFile()) {
|
||
|
return androidJar
|
||
|
} else {
|
||
|
throw new Exception("Can't find android.jar for API level ${androidApiLevel}. Please install corresponding SDK platform package")
|
||
|
}
|
||
|
}
|
||
|
def getAndroidJavadocOffline() {
|
||
|
def androidHome = getAndroidHome()
|
||
|
return androidHome.toString() + "/docs/reference"
|
||
|
}
|
||
|
|
||
|
def getAndroidHome() {
|
||
|
def androidHomeEnv = System.getenv("ANDROID_HOME")
|
||
|
if (androidHomeEnv == null) {
|
||
|
throw new Exception("ANDROID_HOME environment variable is not set")
|
||
|
}
|
||
|
def androidHome = new File(androidHomeEnv)
|
||
|
if (!androidHome.isDirectory()) throw new Exception("Environment variable ANDROID_HOME is not pointing to a directory")
|
||
|
return androidHome
|
||
|
}
|