Skip to content

Commit ce2aadc

Browse files
authored
Migrate to Dokka2 (#1783)
1 parent 2e3ddc7 commit ce2aadc

File tree

8 files changed

+73
-32
lines changed

8 files changed

+73
-32
lines changed

.github/workflows/build.yml

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,42 @@ env:
1313
GRADLE_OPTS: "-Dorg.gradle.jvmargs=-Xmx4g -Dorg.gradle.daemon=false -Dkotlin.incremental=false"
1414

1515
jobs:
16+
generate-docs:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
23+
- name: Configure JDK
24+
uses: actions/setup-java@v4
25+
with:
26+
distribution: 'zulu'
27+
java-version: 17
28+
29+
- name: Setup Gradle
30+
uses: gradle/actions/setup-gradle@v4
31+
32+
- name: Set up Python
33+
uses: actions/setup-python@v5
34+
with:
35+
python-version: 3.12
36+
37+
- name: Prep mkdocs
38+
run: .github/workflows/prepare_mkdocs.sh
39+
40+
- name: Build mkdocs
41+
run: |
42+
pip3 install -r .github/workflows/requirements.in
43+
mkdocs build
44+
45+
- name: Upload Html Docs
46+
uses: actions/upload-artifact@v4
47+
with:
48+
name: mkdocs-${{ github.sha }}
49+
path: |
50+
**/docs/
51+
1652
build:
1753
strategy:
1854
fail-fast: false
@@ -90,7 +126,7 @@ jobs:
90126

91127
- name: Build mkdocs
92128
run: |
93-
pip3 install -r .github/workflows/requirements.txt
129+
pip3 install -r .github/workflows/requirements.in
94130
mkdocs build
95131
96132
- name: Deploy docs to website

.github/workflows/prepare_mkdocs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
set -ex
1010

1111
# Generate the API docs
12-
./gradlew dokkaHtml
12+
./gradlew dokkaGenerate
1313

1414
# Copy in special files that GitHub wants in the project root.
1515
cat README.md | grep -v 'project website' > docs/index.md

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454

5555
- name: Build mkdocs
5656
run: |
57-
pip3 install -r .github/workflows/requirements.txt
57+
pip3 install -r .github/workflows/requirements.in
5858
mkdocs build
5959
6060
- name: Deploy docs to website

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ generated
1818

1919
# Mkdocs files
2020
docs/1.x
21+
docs/2.x
2122
docs/changelog.md
2223
docs/index.md
2324
site/

gradle.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,5 @@ android.suppressUnsupportedCompileSdk=UpsideDownCakePrivacySandbox
2929
# Signals to our own plugin that we are building within the repo.
3030
app.cash.paparazzi.internal=true
3131

32-
kotlin.mpp.androidGradlePluginCompatibility.nowarn=true
32+
# Dokka
33+
org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ markdown_extensions:
5454
nav:
5555
- 'Overview': index.md
5656
- '1.x API': 1.x/paparazzi/app.cash.paparazzi/index.html
57+
- '2.x API': 2.x/paparazzi/app.cash.paparazzi/index.html
5758
- 'Accessibility Snapshots': accessibility.md
5859
- 'Change Log': changelog.md
5960
- 'Code of Conduct': code_of_conduct.md

paparazzi/build.gradle

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import com.android.build.gradle.internal.publishing.AndroidArtifacts
2+
import org.jetbrains.dokka.gradle.engine.parameters.KotlinPlatform
3+
import org.jetbrains.dokka.gradle.engine.parameters.VisibilityModifier
24

35
apply plugin: 'org.jetbrains.kotlin.jvm'
46
apply plugin: 'org.jetbrains.kotlin.plugin.compose'
@@ -74,32 +76,32 @@ dependencies {
7476
testImplementation libs.truth
7577
}
7678

77-
tasks.named("dokkaHtml").configure {
78-
outputDirectory = rootProject.file("docs/1.x")
79-
80-
dokkaSourceSets.named("main") {
81-
configureEach {
82-
reportUndocumented = false
83-
skipDeprecated = true
84-
jdkVersion = 8
85-
includeNonPublic = false
86-
skipEmptyPackages = true
87-
platform = "jvm"
88-
89-
externalDocumentationLink {
90-
url.set(java.net.URL("https://developer.android.com/reference/"))
91-
}
92-
93-
sourceLink {
94-
localDirectory.set(file("src/main/java"))
95-
remoteUrl.set(java.net.URL("https://github.com/cashapp/paparazzi/tree/master/paparazzi/src/main/java"))
96-
remoteLineSuffix.set("#L")
97-
}
98-
99-
perPackageOption {
100-
prefix = "app.cash.paparazzi.internal"
101-
suppress = true
102-
}
79+
dokka {
80+
dokkaPublications.html {
81+
outputDirectory.set(rootProject.file("docs/2.x"))
82+
}
83+
84+
dokkaSourceSets.named("main").configure {
85+
reportUndocumented = false
86+
skipDeprecated = true
87+
jdkVersion = libs.versions.javaTarget.get() as int
88+
documentedVisibilities(VisibilityModifier.Public)
89+
skipEmptyPackages = true
90+
analysisPlatform = KotlinPlatform.JVM
91+
92+
externalDocumentationLinks.register("docs") {
93+
url("https://developer.android.com/reference/")
94+
}
95+
96+
sourceLink {
97+
localDirectory.set(file("src/main/java"))
98+
remoteUrl("https://github.com/cashapp/paparazzi/tree/master/paparazzi/src/main/java")
99+
remoteLineSuffix.set("#L")
100+
}
101+
102+
perPackageOption {
103+
matchingRegex = /app\.cash\.paparazzi\.internal(\..*)?/
104+
suppress = true
103105
}
104106
}
105107
}

renovate.json5

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
"python": "==3.12"
88
},
99
"ignorePaths": [
10-
".github/workflows/requirements.txt",
10+
".github/workflows/requirements.in",
1111
],
1212
"pip-compile": {
1313
"fileMatch": [
14-
".github/workflows/requirements.txt"
14+
".github/workflows/requirements.in"
1515
]
1616
},
1717
packageRules: [

0 commit comments

Comments
 (0)