Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: add separate target to setup binaries #20

Merged
merged 1 commit into from
Jan 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2022 - 2022, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2022 - 2023, Oracle and/or its affiliates. All rights reserved.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/.

# Use bash as the shell when executing a rule's recipe. For more details:
Expand Down Expand Up @@ -83,25 +83,27 @@ venv:
# The _build.yaml GitHub Actions workflow expects dist directory to exist.
# So we create the dist dir if it doesn't exist in the setup target.
# See https://packaging.python.org/en/latest/tutorials/packaging-projects/#generating-distribution-archives.
# We also install SLSA verifier, mvnw, cyclonedx-go, and compile the Go modules.
# We also install cyclonedx-go to generate SBOM for Go, compile the Go modules,
# install SLSA verifier binary, and download mvnw.
.PHONY: setup
setup: force-upgrade setup-go
setup: force-upgrade setup-go setup-binaries
pre-commit install
mkdir -p dist
go install github.com/CycloneDX/cyclonedx-gomod/cmd/cyclonedx-gomod@v1.3.0
setup-go:
go build -o $(MACARON_PATH)/bin/ $(MACARON_PATH)/golang/cmd/...
setup-binaries: $(MACARON_PATH)/bin/slsa-verifier $(MACARON_PATH)/resources/mvnw
$(MACARON_PATH)/bin/slsa-verifier:
git clone --depth 1 https://github.com/slsa-framework/slsa-verifier.git -b v2.0.1
cd slsa-verifier/cli/slsa-verifier && go build -o $(MACARON_PATH)/bin/
cd $(MACARON_PATH) && rm -rf slsa-verifier
go install github.com/CycloneDX/cyclonedx-gomod/cmd/cyclonedx-gomod@v1.3.0
echo "GOPATH=$$GOPATH"
ls $$HOME/go/bin
$(MACARON_PATH)/resources/mvnw:
cd resources \
&& 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 \
&& unzip -o maven-wrapper-distribution-3.1.1-bin.zip \
&& rm -r maven-wrapper-distribution-3.1.1-bin.zip \
&& 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 \
&& cd $(MACARON_PATH)
setup-go:
go build -o $(MACARON_PATH)/bin/ $(MACARON_PATH)/golang/cmd/...

# Install or upgrade an existing virtual environment based on the
# package dependencies declared in pyproject.toml and go.mod.
Expand Down Expand Up @@ -258,7 +260,11 @@ clean: dist-clean bin-clean
nuke-caches: clean
find src/ -type d -name __pycache__ -exec rm -fr {} +
find tests/ -type d -name __pycache__ -exec rm -fr {} +
nuke: nuke-caches
nuke-mvnw:
cd $(MACARON_PATH)/resources \
&& rm mvnw mvnw.cmd mvnwDebug mvnwDebug.cmd \
&& cd $(MACARON_PATH)
nuke: nuke-caches nuke-mvnw
if [ ! -z "${VIRTUAL_ENV}" ]; then \
echo "Please deactivate the virtual environment first!" && exit 1; \
fi
Expand Down
4 changes: 2 additions & 2 deletions scripts/dev_scripts/copyright-checker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ for f in $files; do
startyear=$currentyear
fi
if ! grep -i -e "Copyright (c) $startyear - $currentyear, Oracle and/or its affiliates. All rights reserved." "$f" 1>/dev/null;then
if [[ $f =~ .*\.(js$|py$|java$|tf$|go$|sh$|dl$|yaml$) ]] || [[ "${f##*/}" = "Dockerfile" ]];then
if [[ $f =~ .*\.(js$|py$|java$|tf$|go$|sh$|dl$|yaml$) ]] || [[ "${f##*/}" = "Dockerfile" ]] || [[ "${f##*/}" = "Makefile" ]];then
missing_copyright_files+=("$f")
fi
fi
Expand All @@ -46,7 +46,7 @@ if [ ${#missing_copyright_files[@]} -ne 0 ]; then
if [ ${#missing_license_note} -eq 0 ]; then
expected="$expected\n\/\* $license_note \*\/"
fi
elif [[ $f =~ .*\.(py$|tf$|sh$|yaml$) ]] || [[ "${f##*/}" = "Dockerfile" ]]; then
elif [[ $f =~ .*\.(py$|tf$|sh$|yaml$) ]] || [[ "${f##*/}" = "Dockerfile" ]] || [[ "${f##*/}" = "Makefile" ]]; then
expected="# Copyright \(c\) $startyear - $currentyear, Oracle and\/or its affiliates\. All rights reserved\."
if [ ${#missing_license_note} -eq 0 ]; then
expected="$expected\n# $license_note"
Expand Down