app/gerrit: import OAuth provider and add SSO support

This change:

 - imports gerrit-oauth-provider from upstream
 - adds sso.hackerspae.pl support to it

Change-Id: I92e7053614a9297bf1ced3aac044c0002acd836a
diff --git a/app/gerrit/gerrit-oauth-provider/tools/bzl/BUILD b/app/gerrit/gerrit-oauth-provider/tools/bzl/BUILD
new file mode 100644
index 0000000..c5ed0b7
--- /dev/null
+++ b/app/gerrit/gerrit-oauth-provider/tools/bzl/BUILD
@@ -0,0 +1 @@
+# Empty file required by Bazel
diff --git a/app/gerrit/gerrit-oauth-provider/tools/bzl/classpath.bzl b/app/gerrit/gerrit-oauth-provider/tools/bzl/classpath.bzl
new file mode 100644
index 0000000..c921d01
--- /dev/null
+++ b/app/gerrit/gerrit-oauth-provider/tools/bzl/classpath.bzl
@@ -0,0 +1,6 @@
+load(
+    "@com_googlesource_gerrit_bazlets//tools:classpath.bzl",
+    _classpath_collector = "classpath_collector",
+)
+
+classpath_collector = _classpath_collector
diff --git a/app/gerrit/gerrit-oauth-provider/tools/bzl/junit.bzl b/app/gerrit/gerrit-oauth-provider/tools/bzl/junit.bzl
new file mode 100644
index 0000000..97307bd
--- /dev/null
+++ b/app/gerrit/gerrit-oauth-provider/tools/bzl/junit.bzl
@@ -0,0 +1,6 @@
+load(
+    "@com_googlesource_gerrit_bazlets//tools:junit.bzl",
+    _junit_tests = "junit_tests",
+)
+
+junit_tests = _junit_tests
diff --git a/app/gerrit/gerrit-oauth-provider/tools/bzl/maven_jar.bzl b/app/gerrit/gerrit-oauth-provider/tools/bzl/maven_jar.bzl
new file mode 100644
index 0000000..35ea8ce
--- /dev/null
+++ b/app/gerrit/gerrit-oauth-provider/tools/bzl/maven_jar.bzl
@@ -0,0 +1,3 @@
+load("@com_googlesource_gerrit_bazlets//tools:maven_jar.bzl", _maven_jar = "maven_jar")
+
+maven_jar = _maven_jar
diff --git a/app/gerrit/gerrit-oauth-provider/tools/bzl/plugin.bzl b/app/gerrit/gerrit-oauth-provider/tools/bzl/plugin.bzl
new file mode 100644
index 0000000..4d2dbdd
--- /dev/null
+++ b/app/gerrit/gerrit-oauth-provider/tools/bzl/plugin.bzl
@@ -0,0 +1,10 @@
+load(
+    "@com_googlesource_gerrit_bazlets//:gerrit_plugin.bzl",
+    _gerrit_plugin = "gerrit_plugin",
+    _plugin_deps = "PLUGIN_DEPS",
+    _plugin_test_deps = "PLUGIN_TEST_DEPS",
+)
+
+gerrit_plugin = _gerrit_plugin
+PLUGIN_DEPS = _plugin_deps
+PLUGIN_TEST_DEPS = _plugin_test_deps
diff --git a/app/gerrit/gerrit-oauth-provider/tools/eclipse/BUILD b/app/gerrit/gerrit-oauth-provider/tools/eclipse/BUILD
new file mode 100644
index 0000000..0dced85
--- /dev/null
+++ b/app/gerrit/gerrit-oauth-provider/tools/eclipse/BUILD
@@ -0,0 +1,9 @@
+load("//app/gerrit/gerrit-oauth-provider/tools/bzl:classpath.bzl", "classpath_collector")
+
+classpath_collector(
+    name = "main_classpath_collect",
+    testonly = 1,
+    deps = [
+        "//:gerrit-oauth-provider__plugin_test_deps",
+    ],
+)
diff --git a/app/gerrit/gerrit-oauth-provider/tools/eclipse/project.sh b/app/gerrit/gerrit-oauth-provider/tools/eclipse/project.sh
new file mode 100755
index 0000000..8e4ed79
--- /dev/null
+++ b/app/gerrit/gerrit-oauth-provider/tools/eclipse/project.sh
@@ -0,0 +1,15 @@
+#!/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 oauth -r .
diff --git a/app/gerrit/gerrit-oauth-provider/tools/workspace-status.sh b/app/gerrit/gerrit-oauth-provider/tools/workspace-status.sh
new file mode 100755
index 0000000..8fba304
--- /dev/null
+++ b/app/gerrit/gerrit-oauth-provider/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() {
+  cd $1; git describe --always --match "v[0-9].*" --dirty
+}
+
+echo STABLE_BUILD_GERRIT-OAUTH-PROVIDER_LABEL $(rev .)