Update bazlets to latest master revision and build with Bazel 1.0.0

Introduce .bazelversion specifying version 1.0.0, and machinery in
the WORKSPACE to ensure that the minimum version is used.

Test plan: bazel build all

Change-Id: Iab9b87df506f5a5204c49e82449bca903f828fdf
diff --git a/.bazelversion b/.bazelversion
new file mode 100644
index 0000000..3eefcb9
--- /dev/null
+++ b/.bazelversion
@@ -0,0 +1 @@
+1.0.0
diff --git a/WORKSPACE b/WORKSPACE
index 5c4b172..5770699 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -1,8 +1,25 @@
 workspace(name = "prolog_cafe")
 
 load("//:bazlets.bzl", "load_bazlets")
+load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
 
 load_bazlets(
-    commit = "09a035e98077dce549d5f6a7472d06c4b8f792d2",
+    commit = "97e83629a68dedda29125657a0a0a8cb21094de1",
     #    local_path = "/home/<user>/projects/bazlets"
 )
+
+http_archive(
+    name = "bazel_skylib",
+    sha256 = "2ea8a5ed2b448baf4a6855d3ce049c4c452a6470b1efd1504fdb7c1c134d220a",
+    strip_prefix = "bazel-skylib-0.8.0",
+    urls = ["https://github.com/bazelbuild/bazel-skylib/archive/0.8.0.tar.gz"],
+)
+
+# Check Bazel version when invoked by Bazel directly
+load("//tools/bzl:bazelisk_version.bzl", "bazelisk_version")
+
+bazelisk_version(name = "bazelisk_version")
+
+load("@bazelisk_version//:check.bzl", "check_bazel_version")
+
+check_bazel_version()
diff --git a/tools/bzl/BUILD b/tools/bzl/BUILD
new file mode 100644
index 0000000..7c12f94
--- /dev/null
+++ b/tools/bzl/BUILD
@@ -0,0 +1 @@
+# Empty BUILD file required by Bazel
diff --git a/tools/bzl/bazelisk_version.bzl b/tools/bzl/bazelisk_version.bzl
new file mode 100644
index 0000000..d8b3d10
--- /dev/null
+++ b/tools/bzl/bazelisk_version.bzl
@@ -0,0 +1,16 @@
+_template = """
+load("@bazel_skylib//lib:versions.bzl", "versions")
+
+def check_bazel_version():
+  versions.check(minimum_bazel_version = "{version}")
+""".strip()
+
+def _impl(repository_ctx):
+    repository_ctx.symlink(Label("@//:.bazelversion"), ".bazelversion")
+    bazelversion = repository_ctx.read(".bazelversion").strip()
+
+    repository_ctx.file("BUILD", executable = False)
+
+    repository_ctx.file("check.bzl", executable = False, content = _template.format(version = bazelversion))
+
+bazelisk_version = repository_rule(implementation = _impl)