Skip to content

Commit

Permalink
Update Dokka for multiversion
Browse files Browse the repository at this point in the history
  • Loading branch information
mattco98 committed Oct 22, 2023
1 parent f19bec1 commit 79c3886
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/javadocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
${{ runner.os }}-gradle-
- name: Build Javadocs
run: ./gradlew --no-daemon dokkaHtml
run: ./gradlew --no-daemon generateDokkaDocs

- name: Publish Javadocs
uses: appleboy/scp-action@master
Expand All @@ -39,10 +39,10 @@ jobs:
username: ${{ secrets.ACTIONS_DEPLOYER_USERNAME }}
key: ${{ secrets.ACTIONS_DEPLOYER_SSH_KEY }}
passphrase: ${{ secrets.ACTIONS_DEPLOYER_PASSPHRASE }}
source: build/javadocs/
source: ${{ github.workspace }}/build/javadocs/
# TODO: Remove "new-" when we transition to 3.0.0
target: /srv/www/static/home/new-javadocs
strip_components: 2
strip_components: 4
rm: true

- name: Set File Permissions
Expand Down
10 changes: 8 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@ tasks {
}

tasks.dokkaHtml {
// Just use the module name here since the MC version doesn't affect CT's API
// across the same mod version
moduleVersion.set(modVersion)
moduleName.set("ctjs")

val docVersionsDir = projectDir.resolve("build/javadocs")
val currentVersion = project.version.toString()
val currentDocsDir = docVersionsDir.resolve(currentVersion)
Expand All @@ -135,11 +140,12 @@ tasks.dokkaHtml {
outputDirectory.set(file(currentDocsDir))

pluginConfiguration<VersioningPlugin, VersioningConfiguration> {
version = currentVersion
version = modVersion
olderVersionsDir = docVersionsDir
renderVersionsNavigationOnAllPages = true
}

suppressObviousFunctions.set(true)
suppressInheritedMembers.set(true)

val branch = getBranch()
Expand All @@ -148,7 +154,7 @@ tasks.dokkaHtml {
jdkVersion.set(17)

perPackageOption {
matchingRegex.set("com\\.chattriggers\\.ctjs\\.internal")
matchingRegex.set("com\\.chattriggers\\.ctjs\\.internal(\$|\\.).*")
suppress.set(true)
}

Expand Down
14 changes: 14 additions & 0 deletions root.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,17 @@ preprocess {
apiValidation {
ignoredPackages.add("com.chattriggers.ctjs.internal")
}

tasks.register("generateDokkaDocs") {
group = "documentation"

val mainProjectName = rootProject.file("versions/mainProject").readText().trim()
val mainProject = subprojects.first { mainProjectName in it.name }
dependsOn(mainProject.tasks["dokkaHtml"])

doLast {
val dest = rootProject.file("build/javadocs/")
dest.deleteRecursively()
mainProject.file("build/javadocs/").copyRecursively(dest)
}
}

0 comments on commit 79c3886

Please sign in to comment.