-
Notifications
You must be signed in to change notification settings - Fork 28
chore: Makefile tweaks #841
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
Changes from all commits
2b0a557
22a904b
1810db5
751c39c
09c5fb6
b145015
4f634f2
85446ff
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,7 +88,11 @@ venv: | |
# install SLSA verifier binary, download mvnw, and gradlew. | ||
.PHONY: setup | ||
setup: force-upgrade setup-go setup-binaries setup-schemastore | ||
ifeq ($(PRE_COMMIT_HOOKS),false) | ||
$(warning "Pre-commit hooks were not installed. Install manually using `pre-commit install` command.") | ||
else | ||
pre-commit install | ||
endif | ||
mkdir -p dist | ||
go install github.com/CycloneDX/cyclonedx-gomod/cmd/cyclonedx-gomod@v1.3.0 | ||
setup-go: | ||
|
@@ -107,13 +111,17 @@ $(PACKAGE_PATH)/resources/mvnw: | |
&& 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 $(REPO_PATH) | ||
$(PACKAGE_PATH)/resources/gradlew: | ||
ifeq ($(shell java --version 2>&1 | grep '17.' >/dev/null; echo $$?), 0) | ||
cd $(PACKAGE_PATH)/resources \ | ||
&& export GRADLE_VERSION=7.6 \ | ||
&& wget https://services.gradle.org/distributions/gradle-$$GRADLE_VERSION-bin.zip \ | ||
&& unzip -o gradle-$$GRADLE_VERSION-bin.zip \ | ||
&& rm -r gradle-$$GRADLE_VERSION-bin.zip \ | ||
&& gradle-$$GRADLE_VERSION/bin/gradle wrapper \ | ||
&& cd $(REPO_PATH) | ||
else | ||
$(error Java 17 is required for Gradle 7.6 installation. See the Grable compatbility matrix: https://docs.gradle.org/current/userguide/compatibility.html) | ||
endif | ||
setup-schemastore: $(PACKAGE_PATH)/resources/schemastore/github-workflow.json $(PACKAGE_PATH)/resources/schemastore/LICENSE $(PACKAGE_PATH)/resources/schemastore/NOTICE | ||
$(PACKAGE_PATH)/resources/schemastore/github-workflow.json: | ||
cd $(PACKAGE_PATH)/resources \ | ||
|
@@ -145,7 +153,10 @@ else | |
endif | ||
.PHONY: souffle | ||
souffle: | ||
if ! command -v souffle; then \ | ||
ifeq ($(INSTALL_SOUFFLE),false) | ||
$(warning "Skipping Souffle installation. Set INSTALL_SOUFFLE=true to install.") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assume you are trying to optionally disable the Souffle installation, but the implementation below should have handled that. Did you get this error on your macOS? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, the |
||
else | ||
@if ! command -v souffle; then \ | ||
echo "Installing system dependency: souffle" && \ | ||
case $(OS_DISTRO) in \ | ||
"Oracle Linux") \ | ||
|
@@ -166,10 +177,9 @@ souffle: | |
else \ | ||
echo "Unable to install Souffle. Please install it manually." && exit 0; \ | ||
fi ;; \ | ||
esac; \ | ||
fi && \ | ||
command -v souffle || true | ||
|
||
esac; \ | ||
fi | ||
endif | ||
|
||
# Install or upgrade an existing virtual environment based on the | ||
# package dependencies declared in pyproject.toml. | ||
|
@@ -188,10 +198,24 @@ upgrade: .venv/upgraded-on | |
python -m pip install --upgrade --upgrade-strategy eager --editable .[actions,dev,docs,hooks,test,test-docker] | ||
$(MAKE) upgrade-quiet | ||
force-upgrade: | ||
rm -f .venv/upgraded-on | ||
@if [ -f .venv/upgraded-on ]; then \ | ||
rm -f .venv/upgraded-on; \ | ||
else \ | ||
rm -f ${VIRTUAL_ENV}/upgraded-on; \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you please provide more details? What was the original issue? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll add more details in the PR description but TL;DR - if a user is using a Python version manager such as
$ echo $VIRTUAL_ENV
... <nothing here> ...
$ pyenv activate oracle@macaron
... <nothing here> ...
(oracle@macaron) $ echo $VIRTUAL_ENV
/Users/harish/.pyenv/versions/3.11.9/envs/oracle@macaron |
||
fi | ||
|
||
$(MAKE) upgrade | ||
upgrade-quiet: | ||
echo "Automatically generated by Python Package Makefile on $$(date '+%Y-%m-%d %H:%M:%S %z')." > .venv/upgraded-on | ||
@if [ -d .venv/ ]; then \ | ||
echo "Automatically generated by Python Package Makefile for macaron on $$(date '+%Y-%m-%d %H:%M:%S %z')." > .venv/upgraded-on; \ | ||
else \ | ||
if [ ! -z "$(VIRTUAL_ENV)" ] && [ -d $(VIRTUAL_ENV) ]; then \ | ||
echo "Automatically generated by Python Package Makefile for macaron on $$(date '+%Y-%m-%d %H:%M:%S %z')." > $(VIRTUAL_ENV)/upgraded-on; \ | ||
else \ | ||
echo Failed to upgrade. Python virtual environment not found.; \ | ||
fi \ | ||
fi; | ||
|
||
upgrade-go: | ||
go get $$(go list -f '{{if not (or .Main .Indirect)}}{{.Path}}{{end}}' -m all) | ||
go mod tidy | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reason to make
pre-commit
optional? Our development environment requirespre-commit
hooks.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is purely for dev convenience & is also related to the 3rd party(Souffle) build break.
make setup
triggers thepre-commit
hooks and because tests fail (as expected),build
/setup
step is blocked as a result.