Skip to content

Commit 6e70780

Browse files
author
James Melvin
committed
example-simpleSshCommand: Standalone build with bazel
Change-Id: Ic2e1df8dbf271f8b2e3a6c1cddd33ce92b57977d
1 parent dba1550 commit 6e70780

File tree

8 files changed

+81
-4
lines changed

8 files changed

+81
-4
lines changed

README

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,30 @@ The output for all the example plugins is created in
1919
bazel-genfiles/all.zip
2020

2121

22-
To build a specific example plugin, issue the following command:
22+
To build a specific example plugin, issue one of the following commands:
2323

2424

2525
bazel build example-<example>
2626

27+
OR
28+
29+
cd example-<example> && bazel build example-<example>
2730

28-
The output for the example is created in
31+
32+
If the build command is run from the top-level example directory,
33+
the output for the example is created in
2934

3035

3136
bazel-genfiles/example-<example>/example-<example>.jar
3237

3338

39+
If the build command is run from inside a specific example directory,
40+
the output for the example is created in
41+
42+
43+
example-<example>/bazel-genfiles/example-<example>.jar
44+
45+
3446

3547
Buck Build
3648
==========

example-simpleSshCommand/WORKSPACE

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
workspace(name = "simpleSshCommand")
2+
3+
load("//:bazlets.bzl", "load_bazlets")
4+
5+
load_bazlets(
6+
commit = "0f87babe07a555425d829c6e7951e296e9e24579",
7+
# local_path = "/home/<user>/projects/bazlets",
8+
)
9+
10+
# Release Plugin API
11+
load(
12+
"@com_googlesource_gerrit_bazlets//:gerrit_api.bzl",
13+
"gerrit_api",
14+
)
15+
16+
# Snapshot Plugin API
17+
#load(
18+
# "@com_googlesource_gerrit_bazlets//:gerrit_api_maven_local.bzl",
19+
# "gerrit_api_maven_local",
20+
#)
21+
22+
# Load release Plugin API
23+
gerrit_api()
24+
25+
# Load snapshot Plugin API
26+
#gerrit_api_maven_local()

example-simpleSshCommand/bazlets.bzl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
NAME = "com_googlesource_gerrit_bazlets"
2+
3+
def load_bazlets(
4+
commit,
5+
local_path = None
6+
):
7+
if not local_path:
8+
native.git_repository(
9+
name = NAME,
10+
remote = "https://gerrit.googlesource.com/bazlets",
11+
commit = commit,
12+
)
13+
else:
14+
native.local_repository(
15+
name = NAME,
16+
path = local_path,
17+
)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
build --workspace_status_command=./tools/workspace-status.sh
2+
test --build_tests_only

example-simpleSshCommand/tools/bzl/BUILD

Whitespace-only changes.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
load(
2+
"@com_googlesource_gerrit_bazlets//:gerrit_plugin.bzl",
3+
"gerrit_plugin",
4+
)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
3+
# This script will be run by bazel when the build process starts to
4+
# generate key-value information that represents the status of the
5+
# workspace. The output should be like
6+
#
7+
# KEY1 VALUE1
8+
# KEY2 VALUE2
9+
#
10+
# If the script exits with non-zero code, it's considered as a failure
11+
# and the output will be discarded.
12+
13+
function rev() {
14+
git describe --always --match "v[0-9].*" --dirty
15+
}
16+
17+
echo STABLE_BUILD_EXAMPLE-SIMPLESSHCOMMAND_LABEL $(rev)

tools/workspace-status.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,5 @@ function rev() {
1616

1717
for p in example-* ; do
1818
test -d "$p" || continue
19-
# special treatment of nested example plugins
20-
echo STABLE_BUILD_$(echo $(basename $p)_LABEL|tr '[a-z]' '[A-Z]' ) $(rev $p)
19+
./$p/tools/workspace-status.sh
2120
done

0 commit comments

Comments
 (0)