Merge pull request #21 from aiuto:update

PiperOrigin-RevId: 346050578
Change-Id: Iff27708f9cbb77a5de4a8f1d529f4e3aa53f5a5f
diff --git a/distro/README.md b/distro/README.md
new file mode 100644
index 0000000..b955ffb
--- /dev/null
+++ b/distro/README.md
@@ -0,0 +1,156 @@
+# Updating bazelbuild/platforms
+
+WARNING: These are what worked last time. Reality might be different. 
+
+## Step 1: Make the release
+
+- Pick a new version number
+- Run distro/make_rel.sh *version*
+- Go to the [Releases](https://github.com/bazelbuild/platforms/releases) page
+- Draft a new release
+  - Name the release with a version number
+  - Use the version number as the title
+  - Copy the description that make_rel.sh produced to the description field.
+  - upload the generated tar file
+
+- use https://github.com/bazelbuild/continuous-integration/blob/master/mirror/mirror.sh to mirror the file
+
+## Step 2: Update Bazel
+
+- Edit `WORKSPACE`
+- There are probably 7 places to edit
+- Merge the PR
+
+Sample diff:
+
+```
+***************
+*** 161,167 ****
+          # bazelbuild/bazel-skylib
+          "bazel-skylib-1.0.3.tar.gz",
+          # bazelbuild/platforms
+!         "46993efdd33b73649796c5fc5c9efb193ae19d51.zip",
+          # bazelbuild/rules_java
+          "7cf3cefd652008d0a64a419c34c13bdca6c8f178.zip",
+          # bazelbuild/rules_cc
+--- 161,167 ----
+          # bazelbuild/bazel-skylib
+          "bazel-skylib-1.0.3.tar.gz",
+          # bazelbuild/platforms
+!         "platforms-0.0.2.tar.gz",
+          # bazelbuild/rules_java
+          "7cf3cefd652008d0a64a419c34c13bdca6c8f178.zip",
+          # bazelbuild/rules_cc
+***************
+*** 203,209 ****
+          # bazelbuild/bazel-skylib
+          "bazel-skylib-1.0.3.tar.gz": "1c531376ac7e5a180e0237938a2536de0c54d93f5c278634818e0efc952dd56c",
+          # bazelbuild/platforms
+!         "46993efdd33b73649796c5fc5c9efb193ae19d51.zip": "66184688debeeefcc2a16a2f80b03f514deac8346fe888fb7e691a52c023dd88",
+          # bazelbuild/rules_java
+          "7cf3cefd652008d0a64a419c34c13bdca6c8f178.zip": "bc81f1ba47ef5cc68ad32225c3d0e70b8c6f6077663835438da8d5733f917598",
+          # bazelbuild/rules_cc
+--- 203,209 ----
+          # bazelbuild/bazel-skylib
+          "bazel-skylib-1.0.3.tar.gz": "1c531376ac7e5a180e0237938a2536de0c54d93f5c278634818e0efc952dd56c",
+          # bazelbuild/platforms
+!         "platforms-0.0.2.tar.gz": "48a2d8d343863989c232843e01afc8a986eb8738766bfd8611420a7db8f6f0c3",
+          # bazelbuild/rules_java
+          "7cf3cefd652008d0a64a419c34c13bdca6c8f178.zip": "bc81f1ba47ef5cc68ad32225c3d0e70b8c6f6077663835438da8d5733f917598",
+          # bazelbuild/rules_cc
+***************
+*** 268,276 ****
+              "https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.3/bazel-skylib-1.0.3.tar.gz",
+          ],
+          # bazelbuild/platforms
+!         "46993efdd33b73649796c5fc5c9efb193ae19d51.zip": [
+!             "https://mirror.bazel.build/github.com/bazelbuild/platforms/archive/46993efdd33b73649796c5fc5c9efb193ae19d51.zip",
+!             "https://github.com/bazelbuild/platforms/archive/46993efdd33b73649796c5fc5c9efb193ae19d51.zip",
+          ],
+          # bazelbuild/rules_java
+          "7cf3cefd652008d0a64a419c34c13bdca6c8f178.zip": [
+--- 268,276 ----
+              "https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.3/bazel-skylib-1.0.3.tar.gz",
+          ],
+          # bazelbuild/platforms
+!         "platforms-0.0.2.tar.gz": [
+!             "https://mirror.bazel.build/github.com/bazelbuild/platforms/releases/download/0.0.2/platforms-0.0.2.tar.gz",
+!             "https://github.com/bazelbuild/platforms/releases/download/0.0.2/platforms-0.0.2.tar.gz",
+          ],
+          # bazelbuild/rules_java
+          "7cf3cefd652008d0a64a419c34c13bdca6c8f178.zip": [
+***************
+*** 563,569 ****
+          # bazelbuild/bazel-skylib
+          "bazel-skylib-1.0.3.tar.gz",
+          # bazelbuild/platforms
+!         "46993efdd33b73649796c5fc5c9efb193ae19d51.zip",
+          # bazelbuild/rules_java
+          "7cf3cefd652008d0a64a419c34c13bdca6c8f178.zip",
+          # bazelbuild/rules_cc
+--- 563,569 ----
+          # bazelbuild/bazel-skylib
+          "bazel-skylib-1.0.3.tar.gz",
+          # bazelbuild/platforms
+!         "platforms-0.0.2.tar.gz",
+          # bazelbuild/rules_java
+          "7cf3cefd652008d0a64a419c34c13bdca6c8f178.zip",
+          # bazelbuild/rules_cc
+***************
+*** 598,604 ****
+          # bazelbuild/bazel-skylib
+          "bazel-skylib-1.0.3.tar.gz": "1c531376ac7e5a180e0237938a2536de0c54d93f5c278634818e0efc952dd56c",
+          # bazelbuild/platforms
+!         "46993efdd33b73649796c5fc5c9efb193ae19d51.zip": "66184688debeeefcc2a16a2f80b03f514deac8346fe888fb7e691a52c023dd88",
+          # bazelbuild/rules_java
+          "7cf3cefd652008d0a64a419c34c13bdca6c8f178.zip": "bc81f1ba47ef5cc68ad32225c3d0e70b8c6f6077663835438da8d5733f917598",
+          # bazelbuild/rules_cc
+--- 598,604 ----
+          # bazelbuild/bazel-skylib
+          "bazel-skylib-1.0.3.tar.gz": "1c531376ac7e5a180e0237938a2536de0c54d93f5c278634818e0efc952dd56c",
+          # bazelbuild/platforms
+!         "platforms-0.0.2.tar.gz": "48a2d8d343863989c232843e01afc8a986eb8738766bfd8611420a7db8f6f0c3",
+          # bazelbuild/rules_java
+          "7cf3cefd652008d0a64a419c34c13bdca6c8f178.zip": "bc81f1ba47ef5cc68ad32225c3d0e70b8c6f6077663835438da8d5733f917598",
+          # bazelbuild/rules_cc
+***************
+*** 637,643 ****
+              "https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.3/bazel-skylib-1.0.3.tar.gz",
+          ],
+          # bazelbuild/platforms
+!         "46993efdd33b73649796c5fc5c9efb193ae19d51.zip": [
+              "https://mirror.bazel.build/github.com/bazelbuild/platforms/archive/46993efdd33b73649796c5fc5c9efb193ae19d51.zip",
+              "https://github.com/bazelbuild/platforms/archive/46993efdd33b73649796c5fc5c9efb193ae19d51.zip",
+          ],
+--- 637,643 ----
+              "https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.3/bazel-skylib-1.0.3.tar.gz",
+          ],
+          # bazelbuild/platforms
+!         "platforms-0.0.2.tar.gz": [
+              "https://mirror.bazel.build/github.com/bazelbuild/platforms/archive/46993efdd33b73649796c5fc5c9efb193ae19d51.zip",
+              "https://github.com/bazelbuild/platforms/archive/46993efdd33b73649796c5fc5c9efb193ae19d51.zip",
+          ],
+***************
+*** 747,757 ****
+  
+  http_archive(
+      name = "platforms",
+!     sha256 = "66184688debeeefcc2a16a2f80b03f514deac8346fe888fb7e691a52c023dd88",
+!     strip_prefix = "platforms-46993efdd33b73649796c5fc5c9efb193ae19d51",
+      urls = [
+!         "https://mirror.bazel.build/github.com/bazelbuild/platforms/archive/46993efdd33b73649796c5fc5c9efb193ae19d51.zip",
+!         "https://github.com/bazelbuild/platforms/archive/46993efdd33b73649796c5fc5c9efb193ae19d51.zip",
+      ],
+  )
+  
+--- 747,756 ----
+  
+  http_archive(
+      name = "platforms",
+!     sha256 = "48a2d8d343863989c232843e01afc8a986eb8738766bfd8611420a7db8f6f0c3",
+      urls = [
+!         "https://mirror.bazel.build/github.com/bazelbuild/platforms/releases/download/0.0.2/platforms-0.0.2.tar.gz",
+!         "https://github.com/bazelbuild/platforms/releases/download/0.0.2/platforms-0.0.2.tar.gz",
+      ],
+  )
+``` 
diff --git a/distro/makerel.sh b/distro/makerel.sh
new file mode 100755
index 0000000..e6f8fe3
--- /dev/null
+++ b/distro/makerel.sh
@@ -0,0 +1,51 @@
+#!/bin/bash
+
+if [[ $# != 1 ]] ; then
+  echo "usage: $0 version"
+  exit 1
+fi
+version="$1"
+
+if [[ ! -f WORKSPACE ]] ; then
+  echo 'You must run this command from the top of the workspace.'
+  exit 1
+fi
+
+# tar on macos builds a file with different checksums each time.
+if [[ $(uname) != 'Linux' ]] ; then
+  echo 'You must run this command from a linux machine.'
+  exit 1
+fi
+
+
+dist_file="/tmp/platforms-${version}.tar.gz"
+tar czf "$dist_file" BUILD LICENSE WORKSPACE cpu os
+sha256=$(shasum -a256 "$dist_file" | cut -d' ' -f1)
+
+cat <<INP
+
+
+1. Create a new release using the tag $version
+2. Copy/paste the text below into the release description field.
+3. Upload $dist_file as an artifact.
+4. Copy $dist_file to the mirror site.
+5. Create the release.
+6. Update Bazel to point to this new release. See the readme.
+
+=============== CUT HERE =============== 
+**WORKSPACE setup**
+
+\`\`\`
+load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
+http_archive(
+    name = "platforms",
+    urls = [
+        "https://mirror.bazel.build/github.com/bazelbuild/platforms/releases/download/$version/platforms-$version.tar.gz",
+        "https://github.com/bazelbuild/platforms/releases/download/$version/platforms-$version.tar.gz",
+    ],
+    sha256 = "$sha256",
+)
+\`\`\`
+=============== CUT HERE =============== 
+INP
+