|
| 1 | += Reqstool Gradle Plugin |
| 2 | +:toc: |
| 3 | +:toc-placement!: |
| 4 | + |
| 5 | +image:https://img.shields.io/badge/License-MIT-blue.svg[License,link=LICENSE] |
| 6 | + |
| 7 | +Gradle plugin for assembling and attaching reqstool ZIP artifacts. This plugin mimics the behavior of the link:https://github.com/Luftfartsverket/reqstool-java-maven-plugin[reqstool-java-maven-plugin]. |
| 8 | + |
| 9 | +toc::[] |
| 10 | + |
| 11 | +== Features |
| 12 | + |
| 13 | +* *Zero-configuration*: Works out of the box with sensible defaults |
| 14 | +* *Automatic lifecycle integration*: Runs as part of the standard `build` task |
| 15 | +* *Maven publishing support*: Automatically registers ZIP artifact for publication |
| 16 | +* *Combines annotations*: Merges requirements annotations from implementation and test code |
| 17 | +* *Assembles ZIP artifact*: Creates structured ZIP containing requirements, test results, and configuration |
| 18 | + |
| 19 | +== Quick Start |
| 20 | + |
| 21 | +=== Apply the Plugin |
| 22 | + |
| 23 | +[source,gradle] |
| 24 | +---- |
| 25 | +plugins { |
| 26 | + id 'se.lfv.reqstool' version '1.0.0' |
| 27 | +} |
| 28 | +---- |
| 29 | + |
| 30 | +=== Default Behavior |
| 31 | + |
| 32 | +The plugin automatically: |
| 33 | + |
| 34 | +1. Runs after the `check` task (when tests complete) |
| 35 | +2. Combines annotation files from `build/generated-sources/` and `build/generated-test-sources/` |
| 36 | +3. Creates a ZIP artifact in `build/reqstool/` containing: |
| 37 | + * `requirements.yml` (from `./reqstool/` directory) |
| 38 | + * `software_verification_cases.yml` (optional) |
| 39 | + * `manual_verification_results.yml` (optional) |
| 40 | + * `annotations.yml` (combined/merged annotations) |
| 41 | + * `test_results/` (XML test results from `build/test-results/`) |
| 42 | + * `reqstool_config.yml` (configuration manifest) |
| 43 | +4. Registers the ZIP for Maven publication (if `maven-publish` plugin is applied) |
| 44 | + |
| 45 | +=== Minimal Setup |
| 46 | + |
| 47 | +Create a `reqstool/` directory in your project root with a `requirements.yml` file: |
| 48 | + |
| 49 | +---- |
| 50 | +my-project/ |
| 51 | +├── build.gradle |
| 52 | +├── reqstool/ |
| 53 | +│ └── requirements.yml (mandatory) |
| 54 | +└── src/ |
| 55 | +---- |
| 56 | + |
| 57 | +Run `gradle build` and the ZIP artifact will be created automatically. |
| 58 | + |
| 59 | +== Configuration |
| 60 | + |
| 61 | +The plugin provides zero-configuration defaults, but you can customize if needed: |
| 62 | + |
| 63 | +[source,gradle] |
| 64 | +---- |
| 65 | +requirementsTool { |
| 66 | + // Path to requirements annotations YAML |
| 67 | + // Default: build/generated-sources/annotations/resources/annotations.yml |
| 68 | + requirementsAnnotationsFile = file('build/custom-path/annotations.yml') |
| 69 | + |
| 70 | + // Path to SVCS annotations YAML |
| 71 | + // Default: build/generated-test-sources/test-annotations/resources/annotations.yml |
| 72 | + svcsAnnotationsFile = file('build/custom-path/test-annotations.yml') |
| 73 | + |
| 74 | + // Output directory for ZIP and combined annotations |
| 75 | + // Default: build/reqstool |
| 76 | + outputDirectory = file('build/custom-output') |
| 77 | + |
| 78 | + // Dataset directory containing requirements.yml and optional files |
| 79 | + // Default: ./reqstool |
| 80 | + datasetPath = file('custom-reqstool-data') |
| 81 | + |
| 82 | + // Test result file patterns |
| 83 | + // Default: ['build/test-results/**/*.xml'] |
| 84 | + testResults = ['build/test-results/**/*.xml', 'build/custom-tests/**/*.xml'] |
| 85 | + |
| 86 | + // Skip entire plugin execution |
| 87 | + // Default: false |
| 88 | + skip = false |
| 89 | + |
| 90 | + // Skip ZIP assembly but keep annotation combining |
| 91 | + // Default: false |
| 92 | + skipAssembleZipArtifact = false |
| 93 | + |
| 94 | + // Skip artifact attachment for publishing |
| 95 | + // Default: false |
| 96 | + skipAttachZipArtifact = false |
| 97 | +} |
| 98 | +---- |
| 99 | + |
| 100 | +== Publishing |
| 101 | + |
| 102 | +When the `maven-publish` plugin is applied, the reqstool ZIP is automatically registered for publication: |
| 103 | + |
| 104 | +[source,gradle] |
| 105 | +---- |
| 106 | +plugins { |
| 107 | + id 'se.lfv.reqstool' version '1.0.0' |
| 108 | + id 'maven-publish' |
| 109 | +} |
| 110 | +
|
| 111 | +publishing { |
| 112 | + repositories { |
| 113 | + maven { |
| 114 | + url = "https://your-repo.example.com/maven" |
| 115 | + } |
| 116 | + } |
| 117 | +} |
| 118 | +---- |
| 119 | + |
| 120 | +The ZIP artifact will be published with classifier `reqstool` (e.g., `my-app-1.0.0-reqstool.zip`). |
| 121 | + |
| 122 | +== Tasks |
| 123 | + |
| 124 | +=== `assembleRequirements` |
| 125 | + |
| 126 | +Main task that: |
| 127 | + |
| 128 | +* Depends on `check` task (ensures tests have run) |
| 129 | +* Combines annotation files |
| 130 | +* Assembles ZIP artifact |
| 131 | +* Runs automatically as part of `build` task |
| 132 | + |
| 133 | +Run manually: |
| 134 | + |
| 135 | +[source,bash] |
| 136 | +---- |
| 137 | +gradle assembleRequirements |
| 138 | +---- |
| 139 | + |
| 140 | +== Requirements |
| 141 | + |
| 142 | +* Gradle 6.0+ (tested with Gradle 9.3) |
| 143 | +* Java 8+ |
| 144 | +* A `requirements.yml` file in the dataset directory (default: `./reqstool/`) |
| 145 | + |
| 146 | +== License |
| 147 | + |
| 148 | +MIT License - see link:LICENSE[LICENSE] file for details |
| 149 | + |
| 150 | +== Credits |
| 151 | + |
| 152 | +Based on link:https://github.com/Luftfartsverket/reqstool-java-maven-plugin[reqstool-java-maven-plugin] by Luftfartsverket (LFV). |
0 commit comments