diff --git a/README.md b/README.md index 9ce1db4..8b4a440 100644 --- a/README.md +++ b/README.md @@ -12,28 +12,77 @@ Gradle build plugin for [reqstool](https://github.com/reqstool/reqstool-client) Collects `@Requirements` and `@SVCs` annotations from compiled Java code, combines them with test results, and packages everything into a ZIP artifact for analysis by the reqstool CLI. Supports Java 21+. +The plugin automatically wires task dependencies: `assembleRequirements` depends on all `compileJava` tasks, and `build` is finalized by `assembleRequirements`. No manual task wiring is needed in most projects. + ## Installation Add the plugin to your `build.gradle`: ```groovy plugins { - id 'io.github.reqstool.gradle-plugin' version '0.1.0' + id 'io.github.reqstool.gradle-plugin' version '0.1.1' } requirementsTool { datasetPath = file('docs/reqstool') } +``` -tasks.named('build') { - finalizedBy tasks.named('assembleRequirements') -} +The `assembleRequirements` task runs automatically as part of `build`. No additional wiring is required. + +## Configuration + +All properties are optional. Defaults match the standard Gradle project layout. + +| Property | Type | Default | Description | +|---|---|---|---| +| `requirementsAnnotationsFile` | `RegularFileProperty` | `build/generated/sources/annotationProcessor/java/main/resources/annotations.yml` | Requirements annotations YAML file generated by the annotation processor for the main source set | +| `svcsAnnotationsFiles` | `ConfigurableFileCollection` | Auto-discovered from all non-main source sets | SVCs annotations YAML files, one per test source set (e.g. `test`, `integrationTest`) | +| `svcsAnnotationsFile` _(deprecated)_ | `Object` | — | **Deprecated since 0.1.1.** Use `svcsAnnotationsFiles.from(...)` instead. Delegates to `svcsAnnotationsFiles` and emits a `WARN` log. | +| `outputDirectory` | `RegularFileProperty` | `build/reqstool` | Output directory for the ZIP artifact and combined annotations file | +| `datasetPath` | `RegularFileProperty` | `reqstool/` (project directory) | Directory containing `requirements.yml` and optional supporting files | +| `testResults` | `ListProperty` | `["build/test-results/**/*.xml"]` | Ant-style glob patterns for test result XML files to include in the ZIP | +| `skip` | `Property` | `false` | Skip all plugin execution | +| `skipAssembleZipArtifact` | `Property` | `false` | Skip ZIP assembly; annotations are still combined into `annotations.yml` | +| `skipAttachZipArtifact` | `Property` | `false` | Skip attaching the ZIP artifact to Maven publications | + +### Dataset directory + +The `datasetPath` directory must contain at minimum a `requirements.yml` file. Optional files in the same directory are included if present: + +| File | Required | +|---|---| +| `requirements.yml` | Yes | +| `software_verification_cases.yml` | No | +| `manual_verification_results.yml` | No | + +### Overriding auto-discovered annotation files -tasks.named('assembleRequirements') { - dependsOn tasks.named('test') +To replace the auto-discovered SVCs annotation files with explicit paths (also disables auto-wired compile dependencies for test source sets): + +```groovy +requirementsTool { + setSvcsAnnotationsFiles( + file('custom/path/test-annotations.yml'), + file('custom/path/it-annotations.yml') + ) } ``` +## Task reference + +### `assembleRequirements` + +Group: `build` + +Combines requirements and SVCs annotations from all source sets, writes a merged `annotations.yml` to `outputDirectory`, and (unless `skipAssembleZipArtifact` is set) assembles a ZIP artifact at `/--reqstool.zip`. + +**Auto-wired dependencies** (when the `java` plugin is applied): + +- Depends on `compileJava` (main source set) +- Depends on `compileXxxJava` for each non-main source set (unless `svcsAnnotationsFiles` was set explicitly) +- `build` is finalized by `assembleRequirements` + ## Usage ```bash diff --git a/docs/modules/ROOT/pages/configuration.adoc b/docs/modules/ROOT/pages/configuration.adoc index afbe107..6fd8abe 100644 --- a/docs/modules/ROOT/pages/configuration.adoc +++ b/docs/modules/ROOT/pages/configuration.adoc @@ -1,146 +1,154 @@ -== Configuration += Configuration -The plugin provides zero-configuration defaults, but you can customize if needed: +The plugin provides zero-configuration defaults that match the standard Gradle project layout. +Override only what you need. -=== Complete Configuration Example +== Configuration reference -[source,gradle] ----- -requirementsTool { - // Path to requirements annotations YAML - // Default: build/generated-sources/annotations/resources/annotations.yml - requirementsAnnotationsFile = file('build/custom-path/annotations.yml') +[cols="1,1,2,2",options="header"] +|=== +|Property |Type |Default |Description - // Path to SVCS annotations YAML - // Default: build/generated-test-sources/test-annotations/resources/annotations.yml - svcsAnnotationsFile = file('build/custom-path/test-annotations.yml') +|`requirementsAnnotationsFile` +|`RegularFileProperty` +|`build/generated/sources/annotationProcessor/java/main/resources/annotations.yml` +|Requirements annotations YAML file generated by the annotation processor for the main source set - // Output directory for ZIP and combined annotations - // Default: build/reqstool - outputDirectory = file('build/custom-output') +|`svcsAnnotationsFiles` +|`ConfigurableFileCollection` +|Auto-discovered from all non-main source sets +|SVCs annotations YAML files, one per test source set (e.g. `test`, `integrationTest`) - // Dataset directory containing requirements.yml and optional files - // Default: ./reqstool - datasetPath = file('custom-reqstool-data') +|`svcsAnnotationsFile` _(deprecated)_ +|`Object` +|— +|*Deprecated since 0.1.1.* Use `svcsAnnotationsFiles.from(...)` instead. Delegates to `svcsAnnotationsFiles` and emits a `WARN` log. - // Test result file patterns - // Default: ['build/test-results/**/*.xml'] - testResults = ['build/test-results/**/*.xml', 'build/custom-tests/**/*.xml'] +|`outputDirectory` +|`RegularFileProperty` +|`build/reqstool` +|Output directory for the ZIP artifact and combined `annotations.yml` - // Skip entire plugin execution - // Default: false - skip = false +|`datasetPath` +|`RegularFileProperty` +|`reqstool/` (project directory) +|Directory containing `requirements.yml` and optional supporting files - // Skip ZIP assembly but keep annotation combining - // Default: false - skipAssembleZipArtifact = false +|`testResults` +|`ListProperty` +|`["build/test-results/**/*.xml"]` +|Ant-style glob patterns for test result XML files to include in the ZIP - // Skip artifact attachment for publishing - // Default: false - skipAttachZipArtifact = false -} ----- +|`skip` +|`Property` +|`false` +|Skip all plugin execution -=== Configuration Parameters +|`skipAssembleZipArtifact` +|`Property` +|`false` +|Skip ZIP assembly; annotations are still combined into `annotations.yml` -==== requirementsAnnotationsFile +|`skipAttachZipArtifact` +|`Property` +|`false` +|Skip attaching the ZIP artifact to Maven publications +|=== -The `requirementsAnnotationsFile` parameter specifies the path to the requirements annotations file. -Defaults to the value set below. +== Dataset directory -[source,gradle] ----- -requirementsTool { - requirementsAnnotationsFile = file('build/generated-sources/annotations/resources/annotations.yml') -} ----- +The `datasetPath` directory must contain at minimum a `requirements.yml` file. +Optional files in the same directory are included if present. -==== svcsAnnotationsFile +[cols="1,1",options="header"] +|=== +|File |Required -The `svcsAnnotationsFile` parameter specifies the path to the SVCS (Software Verification Cases) annotations file. -Defaults to the value set below. +|`requirements.yml` +|Yes -[source,gradle] ----- -requirementsTool { - svcsAnnotationsFile = file('build/generated-test-sources/test-annotations/resources/annotations.yml') -} ----- +|`software_verification_cases.yml` +|No + +|`manual_verification_results.yml` +|No +|=== -==== outputDirectory +== Minimal configuration -The `outputDirectory` parameter specifies the path to where to put the generated output. -Defaults to the value set below. +Only `datasetPath` needs to be set when the dataset lives outside the default `reqstool/` directory: [source,gradle] ---- requirementsTool { - outputDirectory = file('build/reqstool') + datasetPath = file('docs/reqstool') } ---- -==== datasetPath - -The `datasetPath` parameter specifies the path to the dataset directory containing requirements.yml and optional files. -Defaults to the value set below. +== Complete configuration example [source,gradle] ---- requirementsTool { - datasetPath = file('./reqstool') + requirementsAnnotationsFile = + file('build/generated/sources/annotationProcessor/java/main/resources/annotations.yml') + + // svcsAnnotationsFiles is a file collection — use .from() to add files additively + svcsAnnotationsFiles.from( + file('build/generated/sources/annotationProcessor/java/test/resources/annotations.yml') + ) + + outputDirectory = file('build/reqstool') + datasetPath = file('docs/reqstool') + testResults = ['build/test-results/**/*.xml'] + skip = false + skipAssembleZipArtifact = false + skipAttachZipArtifact = false } ---- -==== testResults +== Overriding auto-discovered annotation files -The `testResults` parameter specifies one or more test result file patterns. -Supports Ant-style pattern matching. +`svcsAnnotationsFiles` is auto-discovered from all non-main source sets. +To replace auto-discovery with explicit paths (also disables auto-wired compile dependencies for test source sets): [source,gradle] ---- requirementsTool { - testResults = ['build/test-results/**/*.xml', 'build/custom-tests/**/*.xml'] + setSvcsAnnotationsFiles( + file('custom/path/test-annotations.yml'), + file('custom/path/it-annotations.yml') + ) } ---- -==== skip +== Auto-wired task dependencies -Skip the execution of the entire plugin. -Defaults to the value set below. +When the `java` plugin is applied, the plugin automatically wires: -[source,gradle] ----- -requirementsTool { - skip = false -} ----- +* `assembleRequirements` depends on `compileJava` (main source set) +* `assembleRequirements` depends on `compileXxxJava` for each non-main source set (unless `svcsAnnotationsFiles` was set explicitly via `setSvcsAnnotationsFiles(...)`) +* `build` is finalized by `assembleRequirements` + +No manual `dependsOn` or `finalizedBy` blocks are needed in the consuming project. + +If an annotation file is missing at execution time (e.g. when a compile task was excluded), the plugin emits a `WARN` message identifying the missing file. -==== skipAssembleZipArtifact +== Deprecation notice -Skip ZIP artifact assembly but continue with annotation combining. -Defaults to the value set below. +The `svcsAnnotationsFile` property (singular) from plugin `0.1.0` has been replaced by +`svcsAnnotationsFiles` (plural, a `ConfigurableFileCollection`). +The old property still works but emits a deprecation warning and will be removed in a future release. [source,gradle] ---- +// Deprecated — emits a warning; delegates to svcsAnnotationsFiles.from(...) requirementsTool { - skipAssembleZipArtifact = false + svcsAnnotationsFile = file('...') } ----- - -==== skipAttachZipArtifact - -Skip artifact attachment for publishing. -Defaults to the value set below. -[source,gradle] ----- +// Preferred — additive requirementsTool { - skipAttachZipArtifact = false + svcsAnnotationsFiles.from(file('...')) } ---- - -=== Notes - -* All path parameters support both absolute and relative paths -* The plugin executes after the `check` task by default -* Test result paths support Ant-style pattern matching diff --git a/docs/modules/ROOT/pages/index.adoc b/docs/modules/ROOT/pages/index.adoc index 09711a6..b34bb01 100644 --- a/docs/modules/ROOT/pages/index.adoc +++ b/docs/modules/ROOT/pages/index.adoc @@ -5,46 +5,52 @@ This Gradle plugin generates a ZIP artifact containing combined annotations and == Features * *Zero-configuration*: Works out of the box with sensible defaults -* *Automatic lifecycle integration*: Runs as part of the standard `build` task +* *Automatic task wiring*: `assembleRequirements` depends on all compile tasks; `build` is finalized by `assembleRequirements` +* *Multi-source-set support*: SVCs annotation files are auto-discovered from all non-main source sets * *Maven publishing support*: Automatically registers ZIP artifact for publication * *Combines annotations*: Merges requirements annotations from implementation and test code * *Assembles ZIP artifact*: Creates structured ZIP containing requirements, test results, and configuration == Quick Start -== Apply the Plugin +=== Apply the plugin [source,gradle] ---- plugins { - id 'io.github.reqstool.gradle-plugin' version '0.1.0' + id 'io.github.reqstool.gradle-plugin' version '0.1.1' +} + +requirementsTool { + datasetPath = file('docs/reqstool') } ---- -== Default Behavior +=== Default behavior The plugin automatically: -1. Runs after the `check` task (when tests complete) -2. Combines annotation files from `build/generated-sources/` and `build/generated-test-sources/` -3. Creates a ZIP artifact in `build/reqstool/` containing: - * `requirements.yml` (from `./reqstool/` directory) +1. Wires `assembleRequirements` to depend on `compileJava` and all non-main `compileXxxJava` tasks +2. Finalizes `build` with `assembleRequirements` — no manual task configuration needed +3. Combines annotation files from all source sets into `build/reqstool/annotations.yml` +4. Creates a ZIP artifact in `build/reqstool/` containing: + * `requirements.yml` (from `datasetPath` directory) * `software_verification_cases.yml` (optional) * `manual_verification_results.yml` (optional) - * `annotations.yml` (combined/merged annotations) - * `test_results/` (XML test results from `build/test-results/`) + * `annotations.yml` (combined annotations) + * `test_results/` (XML test results matching `testResults` patterns) * `reqstool_config.yml` (configuration manifest) -4. Registers the ZIP for Maven publication (if `maven-publish` plugin is applied) +5. Registers the ZIP for Maven publication (if `maven-publish` plugin is applied) -== Minimal Setup +=== Minimal setup -Create a `reqstool/` directory in your project root with a `requirements.yml` file: +Create a dataset directory with a `requirements.yml` file: [source] ---- my-project/ ├── build.gradle -├── reqstool/ +├── docs/reqstool/ │ └── requirements.yml (mandatory) └── src/ ---- @@ -55,7 +61,7 @@ Run `gradle build` and the ZIP artifact will be created automatically. * Gradle 9.0+ * Java 21+ -* A `requirements.yml` file in the dataset directory (default: `./reqstool/`) +* A `requirements.yml` file in the dataset directory (default: `reqstool/`) == License diff --git a/docs/modules/ROOT/pages/usage.adoc b/docs/modules/ROOT/pages/usage.adoc index e4998bb..383e8f5 100644 --- a/docs/modules/ROOT/pages/usage.adoc +++ b/docs/modules/ROOT/pages/usage.adoc @@ -1,66 +1,86 @@ -== Usage += Usage -To use the reqstool Gradle Plugin, add the following configuration to your Gradle project's `build.gradle`: +== Basic usage -=== Basic Usage +Apply the plugin and set `datasetPath` if your dataset directory is not the default `reqstool/`: [source,gradle] ---- plugins { - id 'io.github.reqstool.gradle-plugin' version '0.1.0' + id 'io.github.reqstool.gradle-plugin' version '0.1.1' +} + +requirementsTool { + datasetPath = file('docs/reqstool') } ---- -The plugin will automatically integrate with the standard Gradle build lifecycle. +Run a standard build — `assembleRequirements` is wired automatically: -=== Using Tasks Manually +[source,bash] +---- +gradle clean build +---- -The main task can be invoked manually: +== Running the task manually [source,bash] ---- gradle assembleRequirements ---- -=== With Maven Publishing +When invoked directly, `assembleRequirements` still depends on all compile tasks so annotation files are always up to date. + +== With Maven publishing -When the `maven-publish` plugin is applied, the reqstool ZIP is automatically registered for publication: +When the `maven-publish` plugin is applied, the reqstool ZIP is automatically registered for publication with classifier `reqstool`: [source,gradle] ---- plugins { - id 'io.github.reqstool.gradle-plugin' version '0.1.0' + id 'io.github.reqstool.gradle-plugin' version '0.1.1' id 'maven-publish' } publishing { repositories { maven { - url = "https://your-repo.example.com/maven" + url = 'https://your-repo.example.com/maven' } } } ---- -The ZIP artifact will be published with classifier `reqstool` (e.g., `my-app-1.0.0-reqstool.zip`). +The artifact is published as `--reqstool.zip`. -=== Available Tasks +== Task reference -==== assembleRequirements +=== assembleRequirements -Main task that: +Group: `build` -* Depends on `check` task (ensures tests have run) -* Combines annotation files -* Assembles ZIP artifact -* Runs automatically as part of `build` task +Combines requirements and SVCs annotations from all source sets into a single `annotations.yml`, +then (unless `skipAssembleZipArtifact` is set) assembles a ZIP artifact at +`/--reqstool.zip`. -=== Default Lifecycle +*Auto-wired dependencies* (when the `java` plugin is applied): -The plugin automatically integrates into the standard Gradle build: +* Depends on `compileJava` (main source set — generates `requirementsAnnotationsFile`) +* Depends on `compileXxxJava` for each non-main source set (generates entries in `svcsAnnotationsFiles`) +* `build` is finalized by `assembleRequirements` + +These dependencies ensure annotation processors run before the task executes. +No manual wiring is needed unless you override annotation file paths with `setSvcsAnnotationsFiles(...)`. + +== Default lifecycle + +[source] +---- +build + └── (finalizedBy) assembleRequirements + ├── (dependsOn) compileJava + ├── (dependsOn) compileTestJava + └── (dependsOn) compileIntegrationTestJava (if source set exists) +---- -1. Plugin is applied -2. `assembleRequirements` task is created and configured -3. Task runs after `check` (when all tests complete) -4. ZIP artifact is created in `build/reqstool/` -5. If `maven-publish` plugin is applied, artifact is registered for publication +ZIP artifact is written to `build/reqstool/--reqstool.zip`. diff --git a/src/main/java/io/github/reqstool/gradle/RequirementsToolExtension.java b/src/main/java/io/github/reqstool/gradle/RequirementsToolExtension.java index e769762..c1ba392 100644 --- a/src/main/java/io/github/reqstool/gradle/RequirementsToolExtension.java +++ b/src/main/java/io/github/reqstool/gradle/RequirementsToolExtension.java @@ -17,10 +17,14 @@ */ public class RequirementsToolExtension { + private final Project project; + private final RegularFileProperty requirementsAnnotationsFile; private final ConfigurableFileCollection svcsAnnotationsFiles; + private boolean svcsAnnotationsFilesExplicit = false; + private final RegularFileProperty outputDirectory; private final RegularFileProperty datasetPath; @@ -39,6 +43,7 @@ public class RequirementsToolExtension { * @param project the Gradle project */ public RequirementsToolExtension(Project project) { + this.project = project; this.requirementsAnnotationsFile = project.getObjects().fileProperty(); this.svcsAnnotationsFiles = project.getObjects().fileCollection(); this.outputDirectory = project.getObjects().fileProperty(); @@ -105,6 +110,37 @@ public ConfigurableFileCollection getSvcsAnnotationsFiles() { return svcsAnnotationsFiles; } + /** + * Replaces the auto-discovered SVCs annotations file collection with explicit paths + * and disables auto-wired compile task dependencies. + * @param paths one or more file paths, {@link java.io.File}, or + * {@link org.gradle.api.file.FileCollection} entries + */ + public void setSvcsAnnotationsFiles(Object... paths) { + this.svcsAnnotationsFilesExplicit = true; + this.svcsAnnotationsFiles.setFrom(paths); + } + + /** + * Returns whether {@link #getSvcsAnnotationsFiles()} was explicitly configured. + * @return {@code true} if the user called {@link #setSvcsAnnotationsFiles} + */ + public boolean isSvcsAnnotationsFilesExplicit() { + return svcsAnnotationsFilesExplicit; + } + + /** + * @deprecated Use {@link #getSvcsAnnotationsFiles()} instead. + * @param file the file to add to {@link #getSvcsAnnotationsFiles()} + */ + @Deprecated + public void setSvcsAnnotationsFile(Object file) { + project.getLogger() + .warn("[reqstool] 'svcsAnnotationsFile' is deprecated and will be removed in a future release." + + " Use 'svcsAnnotationsFiles.from(...)' instead."); + this.svcsAnnotationsFiles.from(file); + } + /** * Returns the output directory where the ZIP artifact and combined annotations are * written. diff --git a/src/main/java/io/github/reqstool/gradle/RequirementsToolPlugin.java b/src/main/java/io/github/reqstool/gradle/RequirementsToolPlugin.java index 7d599b4..3517845 100644 --- a/src/main/java/io/github/reqstool/gradle/RequirementsToolPlugin.java +++ b/src/main/java/io/github/reqstool/gradle/RequirementsToolPlugin.java @@ -3,8 +3,11 @@ import org.gradle.api.Plugin; import org.gradle.api.Project; +import org.gradle.api.plugins.JavaPlugin; +import org.gradle.api.plugins.JavaPluginExtension; import org.gradle.api.publish.PublishingExtension; import org.gradle.api.publish.maven.MavenPublication; +import org.gradle.api.tasks.SourceSet; import org.gradle.api.tasks.TaskProvider; /** @@ -61,6 +64,27 @@ public void apply(Project project) { .file(dir.getAsFile().getPath() + "/" + zipFileName))); }); + // Auto-wire compile task dependencies and build lifecycle integration + project.getPlugins().withType(JavaPlugin.class, javaPlugin -> { + JavaPluginExtension javaExt = project.getExtensions().getByType(JavaPluginExtension.class); + + String compileMain = javaExt.getSourceSets() + .getByName(SourceSet.MAIN_SOURCE_SET_NAME) + .getCompileJavaTaskName(); + assembleTask.configure(task -> task.dependsOn(project.getTasks().named(compileMain))); + + project.afterEvaluate(p -> { + if (!extension.isSvcsAnnotationsFilesExplicit()) { + javaExt.getSourceSets() + .stream() + .filter(ss -> !SourceSet.MAIN_SOURCE_SET_NAME.equals(ss.getName())) + .forEach(ss -> assembleTask + .configure(task -> task.dependsOn(project.getTasks().named(ss.getCompileJavaTaskName())))); + } + project.getTasks().named("build").configure(build -> build.finalizedBy(assembleTask)); + }); + }); + // Auto-configure Maven publishing if maven-publish plugin is applied project.getPlugins().withId("maven-publish", plugin -> { configureMavenPublishing(project, assembleTask); diff --git a/src/main/java/io/github/reqstool/gradle/RequirementsToolTask.java b/src/main/java/io/github/reqstool/gradle/RequirementsToolTask.java index c6d8b5c..e7668de 100644 --- a/src/main/java/io/github/reqstool/gradle/RequirementsToolTask.java +++ b/src/main/java/io/github/reqstool/gradle/RequirementsToolTask.java @@ -283,6 +283,11 @@ public void execute() { .path(XML_REQUIREMENT_ANNOTATIONS) .path(XML_IMPLEMENTATIONS); } + else if (reqAnnotFile != null) { + getLogger().warn( + "reqstool: no annotations found at {} — ensure the compile task runs before assembleRequirements", + reqAnnotFile.getAbsolutePath()); + } ObjectNode mergedTestsNode = yamlMapper.createObjectNode(); for (File svcsAnnotFile : svcsAnnotationsFiles.getFiles()) { @@ -292,6 +297,11 @@ public void execute() { .path(XML_TESTS); mergeTestNodes(mergedTestsNode, fileTestsNode); } + else { + getLogger().warn( + "reqstool: no annotations found at {} — ensure the compile task runs before assembleRequirements", + svcsAnnotFile.getAbsolutePath()); + } } testsNode = mergedTestsNode.isEmpty() ? yamlMapper.createObjectNode() : mergedTestsNode; diff --git a/src/test/java/io/github/reqstool/gradle/RequirementsToolTaskTest.java b/src/test/java/io/github/reqstool/gradle/RequirementsToolTaskTest.java index 2b7338e..bb0173f 100644 --- a/src/test/java/io/github/reqstool/gradle/RequirementsToolTaskTest.java +++ b/src/test/java/io/github/reqstool/gradle/RequirementsToolTaskTest.java @@ -168,6 +168,30 @@ void testMergeTestNodes_mergesTwoFiles() throws IOException { assertTrue(mergedTests.has("SVC_003")); } + @Test + void testSetSvcsAnnotationsFilesMarksExplicit() { + RequirementsToolExtension extension = project.getExtensions() + .create("requirementsTool", RequirementsToolExtension.class, project); + + assertFalse(extension.isSvcsAnnotationsFilesExplicit()); + + File file = tempDir.resolve("annotations.yml").toFile(); + extension.setSvcsAnnotationsFiles(file); + + assertTrue(extension.isSvcsAnnotationsFilesExplicit()); + assertTrue(extension.getSvcsAnnotationsFiles().contains(file)); + } + + @Test + void testDeprecatedSvcsAnnotationsFileSetter() { + RequirementsToolExtension extension = project.getExtensions() + .create("requirementsTool", RequirementsToolExtension.class, project); + + File file = tempDir.resolve("annotations.yml").toFile(); + assertDoesNotThrow(() -> extension.setSvcsAnnotationsFile(file)); + assertTrue(extension.getSvcsAnnotationsFiles().contains(file)); + } + @Test void testMissingRequirementsFile() throws IOException { // Setup directories diff --git a/tests/fixtures/test_project/build.gradle b/tests/fixtures/test_project/build.gradle index bbe5411..1928b1b 100644 --- a/tests/fixtures/test_project/build.gradle +++ b/tests/fixtures/test_project/build.gradle @@ -69,11 +69,3 @@ requirementsTool { datasetPath = file('docs/reqstool') testResults = ['build/test-results/**/*.xml'] } - -tasks.named('build') { - finalizedBy tasks.named('assembleRequirements') -} - -tasks.named('assembleRequirements') { - dependsOn test, testing.suites.integrationTest -}