Merge branch 'stable-2.16' into stable-3.0

* stable-2.16:
  Upgrade bazlets to latest stable-2.15 to build with 2.15.18 API
  Bazel: Migrate workspace status script to python
  Upgrade bazlets to latest stable-2.15
  Upgrade bazlets to latest stable-2.14
  Upgrade bazlets to latest stable-2.16
  Upgrade bazlets to latest stable-2.15
  Upgrade bazlets to latest stable-2.14
  Bump Bazel version to 1.1.0
  Disable inputs in configuration screen for non-owners

Change-Id: I1f64849a500c62518ec74688b5add53927839345
diff --git a/.bazelrc b/.bazelrc
index 4ed16cf..3ae03ff 100644
--- a/.bazelrc
+++ b/.bazelrc
@@ -1,2 +1,2 @@
-build --workspace_status_command=./tools/workspace-status.sh
+build --workspace_status_command="python ./tools/workspace_status.py"
 test --build_tests_only
diff --git a/.bazelversion b/.bazelversion
index 3eefcb9..9084fa2 100644
--- a/.bazelversion
+++ b/.bazelversion
@@ -1 +1 @@
-1.0.0
+1.1.0
diff --git a/src/main/resources/static/gr-uploadvalidator-config-table.html b/src/main/resources/static/gr-uploadvalidator-config-table.html
index d688f01..c8ed87b 100644
--- a/src/main/resources/static/gr-uploadvalidator-config-table.html
+++ b/src/main/resources/static/gr-uploadvalidator-config-table.html
@@ -34,7 +34,8 @@
                 <td class="deleteColumn">
                   <gr-button id="{{item}}"
                              class="deleteEntryButton"
-                             on-click="_handleDeleteEntry">
+                             on-click="_handleDeleteEntry"
+                             disabled="[[disabled]]">
                     Delete
                   </gr-button>
                 </td>
@@ -43,7 +44,7 @@
             <tr>
               <td class="nameColumn">
                 <iron-input>
-                  <input id="newEntry" type="text">
+                  <input id="newEntry" type="text" disabled$="[[disabled]]">
                 </iron-input>
               </td>
               <td class="deleteColumn">
diff --git a/src/main/resources/static/gr-uploadvalidator-config.html b/src/main/resources/static/gr-uploadvalidator-config.html
index 83f399b..7de6ea2 100644
--- a/src/main/resources/static/gr-uploadvalidator-config.html
+++ b/src/main/resources/static/gr-uploadvalidator-config.html
@@ -29,19 +29,22 @@
         <section>
           <h3>Author Email Pattern</h3>
           <gr-uploadvalidator-config-table id="allowedAuthorEmailPattern"
-                                           entries=[[_changedConfig.allowedAuthorEmailPattern.values]]>
+                                           entries=[[_changedConfig.allowedAuthorEmailPattern.values]]
+                                           disabled="[[readOnly]]">
           </gr-uploadvalidator-config-table>
         </section>
         <section>
           <h3>Committer Email Pattern</h3>
           <gr-uploadvalidator-config-table id="allowedCommitterEmailPattern"
-                                           entries=[[_changedConfig.allowedCommitterEmailPattern.values]]>
+                                           entries=[[_changedConfig.allowedCommitterEmailPattern.values]]
+                                           disabled="[[readOnly]]">
           </gr-uploadvalidator-config-table>
         </section>
         <section>
           <h3>Binary Types</h3>
           <gr-uploadvalidator-config-table id="binaryTypes"
-                                           entries=[[_changedConfig.binaryTypes.values]]>
+                                           entries=[[_changedConfig.binaryTypes.values]]
+                                           disabled="[[readOnly]]">
           </gr-uploadvalidator-config-table>
         </section>
         <section>
@@ -51,50 +54,57 @@
             <gr-select id="blockedContentTypeWhitelist"
                        bind-value="{{_changedConfig.blockedContentTypeWhitelist.value}}"
                        on-change="_handlePrefsChanged">
-              <select>
+              <select disabled$="[[readOnly]]">
                 <option value="true">Whitelist</option>
                 <option value="false">Blacklist</option>
               </select>
             </gr-select>
           </span>
           <gr-uploadvalidator-config-table id="blockedContentType"
-                                           entries=[[_changedConfig.blockedContentType.values]]>
+                                           entries=[[_changedConfig.blockedContentType.values]]
+                                           disabled="[[readOnly]]">
           </gr-uploadvalidator-config-table>
         </section>
         <section>
           <h3>Blocked File Extensions</h3>
           <gr-uploadvalidator-config-table id="blockedFileExtension"
-                                           entries=[[_changedConfig.blockedFileExtension.values]]>
+                                           entries=[[_changedConfig.blockedFileExtension.values]]
+                                           disabled="[[readOnly]]">
           </gr-uploadvalidator-config-table>
         </section>
         <section>
           <h3>Blocked Keyword Pattern</h3>
           <gr-uploadvalidator-config-table id="blockedKeywordPattern"
