Skip to content

Commit f660e62

Browse files
committed
docs: add comprehensive Javadoc to all public methods
- Document all public getters in RequirementsToolExtension - Document all public getters and task action in RequirementsToolTask - Document apply() and configureMavenPublishing() in RequirementsToolPlugin - Document all private helper methods - Enable Xdoclint:all for stricter documentation checks - Remove previous Xdoclint:none suppression
1 parent 288d0dc commit f660e62

5 files changed

Lines changed: 157 additions & 1 deletion

File tree

.claude/settings.local.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"permissions": {
3+
"allow": [
4+
"Bash(git checkout:*)",
5+
"Bash(./gradlew clean:*)",
6+
"Bash(git add:*)",
7+
"Bash(./gradlew publishToMavenLocal:*)",
8+
"Bash(gradle build:*)",
9+
"Bash(unzip:*)",
10+
"Bash(gradle clean:*)",
11+
"Bash(git:*)",
12+
"Bash(GIT_SEQUENCE_EDITOR=\"/tmp/reword_all.sh\" GIT_EDITOR=\"/tmp/strip_coauthor.sh\" git:*)",
13+
"Bash(gh pr:*)",
14+
"Bash(gh issue:*)",
15+
"Bash(ls:*)",
16+
"WebFetch(domain:github.com)"
17+
]
18+
}
19+
}

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ dependencies {
5050
}
5151

5252
javadoc {
53-
options.addStringOption('Xdoclint:none', '-quiet')
53+
options.addBooleanOption('Xdoclint:all', true)
5454
}
5555

