Skip to content

Instantly share code, notes, and snippets.

@rohansingh
Last active March 10, 2021 21:08
Show Gist options
  • Save rohansingh/8585e11d704bba5857b5175b38973ca7 to your computer and use it in GitHub Desktop.
Save rohansingh/8585e11d704bba5857b5175b38973ca7 to your computer and use it in GitHub Desktop.
Invoking Tilt via Bazel
sh_binary(
name = "tilt",
srcs = ["tilt-wrapper.sh"],
args = ["up"],
data = select({
"@bazel_tools//src/conditions:darwin": ["@tilt_mac_x86_64//:tilt"],
"//conditions:default": ["@tilt_linux_x86_64//:tilt"],
}),
)
# test edit
#!/bin/bash
set -euo pipefail
if [[ "$OSTYPE" == "darwin"* ]]; then
TILT="external/tilt_mac_x86_64/tilt"
else
TILT="external/tilt_linux_x86_64/tilt"
fi
TILT="$(realpath "$TILT")"
cd "$BUILD_WORKSPACE_DIRECTORY"
exec "$TILT" "$@"

Run tilt up via:

bazel run //:tilt

You can also supply other commands arguments to tilt:

bazel run //:tilt -- --help
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "tilt_linux_x86_64",
build_file_content = "exports_files(['tilt'])",
sha256 = "4a0beca6d9b9f54122aca30b6ab4d6b7586a436cf1d43bca1b9604c6baa37204",
urls = ["https://github.com/windmilleng/tilt/releases/download/v0.7.10/tilt.0.7.10.linux.x86_64.tar.gz"
)
http_archive(
name = "tilt_mac_x86_64",
build_file_content = "exports_files(['tilt'])",
sha256 = "d88639a9d2e4cfdeda11aa01309337b6d09e1b14e615c10a881da1f8e108acd7",
urls = ["https://github.com/windmilleng/tilt/releases/download/v0.7.10/tilt.0.7.10.mac.x86_64.tar.gz"],
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment