|
| 1 | +#!/usr/bin/env bash |
| 2 | +# ----------------------------------------------------------------------------- |
| 3 | +# DO NOT EDIT! |
| 4 | +# Automatically generated from npm-packages-helper/templates/*. |
| 5 | +# |
| 6 | +# This file is part of the xPack project (http://xpack.github.io). |
| 7 | +# Copyright (c) 2022-2026 Liviu Ionescu. All rights reserved. |
| 8 | +# |
| 9 | +# Permission to use, copy, modify, and/or distribute this software for any |
| 10 | +# purpose is hereby granted, under the terms of the MIT license. |
| 11 | +# |
| 12 | +# If a copy of the license was not distributed with this file, it can be |
| 13 | +# obtained from https://opensource.org/licenses/mit. |
| 14 | +# |
| 15 | +# ----------------------------------------------------------------------------- |
| 16 | + |
| 17 | +# ----------------------------------------------------------------------------- |
| 18 | +# Safety settings (see https://gist.github.com/ilg-ul/383869cbb01f61a51c4d). |
| 19 | + |
| 20 | +if [[ ! -z ${DEBUG} ]] |
| 21 | +then |
| 22 | + set ${DEBUG} # Activate the expand mode if DEBUG is anything but empty. |
| 23 | +else |
| 24 | + DEBUG="" |
| 25 | +fi |
| 26 | + |
| 27 | +set -o errexit # Exit if command failed. |
| 28 | +set -o pipefail # Exit if pipe failed. |
| 29 | +set -o nounset # Exit if variable not set. |
| 30 | + |
| 31 | +# Remove the initial space and instead use '\n'. |
| 32 | +IFS=$'\n\t' |
| 33 | + |
| 34 | +# ----------------------------------------------------------------------------- |
| 35 | +# Identify the script location, to reach, for example, the helper scripts. |
| 36 | + |
| 37 | +build_script_path="$0" |
| 38 | +if [[ "${build_script_path}" != /* ]] |
| 39 | +then |
| 40 | + # Make relative path absolute. |
| 41 | + build_script_path="$(pwd)/$0" |
| 42 | +fi |
| 43 | + |
| 44 | +script_folder_path="$(dirname "${build_script_path}")" |
| 45 | +script_folder_name="$(basename "${script_folder_path}")" |
| 46 | + |
| 47 | +# ============================================================================= |
| 48 | + |
| 49 | +# pip3 install --user cmakelang pyyaml |
| 50 | + |
| 51 | +# set -x |
| 52 | +PYPATH="$(python3 -m site --user-base)" |
| 53 | +echo cmake-format "$(${PYPATH}/bin/cmake-format --version)" |
| 54 | +# "${PYPATH}/bin/cmake-format" --no-default --dump-config yaml --config-file "config/.cmake-format.yaml" |
| 55 | + |
| 56 | +function run_verbose() |
| 57 | +{ |
| 58 | + # Does not include the .exe extension. |
| 59 | + local _app_path="$1" |
| 60 | + shift |
| 61 | + |
| 62 | + echo |
| 63 | + echo "[${_app_path} $@]" |
| 64 | + "${_app_path}" "$@" 2>&1 |
| 65 | +} |
| 66 | + |
| 67 | +run_verbose "${PYPATH}/bin/cmake-format" --config-file "config/.cmake-format.yaml" --in-place \ |
| 68 | + $(find . \( \( -type d -name "build" \) -o \( -type d -name "xpacks" \) -o \( -type d -name "node_modules" \) \) -prune -o \ |
| 69 | + -type f \( -name "CMakeLists.txt" -o -name "*.cmake" \) -print) |
0 commit comments