This is an automated email from the ASF dual-hosted git repository. asf-gitbox-commits pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/ant-antlibs-cyclonedx.git
commit d8c0f08d4ab35ac6e6e7849ad11aedf3af5114e0 Author: Stefan Bodewig <[email protected]> AuthorDate: Sat May 23 17:48:01 2026 +0200 try to generalize logic for tarball boms --- build.xml | 44 +++++++++++++++------------- src/main/org/apache/ant/cyclonedx/antlib.xml | 42 +++++++++++++++++++++++++- 2 files changed, 65 insertions(+), 21 deletions(-) diff --git a/build.xml b/build.xml index b33370d..657b67d 100644 --- a/build.xml +++ b/build.xml @@ -291,33 +291,30 @@ under the License. <attribute name="binsrc"/> <attribute name="binarysource"/> <attribute name="ext"/> + <element name="moreComponentChildren" implicit="true" optional="true"/> <sequential> - <cdx:componentbom - bomName="${dist.name}-@{binsrc}.@{ext}.cyclonedx" + <cdx:distributionbom outputdirectory="@{distbase}" - format="all" - useComponentSupplier="true" + version="${artifact.version}" + archiveName="${dist.name}-@{binsrc}.@{ext}" + archiveUrl="https://archive.apache.org/dist/ant/antlibs/${dist.name}-@{binsrc}.@{ext}" + archiveLocation="@{distbase}/${dist.name}-@{binsrc}.@{ext}" + description="Apache CycloneDX Antlib @{binarysource}" + publisher="The Apache Software Foundation" xmlns:cdx="antlib:org.apache.ant.cyclonedx"> - <component - version="${artifact.version}" - purl="https://archive.apache.org/dist/ant/antlibs/${dist.name}-@{binsrc}.@{ext}" - name="https://archive.apache.org/dist/ant/antlibs/${dist.name}-@{binsrc}.@{ext}" - description="Apache CycloneDX Antlib @{binarysource}" - publisher="The Apache Software Foundation" - type="FILE" - manufacturerIsSupplier="true"> - <file file="@{distbase}/${dist.name}-@{binsrc}.@{ext}"/> + <componentChildren> <manufacturer refid="ant-team"/> <license refid="apache-2"/> <externalReferenceSet refid="ant-common-refs"/> <externalReferenceSet refid="antlib-ext-refs"/> - </component> - <pureFileComponents> + <moreComponentChildren/> + </componentChildren> + <archiveContent> <fileset dir="@{distdir}/.."> <include name="${dist.name}/**"/> </fileset> - </pureFileComponents> - </cdx:componentbom> + </archiveContent> + </cdx:distributionbom> </sequential> </macrodef> <macrodef name="create-tarball-boms"> @@ -325,25 +322,32 @@ under the License. <attribute name="distbase"/> <attribute name="binsrc"/> <attribute name="binarysource"/> + <element name="componentChildren" implicit="true" optional="true"/> <sequential> <create-tarball-bom distdir="@{distdir}" distbase="@{distbase}" binsrc="@{binsrc}" binarysource="@{binarysource}" - ext="tar.gz"/> + ext="tar.gz"> + <componentChildren/> + </create-tarball-bom> <create-tarball-bom distdir="@{distdir}" distbase="@{distbase}" binsrc="@{binsrc}" binarysource="@{binarysource}" - ext="tar.bz2"/> + ext="tar.bz2"> + <componentChildren/> + </create-tarball-bom> <create-tarball-bom distdir="@{distdir}" distbase="@{distbase}" binsrc="@{binsrc}" binarysource="@{binarysource}" - ext="zip"/> + ext="zip"> + <componentChildren/> + </create-tarball-bom> </sequential> </macrodef> </target> diff --git a/src/main/org/apache/ant/cyclonedx/antlib.xml b/src/main/org/apache/ant/cyclonedx/antlib.xml index e42042c..012804f 100644 --- a/src/main/org/apache/ant/cyclonedx/antlib.xml +++ b/src/main/org/apache/ant/cyclonedx/antlib.xml @@ -17,7 +17,7 @@ KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> -<antlib xmlns:au="ant:current"> +<antlib xmlns:cdx="ant:current"> <taskdef name="componentbom" classname="org.apache.ant.cyclonedx.ComponentBomTask"/> <typedef name="component" @@ -28,4 +28,44 @@ under the License. classname="org.apache.ant.cyclonedx.License"/> <typedef name="externalreferenceset" classname="org.apache.ant.cyclonedx.ExternalReferenceSet"/> + + <macrodef name="distributionbom" backtrace="false"> + <attribute name="version"/> + <attribute name="archiveName"/> + <attribute name="archiveUrl"/> + <attribute name="archiveLocation"/> + <attribute name="outputDirectory"/> + <attribute name="description"/> + <attribute name="publisher"/> + <attribute name="componentType" default="file"/> + <attribute name="format" default="all"/> + <attribute name="useComponentSupplier" default="true"/> + <attribute name="manufacturerIsSupplier" default="true"/> + <element name="archiveContent"/> + <element name="componentChildren" optional="true"/> + <element name="additionalBomContent" optional="true"/> + <sequential> + <cdx:componentbom + bomName="@{archiveName}.cyclonedx" + outputdirectory="@{outputDirectory}" + format="@{format}" + useComponentSupplier="@{useComponentSupplier}"> + <component + version="@{version}" + purl="@{archiveUrl}" + name="@{archiveUrl}" + description="@{description}" + publisher="@{publisher}" + type="@{componentType}" + manufacturerIsSupplier="@{manufacturerIsSupplier}"> + <file file="@{archiveLocation}"/> + <componentChildren/> + </component> + <pureFileComponents> + <archiveContent/> + </pureFileComponents> + <additionalBomContent/> + </cdx:componentbom> + </sequential> + </macrodef> </antlib>
