-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[scripts] created bootstrap script for ZAP (#22757)
Extracted bootstrap code from run_zaptool.sh and reuse it in other Python scripts. This allows to run ZAP convert/generate tools out of the box without necessity to run zaptool beforehand. Signed-off-by: Marcin Kajor <[email protected]> Signed-off-by: Marcin Kajor <[email protected]>
- Loading branch information
1 parent
34b6d59
commit 3912988
Showing
6 changed files
with
126 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#!/bin/bash | ||
|
||
# | ||
# Copyright (c) 2022 Project CHIP Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
function _get_fullpath() { | ||
cd "$(dirname "$1")" && echo "$PWD/$(basename "$1")" | ||
} | ||
|
||
function _usage() { | ||
cat <<EOF | ||
Invalid arguments passed. | ||
Usage: | ||
zap_bootstrap.sh -> install and update required packages | ||
zap_bootstrap.sh -c -> run a clean bootstrap, install packages from scratch | ||
EOF | ||
exit 1 | ||
} | ||
|
||
set -e | ||
|
||
SCRIPT_PATH="$(_get_fullpath "$0")" | ||
CHIP_ROOT="${SCRIPT_PATH%/scripts/tools/zap/zap_bootstrap.sh}" | ||
|
||
( | ||
cd "$CHIP_ROOT" && | ||
git submodule update --init third_party/zap/repo | ||
|
||
cd "third_party/zap/repo" | ||
|
||
if [ $# -eq 0 ]; then | ||
echo "Running ZAP bootstrap" | ||
if ! npm list installed-check &>/dev/null; then | ||
npm install installed-check | ||
fi | ||
|
||
if ! ./node_modules/.bin/installed-check -c &>/dev/null; then | ||
npm install | ||
fi | ||
elif [ $# -eq 1 ] && [ "$1" = "-c" ]; then | ||
echo "Running clean ZAP bootstrap" | ||
npm ci | ||
npm run version-stamp | ||
npm rebuild canvas --update-binary | ||
npm run build-spa | ||
else | ||
_usage | ||
fi | ||
) | ||
|
||
echo "ZAP bootstrap done!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters