Skip to content

Commit 12c5960

Browse files
authored
build: add separate target to setup binaries (#20)
Signed-off-by: behnazh-w <[email protected]>
1 parent 884d8ba commit 12c5960

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

Makefile

+15-9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2022 - 2022, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2022 - 2023, Oracle and/or its affiliates. All rights reserved.
22
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/.
33

44
# Use bash as the shell when executing a rule's recipe. For more details:
@@ -83,25 +83,27 @@ venv:
8383
# The _build.yaml GitHub Actions workflow expects dist directory to exist.
8484
# So we create the dist dir if it doesn't exist in the setup target.
8585
# See https://packaging.python.org/en/latest/tutorials/packaging-projects/#generating-distribution-archives.
86-
# We also install SLSA verifier, mvnw, cyclonedx-go, and compile the Go modules.
86+
# We also install cyclonedx-go to generate SBOM for Go, compile the Go modules,
87+
# install SLSA verifier binary, and download mvnw.
8788
.PHONY: setup
88-
setup: force-upgrade setup-go
89+
setup: force-upgrade setup-go setup-binaries
8990
pre-commit install
9091
mkdir -p dist
92+
go install github.com/CycloneDX/cyclonedx-gomod/cmd/[email protected]
93+
setup-go:
94+
go build -o $(MACARON_PATH)/bin/ $(MACARON_PATH)/golang/cmd/...
95+
setup-binaries: $(MACARON_PATH)/bin/slsa-verifier $(MACARON_PATH)/resources/mvnw
96+
$(MACARON_PATH)/bin/slsa-verifier:
9197
git clone --depth 1 https://github.com/slsa-framework/slsa-verifier.git -b v2.0.1
9298
cd slsa-verifier/cli/slsa-verifier && go build -o $(MACARON_PATH)/bin/
9399
cd $(MACARON_PATH) && rm -rf slsa-verifier
94-
go install github.com/CycloneDX/cyclonedx-gomod/cmd/[email protected]
95-
echo "GOPATH=$$GOPATH"
96-
ls $$HOME/go/bin
100+
$(MACARON_PATH)/resources/mvnw:
97101
cd resources \
98102
&& wget https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper-distribution/3.1.1/maven-wrapper-distribution-3.1.1-bin.zip \
99103
&& unzip -o maven-wrapper-distribution-3.1.1-bin.zip \
100104
&& rm -r maven-wrapper-distribution-3.1.1-bin.zip \
101105
&& echo -e "distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.6/apache-maven-3.8.6-bin.zip\nwrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar" > .mvn/wrapper/maven-wrapper.properties \
102106
&& cd $(MACARON_PATH)
103-
setup-go:
104-
go build -o $(MACARON_PATH)/bin/ $(MACARON_PATH)/golang/cmd/...
105107

106108
# Install or upgrade an existing virtual environment based on the
107109
# package dependencies declared in pyproject.toml and go.mod.
@@ -258,7 +260,11 @@ clean: dist-clean bin-clean
258260
nuke-caches: clean
259261
find src/ -type d -name __pycache__ -exec rm -fr {} +
260262
find tests/ -type d -name __pycache__ -exec rm -fr {} +
261-
nuke: nuke-caches
263+
nuke-mvnw:
264+
cd $(MACARON_PATH)/resources \
265+
&& rm mvnw mvnw.cmd mvnwDebug mvnwDebug.cmd \
266+
&& cd $(MACARON_PATH)
267+
nuke: nuke-caches nuke-mvnw
262268
if [ ! -z "${VIRTUAL_ENV}" ]; then \
263269
echo "Please deactivate the virtual environment first!" && exit 1; \
264270
fi

scripts/dev_scripts/copyright-checker.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ for f in $files; do
2222
startyear=$currentyear
2323
fi
2424
if ! grep -i -e "Copyright (c) $startyear - $currentyear, Oracle and/or its affiliates. All rights reserved." "$f" 1>/dev/null;then
25-
if [[ $f =~ .*\.(js$|py$|java$|tf$|go$|sh$|dl$|yaml$) ]] || [[ "${f##*/}" = "Dockerfile" ]];then
25+
if [[ $f =~ .*\.(js$|py$|java$|tf$|go$|sh$|dl$|yaml$) ]] || [[ "${f##*/}" = "Dockerfile" ]] || [[ "${f##*/}" = "Makefile" ]];then
2626
missing_copyright_files+=("$f")
2727
fi
2828
fi
@@ -46,7 +46,7 @@ if [ ${#missing_copyright_files[@]} -ne 0 ]; then
4646
if [ ${#missing_license_note} -eq 0 ]; then
4747
expected="$expected\n\/\* $license_note \*\/"
4848
fi
49-
elif [[ $f =~ .*\.(py$|tf$|sh$|yaml$) ]] || [[ "${f##*/}" = "Dockerfile" ]]; then
49+
elif [[ $f =~ .*\.(py$|tf$|sh$|yaml$) ]] || [[ "${f##*/}" = "Dockerfile" ]] || [[ "${f##*/}" = "Makefile" ]]; then
5050
expected="# Copyright \(c\) $startyear - $currentyear, Oracle and\/or its affiliates\. All rights reserved\."
5151
if [ ${#missing_license_note} -eq 0 ]; then
5252
expected="$expected\n# $license_note"

0 commit comments

Comments
 (0)