-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
41 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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[@]}" | ||
} |