5656
test {

src/main/java/io/github/reqstool/gradle/RequirementsToolExtension.java

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,34 +59,71 @@ public RequirementsToolExtension(Project project) {
5959
this.skipAttachZipArtifact.convention(false);
6060
}
6161

62+
/**
63+
* Returns the path to the requirements annotations YAML file generated by the annotation
64+
* processor.
65+
* @return file property for requirements annotations
66+
*/
6267
public RegularFileProperty getRequirementsAnnotationsFile() {
6368
return requirementsAnnotationsFile;
6469
}
6570

71+
/**
72+
* Returns the path to the SVCs (Software Verification Cases) annotations YAML file
73+
* generated by the test annotation processor.
74+
* @return file property for SVCs annotations
75+
*/
6676
public RegularFileProperty getSvcsAnnotationsFile() {
6777
return svcsAnnotationsFile;
6878
}
6979

80+
/**
81+
* Returns the output directory where the ZIP artifact and combined annotations are
82+
* written.
83+
* @return file property for the output directory
84+
*/
7085
public RegularFileProperty getOutputDirectory() {
7186
return outputDirectory;
7287
}
7388

89+
/**
90+
* Returns the dataset directory containing {@code requirements.yml} and optional
91+
* supporting files.
92+
* @return file property for the dataset directory
93+
*/
7494
public RegularFileProperty getDatasetPath() {
7595
return datasetPath;
7696
}
7797

98+
/**
99+
* Returns the list of Ant-style glob patterns used to locate test result XML files.
100+
* @return list property of test result patterns
101+
*/
78102
public ListProperty<String> getTestResults() {
79103
return testResults;
80104
}
81105

106+
/**
107+
* Returns whether the entire plugin execution should be skipped.
108+
* @return boolean property; {@code true} skips all plugin tasks
109+
*/
82110
public Property<Boolean> getSkip() {
83111
return skip;
84112
}
85113

114+
/**
115+
* Returns whether ZIP artifact assembly should be skipped while still combining
116+
* annotations.
117+
* @return boolean property; {@code true} skips ZIP assembly
118+
*/
86119
public Property<Boolean> getSkipAssembleZipArtifact() {
87120
return skipAssembleZipArtifact;
88121
}
89122

123+
/**
124+
* Returns whether attaching the ZIP artifact for Maven publishing should be skipped.
125+
* @return boolean property; {@code true} skips artifact attachment
126+
*/
90127
public Property<Boolean> getSkipAttachZipArtifact() {
91128
return skipAttachZipArtifact;
92129
}

src/main/java/io/github/reqstool/gradle/RequirementsToolPlugin.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@
1313
*/
1414
public class RequirementsToolPlugin implements Plugin<Project> {
1515

16+
/**
17+
* Applies the plugin to a Gradle project. Registers the {@code assembleRequirements}
18+
* task and automatically configures Maven publishing if the {@code maven-publish}
19+
* plugin is applied.
20+
* @param project the Gradle project
21+
*/
1622
@Override
1723
public void apply(Project project) {
1824
// Create extension for configuration
@@ -55,6 +61,12 @@ public void apply(Project project) {
5561
});
5662
}
5763

64+
/**
65+
* Configures Maven publishing to automatically attach the reqstool ZIP artifact
66+
* to the publication.
67+
* @param project the Gradle project
68+
* @param assembleTask provider for the assembleRequirements task
69+
*/
5870
private void configureMavenPublishing(Project project, TaskProvider<RequirementsToolTask> assembleTask) {
5971
PublishingExtension publishing = project.getExtensions().getByType(PublishingExtension.class);
6072

src/main/java/io/github/reqstool/gradle/RequirementsToolTask.java

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,75 +109,132 @@ public class RequirementsToolTask extends DefaultTask {
109109

110110
private final RegularFileProperty zipFile = getProject().getObjects().fileProperty();
111111

112+
/**
113+
* Returns the path to the requirements annotations YAML file.
114+
* @return file property for requirements annotations
115+
*/
112116
@Optional
113117
@InputFile
114118
public RegularFileProperty getRequirementsAnnotationsFile() {
115119
return requirementsAnnotationsFile;
116120
}
117121

122+
/**
123+
* Returns the path to the SVCs (Software Verification Cases) annotations YAML file.
124+
* @return file property for SVCs annotations
125+
*/
118126
@Optional
119127
@InputFile
120128
public RegularFileProperty getSvcsAnnotationsFile() {
121129
return svcsAnnotationsFile;
122130
}
123131

132+
/**
133+
* Returns the absolute path to the output directory.
134+
* @return output directory path as a string
135+
*/
124136
@Input
125137
public String getOutputDirectoryPath() {
126138
File outDir = outputDirectory.getAsFile().getOrNull();
127139
return outDir != null ? outDir.getAbsolutePath() : "";
128140
}
129141

142+
/**
143+
* Returns the output directory file property.
144+
* @return file property for the output directory
145+
*/
130146
@Internal
131147
public RegularFileProperty getOutputDirectory() {
132148
return outputDirectory;
133149
}
134150

151+
/**
152+
* Returns the dataset directory containing requirements and supporting files.
153+
* @return file property for the dataset directory
154+
*/
135155
@InputDirectory
136156
@Optional
137157
public RegularFileProperty getDatasetPath() {
138158
return datasetPath;
139159
}
140160

161+
/**
162+
* Returns the list of test result file glob patterns.
163+
* @return list property of test result patterns
164+
*/
141165
@Input
142166
public ListProperty<String> getTestResults() {
143167
return testResults;
144168
}
145169

170+
/**
171+
* Returns whether this task execution should be skipped.
172+
* @return boolean property
173+
*/
146174
@Input
147175
public Property<Boolean> getSkip() {
148176
return skip;
149177
}
150178

179+
/**
180+
* Returns whether ZIP artifact assembly should be skipped.
181+
* @return boolean property
182+
*/
151183
@Input
152184
public Property<Boolean> getSkipAssembleZipArtifact() {
153185
return skipAssembleZipArtifact;
154186
}
155187

188+
/**
189+
* Returns whether artifact attachment should be skipped.
190+
* @return boolean property
191+
*/
156192
@Input
157193
public Property<Boolean> getSkipAttachZipArtifact() {
158194
return skipAttachZipArtifact;
159195
}
160196

197+
/**
198+
* Returns the name of the project being built.
199+
* @return project name property
200+
*/
161201
@Input
162202
public Property<String> getProjectName() {
163203
return projectName;
164204
}
165205

206+
/**
207+
* Returns the version of the project being built.
208+
* @return project version property
209+
*/
166210
@Input
167211
public Property<String> getProjectVersion() {
168212
return projectVersion;
169213
}
170214

215+
/**
216+
* Returns the base directory of the project.
217+
* @return project base directory property
218+
*/
171219
@Input
172220
public Property<File> getProjectBasedir() {
173221
return projectBasedir;
174222
}
175223

224+
/**
225+
* Returns the path where the reqstool ZIP artifact will be written.
226+
* @return file property for the ZIP artifact
227+
*/
176228
@OutputFile
177229
public RegularFileProperty getZipFile() {
178230
return zipFile;
179231
}
180232

233+
/**
234+
* Executes the task. Combines requirements and test annotations into a single
235+
* annotations file, and optionally assembles a ZIP artifact containing requirements,
236+
* annotations, and test results.
237+
*/
181238
@TaskAction
182239
public void execute() {
183240
if (skip.get()) {
@@ -226,6 +283,12 @@ public void execute() {
226283
}
227284
}
228285

286+
/**
287+
* Combines implementations and tests nodes into a single requirement annotations node.
288+
* @param implementationsNode node containing requirement implementations
289+
* @param testsNode node containing test cases
290+
* @return combined requirement annotations node
291+
*/
229292
static JsonNode combineOutput(JsonNode implementationsNode, JsonNode testsNode) {
230293
ObjectNode requirementAnnotationsNode = yamlMapper.createObjectNode();
231294
if (!implementationsNode.isEmpty()) {
@@ -241,6 +304,12 @@ static JsonNode combineOutput(JsonNode implementationsNode, JsonNode testsNode)
241304
return newNode;
242305
}
243306

307+
/**
308+
* Writes the combined annotations to a YAML file with language server schema hints.
309+
* @param outputFile the file to write to
310+
* @param combinedOutputNode the combined annotations node
311+
* @throws IOException if writing fails
312+
*/
244313
private void writeCombinedOutputToFile(File outputFile, JsonNode combinedOutputNode) throws IOException {
245314
File reqAnnotFile = requirementsAnnotationsFile.getAsFile().getOrNull();
246315
File svcsAnnotFile = svcsAnnotationsFile.getAsFile().getOrNull();
@@ -255,6 +324,11 @@ private void writeCombinedOutputToFile(File outputFile, JsonNode combinedOutputN
255324
}
256325
}
257326

327+
/**
328+
* Assembles the reqstool ZIP artifact containing requirements, annotations, and test
329+
* results.
330+
* @throws IOException if ZIP creation or file reading fails
331+
*/
258332
private void assembleZipArtifact() throws IOException {
259333
String zipArtifactFilename = projectName.get() + "-" + projectVersion.get() + "-reqstool.zip";
260334
String topLevelDir = projectName.get() + "-" + projectVersion.get() + "-reqstool";
@@ -340,6 +414,13 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IO
340414
getLogger().info("Assembled zip artifact: " + zipFileOutput.getAbsolutePath());
341415
}
342416

417+
/**
418+
* Adds a file to the ZIP artifact at the specified target directory.
419+
* @param zipOut the ZIP output stream
420+
* @param file the file to add
421+
* @param targetDirectory the target directory within the ZIP
422+
* @throws IOException if reading the file or writing to ZIP fails
423+
*/
343424
private void addFileToZipArtifact(ZipOutputStream zipOut, File file, File targetDirectory) throws IOException {
344425
if (file.exists()) {
345426
File entryName;
@@ -362,6 +443,13 @@ private void addFileToZipArtifact(ZipOutputStream zipOut, File file, File target
362443
}
363444
}
364445

446+
/**
447+
* Creates and adds the reqstool_config.yml file to the ZIP artifact.
448+
* @param zipOut the ZIP output stream
449+
* @param topLevelDir the top-level directory within the ZIP
450+
* @param reqstoolConfigResources map of resource files included in the artifact
451+
* @throws IOException if writing to ZIP fails
452+
*/
365453
private void addReqstoolConfigYamlToZip(ZipOutputStream zipOut, File topLevelDir,
366454
Map<String, Object> reqstoolConfigResources) throws IOException {
367455
DumperOptions options = new DumperOptions();

0 commit comments

Comments
 (0)