Skip to content

Commit

Permalink
chore(build): clarify prerequisites in CONTRIBUTING and verify before…
Browse files Browse the repository at this point in the history
… build (#14642)

The build script at the top level of the repository performs a prerequisites check before beginning the build. This verification is not complete as it does not include the required checks for .NET and Python executables. Further, the prerequisites documentation in the contributing guide does not note the Docker requirement.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
BenChaimberg authored May 11, 2021
1 parent 256fd4c commit bf16642
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 5 deletions.
5 changes: 4 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ The following tools need to be installed on your system prior to installing the
- [Yarn >= 1.19.1, < 2](https://yarnpkg.com/lang/en/docs/install)
- [.NET Core SDK 3.1.x](https://www.microsoft.com/net/download)
- [Python >= 3.6.5, < 4.0](https://www.python.org/downloads/release/python-365/)
- [Docker >= 19.03](https://docs.docker.com/get-docker/)
- the Docker daemon must also be running

First fork the repository, and then run the following commands to clone the repository locally.

Expand Down Expand Up @@ -113,8 +115,9 @@ However, if you wish to build the the entire repository, the following command w

```console
cd <root of the CDK repo>
yarn build
scripts/foreach.sh yarn build
```
Note: The `foreach` command is resumable by default; you must supply `-r` or `--reset` to start a new session.

You are now ready to start contributing to the CDK. See the [Pull Requests](#pull-requests) section on how to make your
changes and submit it as a pull request.
Expand Down
33 changes: 29 additions & 4 deletions scripts/check-build-prerequisites.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ app_v=$(node --version)
# Check for version 10.*.* - 29.*.*
echo -e "Checking node version... \c"
if [ $(echo $app_v | grep -c -E "v[12][0-9]\.[0-9]+\.[0-9]+") -eq 1 ]
then
then
# Check for version 13.0 to 13.6
if [ $(echo $app_v | grep -c -E "v13\.[0-6]\.[0-9]+") -eq 1 ]
then
die "node versions 13.0.0 to 13.6.0 are not supported due to compatibility issues with our dependencies."
else
# Check for version < 10.13
if [ $(echo $app_v | grep -c -E "v10\.([0-9]|1[0-2])\.[0-9]+") -eq 1 ]
then
then
wrong_version
else
echo "Ok"
Expand All @@ -68,7 +68,7 @@ check_which $app $app_min
app_v=$(${app} --version)
echo -e "Checking yarn version... \c"
if [ $(echo $app_v | grep -c -E "1\.(19|2[0-9])\.[0-9]+") -eq 1 ]
then
then
echo "Ok"
else
wrong_version
Expand All @@ -83,9 +83,34 @@ check_which $app $app_min
echo -e "Checking if docker is running... \c"
docker_running=$(docker ps)
if [ $? -eq 0 ]
then
then
echo "Ok"
else
die "Docker is not running"
fi

# [.NET == 3.1.x]
app="dotnet"
app_min="3.1.0"
check_which $app $app_min
app_v=$(${app} --version)
echo -e "Checking dotnet version... \c"
if [ $(echo $app_v | grep -c -E "3\.1\.[0-9]+") -eq 1 ]
then
echo "Ok"
else
wrong_version
fi

# [Python >= 3.6.5, < 4.0]
app="python3"
app_min="3.6.5"
check_which $app $app_min
app_v=$(${app} --version)
echo -e "Checking python3 version... \c"
if [ $(echo $app_v | grep -c -E "3\.[6-9]+\.[0-9]+") -eq 1 ]
then
echo "Ok"
else
wrong_version
fi

0 comments on commit bf16642

Please sign in to comment.