Skip to content
This repository was archived by the owner on Oct 4, 2023. It is now read-only.

Commit dad7c85

Browse files
maxwellEDavidGoldman
authored andcommitted
Additional parameter options for building Tulsi
Allows users to specify where Tulsi should be unzipped to after install using the `-d` option and allows them to specify the Bazel path to use with the `-b` option Closes #151. PiperOrigin-RevId: 315557493
1 parent 2dd98fe commit dad7c85

File tree

3 files changed

+31
-9
lines changed

3 files changed

+31
-9
lines changed

.bazelrc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
build --cpu=darwin_x86_64
22
build --apple_platform_type=macos
3-
build --xcode_version=11.3.1
43

54
# Disable the Swift compilation worker when running integration tests, since it
65
# requires the protobuf dependency which is infeasible to get working on Bazel.

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ plant.
99

1010
## Building and installing
1111

12-
1. Check `.bazelrc` to see if the Xcode version used by Tulsi is installed
13-
locally. If it isn't, feel free to remove the `--xcode_version` flag or
14-
modify it as you wish, but note that Tulsi may not build correctly with
15-
different versions of Xcode.
16-
1. Run `build_and_run.sh`. This will install Tulsi.app inside ~/Applications.
12+
Run `build_and_run.sh`. This will install Tulsi.app inside `$HOME/Applications` by default. See below for supported options:
13+
14+
* `-b`: Bazel binary that Tulsi should use to build and install the app (Default is `bazel`)
15+
* `-d`: The folder where to install the Tulsi app into (Default is `$HOME/Applications`)
16+
* `-x`: The Xcode version Tulsi should be built for (Default is `11.3.1`)
1717

1818

1919
## Notes

build_and_run.sh

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,34 @@
2121

2222
set -eu
2323

24-
readonly unzip_dir="${1:-$HOME/Applications}"
24+
unzip_dir="$HOME/Applications"
25+
bazel_path="bazel"
26+
xcode_version="11.3.1"
27+
28+
while getopts ":b:d:x:h" opt; do
29+
case ${opt} in
30+
h)
31+
echo "Usage:"
32+
echo " ./build_and_run -h Display this help message."
33+
echo " ./build_and_run -b PATH Bazel binary used to build Tulsi"
34+
echo " ./build_and_run -d PATH Intall Tulsi App at the provided path"
35+
echo " ./build_and_run -x VERSION Xcode version Tulsi should be built for"
36+
exit 0
37+
;;
38+
b) bazel_path=$OPTARG;;
39+
d) unzip_dir=$OPTARG;;
40+
x) xcode_version=$OPTARG;;
41+
?)
42+
echo "Invalid Option: -$OPTARG" 1>&2
43+
exit 1
44+
;;
45+
esac
46+
done
47+
shift $((OPTIND -1))
2548

2649
# build it
27-
bazel build //:tulsi --use_top_level_targets_for_symlinks
50+
$bazel_path build //:tulsi --use_top_level_targets_for_symlinks --xcode_version=$xcode_version
2851
# unzip it
29-
unzip -oq $(bazel info workspace)/bazel-bin/tulsi.zip -d "$unzip_dir"
52+
unzip -oq $("$bazel_path" info workspace)/bazel-bin/tulsi.zip -d "$unzip_dir"
3053
# run it
3154
open "$unzip_dir/Tulsi.app"

0 commit comments

Comments
 (0)