@@ -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