From 5e58b4b41039d24b0da265115aa8750ea37e26c8 Mon Sep 17 00:00:00 2001 From: Christian Edward Gruber Date: Tue, 18 Feb 2020 17:08:10 -0500 Subject: [PATCH] Only propagate srcjar if it isn't the default empty jar added in ae70089a2f672182d55ef8cd1bd97ec6d2370d6a to fix bazelbuild/intellij#1616 (#276) --- kotlin/internal/jvm/impl.bzl | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/kotlin/internal/jvm/impl.bzl b/kotlin/internal/jvm/impl.bzl index 5c5d86d2b..fa86a71e0 100644 --- a/kotlin/internal/jvm/impl.bzl +++ b/kotlin/internal/jvm/impl.bzl @@ -73,7 +73,10 @@ def _unify_jars(ctx): else: # Legacy handling. jars = [] - source_jars = [ctx.file.srcjar] if ctx.file.srcjar else [] + if (ctx.file.srcjar and not "%s" % ctx.file.srcjar.path == "third_party/empty.jar"): + source_jars = [ctx.file.srcjar] + else: + source_jars = [] # TODO after a while remove the for block, the checks after it,and simplify the source-jar to jar allignment. # There must be a single jar jar and it can either be a filegroup or a JavaInfo. @@ -98,9 +101,7 @@ def _unify_jars(ctx): fail("got more than one jar, this is an error create an issue: %s" % jars) if len(source_jars) > 1: fail("got more than one source jar. " + - "Did you include both srcjar and a sources jar in the jars attribute?: " + - jars) - print(source_jars) + "Did you include both srcjar and a sources jar in the jars attribute?: %s" % source_jars) return struct(class_jar = jars[0], source_jar = source_jars[0] if len(source_jars) == 1 else None, ijar = None) def kt_jvm_import_impl(ctx):