example-simpleSshCommand: Standalone build with bazel Change-Id: Ic2e1df8dbf271f8b2e3a6c1cddd33ce92b57977d
diff --git a/README b/README index 3024def..4889aad 100644 --- a/README +++ b/README
@@ -19,18 +19,30 @@ bazel-genfiles/all.zip -To build a specific example plugin, issue the following command: +To build a specific example plugin, issue one of the following commands: bazel build example-<example> + OR -The output for the example is created in + cd example-<example> && bazel build example-<example> + + +If the build command is run from the top-level example directory, +the output for the example is created in bazel-genfiles/example-<example>/example-<example>.jar +If the build command is run from inside a specific example directory, +the output for the example is created in + + + example-<example>/bazel-genfiles/example-<example>.jar + + Buck Build ==========
diff --git a/example-simpleSshCommand/WORKSPACE b/example-simpleSshCommand/WORKSPACE new file mode 100644 index 0000000..b87e8ed --- /dev/null +++ b/example-simpleSshCommand/WORKSPACE
@@ -0,0 +1,26 @@ +workspace(name = "simpleSshCommand") + +load("//:bazlets.bzl", "load_bazlets") + +load_bazlets( + commit = "0f87babe07a555425d829c6e7951e296e9e24579", + # local_path = "/home/<user>/projects/bazlets", +) + +# Release Plugin API +load( + "@com_googlesource_gerrit_bazlets//:gerrit_api.bzl", + "gerrit_api", +) + +# Snapshot Plugin API +#load( +# "@com_googlesource_gerrit_bazlets//:gerrit_api_maven_local.bzl", +# "gerrit_api_maven_local", +#) + +# Load release Plugin API +gerrit_api() + +# Load snapshot Plugin API +#gerrit_api_maven_local()
diff --git a/example-simpleSshCommand/bazlets.bzl b/example-simpleSshCommand/bazlets.bzl new file mode 100644 index 0000000..e14e488 --- /dev/null +++ b/example-simpleSshCommand/bazlets.bzl
@@ -0,0 +1,17 @@ +NAME = "com_googlesource_gerrit_bazlets" + +def load_bazlets( + commit, + local_path = None + ): + if not local_path: + native.git_repository( + name = NAME, + remote = "https://gerrit.googlesource.com/bazlets", + commit = commit, + ) + else: + native.local_repository( + name = NAME, + path = local_path, + )
diff --git a/example-simpleSshCommand/tools/bazel.rc b/example-simpleSshCommand/tools/bazel.rc new file mode 100644 index 0000000..4ed16cf --- /dev/null +++ b/example-simpleSshCommand/tools/bazel.rc
@@ -0,0 +1,2 @@ +build --workspace_status_command=./tools/workspace-status.sh +test --build_tests_only
diff --git a/example-simpleSshCommand/tools/bzl/BUILD b/example-simpleSshCommand/tools/bzl/BUILD new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/example-simpleSshCommand/tools/bzl/BUILD
diff --git a/example-simpleSshCommand/tools/bzl/plugin.bzl b/example-simpleSshCommand/tools/bzl/plugin.bzl new file mode 100644 index 0000000..2b1df8c --- /dev/null +++ b/example-simpleSshCommand/tools/bzl/plugin.bzl
@@ -0,0 +1,4 @@ +load( + "@com_googlesource_gerrit_bazlets//:gerrit_plugin.bzl", + "gerrit_plugin", +)
diff --git a/example-simpleSshCommand/tools/workspace-status.sh b/example-simpleSshCommand/tools/workspace-status.sh new file mode 100755 index 0000000..bfc255d --- /dev/null +++ b/example-simpleSshCommand/tools/workspace-status.sh
@@ -0,0 +1,17 @@ +#!/bin/bash + +# This script will be run by bazel when the build process starts to +# generate key-value information that represents the status of the +# workspace. The output should be like +# +# KEY1 VALUE1 +# KEY2 VALUE2 +# +# If the script exits with non-zero code, it's considered as a failure +# and the output will be discarded. + +function rev() { + git describe --always --match "v[0-9].*" --dirty +} + +echo STABLE_BUILD_EXAMPLE-SIMPLESSHCOMMAND_LABEL $(rev)
diff --git a/tools/workspace-status.sh b/tools/workspace-status.sh index 34dd869..6089eb0 100755 --- a/tools/workspace-status.sh +++ b/tools/workspace-status.sh
@@ -16,6 +16,5 @@ for p in example-* ; do test -d "$p" || continue - # special treatment of nested example plugins - echo STABLE_BUILD_$(echo $(basename $p)_LABEL|tr '[a-z]' '[A-Z]' ) $(rev $p) + ./$p/tools/workspace-status.sh done