Skip to content

Commit 51d7b47

Browse files
committed
refactor(reqstool): address full-pr-review findings on #166
- Extract the main/test annotations.yml merge logic from build.yml into scripts/combine-annotations.sh, so it's testable/runnable outside CI rather than only living as inline workflow YAML - Fix import ordering in AbstractAnnotationsProcessor.java and AnnotationsProcessorTests.java (io.github.reqstool.* grouped with other imports, not appended out of order) Other findings from the review were judged out of scope for this PR: the openspecui.hooks.ts MCP client and .claude/settings.json auto-enable pattern are byte-identical to what's already merged across reqstool-client and the other three dogfooded repos this rollout, and the self-apply Maven profile being CI-only (no isolated Invoker IT) matches the Maven/Gradle plugins' existing pattern. Signed-off-by: Jimisola Laursen <jimisola@jimisola.com>
1 parent b7bac87 commit 51d7b47

4 files changed

Lines changed: 26 additions & 9 deletions

File tree

‎.github/workflows/build.yml‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,10 @@ jobs:
4242
# the Maven/Gradle plugins) -- merge them the same way those plugins'
4343
# combineOutput() would, so reqstool status has real, non-fabricated data.
4444
run: |
45-
mkdir -p target/reqstool
46-
{
47-
echo "# yaml-language-server: \$schema=https://raw.githubusercontent.com/reqstool/reqstool-client/main/src/reqstool/resources/schemas/v1/annotations.schema.json"
48-
yq eval-all '. as $item ireduce ({}; . * $item )' \
49-
target/generated-sources/annotations/resources/annotations.yml \
50-
target/generated-test-sources/test-annotations/resources/annotations.yml | grep -v "^#"
51-
} > target/reqstool/annotations.yml
45+
scripts/combine-annotations.sh \
46+
target/generated-sources/annotations/resources/annotations.yml \
47+
target/generated-test-sources/test-annotations/resources/annotations.yml \
48+
target/reqstool/annotations.yml
5249
- name: Install reqstool
5350
uses: reqstool/.github/.github/actions/install-reqstool@9c6feaab046f4782f430dd2527fdb82c2a5cd926 # main 2026-06-22
5451
with:

‎scripts/combine-annotations.sh‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env bash
2+
# Combines this library's own main/test annotation processor output into a
3+
# single annotations.yml, the way the Maven/Gradle plugins' combineOutput()
4+
# would -- but this library has no shared mojo to do it, since main and test
5+
# annotation processing run in separate javac invocations and write to
6+
# separate generated-sources directories.
7+
#
8+
# Usage: scripts/combine-annotations.sh <main-annotations.yml> <test-annotations.yml> <output.yml>
9+
set -euo pipefail
10+
11+
main_file="$1"
12+
test_file="$2"
13+
output_file="$3"
14+
15+
mkdir -p "$(dirname "$output_file")"
16+
17+
{
18+
echo '# yaml-language-server: $schema=https://raw.githubusercontent.com/reqstool/reqstool-client/main/src/reqstool/resources/schemas/v1/annotations.schema.json'
19+
yq eval-all '. as $item ireduce ({}; . * $item )' "$main_file" "$test_file" | grep -v "^#"
20+
} > "$output_file"

‎src/main/java/io/github/reqstool/processor/AbstractAnnotationsProcessor.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright © LFV
22
package io.github.reqstool.processor;
33

4+
import io.github.reqstool.annotations.Requirements;
45
import java.io.IOException;
56
import java.io.OutputStreamWriter;
67
import java.io.PrintWriter;
@@ -26,7 +27,6 @@
2627
import com.fasterxml.jackson.databind.SerializationFeature;
2728
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
2829
import com.fasterxml.jackson.dataformat.yaml.YAMLGenerator;
29-
import io.github.reqstool.annotations.Requirements;
3030

3131
public abstract class AbstractAnnotationsProcessor extends AbstractProcessor {
3232

‎src/test/java/io/github/reqstool/processor/AnnotationsProcessorTests.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import static org.hamcrest.CoreMatchers.is;
55
import static org.hamcrest.MatcherAssert.assertThat;
6+
import io.github.reqstool.annotations.SVCs;
67
import java.io.File;
78
import java.io.IOException;
89
import java.nio.file.Files;
@@ -16,7 +17,6 @@
1617
import javax.tools.ToolProvider;
1718
import org.junit.jupiter.api.Test;
1819
import org.junit.jupiter.api.io.TempDir;
19-
import io.github.reqstool.annotations.SVCs;
2020

2121
/**
2222
* Test custom AnnotationsProcessorTests

0 commit comments

Comments
 (0)