Skip to content

Commit

Permalink
Initial CDXA support
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Leonard <[email protected]>
  • Loading branch information
andrew-m-leonard committed Nov 28, 2024
1 parent 919077a commit 59d0852
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 52 deletions.
37 changes: 0 additions & 37 deletions cyclonedx-lib/src/temurin/sbom/TemurinGenSBOM.java
Original file line number Diff line number Diff line change
Expand Up @@ -182,15 +182,6 @@ public static void main(final String[] args) {
writeFile(bom, fileName);
break;

case "addExternalReference": // Adds external Reference
bom = addExternalReference(fileName, hash, url, comment);
writeFile(bom, fileName);
break;

case "addComponentExternalReference": // Adds external Reference to component
bom = addComponentExternalReference(fileName, hash, url, comment);
writeFile(bom, fileName);
break;
default:
System.out.println("Please enter a command.");
}
Expand Down Expand Up @@ -309,34 +300,6 @@ static Bom addComponentProperty(final String fileName, final String compName, fi
return bom;
}

// Method to store externalReferences: dependency_version_alsa.
static Bom addExternalReference(final String fileName, final String hash, final String url, final String comment) {
Bom bom = readFile(fileName);
ExternalReference extRef = new ExternalReference();
Hash hash1 = new Hash(Hash.Algorithm.SHA_256, hash);
extRef.setType(ExternalReference.Type.BUILD_SYSTEM); //required
extRef.setUrl(url); // required must be a valid URL with protocol
extRef.setComment(comment);
extRef.addHash(hash1);
bom.addExternalReference(extRef);
return bom;
}

// Method to store externalReferences to store: openjdk_source.
static Bom addComponentExternalReference(final String fileName, final String hash, final String url, final String comment) {
Bom bom = readFile(fileName);
ExternalReference extRef = new ExternalReference();
Hash hash1 = new Hash(Hash.Algorithm.SHA_256, hash);
Component comp = new Component();
extRef.addHash(hash1);
extRef.setUrl(url);
extRef.setComment(comment); //"openjdk_source"
extRef.setType(ExternalReference.Type.BUILD_SYSTEM);
comp.addExternalReference(extRef);
bom.addComponent(comp);
return bom;
}

static Bom addFormulation(final String fileName, final String name) {
Bom bom = readFile(fileName);
List<Formula> formulation = bom.getFormulation();
Expand Down
15 changes: 0 additions & 15 deletions sbin/common/sbom.sh
Original file line number Diff line number Diff line change
Expand Up @@ -205,18 +205,3 @@ addSBOMComponentPropertyFromFile() {
fi
}

# Function not in use
# Ref: https://cyclonedx.org/docs/1.4/json/#externalReferences
addExternalReference() {
local javaHome="${1}"
local classpath="${2}"
local jsonFile="${3}"
local url="${4}" # required
local comment="${5}"
local hash="${6}"
if [ -z "${hash}" ]; then
"${javaHome}"/bin/java -cp "${classpath}" temurin.sbom.TemurinGenSBOM --addExternalReference --jsonFile "${jsonFile}" --url "${url}" --comment "${comment}" --hash "${hash}"
else
"${javaHome}"/bin/java -cp "${classpath}" temurin.sbom.TemurinGenSBOM --addExternalReference --jsonFile "${jsonFile}" --url "${url}" --comment "${comment}"
fi
}

0 comments on commit 59d0852

Please sign in to comment.