aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runners/gradle-integration-tests/android-licenses/android-sdk-license2
-rw-r--r--runners/gradle-integration-tests/android-licenses/android-sdk-preview-license2
-rw-r--r--runners/gradle-integration-tests/build.gradle6
-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
6 files changed, 54 insertions, 4 deletions
diff --git a/runners/gradle-integration-tests/android-licenses/android-sdk-license b/runners/gradle-integration-tests/android-licenses/android-sdk-license
new file mode 100644
index 00000000..c311cf48
--- /dev/null
+++ b/runners/gradle-integration-tests/android-licenses/android-sdk-license
@@ -0,0 +1,2 @@
+
+d56f5187479451eabf01fb78af6dfcb131a6481e \ No newline at end of file
diff --git a/runners/gradle-integration-tests/android-licenses/android-sdk-preview-license b/runners/gradle-integration-tests/android-licenses/android-sdk-preview-license
new file mode 100644
index 00000000..da4552d2
--- /dev/null
+++ b/runners/gradle-integration-tests/android-licenses/android-sdk-preview-license
@@ -0,0 +1,2 @@
+
+84831b9409646a918e30573bab4c9c91346d8abd \ No newline at end of file
diff --git a/runners/gradle-integration-tests/build.gradle b/runners/gradle-integration-tests/build.gradle
index 179b6455..1b4ff5ed 100644
--- a/runners/gradle-integration-tests/build.gradle
+++ b/runners/gradle-integration-tests/build.gradle
@@ -42,4 +42,8 @@ task createClasspathManifest {
createClasspathManifest.mustRunAfter project(":runners:fatjar").shadowJar
testClasses.dependsOn project(":runners:fatjar").shadowJar
-testClasses.dependsOn createClasspathManifest \ No newline at end of file
+testClasses.dependsOn createClasspathManifest
+
+test {
+ systemProperty "android.licenses.overwrite", project.findProperty("android.licenses.overwrite") ?: ""
+} \ No newline at end of file
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) {