Skip to content

Commit 72d3cb8

Browse files
authored
Merge branch 'main' into renovate/gradle-8.x
2 parents 02dd8cd + 99508fd commit 72d3cb8

File tree

39 files changed

+1098
-883
lines changed

39 files changed

+1098
-883
lines changed

.gitattributes

+10-8
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,16 @@ gradlew text eol=lf
3939
*.svg text
4040

4141
# Exclude external libs from GitHub language stats https://github.com/github/linguist/blob/v7.24.1/docs/overrides.md
42-
examples/** linguist-documentation
43-
examples/*/dokka linguist-vendored
44-
examples/versioning-multimodule-example/dokka/previousDocVersions linguist-generated
45-
examples/versioning-multimodule-example/dokkatoo/previousDocVersions linguist-generated
46-
modules/docs/** linguist-documentation
47-
modules/dokkatoo-plugin-integration-tests/example-project-data linguist-generated
48-
modules/dokkatoo-plugin-integration-tests/projects/**dokka/ linguist-vendored
49-
modules/dokkatoo-plugin-integration-tests/projects/**dokkatoo/ linguist-documentation
42+
examples/** linguist-documentation
43+
modules/docs/** linguist-documentation
44+
modules/dokkatoo-plugin-integration-tests/projects/**dokkatoo/ linguist-documentation
45+
46+
examples/*/dokka/** linguist-vendored
47+
modules/dokkatoo-plugin-integration-tests/projects/**dokka/ linguist-vendored
48+
49+
examples/versioning-multimodule-example/dokka/previousDocVersions/** linguist-generated
50+
examples/versioning-multimodule-example/dokkatoo/previousDocVersions/** linguist-generated
51+
modules/dokkatoo-plugin-integration-tests/example-project-data/** linguist-generated
5052

5153
# Exclude files from exporting
5254

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Gradle Dependency Graph
2+
run-name: "Gradle Dependency Graph"
3+
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
checkout-ref:
8+
description: "The branch, tag or SHA to checkout. See actions/checkout 'ref'."
9+
required: false
10+
type: string
11+
workflow_call:
12+
inputs:
13+
checkout-ref:
14+
description: "The branch, tag or SHA to checkout. See actions/checkout 'ref'."
15+
required: false
16+
type: string
17+
18+
19+
concurrency:
20+
group: "Gradle Dependency Graph: ${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
21+
cancel-in-progress: true
22+
23+
24+
permissions:
25+
contents: write # required to submit dependency graph
26+
27+
28+
jobs:
29+
30+
run-task:
31+
runs-on: ubuntu-latest
32+
timeout-minutes: 60
33+
steps:
34+
35+
- name: Checkout the repo
36+
uses: actions/checkout@v4
37+
with:
38+
ref: ${{ inputs.checkout-ref || github.ref }}
39+
40+
- name: Validate Gradle Wrapper
41+
uses: gradle/actions/wrapper-validation@v3
42+
43+
- name: Update GitHub Gradle dependency graph
44+
uses: gradle/actions/dependency-submission@v3

.github/workflows/run_gradle_task.yml

+10-3
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ jobs:
6161
ref: ${{ inputs.checkout-ref || github.ref }}
6262

6363
- name: Validate Gradle Wrapper
64-
uses: gradle/wrapper-validation-action@v2
64+
uses: gradle/actions/wrapper-validation@v3
6565

6666
- name: Setup JDK 11
6767
uses: actions/setup-java@v4
@@ -78,12 +78,16 @@ jobs:
7878
- name: Setup Android SDK # required for integration tests
7979
uses: android-actions/setup-android@v3
8080

81-
- uses: gradle/gradle-build-action@v3
81+
- name: Setup Gradle
82+
uses: gradle/actions/setup-gradle@v3
8283
with:
8384
gradle-home-cache-cleanup: true
84-
arguments: ${{ inputs.gradle-task }}
8585
# write build cache on 'main' and 'release' branches, or tags (default is 'main' only)
8686
cache-read-only: ${{ github.ref != 'refs/heads/main' && !startsWith(github.ref, 'refs/heads/release') && !startsWith(github.ref, 'refs/tags/') }}
87+
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
88+
89+
- run: >-
90+
./gradlew ${{ inputs.gradle-task }}
8791
env:
8892
MAVEN_SONATYPE_USERNAME: ${{ vars.MAVEN_SONATYPE_USERNAME }}
8993
MAVEN_SONATYPE_PASSWORD: ${{ secrets.MAVEN_SONATYPE_PASSWORD }}
@@ -97,6 +101,9 @@ jobs:
97101
MAVEN_ADAMKO_DEV_USERNAME: ${{ vars.MAVEN_ADAMKO_DEV_USERNAME }}
98102
MAVEN_ADAMKO_DEV_PASSWORD: ${{ secrets.MAVEN_ADAMKO_DEV_PASSWORD }}
99103
104+
"ORG_GRADLE_PROJECT_gradle.publish.key": ${{ secrets.GRADLE_PLUGIN_PORTAL_KEY }}
105+
"ORG_GRADLE_PROJECT_gradle.publish.secret": ${{ secrets.GRADLE_PLUGIN_PORTAL_SECRET }}
106+
100107
- name: Upload build reports
101108
if: failure()
102109
uses: actions/upload-artifact@v4

.github/workflows/run_publish_site.yml

+8-6
Original file line numberDiff line numberDiff line change
@@ -32,24 +32,26 @@ jobs:
3232
ref: ${{ inputs.checkout-ref || github.ref }}
3333

3434
- name: Validate Gradle Wrapper
35-
uses: gradle/wrapper-validation-action@v2
35+
uses: gradle/actions/wrapper-validation@v3
3636

3737
- name: Setup JDK
3838
uses: actions/setup-java@v4
3939
with:
4040
distribution: temurin
4141
java-version: 11
4242

43-
- name: Build site
44-
uses: gradle/gradle-build-action@v3
43+
- name: Setup Gradle
44+
uses: gradle/actions/setup-gradle@v3
4545
with:
4646
gradle-home-cache-cleanup: true
4747
# write build cache on 'main' and 'release' branches, or tags (default is 'main' only)
4848
cache-read-only: ${{ github.ref != 'refs/heads/main' && !startsWith(github.ref, 'refs/heads/release') && !startsWith(github.ref, 'refs/tags/') }}
49-
arguments: |
50-
:modules:docs:docusaurusBuild
49+
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
50+
51+
- name: Build site
52+
run: ./gradlew :modules:docs:docusaurusBuild
5153

52-
- name: Upload Dokka to Pages
54+
- name: Upload site to Pages
5355
uses: actions/upload-pages-artifact@v3
5456
with:
5557
path: ./modules/docs/site/build/

.github/workflows/run_tests.yml

-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ jobs:
4747
--no-configuration-cache
4848
--no-daemon
4949
--max-workers=1
50-
-Dorg.gradle.workers.max=1
5150
fail-fast: false
5251
uses: ./.github/workflows/run_gradle_task.yml
5352
with:

.github/workflows/workflow_release.yml

+24
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ jobs:
2929
with:
3030
checkout-ref: ${{ inputs.checkout-ref }}
3131

32+
dependency-graph:
33+
uses: ./.github/workflows/run_gradle_dependency_graph.yml
34+
permissions:
35+
contents: write
36+
with:
37+
checkout-ref: ${{ inputs.checkout-ref }}
38+
3239
publish-maven:
3340
needs: tests
3441
# only publish when manually triggered, or it's the main branch, or it's for a release
@@ -42,6 +49,23 @@ jobs:
4249
with:
4350
checkout-ref: ${{ inputs.checkout-ref }}
4451

52+
publish-gradle-plugin:
53+
# only publish when manually triggered, or it's for a release
54+
# (Gradle Plugin Portal doesn't allow snapshot versions)
55+
if: inputs.checkout-ref || (github.event_name == 'release' && github.event.action == 'created')
56+
uses: ./.github/workflows/run_gradle_task.yml
57+
secrets: inherit
58+
permissions:
59+
contents: read
60+
packages: write
61+
checks: write
62+
with:
63+
runs-on: macos-latest
64+
gradle-task: >-
65+
publishPlugins
66+
--stacktrace
67+
checkout-ref: ${{ inputs.checkout-ref }}
68+
4569
publish-site:
4670
needs: tests
4771
# only publish when manually triggered, or it's for a release

buildSrc/build.gradle.kts

+3-5
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,9 @@ dependencies {
1616
because("parse Dokka's libs.version.toml, so Dokkatoo can use the same versions")
1717
}
1818

19-
compileOnly("com.microsoft.playwright:playwright:1.42.0")
19+
compileOnly("com.microsoft.playwright:playwright:1.43.0")
2020
}
2121

22-
java {
23-
toolchain {
24-
languageVersion.set(JavaLanguageVersion.of(11))
25-
}
22+
kotlin {
23+
jvmToolchain(11)
2624
}

buildSrc/src/main/kotlin/buildsrc/conventions/dokka-source-downloader.gradle.kts

+28
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,29 @@ import buildsrc.utils.consumable
55
import buildsrc.utils.declarable
66
import buildsrc.utils.dropDirectories
77
import buildsrc.utils.resolvable
8+
import dev.adamko.dokkatoo.DokkatooBasePlugin
9+
import dev.adamko.dokkatoo.DokkatooExtension
810
import org.gradle.api.attributes.Category.CATEGORY_ATTRIBUTE
911
import org.gradle.api.attributes.Usage.USAGE_ATTRIBUTE
1012
import org.gradle.kotlin.dsl.support.serviceOf
1113

14+
/**
15+
* Download https://github.com/Kotlin/dokka source code.
16+
*
17+
* Use [prepareDokkaSource] to access the downloaded source code.
18+
*
19+
* ### Downloaded version
20+
*
21+
* If Dokkatoo Plugin is applied, the downloaded version will be automatically synced with Dokkatoo.
22+
* The version can be manually set using [DokkaSourceDownloaderSettings]:
23+
*
24+
* ```
25+
* dokkaSourceDownload {
26+
* dokkaVersion.set(libs.versions.kotlin.dokka)
27+
* }
28+
* ```
29+
*/
30+
1231
plugins {
1332
id("buildsrc.conventions.base")
1433
}
@@ -77,3 +96,12 @@ val prepareDokkaSource by tasks.registering(Sync::class) {
7796
"**/gradle/wrapper/gradle-wrapper.properties",
7897
)
7998
}
99+
100+
// if Dokkatoo plugin is applied, then re-use the same Dokka version
101+
plugins.withType<DokkatooBasePlugin>().configureEach {
102+
val dokkaVersionFromDokkatoo =
103+
extensions.findByType<DokkatooExtension>()?.versions?.jetbrainsDokka
104+
if (dokkaVersionFromDokkatoo != null) {
105+
dsdExt.dokkaVersion.convention(dokkaVersionFromDokkatoo)
106+
}
107+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
package buildsrc.conventions
2+
3+
import org.gradle.api.tasks.PathSensitivity.NONE
4+
import org.gradle.kotlin.dsl.*
5+
6+
plugins {
7+
id("dev.adamko.dokkatoo-html")
8+
id("buildsrc.conventions.dokka-source-downloader")
9+
}
10+
11+
val prepareDokkaTemplates by tasks.registering {
12+
description = "Prepare Dokka FTL templates"
13+
// This task is too complicated, but Dokka doesn't provide a way of injecting a single script.
14+
// I don't want to copy-paste the current Dokka templates into this project, because if Dokka
15+
// updates the templates then I won't realise they've changed.
16+
17+
val outputDir = layout.buildDirectory.dir("dokkaConfig/templates")
18+
outputs.dir(outputDir).withPropertyName("outputDir")
19+
20+
outputs.cacheIf("always cache, to avoid downloading Dokka source") { true }
21+
22+
val dokkaSourceDir = tasks.named<Sync>("prepareDokkaSource").map { it.destinationDir }
23+
24+
inputs.dir(dokkaSourceDir).withPropertyName("dokkaSourceDir")
25+
.withPathSensitivity(NONE)
26+
27+
val cloudflareScript = """
28+
<script src="https://static.cloudflareinsights.com/beacon.min.js" data-cf-beacon='{"token": "60b3e3c8134343cc8cb3b0fa0bae9a28"}'></script>
29+
""".trimIndent()
30+
inputs.property("cloudflareScript", cloudflareScript)
31+
32+
doLast {
33+
val pageMetadataFtl = outputDir.get().asFile.resolve("includes/page_metadata.ftl").apply {
34+
parentFile.mkdirs()
35+
}
36+
37+
val sourcePageMetadataFtl = dokkaSourceDir.get()
38+
.resolve("dokka-subprojects/plugin-base/src/main/resources/dokka/templates/includes/page_metadata.ftl")
39+
40+
pageMetadataFtl.writeText(
41+
"<#-- DO NOT EDIT generated by $path -->\n" +
42+
sourcePageMetadataFtl.readText()
43+
.replace(
44+
"""</title>""",
45+
"""</title>${"\n"} $cloudflareScript""",
46+
)
47+
)
48+
49+
require(cloudflareScript in pageMetadataFtl.readText()) {
50+
"Cloudflare script missing from $pageMetadataFtl"
51+
}
52+
}
53+
}
54+
55+
dokkatoo {
56+
57+
dokkatooSourceSets.configureEach {
58+
externalDocumentationLinks.register("gradle") {
59+
// https://docs.gradle.org/current/javadoc/index.html
60+
url("https://docs.gradle.org/${gradle.gradleVersion}/javadoc/")
61+
}
62+
63+
sourceLink {
64+
localDirectory.set(file("src/main/kotlin"))
65+
val relativeProjectPath = projectDir.relativeToOrNull(rootDir)?.invariantSeparatorsPath ?: ""
66+
remoteUrl("https://github.com/adamko-dev/dokkatoo/tree/main/$relativeProjectPath/src/main/kotlin")
67+
}
68+
}
69+
70+
pluginsConfiguration {
71+
html {
72+
templatesDir.fileProvider(prepareDokkaTemplates.map { it.outputs.files.singleFile })
73+
homepageLink = "https://github.com/adamko-dev/dokkatoo/"
74+
footerMessage = "Copyright © 2023"
75+
}
76+
}
77+
}

buildSrc/src/main/kotlin/buildsrc/screenshotter/plugin.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import org.gradle.api.attributes.Usage.USAGE_ATTRIBUTE
99
val screenshotterClasspath: Configuration by configurations.creating {
1010
declarable()
1111
withDependencies {
12-
add(project.dependencies.create("com.microsoft.playwright:playwright:1.42.0"))
12+
add(project.dependencies.create("com.microsoft.playwright:playwright:1.43.0"))
1313
}
1414
}
1515

0 commit comments

Comments
 (0)