Remove build dependency on Android SDK

This commit is contained in:
Paul Schaub 2021-06-03 23:24:30 +02:00
parent cc87bf5111
commit e0cb1cff3b
2 changed files with 2 additions and 26 deletions

View File

@ -1,8 +1,5 @@
language: android language: java
dist: trusty dist: trusty
android:
components:
- android-10
jdk: jdk:
- openjdk8 - openjdk8
- openjdk11 - openjdk11
@ -13,7 +10,6 @@ before_cache:
cache: cache:
directories: directories:
- $HOME/.gradle/caches/ - $HOME/.gradle/caches/
- $HOME/.android/build-cache
- $HOME/.m2 - $HOME/.m2
before_install: before_install:

View File

@ -28,6 +28,7 @@ allprojects {
apply plugin: 'jacoco' apply plugin: 'jacoco'
apply plugin: 'checkstyle' apply plugin: 'checkstyle'
// For non-sop modules, enable android api compatibility check
if (!it.name.equals('pgpainless-sop')) { if (!it.name.equals('pgpainless-sop')) {
// animalsniffer // animalsniffer
apply plugin: 'ru.vyarus.animalsniffer' apply plugin: 'ru.vyarus.animalsniffer'
@ -56,7 +57,6 @@ allprojects {
project.ext { project.ext {
junitVersion = '5.7.1' junitVersion = '5.7.1'
androidBootClasspath = getAndroidRuntimeJar(pgpainlessMinAndroidSdk)
rootConfigDir = new File(rootDir, 'config') rootConfigDir = new File(rootDir, 'config')
gitCommit = getGitCommit() gitCommit = getGitCommit()
builtDate = (new SimpleDateFormat("yyyy-MM-dd")).format(new Date()) builtDate = (new SimpleDateFormat("yyyy-MM-dd")).format(new Date())
@ -196,26 +196,6 @@ subprojects {
processResources.dependsOn generateVersionProperties processResources.dependsOn generateVersionProperties
} }
def getAndroidRuntimeJar(androidSdkApiLevel) {
def androidHome = getAndroidHome()
def androidJar = new File("$androidHome/platforms/android-$androidSdkApiLevel/android.jar")
if (androidJar.isFile()) {
return androidJar
} else {
throw new Exception("Can't find android.jar for API level $androidSdkApiLevel at $androidHome/platforms/android-$androidSdkApiLevel/android.jar. Please install corresponding SDK platform package")
}
}
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
}
def getGitCommit() { def getGitCommit() {
def projectDirFile = new File("$projectDir") def projectDirFile = new File("$projectDir")
def dotGit = new File("$projectDir/.git") def dotGit = new File("$projectDir/.git")