diff --git a/Scripts/README.md b/Scripts/README.md new file mode 100644 index 000000000..6ba18c885 --- /dev/null +++ b/Scripts/README.md @@ -0,0 +1,50 @@ +# Helper Scripts +The `Scripts` directory contains a set of useful scripts to be used during development, continuous integration, testing and packaging. + +## `build_for_codeql.sh` +Builds tests and the main application without running so that CodeQL can intercept the commands and perform its analysis afterwards. +`xcodebuild` and `xcpretty` must be available in the environment in order for this script to run. + +## `build_nightly.sh` +Builds Nimble Commander with the `NimbleCommander-NonMAS` scheme / `Release` configuration, signs it, packages the runnable build into a `.dmg` image and notarizes the final image. +`xcodebuild`, `xcpretty` and `create-dmg` must be available in the environment in order for this script to run. +It also requires the codesigning certificate to be properly signed. + +## `build_unsigned.sh` +Builds Nimble Commander with the `NimbleCommander-Unsigned` scheme / `Release` configuration and packages the runnable build into a `.dmg` image. +`xcodebuild`, `xcpretty` and `create-dmg` must be available in the environment in order for this script to run. + +## `build_unsigned_and_run.sh` +Builds Nimble Commander with the `NimbleCommander-Unsigned` scheme / `Debug` configuration and runs it afterwards. +`xcodebuild` must be available in the environment in order for this script to run. + +## `run_all_integration_tests.sh` +Builds and executes all integration tests with the Debug/ASAN configuration. +`xcodebuild` and `xcpretty` must be available in the environment in order for this script to run. +`docker` must be available to run the VMs required for NC's virtual file systems. + +## `run_all_unit_tests.sh [Debug|Release|ASAN|UBSAN]` +Builds and executes all unit tests with the specified configuration. +`xcodebuild` and `xcpretty` must be available in the environment in order for this script to run. + +## `run_clang_format.sh` +Executes `clang-format` against all source files in the `Source` directory, re-formatting them in-place if necessary. +Rules from `Source/.clang-format` are used in the process. +`clang-format` must be available in order for this script to run. + +## `run_clang_tidy.sh` +Executes `clang-tidy` against all source files in the `Source` directory, updating them in-place if necessary. +`xcodebuild`, `xcpretty` and `jq` must be available in the environment in order for this script to run. +`clang-tidy` must be installed via Brew and is expected to be located at `/usr/local/opt/llvm/bin/`. +Rules from `Source/.clang-tidy` are used in the process. +It's recommended to execute `run_clang_format.sh` afterwards. + +## Dependencies installation: + * xcodebuild: + * XCode: https://download.developer.apple.com/Developer_Tools/Xcode_15.1/Xcode_15.1.xip + * Or just build tools: https://download.developer.apple.com/Developer_Tools/Command_Line_Tools_for_Xcode_15.1/Command_Line_Tools_for_Xcode_15.1.dmg + * [xcpretty](https://github.com/xcpretty/xcpretty): `gem install xcpretty` + * [clang-format](https://clang.llvm.org/docs/ClangFormat.html): `brew install clang-format` + * [clang-tidy](https://clang.llvm.org/extra/clang-tidy/): `brew install llvm` + * [jq](https://jqlang.github.io/jq/): `brew install jq` + * [create-dmg](https://github.com/create-dmg/create-dmg): `brew install create-dmg` diff --git a/Scripts/archive_all_versions.sh b/Scripts/archive_all_versions.sh deleted file mode 100755 index a6b6f279d..000000000 --- a/Scripts/archive_all_versions.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -set -o pipefail - -XC="xcodebuild \ - -project ../NimbleCommander.xcodeproj" - -$XC -scheme NimbleCommander-NonMAS archive | xcpretty -$XC -scheme NimbleCommander-MAS-Free archive | xcpretty -$XC -scheme NimbleCommander-MAS-Paid archive | xcpretty - diff --git a/Scripts/build_all_versions.sh b/Scripts/build_all_versions.sh deleted file mode 100755 index 81fb72c0e..000000000 --- a/Scripts/build_all_versions.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh -set -o pipefail - -XC="xcodebuild -project ../NimbleCommander.xcodeproj" - -$XC clean - -SCHEMES="NimbleCommander-Unsigned NimbleCommander-NonMAS NimbleCommander-MAS-Free NimbleCommander-MAS-Paid" -CONFIGURATIONS="Debug Release" -for SCHEME in $SCHEMES -do - for CONFIGURATION in $CONFIGURATIONS - do - CMD="$XC -scheme $SCHEME -configuration $CONFIGURATION" - echo "Command: $CMD" - $CMD build | xcpretty - if [ $? -ne 0 ] - then - exit $? - fi - done - if [ $? -ne 0 ] - then - exit $? - fi -done -if [ $? -ne 0 ] -then - exit $? -fi diff --git a/Scripts/build_nightly.sh b/Scripts/build_nightly.sh index eb5cb5e1f..f23311512 100755 --- a/Scripts/build_nightly.sh +++ b/Scripts/build_nightly.sh @@ -28,15 +28,6 @@ BUILT_PATH="${BUILD_DIR}/built" mkdir -p "${BUILD_DIR}" mkdir -p "${ARCHIVE_PATH}" -# Enable caching with ccache if it's available in the system -if type -p /usr/local/bin/ccache >/dev/null 2>&1; then - echo Using ccache - export CCACHE_BASEDIR="${ROOT_DIR}" - export CCACHE_SLOPPINESS=time_macros,include_file_mtime,include_file_ctime,file_stat_matches - export CC="${SCRIPTS_DIR}/ccache-clang" - export CXX="${SCRIPTS_DIR}/ccache-clang++" -fi - # Gather common flags in the XC variable XC="xcodebuild \ -project ${XCODEPROJ} \ diff --git a/Scripts/build_preview.sh b/Scripts/build_preview.sh deleted file mode 100755 index f4aba3ccb..000000000 --- a/Scripts/build_preview.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -set -o pipefail - -XC="xcodebuild \ - -project ../NimbleCommander.xcodeproj \ - -scheme NimbleCommander-NonMAS \ - -configuration Debug" - -$XC clean -$XC build - -APP_DIR=$($XC -showBuildSettings | grep " BUILT_PRODUCTS_DIR =" | sed -e 's/.*= *//' ) -APP_NAME=$($XC -showBuildSettings | grep " FULL_PRODUCT_NAME =" | sed -e 's/.*= *//' ) -APP_PATH=$APP_DIR/$APP_NAME - -PBUDDY=/usr/libexec/PlistBuddy -VERSION=$( $PBUDDY -c "Print CFBundleShortVersionString" "$APP_PATH/Contents/Info.plist" ) -BUILD=$( $PBUDDY -c "Print CFBundleVersion" "$APP_PATH/Contents/Info.plist" ) - -ZIPNAME=nimble-commander-$VERSION\($BUILD\).zip -rm $HOME/Desktop/$ZIPNAME - -cd "$APP_DIR" -zip $HOME/Desktop/$ZIPNAME -r --symlinks "$APP_NAME" diff --git a/Scripts/build_unsigned.sh b/Scripts/build_unsigned.sh index a3f47fcce..9b43f937e 100755 --- a/Scripts/build_unsigned.sh +++ b/Scripts/build_unsigned.sh @@ -30,14 +30,6 @@ XCODEPROJ="../Source/NimbleCommander/NimbleCommander.xcodeproj" PBUDDY=/usr/libexec/PlistBuddy -if type -p /usr/local/bin/ccache >/dev/null 2>&1; then - echo Using ccache - export CCACHE_BASEDIR="${ROOT_DIR}" - export CCACHE_SLOPPINESS=time_macros,include_file_mtime,include_file_ctime,file_stat_matches - export CC="${SCRIPTS_DIR}/ccache-clang" - export CXX="${SCRIPTS_DIR}/ccache-clang++" -fi - XC="xcodebuild \ -project ${XCODEPROJ} \ -scheme NimbleCommander-NonMAS \ diff --git a/Scripts/ccache-clang b/Scripts/ccache-clang deleted file mode 100755 index 1013b3375..000000000 --- a/Scripts/ccache-clang +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exec /usr/local/bin/ccache /usr/bin/clang "$@" \ No newline at end of file diff --git a/Scripts/ccache-clang++ b/Scripts/ccache-clang++ deleted file mode 100755 index 704a294e6..000000000 --- a/Scripts/ccache-clang++ +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exec /usr/local/bin/ccache /usr/bin/clang++ "$@" \ No newline at end of file diff --git a/Scripts/run_all_tests.sh b/Scripts/run_all_tests.sh deleted file mode 100755 index 415969e61..000000000 --- a/Scripts/run_all_tests.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/sh - -set -o pipefail - -build_target() -{ - TARGET=$1 - CONFIGURATION=$2 - echo building ${TARGET} - ${CONFIGURATION} - XC="xcodebuild \ - -project ../NimbleCommander.xcodeproj \ - -scheme ${TARGET} \ - -configuration ${CONFIGURATION} \ - -parallelizeTargets \ - -quiet" - BINARY_DIR=$($XC -showBuildSettings | grep " BUILT_PRODUCTS_DIR =" | sed -e 's/.*= *//') - BINARY_NAME=$($XC -showBuildSettings | grep " FULL_PRODUCT_NAME =" | sed -e 's/.*= *//') - BINARY_PATH=$BINARY_DIR/$BINARY_NAME - $XC build -} - -tests=(\ -HabaneroUT \ -ConfigUT \ -UtilityUT \ -VFSIconUnitTests \ -VFSIconIntegrationTests \ -VFSUT \ -VFSIT \ -ViewerUT \ -OperationsIT \ -TermUT \ -TermIT \ -PanelUT \ -NimbleCommanderUT \ -) - -configurations=(\ -Debug \ -Release \ -) - -for configuration in ${configurations[@]}; do - for test in ${tests[@]}; do - build_target $test $configuration - $BINARY_PATH - done -done diff --git a/Scripts/run_all_unit_tests.sh b/Scripts/run_all_unit_tests.sh index 3b2356a1e..13dd5f8d9 100755 --- a/Scripts/run_all_unit_tests.sh +++ b/Scripts/run_all_unit_tests.sh @@ -25,14 +25,6 @@ XCODEPROJ="../Source/NimbleCommander/NimbleCommander.xcodeproj" LOG_FILE=${BUILD_DIR}/xcodebuild.log -if type -p /usr/local/bin/ccache >/dev/null 2>&1; then - echo Using ccache - export CCACHE_BASEDIR="${ROOT_DIR}" - export CCACHE_SLOPPINESS=time_macros,include_file_mtime,include_file_ctime,file_stat_matches - export CC="${SCRIPTS_DIR}/ccache-clang" - export CXX="${SCRIPTS_DIR}/ccache-clang++" -fi - build_target() { TARGET=$1 diff --git a/Scripts/sloc.sh b/Scripts/sloc.sh deleted file mode 100755 index e1adc6613..000000000 --- a/Scripts/sloc.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -sloccount ../VFS/ ../Operations/ ../Term/ ../RoutedIO/ ../Habanero/ ../Utility/ ../VFSIcon/ ../Config/ ../Viewer/ ../CUI/ ../Panel/ ../NimbleCommander/