Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions .claude/settings.local.json

This file was deleted.

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,6 @@ bin/

### Mac OS ###
.DS_Store

### Claude Code ###
.claude/
158 changes: 9 additions & 149 deletions README.adoc
Original file line number Diff line number Diff line change
@@ -1,149 +1,9 @@
= Reqstool Gradle Plugin
:toc:
:toc-placement!:

image:https://img.shields.io/badge/License-MIT-blue.svg[License,link=LICENSE]

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].

toc::[]

== Features

* *Zero-configuration*: Works out of the box with sensible defaults
* *Automatic lifecycle integration*: Runs as part of the standard `build` task
* *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

[source,gradle]
----
plugins {
id 'io.github.reqstool.gradle-plugin' version '0.1.0'
}
----

=== 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)
* `software_verification_cases.yml` (optional)
* `manual_verification_results.yml` (optional)
* `annotations.yml` (combined/merged annotations)
* `test_results/` (XML test results from `build/test-results/`)
* `reqstool_config.yml` (configuration manifest)
4. Registers the ZIP for Maven publication (if `maven-publish` plugin is applied)

=== Minimal Setup

Create a `reqstool/` directory in your project root with a `requirements.yml` file:

----
my-project/
├── build.gradle
├── reqstool/
│ └── requirements.yml (mandatory)
└── src/
----

Run `gradle build` and the ZIP artifact will be created automatically.

== Configuration

The plugin provides zero-configuration defaults, but you can customize if needed:

[source,gradle]
----
requirementsTool {
// Path to requirements annotations YAML
// Default: build/generated-sources/annotations/resources/annotations.yml
requirementsAnnotationsFile = file('build/custom-path/annotations.yml')

// Path to SVCS annotations YAML
// Default: build/generated-test-sources/test-annotations/resources/annotations.yml
svcsAnnotationsFile = file('build/custom-path/test-annotations.yml')

// Output directory for ZIP and combined annotations
// Default: build/reqstool
outputDirectory = file('build/custom-output')

// Dataset directory containing requirements.yml and optional files
// Default: ./reqstool
datasetPath = file('custom-reqstool-data')

// Test result file patterns
// Default: ['build/test-results/**/*.xml']
testResults = ['build/test-results/**/*.xml', 'build/custom-tests/**/*.xml']

// Skip entire plugin execution
// Default: false
skip = false

// Skip ZIP assembly but keep annotation combining
// Default: false
skipAssembleZipArtifact = false

// Skip artifact attachment for publishing
// Default: false
skipAttachZipArtifact = false
}
----

== Publishing

When the `maven-publish` plugin is applied, the reqstool ZIP is automatically registered for publication:

[source,gradle]
----
plugins {
id 'io.github.reqstool.gradle-plugin' version '0.1.0'
id 'maven-publish'
}

publishing {
repositories {
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`).

== Tasks

=== `assembleRequirements`

Main task that:

* Depends on `check` task (ensures tests have run)
* Combines annotation files
* Assembles ZIP artifact
* Runs automatically as part of `build` task

Run manually:

[source,bash]
----
gradle assembleRequirements
----

== Requirements

* Gradle 9.0+
* Java 17+
* A `requirements.yml` file in the dataset directory (default: `./reqstool/`)

== License

MIT License - see link:LICENSE[LICENSE] file for details

image:https://img.shields.io/github/commit-activity/m/reqstool/reqstool-java-gradle-plugin?label=commits&style=for-the-badge["Commit Activity", link="https://github.com/reqstool/reqstool-java-gradle-plugin/pulse"]
image:https://img.shields.io/github/issues/reqstool/reqstool-java-gradle-plugin?style=for-the-badge&logo=github["GitHub Issues", link="https://github.com/reqstool/reqstool-java-gradle-plugin/issues"]
image:https://img.shields.io/badge/Java-17-brightgreen.svg?style=for-the-badge["JVM support", link="https://sdkman.io"]
image:https://img.shields.io/github/license/reqstool/reqstool-java-gradle-plugin?style=for-the-badge&logo=opensourceinitiative["License", link="https://opensource.org/license/mit/"]
image:https://img.shields.io/github/actions/workflow/status/reqstool/reqstool-java-gradle-plugin/build.yml?style=for-the-badge&logo=github["Build", link="https://github.com/reqstool/reqstool-java-gradle-plugin/actions/workflows/build.yml"]
image:https://img.shields.io/badge/Documentation-blue?style=for-the-badge&link=docs["Static Badge", link="https://reqstool.github.io/reqstool-java-gradle-plugin/"]

See:
link:https://github.com/reqstool/reqstool-java-gradle-plugin/blob/main/docs/modules/ROOT/pages/index.adoc[Documentation]
22 changes: 17 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ repositories {
}

gradlePlugin {
website = 'https://github.com/reqstool/reqstool-java-gradle-plugin'
website = 'https://reqstool.github.io'
vcsUrl = 'https://github.com/reqstool/reqstool-java-gradle-plugin.git'

plugins {
Expand Down Expand Up @@ -49,10 +49,22 @@ dependencies {
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}

javadoc {
options.addBooleanOption('Xdoclint:all', true)
}

test {
useJUnitPlatform()
}

publishing {
publications {
withType(MavenPublication) {
pom {
developers {
developer {
name = 'Reqstool Contributors'
organization = 'reqstool'
organizationUrl = 'https://github.com/reqstool'
}
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ public class RequirementsToolTask extends DefaultTask {
public static final String XML_TESTS = "tests";

/** YAML language server schema hint for annotations files. */
protected static final String YAML_LANG_SERVER_SCHEMA_ANNOTATIONS = "# yaml-language-server: $schema=https://raw.githubusercontent.com/Luftfartsverket/reqstool-client/main/src/reqstool/resources/schemas/v1/annotations.schema.json";
protected static final String YAML_LANG_SERVER_SCHEMA_ANNOTATIONS = "# yaml-language-server: $schema=https://raw.githubusercontent.com/reqstool/reqstool-client/main/src/reqstool/resources/schemas/v1/annotations.schema.json";

/** YAML language server schema hint for reqstool config files. */
protected static final String YAML_LANG_SERVER_SCHEMA_CONFIG = "# yaml-language-server: $schema=https://raw.githubusercontent.com/Luftfartsverket/reqstool-client/main/src/reqstool/resources/schemas/v1/reqstool_config.schema.json";
protected static final String YAML_LANG_SERVER_SCHEMA_CONFIG = "# yaml-language-server: $schema=https://raw.githubusercontent.com/reqstool/reqstool-client/main/src/reqstool/resources/schemas/v1/reqstool_config.schema.json";

private static final ObjectMapper yamlMapper;

Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/yml/requirements_annotations.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/Luftfartsverket/reqstool-client/main/src/reqstool/resources/schemas/v1/annotations.schema.json
# yaml-language-server: $schema=https://raw.githubusercontent.com/reqstool/reqstool-client/main/src/reqstool/resources/schemas/v1/annotations.schema.json
---
requirement_annotations:
implementations:
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/yml/svcs_annotations.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/Luftfartsverket/reqstool-client/main/src/reqstool/resources/schemas/v1/annotations.schema.json
# yaml-language-server: $schema=https://raw.githubusercontent.com/reqstool/reqstool-client/main/src/reqstool/resources/schemas/v1/annotations.schema.json
---
requirement_annotations:
tests:
Expand Down