aboutsummaryrefslogtreecommitdiff
path: root/runners/gradle-integration-tests/src
diff options
context:
space:
mode:
Diffstat (limited to 'runners/gradle-integration-tests/src')
-rw-r--r--runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaAndroidGradleTest.kt43
-rw-r--r--runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AndroidAppTest.kt3
-rw-r--r--runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AndroidMultiFlavourAppTest.kt2
3 files changed, 45 insertions, 3 deletions
diff --git a/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaAndroidGradleTest.kt b/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaAndroidGradleTest.kt
new file mode 100644
index 00000000..52aa4f15
--- /dev/null
+++ b/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaAndroidGradleTest.kt
@@ -0,0 +1,43 @@
+package org.jetbrains.dokka.gradle
+
+import org.junit.BeforeClass
+import java.io.File
+
+abstract class AbstractDokkaAndroidGradleTest : AbstractDokkaGradleTest() {
+
+ companion object {
+
+ @JvmStatic
+ @BeforeClass
+ fun acceptAndroidSdkLicenses() {
+ val sdkDir = androidLocalProperties?.toFile()?.let {
+ val lines = it.readLines().map { it.trim() }
+ val sdkDirLine = lines.firstOrNull { "sdk.dir" in it }
+ sdkDirLine?.substringAfter("=")?.trim()
+ } ?: System.getenv("ANDROID_HOME")
+
+ if (sdkDir == null || sdkDir.isEmpty()) {
+ error("Android SDK home not set, " +
+ "try setting \$ANDROID_HOME " +
+ "or sdk.dir in runners/gradle-integration-tests/testData/android.local.properties")
+ }
+ val sdkDirFile = File(sdkDir)
+ if (!sdkDirFile.exists()) error("\$ANDROID_HOME and android.local.properties points to non-existing location")
+ val sdkLicensesDir = sdkDirFile.resolve("licenses")
+
+ val acceptedLicenses = File("android-licenses")
+ acceptedLicenses.listFiles().forEach { licenseFile ->
+ val target = sdkLicensesDir.resolve(licenseFile.name)
+ if(!target.exists() || target.readText() != licenseFile.readText()) {
+ val overwrite = System.getProperty("android.licenses.overwrite", "false").toBoolean()
+ if (!target.exists() || overwrite) {
+ licenseFile.copyTo(target, true)
+ println("Accepted ${licenseFile.name}, by copying $licenseFile to $target")
+ }
+ }
+
+ }
+ }
+
+ }
+} \ No newline at end of file
diff --git a/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AndroidAppTest.kt b/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AndroidAppTest.kt
index de22a980..1975d6e2 100644
--- a/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AndroidAppTest.kt
+++ b/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AndroidAppTest.kt
@@ -3,10 +3,9 @@ package org.jetbrains.dokka.gradle
import org.gradle.testkit.runner.TaskOutcome
import org.junit.Test
import java.io.File
-import java.nio.file.Files
import kotlin.test.assertEquals
-class AndroidAppTest : AbstractDokkaGradleTest() {
+class AndroidAppTest : AbstractDokkaAndroidGradleTest() {
override val pluginClasspath: List<File> = androidPluginClasspathData.toFile().readLines().map { File(it) }
fun prepareTestData(testDataRootPath: String) {
diff --git a/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AndroidMultiFlavourAppTest.kt b/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AndroidMultiFlavourAppTest.kt
index aee0e14c..0a9b2427 100644
--- a/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AndroidMultiFlavourAppTest.kt
+++ b/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AndroidMultiFlavourAppTest.kt
@@ -6,7 +6,7 @@ import org.junit.Test
import java.io.File
import kotlin.test.assertEquals
-class AndroidMultiFlavourAppTest : AbstractDokkaGradleTest() {
+class AndroidMultiFlavourAppTest : AbstractDokkaAndroidGradleTest() {
override val pluginClasspath: List<File> = androidPluginClasspathData.toFile().readLines().map { File(it) }
fun prepareTestData(testDataRootPath: String) {