Merge branch 'stable-2.15' into stable-2.16

* stable-2.15:
  Upgrade testcontainers to 1.12.1
  Bazel: Reuse version from .bazelversion for minimum used version check
  Bazel: Add fixes for --incompatible_disallow_legacy_java_provider
  Rename left over Buck prolog compiler class to Bazel

Change-Id: Ibe7b101a7c6e95a296ee8c2f01ad790d66c216d7
This commit is contained in:
Marco Miller 2019-09-10 10:28:55 -04:00 committed by David Ostrovsky
commit 444d33286f
8 changed files with 44 additions and 20 deletions

View File

@ -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(

View File

@ -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",

View File

@ -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 {

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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"

View File

@ -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)