File tree Expand file tree Collapse file tree 4 files changed +20
-7
lines changed
Sources/SwiftPackageScripts/Documentation.docc Expand file tree Collapse file tree 4 files changed +20
-7
lines changed Original file line number Diff line number Diff line change @@ -27,9 +27,10 @@ The `scripts` folder contains the following scripts:
2727* ` git_default_branch.sh ` - Get the default git branch name.
2828* ` package_name.sh ` - Get the name of the main Swift package.
2929* ` release.sh ` - Make a release build with several validation steps.
30- * ` release_validate.sh ` - Validate the current branch for release.
3130* ` sync_from.sh ` - Sync ` scripts ` from a Swift Package Scripts folder.
3231* ` test.sh ` - Test a target on all or some platforms.
32+ * ` validate_git_branch.sh ` - Validate the current branch.
33+ * ` validate_release.sh ` - Validate the package for release.
3334* ` version_bump.sh ` - Bump the current version number and create a new tag.
3435* ` version_number.sh ` - Get the current version number from the latest tag.
3536
Original file line number Diff line number Diff line change @@ -18,9 +18,10 @@ The `scripts` folder contains the following scripts:
1818* ` git_default_branch.sh ` - Get the default git branch name.
1919* ` package_name.sh ` - Get the name of the main Swift package.
2020* ` release.sh ` - Make a release build with several validation steps.
21- * ` release_validate.sh ` - Validate the current branch for release.
2221* ` sync_from.sh ` - Sync ` scripts ` from a Swift Package Scripts folder.
2322* ` test.sh ` - Test a target on all or some platforms.
23+ * ` validate_git_branch.sh ` - Validate the current branch.
24+ * ` validate_release.sh ` - Validate the package for release.
2425* ` version_bump.sh ` - Bump the current version number and create a new tag.
2526* ` version_number.sh ` - Get the current version number from the latest tag.
2627
Original file line number Diff line number Diff line change @@ -9,8 +9,9 @@ show_usage() {
99 echo " This script validates the Git repository for release."
1010
1111 echo
12- echo " Usage: $0 [BRANCH]"
12+ echo " Usage: $0 [BRANCH] [-b|--branch <BRANCH>] "
1313 echo " [BRANCH] Optional. The branch to validate (auto-detects main/master if not specified)"
14+ echo " -b, --branch Optional. The branch to validate"
1415
1516 echo
1617 echo " This script will:"
@@ -23,6 +24,8 @@ show_usage() {
2324 echo " $0 "
2425 echo " $0 master"
2526 echo " $0 develop"
27+ echo " $0 -b main"
28+ echo " $0 --branch develop"
2629 echo
2730}
2831
@@ -50,6 +53,14 @@ BRANCH="" # Will be set to default after parsing
5053# Parse command line arguments
5154while [[ $# -gt 0 ]]; do
5255 case $1 in
56+ -b|--branch)
57+ shift # Remove --branch from arguments
58+ if [[ $# -eq 0 || " $1 " =~ ^- ]]; then
59+ show_usage_error_and_exit " --branch requires a branch name"
60+ fi
61+ BRANCH=" $1 "
62+ shift
63+ ;;
5364 -h|--help)
5465 show_usage; exit 0 ;;
5566 -* )
103114# Complete successfully
104115echo
105116echo " Git repository validated successfully!"
106- echo
117+ echo
Original file line number Diff line number Diff line change 66# Function to display usage information
77show_usage () {
88 echo
9- echo " This script validates a <TARGET> for release."
9+ echo " This script validates a <TARGET> for release by checking the git repo, then running lint and unit tests for all platforms ."
1010
1111 echo
1212 echo " Usage: $0 [TARGET] [-p|--platforms <PLATFORM1> <PLATFORM2> ...]"
113113
114114# Use the script folder to refer to other scripts
115115FOLDER=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " & > /dev/null && pwd ) "
116- SCRIPT_VALIDATE_GIT=" $FOLDER /release_validate_git .sh"
116+ SCRIPT_VALIDATE_GIT=" $FOLDER /validate_git_branch .sh"
117117SCRIPT_TEST=" $FOLDER /test.sh"
118118
119119# A function that runs a certain script and checks for errors
@@ -153,4 +153,4 @@ run_script "$SCRIPT_TEST" "$TARGET" -p $PLATFORMS
153153# Complete successfully
154154echo
155155echo " Project successfully validated!"
156- echo
156+ echo
You can’t perform that action at this time.
0 commit comments