Skip to content

Commit

Permalink
New helper library buildy-help.
Browse files Browse the repository at this point in the history
  • Loading branch information
danfuzz committed Nov 30, 2023
1 parent 5aaef1f commit bea3ba6
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 2 deletions.
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ Breaking changes:
pretty minimal.

Other notable changes:
* `bashy-basics`: New utility functions `env-clean`, `env-minimize`, and
`env-names`.
* `bashy-basics`:
* New utility functions `env-clean`, `env-minimize`, and `env-names`.
* New helper library `buildy-help`, to help avoid some project-build-related
boilerplate.

### v2.7 -- 2023-10-30

Expand Down
37 changes: 37 additions & 0 deletions scripts/lib/bashy-basics/buildy-help.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Copyright 2022-2023 the Bashy-lib Authors (Dan Bornstein et alia).
# SPDX-License-Identifier: Apache-2.0

#
# Helper library for doing builds.
#

# Wrapper around `lib buildy out-dir` which sets up a built-output directory in
# a standard way and prints out the final path. Takes toggle option `--clean`
# and value option `--out=<path>`.
function set-up-out-dir {
local extraOpts=()

while (( $# > 0 )); do
case "$1" in
--clean|--clean=1)
extraOpts+=(--remove)
shift
;;
--clean=0|--no-clean)
shift
;;
--out=)
extraOpts+=("$1")
shift
;;
esac
done

if (( $# != 0 )); then
error-msg --file-line=1 "Unrecognized argument: $1"
return 1
fi

lib buildy out-dir \
--out="${outDir}" --create --print "${extraOpts[@]}"
}

0 comments on commit bea3ba6

Please sign in to comment.