Skip to content

Commit baa1b4a

Browse files
committed
Allow tests execution on environments there Android SDK is not installed
1 parent 44ebe35 commit baa1b4a

File tree

3 files changed

+18
-17
lines changed

3 files changed

+18
-17
lines changed

samples/junit-tests/build.gradle

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,10 @@
11
plugins {
2-
id("com.android.library")
3-
id("kotlin-android")
2+
id("kotlin")
43
id("com.yelp.codegen.plugin")
54
id("io.gitlab.arturbosch.detekt")
65
id("kotlin-kapt")
76
}
87

9-
android {
10-
compileSdkVersion = 28
11-
defaultConfig {
12-
minSdkVersion 21
13-
targetSdkVersion 28
14-
versionCode = 1
15-
versionName = "1.0"
16-
}
17-
}
18-
198
dependencies {
209
// Kotlin
2110
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.70"

samples/junit-tests/src/main/AndroidManifest.xml

Lines changed: 0 additions & 2 deletions
This file was deleted.

settings.gradle.kts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,24 @@ pluginManagement {
1717
}
1818
}
1919

20-
include(
21-
":samples:junit-tests",
20+
include(":samples:junit-tests")
21+
22+
if (isAndroidSDKConfigured()) {
23+
include(
2224
":samples:kotlin-android",
2325
":samples:kotlin-coroutines",
24-
":samples:groovy-android")
26+
":samples:groovy-android"
27+
)
28+
}
2529

2630
includeBuild("gradle-plugin")
31+
32+
fun isAndroidSDKConfigured(): Boolean {
33+
if (System.getenv("ANDROID_SDK_ROOT") != null) {
34+
return true;
35+
}
36+
// TODO: Check if `sdk.dir` property is defined in `local.properties`
37+
38+
// Ensure that on CI systems we do assume that Android is installed
39+
return System.getenv("CI") != null;
40+
}

0 commit comments

Comments
 (0)