Skip to content

Link documentation code snippets to functional tests - #2293

Closed
Goooler wants to merge 1 commit into
mainfrom
g/20260909/doc-test-links
Closed

Goooler wants to merge 1 commit into
mainfrom
g/20260909/doc-test-links

Conversation

@Goooler

@Goooler Goooler commented Sep 9, 2026 •

Copy link
Copy Markdown
Member
  • Annotate every doc snippet group with <!-- test: TestClass#testMethod --> and emit @see KDoc links in the generated doc tests.
  • Validate referenced test classes and methods in GenerateDocTests.
  • Make documentTest depend on functionalTest output.
  • Add functional tests for snippets that had no coverage yet.
  • Document the guideline in CONTRIBUTING.md.

- Annotate every doc snippet group with `<!-- test: TestClass#testMethod -->`
  and emit `@see` KDoc links in the generated doc tests.
- Validate referenced test classes and methods in `GenerateDocTests`.
- Make `documentTest` depend on `functionalTest` output.
- Add functional tests for snippets that had no coverage yet.
- Document the guideline in CONTRIBUTING.md.
@Goooler
Goooler force-pushed the g/20260909/doc-test-links branch from 0798584 to b737453 Compare November 7, 2026 06:52
@Goooler Goooler changed the title Link test cases to code snippets Link documentation code snippets to functional tests Nov 7, 2026
@Goooler
Goooler marked this pull request as ready for review November 7, 2026 06:53
@Goooler
Goooler requested a balanced review from Copilot November 7, 2026 06:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Documentation test links can target colliding classes or nonexistent members, and the R8 override test cannot distinguish an explicit override from the default dependency.

2 open issues
What changed in this PR

This PR connects Shadow’s documentation snippets to their supporting tests, making coverage easier to trace through generated KDoc links.

Changes:

  • Add test-reference annotations throughout the documentation and document the contributor guideline.
  • Validate referenced classes and methods, generate @see links, and expose test outputs to the documentation suite.
  • Add functional tests for transformer configuration, R8 dependencies, sources JARs, and language-plugin compatibility.
File Description
src/​functionalTest/​kotlin/​com/​github/​jengelman/​gradle/​plugins/​shadow/​transformers/​AppendingTransformerTest.kt Tests configuring a transformer instance with an action.
src/​functionalTest/​kotlin/​com/​github/​jengelman/​gradle/​plugins/​shadow/​R8MinimizationTest.kt Adds an explicit R8 dependency test.
src/​functionalTest/​kotlin/​com/​github/​jengelman/​gradle/​plugins/​shadow/​PublishingTest.kt Tests publishing the shadow component with sources.
src/​functionalTest/​kotlin/​com/​github/​jengelman/​gradle/​plugins/​shadow/​JavaPluginsTest.kt Tests custom sources output and Groovy/Scala compatibility.
gradle/​build-logic/​src/​main/​kotlin/​com/​github/​jengelman/​gradle/​plugins/​shadow/​buildlogic/​GenerateDocTests.kt Validates test references and generates KDoc links.
docs/​publishing/​README.md Annotates publishing and sources examples with test references.
docs/​multi-project/​README.md Annotates cross-project dependency examples.
docs/​kotlin-plugins/​README.md Annotates Kotlin integration examples.
docs/​groovy-and-scala-plugins/​README.md Links language-plugin examples to tests.
docs/​getting-started/​README.md Adds test-class references to setup examples.
docs/​custom-tasks/​README.md Annotates custom Shadow task examples.
docs/​configuration/​reproducible-builds/​README.md Links the reproducibility example to a test.
docs/​configuration/​relocation/​README.md Annotates relocation examples.
docs/​configuration/​README.md Annotates general configuration examples.
docs/​configuration/​minimizing/​README.md Annotates minimization and R8 examples.
docs/​configuration/​merging/​README.md Annotates resource-merging and transformer examples.
docs/​configuration/​filtering/​README.md Links filtering examples to tests.
docs/​configuration/​dependencies/​README.md Annotates dependency configuration examples.
docs/​application-plugin/​README.md Annotates application and distribution examples.
CONTRIBUTING.md Requires behavioral coverage and snippet annotations.
build.gradle.kts Wires test outputs and source directories into documentation testing.

Review effort: Balanced

Comment on lines +42 to +43
methodPattern.findAll(text).forEach { methods += it.groupValues[1] }
javaMethodPattern.findAll(text).forEach { methods += it.groupValues[1] }
appProjectBlock =
"""
|dependencies {
| shadowR8 '${BuildConfig.DEFAULT_R8_DEPENDENCY}'
@Goooler Goooler closed this Nov 7, 2026
@Goooler
Goooler deleted the g/20260909/doc-test-links branch November 7, 2026 07:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants