Migrate from old-style legacy .java provider to the new JavaInfo.

This is a rollforward of https://gerrit-review.googlesource.com/c/gerrit/+/234154
with a bug fix.

I checked the bug is now fixed by building :gerrit at head, with the
faulty (rolledback) change and with the current change. I compared the war files
contents: the ones built at head and with this change are the same, the
ones built at head and with the rolledback change differ a lot.

Change-Id: I1d5afb8b022b33f110ed1006fcfcd6fc7aa97d71
This commit is contained in:
Irina Iancu
2019-08-26 13:20:07 +02:00
committed by David Pursehouse
parent 7d60ca3f34
commit 06f7aaa85c

View File

@@ -77,8 +77,8 @@ def _war_impl(ctx):
# Add lib
transitive_libs = []
for j in ctx.attr.libs:
if hasattr(j, "java"):
transitive_libs.append(j.java.transitive_runtime_deps)
if JavaInfo in j:
transitive_libs.append(j[JavaInfo].transitive_runtime_deps)
elif hasattr(j, "files"):
transitive_libs.append(j.files)
@@ -90,7 +90,7 @@ def _war_impl(ctx):
# Add pgm lib
transitive_pgmlibs = []
for j in ctx.attr.pgmlibs:
transitive_pgmlibs.append(j.java.transitive_runtime_deps)
transitive_pgmlibs.append(j[JavaInfo].transitive_runtime_deps)
transitive_pgmlib_deps = depset(transitive = transitive_pgmlibs)
for dep in transitive_pgmlib_deps.to_list():