-
-
Notifications
You must be signed in to change notification settings - Fork 684
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
go/tools/bazel_benchmark: extract some logic into bash script (#1601)
bazel_benchmark.sh is now responsible for cloning rules_go at master into a temp directory. This script can be copied to a bin directory and run with a timer. The rest of the bazel_benchmark.go logic will run at the tip of master. Also: record Bazel version in the output file.
- Loading branch information
Showing
3 changed files
with
73 additions
and
40 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,6 @@ | ||
load("@io_bazel_rules_go//go:def.bzl", "go_binary") | ||
|
||
go_binary( | ||
name = "bazel_benchmark", | ||
srcs = ["bazel_benchmark.go"], | ||
) |
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,29 @@ | ||
#!/bin/bash | ||
|
||
# Copyright 2018 The Bazel 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. | ||
|
||
set -euo pipefail | ||
|
||
rules_go_dir=$(mktemp --directory --tmpdir rules_go.XXXXXX) | ||
function cleanup { | ||
rm -rf "$rules_go_dir" | ||
} | ||
trap cleanup EXIT | ||
|
||
git clone --depth=1 --single-branch --no-tags \ | ||
https://github.com/bazelbuild/rules_go "$rules_go_dir" | ||
cd "$rules_go_dir" | ||
bazel run //go/tools/bazel_benchmark -- -rules_go_dir "$rules_go_dir" "$@" | ||
|