-
Notifications
You must be signed in to change notification settings - Fork 128
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
3 changed files
with
63 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
## Bazel feature | ||
|
||
Install [Bazelisk](https://github.com/bazelbuild/bazelisk) and [Buildifier](https://github.com/bazelbuild/buildtools/blob/master/buildifier/README.md). |
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,34 @@ | ||
{ | ||
"name": "Bazel", | ||
"id": "bazel", | ||
"version": "1.0.0", | ||
"description": "Bazel feature", | ||
"options": { | ||
"bazelisk_version": { | ||
"type": "string", | ||
"proposals": [ | ||
"1.17.0", | ||
"latest" | ||
], | ||
"default": "latest", | ||
"description": "Version of Bazelisk to manage Bazel versions" | ||
}, | ||
"buildifier_version": { | ||
"type": "string", | ||
"proposals": [ | ||
"5.1.0", | ||
"6.1.2", | ||
"latest" | ||
], | ||
"default": "latest", | ||
"description": "Version of Buildifier to lint BUILD files" | ||
} | ||
}, | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"bazelbuild.vscode-bazel" | ||
] | ||
} | ||
} | ||
} |
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,26 @@ | ||
#!/bin/sh | ||
set -eu | ||
|
||
echo "Installing Bazel" | ||
|
||
LOCAL_BIN="/usr/local/bin" | ||
|
||
github_download() { | ||
repo=$1 | ||
version=$2 | ||
artifact=$3 | ||
output=$4 | ||
if [ "${version}" = "latest" ]; then | ||
URL="https://github.com/${repo}/releases/latest/download/${artifact}" | ||
else | ||
URL="https://github.com/${repo}/releases/download/${version}/${artifact}" | ||
fi | ||
curl -LSs "${URL}" -o "${output}" | ||
} | ||
|
||
github_download "bazelbuild/bazelisk" "${BAZELISK_VERSION}" "bazelisk-linux-amd64" "${LOCAL_BIN}/bazelisk" | ||
chmod +x "${LOCAL_BIN}/bazelisk" | ||
ln -s "${LOCAL_BIN}/bazelisk" "${LOCAL_BIN}/bazel" | ||
|
||
github_download "bazelbuild/buildtools" "${BUILDIFIER_VERSION}" "buildifier-linux-amd64" "${LOCAL_BIN}/buildifier" | ||
chmod +x "${LOCAL_BIN}/buildifier" |