aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsebastian.sellmair <sebastian.sellmair@jetbrains.com>2020-07-23 14:06:59 +0200
committerSebastian Sellmair <34319766+sellmair@users.noreply.github.com>2020-07-23 15:00:22 +0200
commit5065c969e9f07086719b44d89686129f7e3504f8 (patch)
tree4f0ade7175e14fc0ee9a5537d279111414738610
parent9806f309ae4c16f72f685c5aca1dad5d8159f48f (diff)
downloaddokka-5065c969e9f07086719b44d89686129f7e3504f8.tar.gz
dokka-5065c969e9f07086719b44d89686129f7e3504f8.tar.bz2
dokka-5065c969e9f07086719b44d89686129f7e3504f8.zip
Add link to androidx documentation by default for Android projects
-rw-r--r--.run/it-android-0_dokka.run.xml2
-rw-r--r--integration-tests/gradle/projects/it-android-0/build.gradle.kts1
-rw-r--r--integration-tests/gradle/projects/it-android-0/gradle.properties1
-rw-r--r--integration-tests/gradle/projects/it-android-0/src/main/java/it/android/IntegrationTestActivity.kt22
-rw-r--r--integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Android0GradleIntegrationTest.kt7
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt8
6 files changed, 40 insertions, 1 deletions
diff --git a/.run/it-android-0_dokka.run.xml b/.run/it-android-0_dokka.run.xml
index dcb61e2e..305ad77e 100644
--- a/.run/it-android-0_dokka.run.xml
+++ b/.run/it-android-0_dokka.run.xml
@@ -11,7 +11,7 @@
<option name="taskNames">
<list>
<option value="clean" />
- <option value="dokka" />
+ <option value="dokkaHtml" />
</list>
</option>
<option name="vmOptions" value="" />
diff --git a/integration-tests/gradle/projects/it-android-0/build.gradle.kts b/integration-tests/gradle/projects/it-android-0/build.gradle.kts
index 32c5c56c..799ec22d 100644
--- a/integration-tests/gradle/projects/it-android-0/build.gradle.kts
+++ b/integration-tests/gradle/projects/it-android-0/build.gradle.kts
@@ -15,5 +15,6 @@ android {
dependencies {
implementation(kotlin("stdlib"))
+ implementation("androidx.appcompat:appcompat:1.1.0")
}
diff --git a/integration-tests/gradle/projects/it-android-0/gradle.properties b/integration-tests/gradle/projects/it-android-0/gradle.properties
index 1332de19..2bdf43b4 100644
--- a/integration-tests/gradle/projects/it-android-0/gradle.properties
+++ b/integration-tests/gradle/projects/it-android-0/gradle.properties
@@ -1,2 +1,3 @@
dokka_it_kotlin_version=1.3.72
dokka_it_android_gradle_plugin_version=4.0.0
+android.useAndroidX=true
diff --git a/integration-tests/gradle/projects/it-android-0/src/main/java/it/android/IntegrationTestActivity.kt b/integration-tests/gradle/projects/it-android-0/src/main/java/it/android/IntegrationTestActivity.kt
new file mode 100644
index 00000000..1792818b
--- /dev/null
+++ b/integration-tests/gradle/projects/it-android-0/src/main/java/it/android/IntegrationTestActivity.kt
@@ -0,0 +1,22 @@
+package it.android
+
+import android.annotation.SuppressLint
+import android.os.Bundle
+import android.widget.TextView
+import androidx.appcompat.app.AppCompatActivity
+
+/**
+ * Some Activity implementing [AppCompatActivity] from android x
+ */
+class IntegrationTestActivity : AppCompatActivity() {
+ /**
+ * Will show a small happy text
+ */
+ @SuppressLint("SetTextI18n")
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ val textView = TextView(this)
+ textView.text = "I am so happy :)"
+ setContentView(textView)
+ }
+} \ No newline at end of file
diff --git a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Android0GradleIntegrationTest.kt b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Android0GradleIntegrationTest.kt
index 92ea4c3e..4ba01ee3 100644
--- a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Android0GradleIntegrationTest.kt
+++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Android0GradleIntegrationTest.kt
@@ -73,5 +73,12 @@ class Android0GradleIntegrationTest(override val versions: BuildVersions) : Abst
"https://developer.android.com/reference/android/content/Context.html" in file.readText()
}, "Expected link to developer.android.com"
)
+
+ assertTrue(
+ htmlOutputDir.allHtmlFiles().any { file ->
+ "https://developer.android.com/reference/kotlin/androidx/appcompat/app/AppCompatActivity.html" in
+ file.readText()
+ }, "Expected link to developer.android.com/.../androidx/"
+ )
}
}
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt
index 2253a975..f6055a8a 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt
@@ -16,10 +16,17 @@ import org.jetbrains.dokka.ReflectDsl.isNotInstance
import org.jetbrains.dokka.gradle.ConfigurationExtractor.PlatformData
import org.jetbrains.dokka.toJsonString
import java.io.File
+import java.net.URL
import java.util.concurrent.Callable
open class DokkaTask : AbstractDokkaTask() {
private val ANDROID_REFERENCE_URL = Builder("https://developer.android.com/reference/").build()
+
+ private val ANDROIDX_REFERENCE_URL = Builder(
+ url = URL("https://developer.android.com/reference/kotlin/"),
+ packageListUrl = URL("https://developer.android.com/reference/androidx/package-list")
+ ).build()
+
private val configExtractor = ConfigurationExtractor(project)
@Suppress("MemberVisibilityCanBePrivate")
@@ -243,6 +250,7 @@ open class DokkaTask : AbstractDokkaTask() {
if (project.isAndroidProject() && !config.noAndroidSdkLink) {
config.externalDocumentationLinks.add(ANDROID_REFERENCE_URL)
+ config.externalDocumentationLinks.add(ANDROIDX_REFERENCE_URL)
}
if (config.platform?.isNotBlank() == true) {