diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b2c8568..4fa5e56 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -33,7 +33,7 @@ jobs: fetch-depth: 0 persist-credentials: false - - uses: actions/setup-java@v5 + - uses: actions/setup-java@v6 with: distribution: 'temurin' java-version: ${{ matrix.java }} @@ -78,7 +78,7 @@ jobs: - uses: actions/checkout@v7 with: persist-credentials: false - - uses: actions/setup-java@v5 + - uses: actions/setup-java@v6 with: distribution: temurin java-version: 17 diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index f6a34d0..c88894e 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -28,7 +28,7 @@ jobs: with: persist-credentials: false - - uses: actions/setup-java@v5 + - uses: actions/setup-java@v6 with: distribution: 'temurin' java-version: 17 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e328fdb..b783a14 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -33,7 +33,7 @@ jobs: script: | core.setFailed('Not running on main branch, github.ref is ${{ github.ref }}. Please start this workflow only on main') - - uses: actions/setup-java@v5 + - uses: actions/setup-java@v6 with: distribution: "temurin" java-version: 17 diff --git a/CHANGELOG.md b/CHANGELOG.md index 99729c9..d3690c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +- [#77](https://github.com/itsallcode/openfasttrace-gradle/issues/77) + - Add support for OpenFastTrace plugin dependencies - [PR #80](https://github.com/itsallcode/openfasttrace-gradle/pull/80) - Fix JavaDoc warnings and let build fail on warnings - [PR #82](https://github.com/itsallcode/openfasttrace-gradle/pull/82) diff --git a/README.md b/README.md index 720744e..4a33346 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,22 @@ You can configure the following properties: * `filteredArtifactTypes`: Use only the listed artifact types during tracing * `filterWantedStatuses`: Import only specification items that have a status contained in the list of statuses. Possible values: `draft`, `proposed`, `approved`, `rejected`. See the [OFT user guide](https://github.com/itsallcode/openfasttrace/blob/main/doc/user_guide/user_guide.md#filtering-by-status) for details. +### Using OpenFastTrace Plugins + +OpenFastTrace extension plugins can be added with the `pluginDependencies` property. The dependencies are added to the classpath used by requirement collection and tracing: + +```groovy +repositories { + mavenCentral() +} + +requirementTracing { + pluginDependencies = ['org.itsallcode:openfasttrace-asciidoc-plugin:0.3.0'] +} +``` + +These are OpenFastTrace extension plugins, not Gradle build plugins. Plugin JARs must provide the appropriate OpenFastTrace service descriptors and should not include a duplicate incompatible `openfasttrace-api` dependency. Plugin discovery remains additive to OpenFastTrace's built-in plugin directory. + ### Configuring the Short Tag Importer The short tag importer allows omitting artifact type and the covered artifact type. Optionally you can add a prefix to the item name, e.g. a common module name. diff --git a/example-projects/plugin-config/build.gradle b/example-projects/plugin-config/build.gradle new file mode 100644 index 0000000..8b4748c --- /dev/null +++ b/example-projects/plugin-config/build.gradle @@ -0,0 +1,16 @@ +plugins { + id "base" + id 'org.itsallcode.openfasttrace' +} + +repositories { + mavenCentral() +} + +requirementTracing { + failBuild = true + inputDirectories = files('doc', 'src') + reportFormat = 'plain' + // Once we upgrade this, we can remove RegexMatchingImporterFactory + pluginDependencies = ['org.itsallcode:openfasttrace-asciidoc-plugin:0.3.0'] +} diff --git a/example-projects/plugin-config/doc/spec.adoc b/example-projects/plugin-config/doc/spec.adoc new file mode 100644 index 0000000..56e18b7 --- /dev/null +++ b/example-projects/plugin-config/doc/spec.adoc @@ -0,0 +1,6 @@ +== AsciiDoc Spec + +[.specitem, oft-sid="dsn~asciidoc-exampleB~1", oft-needs="impl,test"] +=== Example AsciiDoc Requirement + +Example AsciiDoc requirement diff --git a/example-projects/plugin-config/doc/spec.md b/example-projects/plugin-config/doc/spec.md new file mode 100644 index 0000000..f7393a1 --- /dev/null +++ b/example-projects/plugin-config/doc/spec.md @@ -0,0 +1,6 @@ +# MarkDown Tracing Example +`dsn~md-exampleA~1` + +Example MarkDown requirement + +Needs: impl, test diff --git a/example-projects/plugin-config/settings.gradle b/example-projects/plugin-config/settings.gradle new file mode 100644 index 0000000..782f259 --- /dev/null +++ b/example-projects/plugin-config/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'plugin-config' diff --git a/example-projects/plugin-config/src/Source.java b/example-projects/plugin-config/src/Source.java new file mode 100644 index 0000000..64c6abd --- /dev/null +++ b/example-projects/plugin-config/src/Source.java @@ -0,0 +1,5 @@ +// [impl->dsn~md-exampleA~1] +// [impl->dsn~asciidoc-exampleB~1] +class Source +{ +} diff --git a/example-projects/plugin-config/src/Test.java b/example-projects/plugin-config/src/Test.java new file mode 100644 index 0000000..f234e52 --- /dev/null +++ b/example-projects/plugin-config/src/Test.java @@ -0,0 +1,5 @@ +// [test->dsn~md-exampleA~1] +// [test->dsn~asciidoc-exampleB~1] +class Test +{ +} diff --git a/src/main/java/org/itsallcode/openfasttrace/api/importer/RegexMatchingImporterFactory.java b/src/main/java/org/itsallcode/openfasttrace/api/importer/RegexMatchingImporterFactory.java new file mode 100644 index 0000000..55ab514 --- /dev/null +++ b/src/main/java/org/itsallcode/openfasttrace/api/importer/RegexMatchingImporterFactory.java @@ -0,0 +1,50 @@ +package org.itsallcode.openfasttrace.api.importer; + +import java.util.Collection; + +/** + * Compatibility shim for RegexMatchingImporterFactory which was renamed to + * AbstractRegexMatchingImporterFactory in OpenFastTrace 4.5.0. + *
+ * Shim can be removed when the following issue is fixed: + * + * itsallcode/openffasttrace-asciidoc-plugin # 27 + * + *
+ * Copied from + * OpenFastTrace + * Maven Plugin + * + * @deprecated use {@link AbstractRegexMatchingImporterFactory} instead. + */ +@Deprecated(since = "3.2.0", forRemoval = true) +@SuppressWarnings("java:S118") // Shim class. Ignore name convention. +public abstract class RegexMatchingImporterFactory extends AbstractRegexMatchingImporterFactory +{ + /** + * Constructs a new RegexMatchingImporterFactory with the specified file extensions. + * + * @param extensions + * the file extensions to be associated with this importer factory + * @deprecated use {@link AbstractRegexMatchingImporterFactory} instead. + */ + @Deprecated(since = "3.2.0", forRemoval = true) + protected RegexMatchingImporterFactory(final String... extensions) + { + super(extensions); + } + + /** + * Constructs a new RegexMatchingImporterFactory with the specified file extensions. + * + * @param extensions + * the file extensions to be associated with this importer factory + * @deprecated use {@link AbstractRegexMatchingImporterFactory} instead. + */ + @Deprecated(since = "3.2.0", forRemoval = true) + protected RegexMatchingImporterFactory(final Collection