Skip to content

Commit f4bcbeb

Browse files
LukisorischLukas Bergholz
andauthored
Add CLI for formulation properties, workflows, steps and commands to TemurinGenSBOM.java (#4240)
* Add CLI actions for workflows, steps and commands Signed-off-by: Lukas Bergholz <[email protected]> * Refactor: split main into parseArgs/dispatch; fix linter errors - Extract argument parsing into record - Move command executions into method for each execution - Satisfy Linter requirements * fix: repace record with inner class to support all jdk versions * Add snippet to build.xml for testSBOM, remove name fallbacks for workflows, steps and commands, comment out FormulaProperty (formula level properties) * Switch to ParsedArgs setters and getters, drop one fallback (TemurinGenSBOM.java) - Use explicit setters and getters in ParsedArgs class to avoid arg ordering issues - Remove fallback in addWorkflowStepCmd (step name required) Note: useJson and and verbose are both in the ParsedArgs class and class variables. Thry are mirrored once in the main method. --------- Signed-off-by: Lukas Bergholz <[email protected]> Co-authored-by: Lukas Bergholz <[email protected]>
1 parent 1159fa5 commit f4bcbeb

File tree

2 files changed

+761
-132
lines changed

2 files changed

+761
-132
lines changed

cyclonedx-lib/build.xml

Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,114 @@
552552
<arg value="--jsonFile"/>
553553
<arg value="${testSBOMFile}"/>
554554
</java>
555+
<java classpath="${classpath}" classname="temurin.sbom.TemurinGenSBOM" fork="yes" failonerror="yes">
556+
<arg value="--verbose"/>
557+
<arg value="--addFormulation"/>
558+
<arg value="--formulaName"/>
559+
<arg value="formula_temurin_build_script_1.0_jdk21u"/>
560+
<arg value="--jsonFile"/>
561+
<arg value="${testSBOMFile}"/>
562+
</java>
563+
<java classpath="${classpath}" classname="temurin.sbom.TemurinGenSBOM" fork="yes" failonerror="yes">
564+
<arg value="--verbose"/>
565+
<arg value="--addWorkflow"/>
566+
<arg value="--formulaName"/>
567+
<arg value="formula_temurin_build_script_1.0_jdk21u"/>
568+
<arg value="--workflowRef"/>
569+
<arg value="workflow_temurin_build_script_1.0_jdk21u"/>
570+
<arg value="--workflowUid"/>
571+
<arg value="f1"/>
572+
<arg value="--workflowName"/>
573+
<arg value="temurin build script 1.0 for jdk21u"/>
574+
<arg value="--taskTypes"/>
575+
<arg value="clone,build"/>
576+
<arg value="--jsonFile"/>
577+
<arg value="${testSBOMFile}"/>
578+
</java>
579+
<java classpath="${classpath}" classname="temurin.sbom.TemurinGenSBOM" fork="yes" failonerror="yes">
580+
<arg value="--verbose"/>
581+
<arg value="--addWorkflowStep"/>
582+
<arg value="--formulaName"/>
583+
<arg value="formula_temurin_build_script_1.0_jdk21u"/>
584+
<arg value="--workflowRef"/>
585+
<arg value="workflow_temurin_build_script_1.0_jdk21u"/>
586+
<arg value="--workflowStepName"/>
587+
<arg value="clone repo"/>
588+
<arg value="--description"/>
589+
<arg value="clone repository"/>
590+
<arg value="--jsonFile"/>
591+
<arg value="${testSBOMFile}"/>
592+
</java>
593+
<java classpath="${classpath}" classname="temurin.sbom.TemurinGenSBOM" fork="yes" failonerror="yes">
594+
<arg value="--verbose"/>
595+
<arg value="--addWorkflowStepCmd"/>
596+
<arg value="--formulaName"/>
597+
<arg value="formula_temurin_build_script_1.0_jdk21u"/>
598+
<arg value="--workflowRef"/>
599+
<arg value="workflow_temurin_build_script_1.0_jdk21u"/>
600+
<arg value="--workflowStepName"/>
601+
<arg value="clone repo"/>
602+
<arg value="--executed"/>
603+
<arg value="git clone [email protected]:adoptium/temurin-build"/>
604+
<arg value="--jsonFile"/>
605+
<arg value="${testSBOMFile}"/>
606+
</java>
607+
<java classpath="${classpath}" classname="temurin.sbom.TemurinGenSBOM" fork="yes" failonerror="yes">
608+
<arg value="--verbose"/>
609+
<arg value="--addWorkflowStep"/>
610+
<arg value="--formulaName"/>
611+
<arg value="formula_temurin_build_script_1.0_jdk21u"/>
612+
<arg value="--workflowRef"/>
613+
<arg value="workflow_temurin_build_script_1.0_jdk21u"/>
614+
<arg value="--workflowStepName"/>
615+
<arg value="cd into repository"/>
616+
<arg value="--description"/>
617+
<arg value="cd into temurin-build"/>
618+
<arg value="--jsonFile"/>
619+
<arg value="${testSBOMFile}"/>
620+
</java>
621+
<java classpath="${classpath}" classname="temurin.sbom.TemurinGenSBOM" fork="yes" failonerror="yes">
622+
<arg value="--verbose"/>
623+
<arg value="--addWorkflowStepCmd"/>
624+
<arg value="--formulaName"/>
625+
<arg value="formula_temurin_build_script_1.0_jdk21u"/>
626+
<arg value="--workflowRef"/>
627+
<arg value="workflow_temurin_build_script_1.0_jdk21u"/>
628+
<arg value="--workflowStepName"/>
629+
<arg value="cd into repository"/>
630+
<arg value="--executed"/>
631+
<arg value="cd temurin-build"/>
632+
<arg value="--jsonFile"/>
633+
<arg value="${testSBOMFile}"/>
634+
</java>
635+
<java classpath="${classpath}" classname="temurin.sbom.TemurinGenSBOM" fork="yes" failonerror="yes">
636+
<arg value="--verbose"/>
637+
<arg value="--addWorkflowStep"/>
638+
<arg value="--formulaName"/>
639+
<arg value="formula_temurin_build_script_1.0_jdk21u"/>
640+
<arg value="--workflowRef"/>
641+
<arg value="workflow_temurin_build_script_1.0_jdk21u"/>
642+
<arg value="--workflowStepName"/>
643+
<arg value="makejdk"/>
644+
<arg value="--description"/>
645+
<arg value="execute makejdk-anyplatform.sh"/>
646+
<arg value="--jsonFile"/>
647+
<arg value="${testSBOMFile}"/>
648+
</java>
649+
<java classpath="${classpath}" classname="temurin.sbom.TemurinGenSBOM" fork="yes" failonerror="yes">
650+
<arg value="--verbose"/>
651+
<arg value="--addWorkflowStepCmd"/>
652+
<arg value="--formulaName"/>
653+
<arg value="formula_temurin_build_script_1.0_jdk21u"/>
654+
<arg value="--workflowRef"/>
655+
<arg value="workflow_temurin_build_script_1.0_jdk21u"/>
656+
<arg value="--workflowStepName"/>
657+
<arg value="makejdk"/>
658+
<arg value="--executed"/>
659+
<arg value="bash ./makejdk-any-platform.sh jdk21u --with-version-string=21.0.2+13-202312052047 --with-vendor-version-string=202312052047"/>
660+
<arg value="--jsonFile"/>
661+
<arg value="${testSBOMFile}"/>
662+
</java>
555663

556664
<!-- XML tests -->
557665
<java classpath="${classpath}" classname="temurin.sbom.TemurinGenSBOM" fork="yes" failonerror="yes">
@@ -836,6 +944,114 @@
836944
<arg value="--xmlFile"/>
837945
<arg value="${testSBOMFile_xml}"/>
838946
</java>
947+
<java classpath="${classpath}" classname="temurin.sbom.TemurinGenSBOM" fork="yes" failonerror="yes">
948+
<arg value="--verbose"/>
949+
<arg value="--addFormulation"/>
950+
<arg value="--formulaName"/>
951+
<arg value="formula_temurin_build_script_1.0_jdk21u"/>
952+
<arg value="--xmlFile"/>
953+
<arg value="${testSBOMFile_xml}"/>
954+
</java>
955+
<java classpath="${classpath}" classname="temurin.sbom.TemurinGenSBOM" fork="yes" failonerror="yes">
956+
<arg value="--verbose"/>
957+
<arg value="--addWorkflow"/>
958+
<arg value="--formulaName"/>
959+
<arg value="formula_temurin_build_script_1.0_jdk21u"/>
960+
<arg value="--workflowRef"/>
961+
<arg value="workflow_temurin_build_script_1.0_jdk21u"/>
962+
<arg value="--workflowUid"/>
963+
<arg value="f1"/>
964+
<arg value="--workflowName"/>
965+
<arg value="temurin build script 1.0 for jdk21u"/>
966+
<arg value="--taskTypes"/>
967+
<arg value="clone,build"/>
968+
<arg value="--xmlFile"/>
969+
<arg value="${testSBOMFile_xml}"/>
970+
</java>
971+
<java classpath="${classpath}" classname="temurin.sbom.TemurinGenSBOM" fork="yes" failonerror="yes">
972+
<arg value="--verbose"/>
973+
<arg value="--addWorkflowStep"/>
974+
<arg value="--formulaName"/>
975+
<arg value="formula_temurin_build_script_1.0_jdk21u"/>
976+
<arg value="--workflowRef"/>
977+
<arg value="workflow_temurin_build_script_1.0_jdk21u"/>
978+
<arg value="--workflowStepName"/>
979+
<arg value="clone repo"/>
980+
<arg value="--description"/>
981+
<arg value="clone repository"/>
982+
<arg value="--xmlFile"/>
983+
<arg value="${testSBOMFile_xml}"/>
984+
</java>
985+
<java classpath="${classpath}" classname="temurin.sbom.TemurinGenSBOM" fork="yes" failonerror="yes">
986+
<arg value="--verbose"/>
987+
<arg value="--addWorkflowStepCmd"/>
988+
<arg value="--formulaName"/>
989+
<arg value="formula_temurin_build_script_1.0_jdk21u"/>
990+
<arg value="--workflowRef"/>
991+
<arg value="workflow_temurin_build_script_1.0_jdk21u"/>
992+
<arg value="--workflowStepName"/>
993+
<arg value="clone repo"/>
994+
<arg value="--executed"/>
995+
<arg value="git clone [email protected]:adoptium/temurin-build"/>
996+
<arg value="--xmlFile"/>
997+
<arg value="${testSBOMFile_xml}"/>
998+
</java>
999+
<java classpath="${classpath}" classname="temurin.sbom.TemurinGenSBOM" fork="yes" failonerror="yes">
1000+
<arg value="--verbose"/>
1001+
<arg value="--addWorkflowStep"/>
1002+
<arg value="--formulaName"/>
1003+
<arg value="formula_temurin_build_script_1.0_jdk21u"/>
1004+
<arg value="--workflowRef"/>
1005+
<arg value="workflow_temurin_build_script_1.0_jdk21u"/>
1006+
<arg value="--workflowStepName"/>
1007+
<arg value="cd into repository"/>
1008+
<arg value="--description"/>
1009+
<arg value="cd into temurin-build"/>
1010+
<arg value="--xmlFile"/>
1011+
<arg value="${testSBOMFile_xml}"/>
1012+
</java>
1013+
<java classpath="${classpath}" classname="temurin.sbom.TemurinGenSBOM" fork="yes" failonerror="yes">
1014+
<arg value="--verbose"/>
1015+
<arg value="--addWorkflowStepCmd"/>
1016+
<arg value="--formulaName"/>
1017+
<arg value="formula_temurin_build_script_1.0_jdk21u"/>
1018+
<arg value="--workflowRef"/>
1019+
<arg value="workflow_temurin_build_script_1.0_jdk21u"/>
1020+
<arg value="--workflowStepName"/>
1021+
<arg value="cd into repository"/>
1022+
<arg value="--executed"/>
1023+
<arg value="cd temurin-build"/>
1024+
<arg value="--xmlFile"/>
1025+
<arg value="${testSBOMFile_xml}"/>
1026+
</java>
1027+
<java classpath="${classpath}" classname="temurin.sbom.TemurinGenSBOM" fork="yes" failonerror="yes">
1028+
<arg value="--verbose"/>
1029+
<arg value="--addWorkflowStep"/>
1030+
<arg value="--formulaName"/>
1031+
<arg value="formula_temurin_build_script_1.0_jdk21u"/>
1032+
<arg value="--workflowRef"/>
1033+
<arg value="workflow_temurin_build_script_1.0_jdk21u"/>
1034+
<arg value="--workflowStepName"/>
1035+
<arg value="makejdk"/>
1036+
<arg value="--description"/>
1037+
<arg value="execute makejdk-anyplatform.sh"/>
1038+
<arg value="--xmlFile"/>
1039+
<arg value="${testSBOMFile_xml}"/>
1040+
</java>
1041+
<java classpath="${classpath}" classname="temurin.sbom.TemurinGenSBOM" fork="yes" failonerror="yes">
1042+
<arg value="--verbose"/>
1043+
<arg value="--addWorkflowStepCmd"/>
1044+
<arg value="--formulaName"/>
1045+
<arg value="formula_temurin_build_script_1.0_jdk21u"/>
1046+
<arg value="--workflowRef"/>
1047+
<arg value="workflow_temurin_build_script_1.0_jdk21u"/>
1048+
<arg value="--workflowStepName"/>
1049+
<arg value="makejdk"/>
1050+
<arg value="--executed"/>
1051+
<arg value="bash ./makejdk-any-platform.sh jdk21u --with-version-string=21.0.2+13-202312052047 --with-vendor-version-string=202312052047"/>
1052+
<arg value="--xmlFile"/>
1053+
<arg value="${testSBOMFile_xml}"/>
1054+
</java>
8391055
</target>
8401056

8411057
<macrodef name="get-component" description="Obtain the given component from the local cache if available or download, and verify its checksum.">

0 commit comments

Comments
 (0)