From e891cb1f140dff27bc9bcc2e5e83026c1a486c34 Mon Sep 17 00:00:00 2001 From: iirina Date: Fri, 9 Aug 2019 13:04:20 +0200 Subject: [PATCH 1/2] Migrate from old-style .java provider to JavaInfo. --- jmh/jmh.bzl | 2 +- scala/private/common.bzl | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/jmh/jmh.bzl b/jmh/jmh.bzl index 2bd8c6fba..0802792fa 100644 --- a/jmh/jmh.bzl +++ b/jmh/jmh.bzl @@ -77,7 +77,7 @@ def jmh_repositories(maven_servers = ["http://central.maven.org/maven2"]): def _scala_construct_runtime_classpath(deps): scala_targets = [d.scala for d in deps if hasattr(d, "scala")] - java_targets = [d.java for d in deps if hasattr(d, "java")] + java_targets = [d[JavaInfo] for d in deps if hasattr(d, "JavaInfo")] files = [] for scala in scala_targets: files.append(scala.transitive_runtime_jars) diff --git a/scala/private/common.bzl b/scala/private/common.bzl index 4b4aa84b5..9c7f9684e 100644 --- a/scala/private/common.bzl +++ b/scala/private/common.bzl @@ -44,8 +44,8 @@ def collect_plugin_paths(plugins): paths.append(p) elif hasattr(p, "scala"): paths.extend([j.class_jar for j in p.scala.outputs.jars]) - elif hasattr(p, "java"): - paths.extend([j.class_jar for j in p.java.outputs.jars]) + elif hasattr(p, "JavaInfo"): + paths.extend([j.class_jar for j in p[JavaInfo].outputs.jars]) # support http_file pointed at a jar. http_jar uses ijar, # which breaks scala macros From d0a2ee0b2c5e19eed7f34cc62a9467af97dbfd77 Mon Sep 17 00:00:00 2001 From: iirina Date: Mon, 12 Aug 2019 15:48:29 +0200 Subject: [PATCH 2/2] Remove usage of .scala. --- jmh/jmh.bzl | 8 ++------ scala/private/common.bzl | 4 +--- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/jmh/jmh.bzl b/jmh/jmh.bzl index 0802792fa..58ac7fc3e 100644 --- a/jmh/jmh.bzl +++ b/jmh/jmh.bzl @@ -76,13 +76,9 @@ def jmh_repositories(maven_servers = ["http://central.maven.org/maven2"]): ) def _scala_construct_runtime_classpath(deps): - scala_targets = [d.scala for d in deps if hasattr(d, "scala")] - java_targets = [d[JavaInfo] for d in deps if hasattr(d, "JavaInfo")] files = [] - for scala in scala_targets: - files.append(scala.transitive_runtime_jars) - for java in java_targets: - files.append(java.transitive_runtime_deps) + [files.append(target[JavaInfo].transitive_runtime_deps) for target in deps if JavaInfo in target] + return depset(transitive = files) def _scala_generate_benchmark(ctx): diff --git a/scala/private/common.bzl b/scala/private/common.bzl index 9c7f9684e..e449178c6 100644 --- a/scala/private/common.bzl +++ b/scala/private/common.bzl @@ -42,9 +42,7 @@ def collect_plugin_paths(plugins): for p in plugins: if hasattr(p, "path"): paths.append(p) - elif hasattr(p, "scala"): - paths.extend([j.class_jar for j in p.scala.outputs.jars]) - elif hasattr(p, "JavaInfo"): + elif JavaInfo in p: paths.extend([j.class_jar for j in p[JavaInfo].outputs.jars]) # support http_file pointed at a jar. http_jar uses ijar, # which breaks scala macros