diff --git a/WORKSPACE b/WORKSPACE index ea25fa957a..2ca2cd4ea5 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -65,9 +65,14 @@ http_file( urls = ["https://raw.githubusercontent.com/google/closure-compiler/35d2b3340ff23a69441f10fa3bc820691c2942f2/contrib/externs/polymer-1.0.js"], ) -load("@bazel_skylib//lib:versions.bzl", "versions") +# Check Bazel version when invoked by Bazel directly +load("//tools/bzl:bazelisk_version.bzl", "bazelisk_version") -versions.check(minimum_bazel_version = "0.29.0") +bazelisk_version(name = "bazelisk_version") + +load("@bazelisk_version//:check.bzl", "check_bazel_version") + +check_bazel_version() # Rules Python http_archive( @@ -1152,18 +1157,18 @@ maven_jar( sha1 = "0f5a654e4675769c716e5b387830d19b501ca191", ) -TESTCONTAINERS_VERSION = "1.12.0" +TESTCONTAINERS_VERSION = "1.12.1" maven_jar( name = "testcontainers", artifact = "org.testcontainers:testcontainers:" + TESTCONTAINERS_VERSION, - sha1 = "ac89643ce1ddde504da09172086aba0c7df10bff", + sha1 = "1dc8666ead914c5515d087f75ffe92629414caf6", ) maven_jar( name = "testcontainers-elasticsearch", artifact = "org.testcontainers:elasticsearch:" + TESTCONTAINERS_VERSION, - sha1 = "cd9020f1803396c45ef935312bf232f9b17332b0", + sha1 = "2491f792627a1f15d341bfcd6dd0ea7e3541d82f", ) maven_jar( diff --git a/lib/prolog/BUILD b/lib/prolog/BUILD index 6ae443469c..fa556829e3 100644 --- a/lib/prolog/BUILD +++ b/lib/prolog/BUILD @@ -44,14 +44,14 @@ java_library( java_binary( name = "compiler-bin", - main_class = "BuckPrologCompiler", + main_class = "BazelPrologCompiler", visibility = ["//visibility:public"], runtime_deps = [":compiler-lib"], ) java_library( name = "compiler-lib", - srcs = ["java/BuckPrologCompiler.java"], + srcs = ["java/BazelPrologCompiler.java"], visibility = ["//visibility:public"], deps = [ ":compiler", diff --git a/lib/prolog/java/BuckPrologCompiler.java b/lib/prolog/java/BazelPrologCompiler.java similarity index 98% rename from lib/prolog/java/BuckPrologCompiler.java rename to lib/prolog/java/BazelPrologCompiler.java index cc3e39e603..37ea6960bb 100644 --- a/lib/prolog/java/BuckPrologCompiler.java +++ b/lib/prolog/java/BazelPrologCompiler.java @@ -21,7 +21,7 @@ import java.nio.file.Files; import java.util.jar.JarEntry; import java.util.jar.JarOutputStream; -public class BuckPrologCompiler { +public class BazelPrologCompiler { private static File tmpdir; public static void main(String[] argv) throws IOException, CompileException { diff --git a/tools/bzl/bazelisk_version.bzl b/tools/bzl/bazelisk_version.bzl new file mode 100644 index 0000000000..d8b3d10982 --- /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) diff --git a/tools/bzl/classpath.bzl b/tools/bzl/classpath.bzl index 0d43be78d5..3be7a12507 100644 --- a/tools/bzl/classpath.bzl +++ b/tools/bzl/classpath.bzl @@ -1,10 +1,10 @@ def _classpath_collector(ctx): all = [] for d in ctx.attr.deps: - if hasattr(d, "java"): - all.append(d.java.transitive_runtime_deps) - if hasattr(d.java.compilation_info, "runtime_classpath"): - all.append(d.java.compilation_info.runtime_classpath) + if JavaInfo in d: + all.append(d[JavaInfo].transitive_runtime_deps) + if hasattr(d[JavaInfo].compilation_info, "runtime_classpath"): + all.append(d[JavaInfo].compilation_info.runtime_classpath) elif hasattr(d, "files"): all.append(d.files) diff --git a/tools/bzl/gwt.bzl b/tools/bzl/gwt.bzl index c269a07289..cf1c47e627 100644 --- a/tools/bzl/gwt.bzl +++ b/tools/bzl/gwt.bzl @@ -196,11 +196,11 @@ def _gwt_binary_impl(ctx): def _get_transitive_closure(ctx): deps = [] for dep in ctx.attr.module_deps: - deps.append(dep.java.transitive_runtime_deps) - deps.append(dep.java.transitive_source_jars) + deps.append(dep[JavaInfo].transitive_runtime_deps) + deps.append(dep[JavaInfo].transitive_source_jars) for dep in ctx.attr.deps: - if hasattr(dep, "java"): - deps.append(dep.java.transitive_runtime_deps) + if JavaInfo in dep: + deps.append(dep[JavaInfo].transitive_runtime_deps) elif hasattr(dep, "files"): deps.append(dep.files) diff --git a/tools/bzl/javadoc.bzl b/tools/bzl/javadoc.bzl index 754bd961cf..77c2d4adc0 100644 --- a/tools/bzl/javadoc.bzl +++ b/tools/bzl/javadoc.bzl @@ -17,8 +17,11 @@ def _impl(ctx): zip_output = ctx.outputs.zip - transitive_jars = depset(transitive = [j.java.transitive_deps for j in ctx.attr.libs]) - source_jars = depset(transitive = [j.java.source_jars for j in ctx.attr.libs]) + transitive_jars = depset(transitive = [j[JavaInfo].transitive_deps for j in ctx.attr.libs]) + + # TODO(davido): Remove list to depset conversion on source_jars, when this issue is fixed: + # https://github.com/bazelbuild/bazel/issues/4221 + source_jars = depset(transitive = [depset(j[JavaInfo].source_jars) for j in ctx.attr.libs]) transitive_jar_paths = [j.path for j in transitive_jars.to_list()] dir = ctx.outputs.zip.path + ".dir" diff --git a/tools/bzl/pkg_war.bzl b/tools/bzl/pkg_war.bzl index dd60079d3c..ee57e54bf0 100644 --- a/tools/bzl/pkg_war.bzl +++ b/tools/bzl/pkg_war.bzl @@ -103,8 +103,8 @@ def _war_impl(ctx): transitive_context_libs = [] if ctx.attr.context: for jar in ctx.attr.context: - if hasattr(jar, "java"): - transitive_context_libs.append(jar.java.transitive_runtime_deps) + if JavaInfo in jar: + transitive_context_libs.append(jar[JavaInfo].transitive_runtime_deps) elif hasattr(jar, "files"): transitive_context_libs.append(jar.files)