Skip to content

Commit

Permalink
Add SBOM protocol buffer definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
L3n41c committed Jan 2, 2023
1 parent e91964a commit 4224ec8
Show file tree
Hide file tree
Showing 8 changed files with 6,699 additions and 0 deletions.
29 changes: 29 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
protoc_binary="protoc"
protoc_version="3.5.1"
gogo_dir="/tmp/gogo"
protoc_binary_2="protoc"
protoc_version_2="21.12"
protoc_gen_go_dir="/tmp/protoc-gen-go"


namespace :codegen do

Expand All @@ -24,6 +28,24 @@ namespace :codegen do
unzip protoc-#{protoc_version}*.zip
mv bin/protoc #{protoc_binary}
fi
BASH
EOF
end
if `bash -c "protoc --version"` != "libprotoc ${protoc_version_2}"
protoc_binary_2="/tmp/protoc#{protoc_version_2}"
sh <<-EOF
/bin/bash <<BASH
if [ ! -f #{protoc_binary_2} ] ; then
echo "Downloading protoc #{protoc_version_2}"
cd /tmp
if [ "$(uname -s)" = "Darwin" ] ; then
curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v#{protoc_version_2}/protoc-#{protoc_version_2}-osx-x86_64.zip
else
curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v#{protoc_version_2}/protoc-#{protoc_version_2}-linux-x86_64.zip
fi
unzip protoc-#{protoc_version_2}*.zip
mv bin/protoc #{protoc_binary_2}
fi
BASH
EOF
end
Expand Down Expand Up @@ -71,6 +93,13 @@ BASH
echo "Generating contlcycle proto"
PATH=/tmp/gogo-bin-v1.0.0 #{protoc_binary} --proto_path=$GOPATH/src:#{gogo_dir}/src:. --gogofast_out=$GOPATH/src proto/contlcycle/contlcycle.proto
# Install protoc-gen-go
GOPATH=#{protoc_gen_go_dir} go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
echo "Generating sbom proto"
PATH=#{protoc_gen_go_dir}/bin #{protoc_binary_2} --proto_path=$GOPATH/src:. --go_out=$GOPATH/src proto/deps/github.com/CycloneDX/specification/schema/bom-1.4.proto
PATH=#{protoc_gen_go_dir}/bin #{protoc_binary_2} --proto_path=$GOPATH/src:. --go_out=$GOPATH/src proto/sbom/sbom.proto
cp -r v5/* .
rm -rf v5
BASH
Expand Down
Loading

0 comments on commit 4224ec8

Please sign in to comment.