Skip to content

Commit a2ee82c

Browse files
committed
fix(build): jitpack hardening and multi-module Dokka for JVM modules
- jitpack.yml: add --no-daemon, skip lint tasks (-x lint -x lintVitalRelease) - Add configureDokkaForJvm() helper to buildSrc JvmConfiguration.kt - Apply Dokka to JVM modules (annotations, codegen-core) via helper - Add no-op stub in composite build's JvmConfiguration.kt - Switch gradle-dokka.yml to multi-module: generate all 8 modules, merge into combined-docs/
1 parent da07102 commit a2ee82c

6 files changed

Lines changed: 47 additions & 8 deletions

File tree

.github/workflows/gradle-dokka.yml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,25 @@ jobs:
2323
- name: Grant execute permission for gradlew
2424
run: chmod +x gradlew
2525
- name: Generate docs with dokka
26-
run: ./gradlew :library:dokkaGeneratePublicationHtml
27-
# TODO: Switch to multi-module Dokka. Currently only publishes :library facade docs
28-
# (type aliases pointing to co.anitrend.retrofit.graphql.* packages).
29-
# Future: use dokkaHtmlMultiModule or a composite task to document all library-type modules.
26+
run: |
27+
./gradlew :annotations:dokkaGeneratePublicationHtml \
28+
:api:dokkaGeneratePublicationHtml \
29+
:android-assets:dokkaGeneratePublicationHtml \
30+
:runtime:dokkaGeneratePublicationHtml \
31+
:codegen-core:dokkaGeneratePublicationHtml \
32+
:serialization-gson:dokkaGeneratePublicationHtml \
33+
:serialization-kotlinx:dokkaGeneratePublicationHtml \
34+
:library:dokkaGeneratePublicationHtml
35+
# Merge all module docs into combined-docs
36+
mkdir -p combined-docs
37+
for module in annotations api android-assets runtime codegen-core serialization-gson serialization-kotlinx library; do
38+
if [ -d "$module/build/dokka/html" ]; then
39+
cp -r "$module/build/dokka/html/"* combined-docs/ 2>/dev/null || true
40+
fi
41+
done
3042
3143
- name: Deploy 🚀
3244
uses: JamesIves/github-pages-deploy-action@v4.8.0
3345
with:
3446
branch: docs # The branch the action should deploy to.
35-
folder: library/build/dokka/html # The folder the action should deploy.
47+
folder: combined-docs

annotations/build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
import co.anitrend.retrofit.graphql.buildSrc.plugin.components.configureDokkaForJvm
12
import co.anitrend.retrofit.graphql.buildSrc.plugin.components.configureSpotlessForJvm
23

34
plugins {
45
kotlin("jvm")
56
}
67

78
configureSpotlessForJvm()
9+
configureDokkaForJvm()
810

buildSrc/src/main/java/co/anitrend/retrofit/graphql/buildSrc/plugin/components/JvmConfiguration.kt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import co.anitrend.retrofit.graphql.buildSrc.plugin.extensions.libs
44
import com.diffplug.gradle.spotless.SpotlessExtension
55
import org.gradle.api.Project
66
import org.gradle.kotlin.dsl.configure
7+
import org.jetbrains.dokka.gradle.DokkaExtension
78

89
fun Project.configureSpotlessForJvm() {
910
plugins.apply("com.diffplug.spotless")
@@ -21,3 +22,17 @@ fun Project.configureSpotlessForJvm() {
2122
}
2223
}
2324
}
25+
26+
fun Project.configureDokkaForJvm() {
27+
plugins.apply("org.jetbrains.dokka")
28+
extensions.configure<DokkaExtension> {
29+
moduleName.set("retrofit-graphql-${this@configureDokkaForJvm.name}")
30+
dokkaSourceSets.configureEach {
31+
skipDeprecated.set(false)
32+
reportUndocumented.set(true)
33+
skipEmptyPackages.set(true)
34+
jdkVersion.set(21)
35+
sourceRoots.from(file("src"))
36+
}
37+
}
38+
}

codegen-core/build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
import co.anitrend.retrofit.graphql.buildSrc.plugin.components.configureDokkaForJvm
12
import co.anitrend.retrofit.graphql.buildSrc.plugin.components.configureSpotlessForJvm
23

34
plugins {
45
kotlin("jvm")
56
}
67

78
configureSpotlessForJvm()
9+
configureDokkaForJvm()
810

911
dependencies {
1012
implementation(libs.graphql.java)

gradle-plugin/buildSrc/src/main/java/co/anitrend/retrofit/graphql/buildSrc/plugin/components/JvmConfiguration.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,12 @@ fun Project.configureSpotlessForJvm() {
2727
}
2828
}
2929
}
30+
31+
/**
32+
* Stub for the composite build. Dokka is only needed in the root build
33+
* where API docs are generated; this avoids adding a Dokka dependency
34+
* to the composite build's buildSrc.
35+
*/
36+
fun Project.configureDokkaForJvm() {
37+
// No-op: composite build does not generate Dokka for codegen-core
38+
}

jitpack.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ jdk:
33
#before_install:
44
# - ./custom_setup.sh
55
install:
6-
- echo "Running build commands"
7-
- ./gradlew build --stacktrace
8-
- ./gradlew publishMavenPublicationToMavenLocal
6+
- ./gradlew build --stacktrace --no-daemon -x lint -x lintVitalRelease
7+
- ./gradlew publishMavenPublicationToMavenLocal --no-daemon
98
env:
109
CI: "true"

0 commit comments

Comments
 (0)