openfasttrace-gradle
Gradle plugin for the requirement tracing suite OpenFastTrace.
Project Information
Usage
-
Preconditions: Java 11 and Gradle 7.0
-
Add plugin
org.itsallcode.openfasttrace
to your project:plugins { id "org.itsallcode.openfasttrace" version "1.1.0" }
-
Configure your project, see examples
-
Run
./gradlew traceRequirements
-
Report is written to
build/reports/tracing.txt
by default.
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.
requirementTracing {
tags {
tag {
paths = fileTree(dir: 'src/').include '*.impl.*'
coveredItemNamePrefix = 'prefix'
tagArtifactType = 'impl'
coveredItemArtifactType = 'dsn'
}
tag {
paths = fileTree(dir: 'src/').include '*.test.*'
tagArtifactType = 'utest'
coveredItemArtifactType = 'dsn'
}
}
}
As a benefit the tags are much shorter and contain only the name and revision:
// [[tagname:1]]
See multi-project/sub1 for a basic example.
Sharing requirements
In bigger setups you might want to share requirements between multiple projects.
Example: The Software Architecture Design project swad
contains overall requirements that must be fulfilled by projects component-a
and component-b
.
- The
swad
project publishes its requirements as a zip fileswad-req
to a maven repository. - Both components import these requirements and cover them in their Software Detailed Design (swdd).
- Both components publish their requirements as artefacts
component-a-req
andcomponent-b-req
to the shared maven repository. - A regular job check that all requirements from
swad
are covered by tracingswad-req
,component-a-req
andcomponent-b-req
.
Publishing requirements to a maven repository
If you want to publish requirements to a maven repository you can use the following configuration in your build.gradle
:
plugins {
id 'org.itsallcode.openfasttrace'
id 'maven-publish'
}
requirementTracing {
inputDirectories = files('doc')
}
task requirementsZip(type: Zip, dependsOn: collectRequirements) {
from collectRequirements.outputFile
into '/'
}
publishing {
publications {
maven(MavenPublication) {
artifact requirementsZip
}
}
}
See publish-config for a basic example.
Importing external requirements
You can import requirements from another project using the importedRequirements
configuration. The requirements must be published to a repository as a zip file and can be referenced using the usual gradle dependency syntax:
repositories {
maven {
url "http://repo.example.com/maven2"
}
}
requirementTracing {
importedRequirements = ['com.example:swad:1.0.0@zip']
}
See dependency-config for a basic example.
Development
git clone https://github.com/itsallcode/openfasttrace-gradle-gradle.git
./gradlew check
# Test report: build/reports/tests/index.html
openfasttrace
from source
Use To use openfasttrace
from source during development:
-
Clone https://github.com/itsallcode/openfasttrace to
../openfasttrace
-
Create file
gradle.properties
with the following content:oftSourceDir = ../openfasttrace
Using eclipse
Import into eclipse using buildship plugin:
- Select File > Import... > Gradle > Gradle Project
- Click "Next"
- Select Project root directory
- Click "Finish"
Check if dependencies are up-to-date
./gradlew dependencyUpdates
Check dependencies for vulnerabilities
./gradlew ossIndexAudit
Run local sonar analysis
./gradlew clean sonar --info \
-Dsonar.host.url=https://sonarcloud.io \
-Dsonar.organization=itsallcode \
-Dsonar.login=[token]
plugins.gradle.org
Publish to Preparations
Add your API key to ~/.gradle/gradle.properties
:
gradle.publish.key = <key>
gradle.publish.secret = <secret>
Publish release
-
Make sure that property
oftSourceDir
in filegradle.properties
is commented out, i.e. OpenFastTrace is not used from source. -
Update version number in
build.gradle
andREADME.md
. -
Add changes in new version to
CHANGELOG.md
. -
Commit and push changes.
-
Run
./gradlew clean publishPlugins --info
Plugin will be published at https://plugins.gradle.org/m2/org/itsallcode/openfasttrace/org.itsallcode.openfasttrace.gradle.plugin/
-
Create a release in GitHub