Skip to content
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
53 changes: 50 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@
# SPDX-License-Identifier: Apache-2.0

# Makefile versions
MAKEFILE_VERSION := 2.0
MAKEFILE_VERSION := 2.1
UPDATE_VERSION := make/latest

# This Makefile requires Python version 3.9 or later
REQUIRED_PYTHON_MAJOR_VERSION := 3
REQUIRED_PYTHON_MINOR_VERSION := 9
PYTHON_EXECUTABLE := "python$(REQUIRED_PYTHON_MAJOR_VERSION)"

# Repository versions
SRC_VERSION := $(shell git describe --tags --match 'v[0-9]*')
SRC_VERSION_TAG_ONLY := $(shell git describe --tags --abbrev=0 --match 'v[0-9]*')
Expand Down Expand Up @@ -50,7 +55,7 @@ all: build

.venv/is_ready:
( \
test -d .venv || python3 -m venv .venv; \
test -d .venv || $(PYTHON_EXECUTABLE) -m venv .venv; \
touch .venv/is_ready; \
)

Expand Down Expand Up @@ -175,6 +180,48 @@ docs:
@echo "* $(CLR_BLUE)$(SRC_TAGGED_URL_BASE)/docs/user-guide.md$(CLR_END)"
@echo ""

verify_tooling: .venv
@( \
. .venv/bin/activate; \
$(PYTHON_EXECUTABLE) --version &> /dev/null && \
( \
$(PYTHON_EXECUTABLE) -c "import sys; sys.version_info < ($(REQUIRED_PYTHON_MAJOR_VERSION),$(REQUIRED_PYTHON_MINOR_VERSION)) and sys.exit(1)" || \
( \
$(PYTHON_EXECUTABLE) --version && \
echo '$(CLR_RED)Python version is too old!$(CLR_END)' && \
echo '$(CLR_RED)Python v$(REQUIRED_PYTHON_MAJOR_VERSION).$(REQUIRED_PYTHON_MINOR_VERSION) or later is required.$(CLR_END)' && \
exit 1 \
) \
) || ( \
echo '$(CLR_RED)Python is not installed!$(CLR_END)' && \
exit 1 \
); \
)
@( \
docker --version &> /dev/null || ( \
echo '$(CLR_RED)Docker is not installed!$(CLR_END)' && \
exit 1 \
); \
)
@( \
git --version &> /dev/null || ( \
echo '$(CLR_RED)Git is not installed!$(CLR_END)' && \
exit 1 \
); \
)
@( \
sed --version &> /dev/null || ( \
echo '$(CLR_RED)Sed is not installed!$(CLR_END)' && \
exit 1 \
); \
)
@( \
jq --version &> /dev/null || ( \
echo '$(CLR_RED)Jq is not installed!$(CLR_END)' && \
exit 1 \
); \
)

pre_build: build_deps docker version_number git_ignore

pre_deps_build: deps docker version_number git_ignore
Expand All @@ -194,7 +241,7 @@ post_build:
@echo "$(CLR_GREEN)To deploy ADF, please run:$(CLR_END) make deploy"
@echo ""

build: pre_build sam_build post_build
build: verify_tooling pre_build sam_build post_build

deps_build: pre_deps_build sam_build post_build

Expand Down
5 changes: 4 additions & 1 deletion docs/installation-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ Please note that building on *Windows* is not supported, please use the
This should return 4.3 or later.
- [python 3](https://www.python.org/downloads/)
- To test if it is available, run `python --version`.
This should return 3.11 or later.
This should return 3.9 or later.
- [jq](https://github.com/jqlang/jq)
- To test if it is available, run `jq --version`.
This version should be 1.6 or later.
- [sed](https://www.gnu.org/software/sed/)
- To test if it is available, run `sed --version`.
This should return 4.3 or later.
Expand Down