Skip to content

Commit f4f1ac2

Browse files
committed
Bazel: Publish to local Maven repository and Google storage bucket
TEST PLAN: $ VERBOSE=1 tools/maven/mvn.sh install $ VERBOSE=1 tools/maven/mvn.sh deploy Change-Id: I0b60f9e2137d8755f6e4ca32ff35ec5a5364f4a6
1 parent ff7c81a commit f4f1ac2

File tree

7 files changed

+88
-8
lines changed

7 files changed

+88
-8
lines changed

BUILD

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# This file is intended to be empty

VERSION

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1 @@
1-
# Maven style API version (e.g. '2.x-SNAPSHOT').
2-
#
3-
# Used by :install and :deploy when talking to the destination repository. As
4-
# we currently have no stable releases, we use the "build number" scheme
5-
# described at:
6-
# http://mojo.codehaus.org/versions-maven-plugin/version-rules.html
7-
GITILES_VERSION = '0.1-11'
1+
include_defs('//version.bzl')

WORKSPACE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
workspace(name = "gitiles")
22
load("//tools:bazlets.bzl", "load_bazlets")
33
load_bazlets(
4-
commit = "e10ae3f85781aa15054be802b2a9f9465b1bf1e0",
4+
commit = "0f87babe07a555425d829c6e7951e296e9e24579",
55
# local_path = "/home/<user>/projects/bazlets"
66
)
77
load("@com_googlesource_gerrit_bazlets//tools:maven_jar.bzl",

gitiles-servlet/BUILD

+1
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,5 @@ java_doc(
8484
],
8585
pkgs = ["com.google.gitiles"],
8686
title = "Gitiles API Documentation",
87+
visibility = ["//visibility:public"],
8788
)

tools/maven/BUILD

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
load("//:version.bzl", "GITILES_VERSION")
2+
load("@com_googlesource_gerrit_bazlets//tools/maven:package.bzl", "maven_package")
3+
4+
maven_package(
5+
version = GITILES_VERSION,
6+
group = "com.google.gitiles",
7+
repository = "gerrit-maven-repository",
8+
url = "gs://gerrit-maven",
9+
jar = {
10+
"blame-cache": "//blame-cache:lib",
11+
"gitiles-servlet": "//gitiles-servlet:servlet",
12+
},
13+
src = {
14+
"blame-cache": "//blame-cache:liblib-src.jar",
15+
"gitiles-servlet": "//gitiles-servlet:libservlet-src.jar",
16+
},
17+
doc = {
18+
"blame-cache": "//blame-cache:javadoc",
19+
"gitiles-servlet": "//gitiles-servlet:javadoc",
20+
},
21+
)

tools/maven/mvn.sh

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/bin/bash -e
2+
3+
# Copyright (C) 2016 The Android Open Source Project
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
if [[ "$#" != "1" ]] ; then
18+
cat <<EOF
19+
Usage: run "$0 COMMAND" from the top of your workspace,
20+
where COMMAND is one of
21+
22+
install
23+
deploy
24+
25+
Set VERBOSE in the environment to get more information.
26+
27+
EOF
28+
29+
exit 1
30+
fi
31+
32+
set -o errexit
33+
set -o nounset
34+
35+
case "$1" in
36+
install)
37+
command="api_install"
38+
;;
39+
deploy)
40+
command="api_deploy"
41+
;;
42+
*)
43+
echo "unknown command $1"
44+
exit 1
45+
;;
46+
esac
47+
48+
if [[ "${VERBOSE:-x}" != "x" ]]; then
49+
set -o xtrace
50+
fi
51+
52+
bazel build //tools/maven:gen_${command} || \
53+
{ echo "bazel failed to build gen_${command}. Use VERBOSE=1 for more info" ; exit 1 ; }
54+
55+
export OUTPUT_BASE=`bazel info output_base`
56+
./bazel-genfiles/tools/maven/${command}.sh

version.bzl

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Maven style API version (e.g. '2.x-SNAPSHOT').
2+
#
3+
# Used by :install and :deploy when talking to the destination repository. As
4+
# we currently have no stable releases, we use the "build number" scheme
5+
# described at:
6+
# http://mojo.codehaus.org/versions-maven-plugin/version-rules.html
7+
GITILES_VERSION = '0.1-11'

0 commit comments

Comments
 (0)