-                                           entries=[[_changedConfig.blockedKeywordPattern.values]]>
+                                           entries=[[_changedConfig.blockedKeywordPattern.values]]
+                                           disabled="[[readOnly]]">
           </gr-uploadvalidator-config-table>
         </section>
         <section>
           <h3>Invalid Filename Pattern</h3>
           <gr-uploadvalidator-config-table id="invalidFilenamePattern"
-                                           entries=[[_changedConfig.invalidFilenamePattern.values]]>
+                                           entries=[[_changedConfig.invalidFilenamePattern.values]]
+                                           disabled="[[readOnly]]">
           </gr-uploadvalidator-config-table>
         </section>
         <section>
           <h3>Projects</h3>
           <gr-uploadvalidator-config-table id="project"
-                                           entries=[[_changedConfig.project.values]]>
+                                           entries=[[_changedConfig.project.values]]
+                                           disabled="[[readOnly]]">
           </gr-uploadvalidator-config-table>
         </section>
         <section>
           <h3>Refs</h3>
           <gr-uploadvalidator-config-table id="ref"
-                                           entries=[[_changedConfig.ref.values]]>
+                                           entries=[[_changedConfig.ref.values]]
+                                           disabled="[[readOnly]]">
           </gr-uploadvalidator-config-table>
         </section>
         <section>
           <h3>Required Footers</h3>
           <gr-uploadvalidator-config-table id="requiredFooter"
-                                           entries=[[_changedConfig.requiredFooter.values]]>
+                                           entries=[[_changedConfig.requiredFooter.values]]
+                                           disabled="[[readOnly]]">
           </gr-uploadvalidator-config-table>
         </section>
         <section>
@@ -107,7 +117,8 @@
                      allowed-pattern="[0-9]"
                      type="number"
                      on-keypress="_handlePrefsChanged"
-                     on-change="_handlePrefsChanged">
+                     on-change="_handlePrefsChanged"
+                     disabled$="[[readOnly]]">
             </iron-input>
           </span>
         </section>
@@ -117,7 +128,7 @@
             <gr-select id="rejectDuplicatePathnamesLocale"
                        bind-value="{{_changedConfig.rejectDuplicatePathnamesLocale.value}}"
                        on-change="_handlePrefsChanged">
-              <select>
+              <select disabled$="[[readOnly]]">
                 <template is="dom-repeat"
                           items="[[_changedConfig.rejectDuplicatePathnamesLocale.permitted_values]]">
                   <option value="[[item]]">[[item]]</option>
@@ -132,7 +143,7 @@
             <gr-select id="rejectDuplicatePathnames"
                        bind-value="{{_changedConfig.rejectDuplicatePathnames.value}}"
                        on-change="_handlePrefsChanged">
-              <select>
+              <select disabled$="[[readOnly]]">
                 <option value="true">True</option>
                 <option value="false">False</option>
               </select>
@@ -145,7 +156,7 @@
             <gr-select id="rejectSubmodule"
                        bind-value="{{_changedConfig.rejectSubmodule.value}}"
                        on-change="_handlePrefsChanged">
-              <select>
+              <select disabled$="[[readOnly]]">
                 <option value="true">True</option>
                 <option value="false">False</option>
               </select>
@@ -158,7 +169,7 @@
             <gr-select id="rejectSymlink"
                        bind-value="{{_changedConfig.rejectSymlink.value}}"
                        on-change="_handlePrefsChanged">
-              <select>
+              <select disabled$="[[readOnly]]">
                 <option value="true">True</option>
                 <option value="false">False</option>
               </select>
@@ -171,7 +182,7 @@
             <gr-select id="rejectWindowsLineEndings"
                        bind-value="{{_changedConfig.rejectWindowsLineEndings.value}}"
                        on-change="_handlePrefsChanged">
-              <select>
+              <select disabled$="[[readOnly]]">
                 <option value="true">True</option>
                 <option value="false">False</option>
               </select>
diff --git a/src/main/resources/static/gr-uploadvalidator-config.js b/src/main/resources/static/gr-uploadvalidator-config.js
index be54c1d..69e24a2 100644
--- a/src/main/resources/static/gr-uploadvalidator-config.js
+++ b/src/main/resources/static/gr-uploadvalidator-config.js
@@ -20,6 +20,10 @@
 
     properties: {
       repoName: String,
+      readOnly: {
+        type: Boolean,
+        value: true,
+      },
       _config: Object,
       _changedConfig: Object,
       _prefsChanged: {
diff --git a/tools/workspace-status.sh b/tools/workspace-status.sh
deleted file mode 100755
index 543217f..0000000
--- a/tools/workspace-status.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/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_UPLOADVALIDATOR_LABEL "$(rev .)"
diff --git a/tools/workspace_status.py b/tools/workspace_status.py
new file mode 100644
index 0000000..49ac4c3
--- /dev/null
+++ b/tools/workspace_status.py
@@ -0,0 +1,31 @@
+#!/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_UPLOADVALIDATOR_LABEL %s" % revision())