This repository has been archived by the owner on Oct 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 123
/
build_and_run.sh
executable file
·54 lines (50 loc) · 1.76 KB
/
build_and_run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
# Copyright 2018 The Tulsi Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Helper script to invoke Tulsi in commandline mode.
# The path to the Tulsi.app bundle may be provided though the TULSI_APP
# environment variable. If it is not, the script will attempt to find
# Tulsi using the first result returned by the Spotlight index.
set -eu
unzip_dir="$HOME/Applications"
bazel_path="bazel"
xcode_version="13.4.1"
while getopts ":b:d:x:h" opt; do
case ${opt} in
h)
echo "Usage:"
echo " ./build_and_run -h Display this help message."
echo " ./build_and_run -b PATH Bazel binary used to build Tulsi"
echo " ./build_and_run -d PATH Intall Tulsi App at the provided path"
echo " ./build_and_run -x VERSION Xcode version Tulsi should be built for"
exit 0
;;
b) bazel_path=$OPTARG;;
d) unzip_dir=$OPTARG;;
x) xcode_version=$OPTARG;;
?)
echo "Invalid Option: -$OPTARG" 1>&2
exit 1
;;
esac
done
shift $((OPTIND -1))
# build it
$bazel_path build //:tulsi --use_top_level_targets_for_symlinks --xcode_version=$xcode_version
# unzip it
unzip -oq $("$bazel_path" info workspace)/bazel-bin/tulsi.zip -d "$unzip_dir"
# run it
open "$unzip_dir/Tulsi.app"