mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
ci: Reformat all scripts using 1TBS
One may truly embrace the stylishness of the One True Brace Style.
This commit is contained in:
parent
920db2ecc0
commit
366c9c6a24
@ -24,8 +24,9 @@ function ci_lint_ci_config_files {
|
||||
ci_spawn "$CI_YAMLLINT" --version
|
||||
for MY_FILE in "$CI_TOPLEVEL_DIR"/.*.yml
|
||||
do
|
||||
ci_spawn "$CI_YAMLLINT" --strict "$MY_FILE" ||
|
||||
ci_spawn "$CI_YAMLLINT" --strict "$MY_FILE" || {
|
||||
CI_LINT_COUNTER=$((CI_LINT_COUNTER + 1))
|
||||
}
|
||||
done
|
||||
else
|
||||
ci_warn "program not found: 'yamllint'; skipping checks"
|
||||
@ -40,8 +41,9 @@ function ci_lint_ci_scripts {
|
||||
ci_spawn "$CI_SHELLCHECK" --version
|
||||
for MY_FILE in "$CI_SCRIPT_DIR"/*.sh
|
||||
do
|
||||
ci_spawn "$CI_SHELLCHECK" -x "$MY_FILE" ||
|
||||
ci_spawn "$CI_SHELLCHECK" -x "$MY_FILE" || {
|
||||
CI_LINT_COUNTER=$((CI_LINT_COUNTER + 1))
|
||||
}
|
||||
done
|
||||
else
|
||||
ci_warn "program not found: 'shellcheck'; skipping checks"
|
||||
|
@ -28,8 +28,6 @@ function ci_init_build {
|
||||
CI_CMAKE="${CI_CMAKE:-cmake}"
|
||||
CI_CTEST="${CI_CTEST:-ctest}"
|
||||
CI_CMAKE_BUILD_TYPE="${CI_CMAKE_BUILD_TYPE:-Release}"
|
||||
[[ -x $(command -v ninja) ]] &&
|
||||
CI_CMAKE_GENERATOR="${CI_CMAKE_GENERATOR:-Ninja}"
|
||||
if [[ $CI_CMAKE_GENERATOR == "Visual Studio"* ]]
|
||||
then
|
||||
# Clean up incidental mixtures of Windows and Bash-on-Windows
|
||||
@ -37,8 +35,12 @@ function ci_init_build {
|
||||
[[ $TEMP && ( $Temp || $temp ) ]] && unset TEMP
|
||||
[[ $TMP && ( $Tmp || $tmp ) ]] && unset TMP
|
||||
# Ensure that CI_CMAKE_GENERATOR_PLATFORM is initialized for this generator.
|
||||
[[ $CI_CMAKE_GENERATOR_PLATFORM ]] ||
|
||||
[[ $CI_CMAKE_GENERATOR_PLATFORM ]] || {
|
||||
ci_err_internal "missing \$CI_CMAKE_GENERATOR_PLATFORM"
|
||||
}
|
||||
elif [[ -x $(command -v ninja) ]]
|
||||
then
|
||||
CI_CMAKE_GENERATOR="${CI_CMAKE_GENERATOR:-Ninja}"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -72,12 +74,15 @@ function ci_trace_build {
|
||||
ci_info "environment option: \$CI_NO_CLEAN: '$CI_NO_CLEAN'"
|
||||
ci_info "executable: \$CI_CMAKE: $(command -V "$CI_CMAKE")"
|
||||
ci_info "executable: \$CI_CTEST: $(command -V "$CI_CTEST")"
|
||||
[[ $CI_CC ]] &&
|
||||
[[ $CI_CC ]] && {
|
||||
ci_info "executable: \$CI_CC: $(command -V "$CI_CC")"
|
||||
[[ $CI_AR ]] &&
|
||||
}
|
||||
[[ $CI_AR ]] && {
|
||||
ci_info "executable: \$CI_AR: $(command -V "$CI_AR")"
|
||||
[[ $CI_RANLIB ]] &&
|
||||
}
|
||||
[[ $CI_RANLIB ]] && {
|
||||
ci_info "executable: \$CI_RANLIB: $(command -V "$CI_RANLIB")"
|
||||
}
|
||||
ci_info "## END OF CONFIGURATION ##"
|
||||
}
|
||||
|
||||
@ -94,20 +99,25 @@ function ci_build {
|
||||
ci_info "## START OF BUILD ##"
|
||||
ci_spawn "$(command -v "$CI_CMAKE")" --version
|
||||
ci_spawn "$(command -v "$CI_CTEST")" --version
|
||||
[[ $CI_CMAKE_GENERATOR == *"Ninja"* ]] &&
|
||||
[[ $CI_CMAKE_GENERATOR == *"Ninja"* ]] && {
|
||||
ci_spawn "$(command -v ninja)" --version
|
||||
}
|
||||
# Initialize ALL_CC_FLAGS as a string.
|
||||
local ALL_CC_FLAGS="$CI_CC_FLAGS"
|
||||
[[ $CI_SANITIZERS ]] &&
|
||||
[[ $CI_SANITIZERS ]] && {
|
||||
ALL_CC_FLAGS="-fsanitize=$CI_SANITIZERS $ALL_CC_FLAGS"
|
||||
}
|
||||
# Initialize ALL_CMAKE_VARS, ALL_CMAKE_BUILD_FLAGS and ALL_CTEST_FLAGS as arrays.
|
||||
local ALL_CMAKE_VARS=()
|
||||
[[ $CI_CMAKE_TOOLCHAIN_FILE ]] &&
|
||||
[[ $CI_CMAKE_TOOLCHAIN_FILE ]] && {
|
||||
ALL_CMAKE_VARS+=(-DCMAKE_TOOLCHAIN_FILE="$CI_CMAKE_TOOLCHAIN_FILE")
|
||||
[[ $CI_CC ]] &&
|
||||
}
|
||||
[[ $CI_CC ]] && {
|
||||
ALL_CMAKE_VARS+=(-DCMAKE_C_COMPILER="$CI_CC")
|
||||
[[ $ALL_CC_FLAGS ]] &&
|
||||
}
|
||||
[[ $ALL_CC_FLAGS ]] && {
|
||||
ALL_CMAKE_VARS+=(-DCMAKE_C_FLAGS="$ALL_CC_FLAGS")
|
||||
}
|
||||
[[ $CI_AR ]] && {
|
||||
# Use the full path of CI_AR to work around a CMake error.
|
||||
ALL_CMAKE_VARS+=(-DCMAKE_AR="$(command -v "$CI_AR")")
|
||||
@ -122,20 +132,24 @@ function ci_build {
|
||||
local ALL_CMAKE_BUILD_FLAGS=($CI_CMAKE_BUILD_FLAGS)
|
||||
local ALL_CTEST_FLAGS=($CI_CTEST_FLAGS)
|
||||
# Export the CMake environment variables.
|
||||
[[ $CI_CMAKE_GENERATOR ]] &&
|
||||
[[ $CI_CMAKE_GENERATOR ]] && {
|
||||
ci_spawn export CMAKE_GENERATOR="$CI_CMAKE_GENERATOR"
|
||||
[[ $CI_CMAKE_GENERATOR_PLATFORM ]] &&
|
||||
}
|
||||
[[ $CI_CMAKE_GENERATOR_PLATFORM ]] && {
|
||||
ci_spawn export CMAKE_GENERATOR_PLATFORM="$CI_CMAKE_GENERATOR_PLATFORM"
|
||||
}
|
||||
# And... build!
|
||||
# Use $CI_BUILD_TO_SRC_RELDIR and $CI_BUILD_TO_INSTALL_RELDIR
|
||||
# instead of $CI_SRC_DIR and $CI_INSTALL_DIR from this point onwards.
|
||||
ci_spawn mkdir -p "$CI_BUILD_DIR"
|
||||
ci_spawn cd "$CI_BUILD_DIR"
|
||||
[[ $CI_BUILD_TO_SRC_RELDIR -ef $CI_SRC_DIR ]] ||
|
||||
[[ $CI_BUILD_TO_SRC_RELDIR -ef $CI_SRC_DIR ]] || {
|
||||
ci_err_internal "bad or missing \$CI_BUILD_TO_SRC_RELDIR"
|
||||
}
|
||||
ci_spawn mkdir -p "$CI_INSTALL_DIR"
|
||||
[[ $CI_BUILD_TO_INSTALL_RELDIR -ef $CI_INSTALL_DIR ]] ||
|
||||
[[ $CI_BUILD_TO_INSTALL_RELDIR -ef $CI_INSTALL_DIR ]] || {
|
||||
ci_err_internal "bad or missing \$CI_BUILD_TO_INSTALL_RELDIR"
|
||||
}
|
||||
# Spawn "cmake ...".
|
||||
ci_spawn "$CI_CMAKE" -DCMAKE_INSTALL_PREFIX="$CI_BUILD_TO_INSTALL_RELDIR" \
|
||||
"${ALL_CMAKE_VARS[@]}" \
|
||||
|
@ -26,11 +26,13 @@ function ci_init_build {
|
||||
[[ -x $(command -v cc) ]] && CI_CC="${CI_CC:-cc}"
|
||||
}
|
||||
# Ensure that the CI_ variables that cannot be customized reliably are not initialized.
|
||||
[[ ! $CI_CONFIGURE_VARS ]] ||
|
||||
[[ ! $CI_CONFIGURE_VARS ]] || {
|
||||
ci_err "unsupported: \$CI_CONFIGURE_VARS='$CI_CONFIGURE_VARS'"
|
||||
[[ ! $CI_MAKE_VARS ]] ||
|
||||
}
|
||||
[[ ! $CI_MAKE_VARS ]] || {
|
||||
ci_err "unsupported: \$CI_MAKE_VARS='$CI_MAKE_VARS'"
|
||||
}
|
||||
}
|
||||
|
||||
function ci_trace_build {
|
||||
ci_info "## START OF CONFIGURATION ##"
|
||||
@ -59,16 +61,21 @@ function ci_trace_build {
|
||||
ci_info "environment option: \$CI_NO_INSTALL: '$CI_NO_INSTALL'"
|
||||
ci_info "environment option: \$CI_NO_CLEAN: '$CI_NO_CLEAN'"
|
||||
ci_info "executable: \$CI_MAKE: $(command -V "$CI_MAKE")"
|
||||
[[ $CI_CC ]] &&
|
||||
[[ $CI_CC ]] && {
|
||||
ci_info "executable: \$CI_CC: $(command -V "$CI_CC")"
|
||||
[[ $CI_CPP ]] &&
|
||||
}
|
||||
[[ $CI_CPP ]] && {
|
||||
ci_info "executable: \$CI_CPP: $(command -V "$CI_CPP")"
|
||||
[[ $CI_AR ]] &&
|
||||
}
|
||||
[[ $CI_AR ]] && {
|
||||
ci_info "executable: \$CI_AR: $(command -V "$CI_AR")"
|
||||
[[ $CI_RANLIB ]] &&
|
||||
}
|
||||
[[ $CI_RANLIB ]] && {
|
||||
ci_info "executable: \$CI_RANLIB: $(command -V "$CI_RANLIB")"
|
||||
[[ $CI_LD ]] &&
|
||||
}
|
||||
[[ $CI_LD ]] && {
|
||||
ci_info "executable: \$CI_LD: $(command -V "$CI_LD")"
|
||||
}
|
||||
ci_info "## END OF CONFIGURATION ##"
|
||||
}
|
||||
|
||||
|
@ -53,16 +53,21 @@ function ci_trace_build {
|
||||
ci_info "environment option: \$CI_NO_TEST: '$CI_NO_TEST'"
|
||||
ci_info "environment option: \$CI_NO_CLEAN: '$CI_NO_CLEAN'"
|
||||
ci_info "executable: \$CI_MAKE: $(command -V "$CI_MAKE")"
|
||||
[[ $CI_CC ]] &&
|
||||
[[ $CI_CC ]] && {
|
||||
ci_info "executable: \$CI_CC: $(command -V "$CI_CC")"
|
||||
[[ $CI_CPP ]] &&
|
||||
}
|
||||
[[ $CI_CPP ]] && {
|
||||
ci_info "executable: \$CI_CPP: $(command -V "$CI_CPP")"
|
||||
[[ $CI_AR ]] &&
|
||||
}
|
||||
[[ $CI_AR ]] && {
|
||||
ci_info "executable: \$CI_AR: $(command -V "$CI_AR")"
|
||||
[[ $CI_RANLIB ]] &&
|
||||
}
|
||||
[[ $CI_RANLIB ]] && {
|
||||
ci_info "executable: \$CI_RANLIB: $(command -V "$CI_RANLIB")"
|
||||
[[ $CI_LD ]] &&
|
||||
}
|
||||
[[ $CI_LD ]] && {
|
||||
ci_info "executable: \$CI_LD: $(command -V "$CI_LD")"
|
||||
}
|
||||
ci_info "## END OF CONFIGURATION ##"
|
||||
}
|
||||
|
||||
|
@ -5,10 +5,12 @@
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
test -f "$BASH_SOURCE" ||
|
||||
test -f "$BASH_SOURCE" || {
|
||||
echo >&2 "warning: this module requires Bash version 3 or newer"
|
||||
test "${#BASH_SOURCE[@]}" -gt 1 ||
|
||||
}
|
||||
test "${#BASH_SOURCE[@]}" -gt 1 || {
|
||||
echo >&2 "warning: this module should be sourced from a Bash script"
|
||||
}
|
||||
|
||||
# Reset the locale to avoid surprises from locale-dependent commands.
|
||||
export LC_ALL=C
|
||||
@ -72,19 +74,26 @@ function ci_spawn {
|
||||
}
|
||||
|
||||
# Ensure that the internal initialization is correct.
|
||||
[[ $CI_TOPLEVEL_DIR/ci/lib/ci.lib.sh -ef ${BASH_SOURCE[0]} ]] ||
|
||||
[[ $CI_TOPLEVEL_DIR/ci/lib/ci.lib.sh -ef ${BASH_SOURCE[0]} ]] || {
|
||||
ci_err_internal "bad or missing \$CI_TOPLEVEL_DIR"
|
||||
[[ $CI_SCRIPT_DIR/$CI_SCRIPT_NAME -ef $0 ]] ||
|
||||
}
|
||||
[[ $CI_SCRIPT_DIR/$CI_SCRIPT_NAME -ef $0 ]] || {
|
||||
ci_err_internal "bad or missing \$CI_SCRIPT_DIR/\$CI_SCRIPT_NAME"
|
||||
[[ $CI_BUILD_ARCH && $CI_BUILD_SYSTEM ]] ||
|
||||
}
|
||||
[[ $CI_BUILD_ARCH && $CI_BUILD_SYSTEM ]] || {
|
||||
ci_err_internal "missing \$CI_BUILD_ARCH or \$CI_BUILD_SYSTEM"
|
||||
[[ $CI_TARGET_ARCH && $CI_TARGET_SYSTEM ]] ||
|
||||
}
|
||||
[[ $CI_TARGET_ARCH && $CI_TARGET_SYSTEM ]] || {
|
||||
ci_err_internal "missing \$CI_TARGET_ARCH or \$CI_TARGET_SYSTEM"
|
||||
}
|
||||
|
||||
# Ensure that the user initialization is correct.
|
||||
[[ ${CI_NO_TEST:-0} == [01] ]] ||
|
||||
[[ ${CI_NO_TEST:-0} == [01] ]] || {
|
||||
ci_err "bad boolean option: \$CI_NO_TEST: '$CI_NO_TEST'"
|
||||
[[ ${CI_NO_INSTALL:-0} == [01] ]] ||
|
||||
}
|
||||
[[ ${CI_NO_INSTALL:-0} == [01] ]] || {
|
||||
ci_err "bad boolean option: \$CI_NO_INSTALL: '$CI_NO_INSTALL'"
|
||||
[[ ${CI_NO_CLEAN:-0} == [01] ]] ||
|
||||
}
|
||||
[[ ${CI_NO_CLEAN:-0} == [01] ]] || {
|
||||
ci_err "bad boolean option: \$CI_NO_CLEAN: '$CI_NO_CLEAN'"
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user