Merge branch 'stable-3.0'

* stable-3.0:
  Remove bazel-genfiles from .gitignore
  Replace bazel-genfiles with bazel-bin in documentation
  Upgrade JGit to 5.3.5.201909031855-r
  Upgrade bazlets to latest stable-3.0 to build with 3.0.3 API
  Bump bazel version to 1.0.0
  Add information about LFS config to PolyGerrit UI
  Upgrade JGit to 5.1.11.201909031202-r
  Upgrade bazlets to latest stable-2.16 to build with 2.16.12 API
  Upgrade bazlets to latest stable-2.15 to build with 2.15.17 API

Change-Id: Ib7691592a8bf0eea3455e1ef4ea770e25e72f8d0
diff --git a/.bazelversion b/.bazelversion
index 25939d3..3eefcb9 100644
--- a/.bazelversion
+++ b/.bazelversion
@@ -1 +1 @@
-0.29.1
+1.0.0
diff --git a/.gitignore b/.gitignore
index 72d1580..a4ec9de 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,7 +2,6 @@
 /.project
 /.settings
 /bazel-bin
-/bazel-genfiles
 /bazel-out
 /bazel-lfs
 /bazel-testlogs
diff --git a/src/main/java/com/googlesource/gerrit/plugins/lfs/HttpModule.java b/src/main/java/com/googlesource/gerrit/plugins/lfs/HttpModule.java
index f8c219a..2bd7091 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/lfs/HttpModule.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/lfs/HttpModule.java
@@ -62,8 +62,12 @@
       populateRepository(backend);
     }
 
+    // Only for GWT-UI
     DynamicSet.bind(binder(), WebUiPlugin.class)
         .toInstance(new JavaScriptPlugin("lfs-project-info.js"));
+
+    // Only for PolyGerrit-UI
+    DynamicSet.bind(binder(), WebUiPlugin.class).toInstance(new JavaScriptPlugin("gr-lfs.html"));
   }
 
   private void populateRepository(LfsBackend backend) {
diff --git a/src/main/resources/Documentation/build.md b/src/main/resources/Documentation/build.md
index f71464f..c2d0532 100644
--- a/src/main/resources/Documentation/build.md
+++ b/src/main/resources/Documentation/build.md
@@ -16,7 +16,7 @@
 The output is created in
 
 ```
-  bazel-genfiles/@PLUGIN@.jar
+  bazel-bin/@PLUGIN@.jar
 ```
 
 To execute the tests run:
@@ -45,7 +45,7 @@
 The output is created in
 
 ```
-  bazel-genfiles/plugins/@PLUGIN@/@PLUGIN@.jar
+  bazel-bin/plugins/@PLUGIN@/@PLUGIN@.jar
 ```
 
 This project can be imported into the Eclipse IDE.
diff --git a/src/main/resources/static/gr-lfs-project-info.html b/src/main/resources/static/gr-lfs-project-info.html
new file mode 100644
index 0000000..4008f89
--- /dev/null
+++ b/src/main/resources/static/gr-lfs-project-info.html
@@ -0,0 +1,48 @@
+<!--
+@license
+Copyright (C) 2019 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.
+-->
+
+<dom-module id="gr-lfs-project-info">
+  <template>
+    <style include="shared-styles"></style>
+    <style include="gr-form-styles"></style>
+    <style>
+      .sectionTitle {
+        padding-top: 2em;
+      }
+    </style>
+    <fieldset id="lfsProjectInfo" class="gr-form-styles">
+      <h2 class="sectionTitle">LFS Info</h2>
+      <section>
+        <span class="title">Enabled</span>
+        <span class="value">[[_appliedConfig.enabled]]</span>
+      </section>
+      <section>
+        <span class="title">Max Object Size</span>
+        <span class="value">[[_appliedConfig.max_object_size]]</span>
+      </section>
+      <section>
+        <span class="title">Read Only</span>
+        <span class="value">[[_appliedConfig.read_only]]</span>
+      </section>
+      <section hidden="[[!_appliedConfig.backend]]">
+        <span class="title">Backend</span>
+        <span class="value">[[_appliedConfig.backend]]</span>
+      </section>
+    </fieldset>
+  </template>
+  <script src="gr-lfs-project-info.js"></script>
+</dom-module>
diff --git a/src/main/resources/static/gr-lfs-project-info.js b/src/main/resources/static/gr-lfs-project-info.js
new file mode 100644
index 0000000..ce733b9
--- /dev/null
+++ b/src/main/resources/static/gr-lfs-project-info.js
@@ -0,0 +1,43 @@
+// Copyright (C) 2019 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.
+
+(function () {
+  'use strict';
+
+  Polymer({
+    is: 'gr-lfs-project-info',
+
+    properties: {
+      repoName: String,
+      _appliedConfig: Object,
+    },
+
+    attached() {
+      this._getPreferences()
+    },
+
+    _getPreferences() {
+      return this.plugin.restApi('/projects/')
+        .get(`${this.repoName}/${this.plugin.getPluginName()}~lfs:config-project`)
+        .then(config => {
+          if (!config || Object.entries(config).length === 0) {
+            this.$.lfsProjectInfo.hidden = true;
+            return;
+          }
+
+          this._appliedConfig = config
+        })
+    },
+  });
+})();
diff --git a/src/main/resources/static/gr-lfs.html b/src/main/resources/static/gr-lfs.html
new file mode 100644
index 0000000..8493051
--- /dev/null
+++ b/src/main/resources/static/gr-lfs.html
@@ -0,0 +1,28 @@
+<!--
+@license
+Copyright (C) 2019 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.
+-->
+
+<link rel="import" href="./gr-lfs-project-info.html">
+
+<dom-module id="gr-lfs">
+  <script>
+    Gerrit.install(plugin => {
+      if (!window.Polymer) { return; }
+
+      plugin.registerCustomComponent('repo-config', 'gr-lfs-project-info');
+    });
+  </script>
+</dom-module>
diff --git a/src/main/resources/static/lfs-project-info.js b/src/main/resources/static/lfs-project-info.js
index b514822..f81f975 100644
--- a/src/main/resources/static/lfs-project-info.js
+++ b/src/main/resources/static/lfs-project-info.js
@@ -13,6 +13,11 @@
 // limitations under the License.
 
 Gerrit.install(function(self) {
+
+  if (window.Polymer) { return; }
+
+  // The code below is only used by the GWT-UI
+
   function toUpperCamel(str) {
     var words = str.split('_');
     for (i=0; i<words.length; i++) {
@@ -66,4 +71,4 @@
   }
 
   self.panel('PROJECT_INFO_SCREEN_BOTTOM', onProjectInfo);
-  });
\ No newline at end of file
+  });