Merge "SetPrivateOp: Include non-open change's status in exception message"
diff --git a/WORKSPACE b/WORKSPACE
index ca29e49..7aa4dce 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -14,9 +14,9 @@
http_archive(
name = "io_bazel_rules_closure",
- sha256 = "4f2c173ebf95e94d98a0d5cb799e734536eaf3eca280eb15e124f5e5ef8b6e39",
- strip_prefix = "rules_closure-6fd76e645b5c622221c9920f41a4d0bc578a3046",
- urls = ["https://github.com/bazelbuild/rules_closure/archive/6fd76e645b5c622221c9920f41a4d0bc578a3046.tar.gz"],
+ sha256 = "0e6de40666f2ebb2b30dc0339745a274d9999334a249b05a3b1f46462e489adf",
+ strip_prefix = "rules_closure-87d24b1df8b62405de8dd059cb604fd9d4b1e395",
+ urls = ["https://github.com/bazelbuild/rules_closure/archive/87d24b1df8b62405de8dd059cb604fd9d4b1e395.tar.gz"],
)
# File is specific to Polymer and copied from the Closure Github -- should be
diff --git a/java/com/google/gerrit/server/git/MergeUtil.java b/java/com/google/gerrit/server/git/MergeUtil.java
index 0d427e6..208dafb 100644
--- a/java/com/google/gerrit/server/git/MergeUtil.java
+++ b/java/com/google/gerrit/server/git/MergeUtil.java
@@ -32,6 +32,7 @@
import com.google.gerrit.common.data.LabelType;
import com.google.gerrit.extensions.registration.DynamicItem;
import com.google.gerrit.extensions.registration.DynamicSet;
+import com.google.gerrit.extensions.registration.Extension;
import com.google.gerrit.extensions.restapi.BadRequestException;
import com.google.gerrit.extensions.restapi.MergeConflictException;
import com.google.gerrit.extensions.restapi.MethodNotAllowedException;
@@ -125,20 +126,31 @@
}
public String generate(
- RevCommit original, RevCommit mergeTip, Branch.NameKey dest, String current) {
+ RevCommit original, RevCommit mergeTip, Branch.NameKey dest, String originalMessage) {
requireNonNull(original.getRawBuffer());
if (mergeTip != null) {
requireNonNull(mergeTip.getRawBuffer());
}
- for (ChangeMessageModifier changeMessageModifier : changeMessageModifiers) {
+
+ int count = 0;
+ String current = originalMessage;
+ for (Extension<ChangeMessageModifier> ext : changeMessageModifiers.entries()) {
+ ChangeMessageModifier changeMessageModifier = ext.get();
+ String className = changeMessageModifier.getClass().getName();
current = changeMessageModifier.onSubmit(current, original, mergeTip, dest);
- requireNonNull(
- current,
- () ->
- String.format(
- "%s.OnSubmit returned null instead of new commit message",
- changeMessageModifier.getClass().getName()));
+ checkState(
+ current != null,
+ "%s.onSubmit from plugin %s returned null instead of new commit message",
+ className,
+ ext.getPluginName());
+ count++;
+ logger.atFine().log(
+ "Invoked %s from plugin %s, message length now %d",
+ className, ext.getPluginName(), current.length());
}
+ logger.atFine().log(
+ "Invoked %d ChangeMessageModifiers on message with original length %d",
+ count, originalMessage.length());
return current;
}
}
diff --git a/javatests/com/google/gerrit/acceptance/api/group/GroupsIT.java b/javatests/com/google/gerrit/acceptance/api/group/GroupsIT.java
index b00597c..f5ebfea 100644
--- a/javatests/com/google/gerrit/acceptance/api/group/GroupsIT.java
+++ b/javatests/com/google/gerrit/acceptance/api/group/GroupsIT.java
@@ -84,6 +84,8 @@
import com.google.gerrit.server.index.group.GroupIndexer;
import com.google.gerrit.server.index.group.StalenessChecker;
import com.google.gerrit.server.notedb.Sequences;
+import com.google.gerrit.server.project.ProjectConfig;
+import com.google.gerrit.server.project.testing.Util;
import com.google.gerrit.server.util.MagicBranch;
import com.google.gerrit.server.util.time.TimeUtil;
import com.google.gerrit.testing.TestTimeUtil;
@@ -1074,11 +1076,15 @@
private void assertPushToGroupBranch(
Project.NameKey project, String groupRefName, String expectedErrorOnUpdate) throws Exception {
- grant(project, RefNames.REFS_GROUPS + "*", Permission.CREATE, false, REGISTERED_USERS);
- grant(project, RefNames.REFS_GROUPS + "*", Permission.PUSH, false, REGISTERED_USERS);
- grant(project, RefNames.REFS_DELETED_GROUPS + "*", Permission.CREATE, false, REGISTERED_USERS);
- grant(project, RefNames.REFS_DELETED_GROUPS + "*", Permission.PUSH, false, REGISTERED_USERS);
- grant(project, RefNames.REFS_GROUPNAMES, Permission.PUSH, false, REGISTERED_USERS);
+ try (ProjectConfigUpdate u = updateProject(project)) {
+ ProjectConfig cfg = u.getConfig();
+ Util.allow(cfg, Permission.CREATE, REGISTERED_USERS, RefNames.REFS_GROUPS + "*");
+ Util.allow(cfg, Permission.PUSH, REGISTERED_USERS, RefNames.REFS_GROUPS + "*");
+ Util.allow(cfg, Permission.CREATE, REGISTERED_USERS, RefNames.REFS_DELETED_GROUPS + "*");
+ Util.allow(cfg, Permission.PUSH, REGISTERED_USERS, RefNames.REFS_DELETED_GROUPS + "*");
+ Util.allow(cfg, Permission.PUSH, REGISTERED_USERS, RefNames.REFS_GROUPNAMES);
+ u.save();
+ }
TestRepository<InMemoryRepository> repo = cloneProject(project);
@@ -1097,8 +1103,12 @@
}
private void assertCreateGroupBranch(Project.NameKey project) throws Exception {
- grant(project, RefNames.REFS_GROUPS + "*", Permission.CREATE, false, REGISTERED_USERS);
- grant(project, RefNames.REFS_GROUPS + "*", Permission.PUSH, false, REGISTERED_USERS);
+ try (ProjectConfigUpdate u = updateProject(project)) {
+ ProjectConfig cfg = u.getConfig();
+ Util.allow(cfg, Permission.CREATE, REGISTERED_USERS, RefNames.REFS_GROUPS + "*");
+ Util.allow(cfg, Permission.PUSH, REGISTERED_USERS, RefNames.REFS_GROUPS + "*");
+ u.save();
+ }
TestRepository<InMemoryRepository> repo = cloneProject(project);
PushOneCommit.Result r =
pushFactory
diff --git a/javatests/com/google/gerrit/acceptance/api/project/CheckAccessIT.java b/javatests/com/google/gerrit/acceptance/api/project/CheckAccessIT.java
index 30a8b6b..4088ebf 100644
--- a/javatests/com/google/gerrit/acceptance/api/project/CheckAccessIT.java
+++ b/javatests/com/google/gerrit/acceptance/api/project/CheckAccessIT.java
@@ -32,6 +32,8 @@
import com.google.gerrit.reviewdb.client.Project;
import com.google.gerrit.reviewdb.client.RefNames;
import com.google.gerrit.server.group.SystemGroupBackend;
+import com.google.gerrit.server.project.ProjectConfig;
+import com.google.gerrit.server.project.testing.Util;
import com.google.inject.Inject;
import java.util.List;
import org.eclipse.jgit.lib.RefUpdate;
@@ -60,26 +62,29 @@
privilegedUser = accountCreator.create("privilegedUser", "snowden@nsa.gov", "Ed Snowden");
groupOperations.group(privilegedGroupUuid).forUpdate().addMember(privilegedUser.id).update();
- grant(secretProject, "refs/*", Permission.READ, false, privilegedGroupUuid);
- block(secretProject, "refs/*", Permission.READ, SystemGroupBackend.REGISTERED_USERS);
+ try (ProjectConfigUpdate u = updateProject(secretProject)) {
+ ProjectConfig cfg = u.getConfig();
+ Util.allow(cfg, Permission.READ, privilegedGroupUuid, "refs/*");
+ Util.block(cfg, Permission.READ, SystemGroupBackend.REGISTERED_USERS, "refs/*");
+ u.save();
+ }
- deny(secretRefProject, "refs/*", Permission.READ, SystemGroupBackend.ANONYMOUS_USERS);
- grant(secretRefProject, "refs/heads/secret/*", Permission.READ, false, privilegedGroupUuid);
- block(
- secretRefProject,
- "refs/heads/secret/*",
- Permission.READ,
- SystemGroupBackend.REGISTERED_USERS);
- grant(
- secretRefProject,
- "refs/heads/*",
- Permission.READ,
- false,
- SystemGroupBackend.REGISTERED_USERS);
+ try (ProjectConfigUpdate u = updateProject(secretRefProject)) {
+ ProjectConfig cfg = u.getConfig();
+ Util.deny(cfg, Permission.READ, SystemGroupBackend.ANONYMOUS_USERS, "refs/*");
+ Util.allow(cfg, Permission.READ, privilegedGroupUuid, "refs/heads/secret/*");
+ Util.block(cfg, Permission.READ, SystemGroupBackend.REGISTERED_USERS, "refs/heads/secret/*");
+ Util.allow(cfg, Permission.READ, SystemGroupBackend.REGISTERED_USERS, "refs/heads/*");
+ u.save();
+ }
// Ref permission
- grant(normalProject, "refs/*", Permission.VIEW_PRIVATE_CHANGES, false, privilegedGroupUuid);
- grant(normalProject, "refs/*", Permission.FORGE_SERVER, false, privilegedGroupUuid);
+ try (ProjectConfigUpdate u = updateProject(normalProject)) {
+ ProjectConfig cfg = u.getConfig();
+ Util.allow(cfg, Permission.VIEW_PRIVATE_CHANGES, privilegedGroupUuid, "refs/*");
+ Util.allow(cfg, Permission.FORGE_SERVER, privilegedGroupUuid, "refs/*");
+ u.save();
+ }
}
@Test
diff --git a/javatests/com/google/gerrit/acceptance/rest/change/AbstractSubmitByRebase.java b/javatests/com/google/gerrit/acceptance/rest/change/AbstractSubmitByRebase.java
index 31813e3..36595ce 100644
--- a/javatests/com/google/gerrit/acceptance/rest/change/AbstractSubmitByRebase.java
+++ b/javatests/com/google/gerrit/acceptance/rest/change/AbstractSubmitByRebase.java
@@ -70,7 +70,8 @@
submitWithRebase(user);
}
- private void submitWithRebase(TestAccount submitter) throws Exception {
+ protected ImmutableList<PushOneCommit.Result> submitWithRebase(TestAccount submitter)
+ throws Exception {
requestScopeOperations.setApiUser(submitter.getId());
RevCommit initialHead = getRemoteHead();
PushOneCommit.Result change = createChange("Change 1", "a.txt", "content");
@@ -97,6 +98,7 @@
headAfterFirstSubmit.name(),
change2.getChangeId(),
headAfterSecondSubmit.name());
+ return ImmutableList.of(change, change2);
}
@Test
diff --git a/javatests/com/google/gerrit/acceptance/rest/change/SubmitByRebaseAlwaysIT.java b/javatests/com/google/gerrit/acceptance/rest/change/SubmitByRebaseAlwaysIT.java
index 7eec854..d9a26aa 100644
--- a/javatests/com/google/gerrit/acceptance/rest/change/SubmitByRebaseAlwaysIT.java
+++ b/javatests/com/google/gerrit/acceptance/rest/change/SubmitByRebaseAlwaysIT.java
@@ -15,25 +15,35 @@
package com.google.gerrit.acceptance.rest.change;
import static com.google.common.truth.Truth.assertThat;
+import static com.google.common.truth.Truth.assert_;
import static com.google.gerrit.extensions.client.ListChangesOption.CURRENT_REVISION;
+import com.google.common.base.Throwables;
+import com.google.common.collect.ImmutableList;
import com.google.gerrit.acceptance.PushOneCommit;
import com.google.gerrit.acceptance.TestProjectInput;
import com.google.gerrit.common.FooterConstants;
import com.google.gerrit.extensions.client.InheritableBoolean;
import com.google.gerrit.extensions.client.SubmitType;
import com.google.gerrit.extensions.common.ChangeInfo;
+import com.google.gerrit.extensions.registration.DynamicItem;
import com.google.gerrit.extensions.registration.DynamicSet;
import com.google.gerrit.extensions.registration.RegistrationHandle;
+import com.google.gerrit.extensions.restapi.ResourceConflictException;
+import com.google.gerrit.reviewdb.client.PatchSet;
+import com.google.gerrit.server.config.UrlFormatter;
import com.google.gerrit.server.git.ChangeMessageModifier;
+import com.google.gerrit.server.query.change.ChangeData;
import com.google.inject.Inject;
-import java.util.List;
+import java.util.ArrayDeque;
+import java.util.Deque;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.revwalk.RevCommit;
import org.junit.Test;
public class SubmitByRebaseAlwaysIT extends AbstractSubmitByRebase {
@Inject private DynamicSet<ChangeMessageModifier> changeMessageModifiers;
+ @Inject private DynamicItem<UrlFormatter> urlFormatter;
@Override
protected SubmitType getSubmitType() {
@@ -79,36 +89,86 @@
}
@Test
- @TestProjectInput(useContentMerge = InheritableBoolean.TRUE)
- public void changeMessageOnSubmit() throws Exception {
- PushOneCommit.Result change1 = createChange();
- PushOneCommit.Result change2 = createChange();
+ public void rebaseInvokesChangeMessageModifiers() throws Exception {
+ ChangeMessageModifier modifier1 =
+ (msg, orig, tip, dest) -> msg + "This-change-before-rebase: " + orig.name() + "\n";
+ ChangeMessageModifier modifier2 =
+ (msg, orig, tip, dest) -> msg + "Previous-step-tip: " + tip.name() + "\n";
+ ChangeMessageModifier modifier3 =
+ (msg, orig, tip, dest) -> msg + "Dest: " + dest.getShortName() + "\n";
- RegistrationHandle handle =
- changeMessageModifiers.add(
- "gerrit",
- (newCommitMessage, original, mergeTip, destination) -> {
- List<String> custom = mergeTip.getFooterLines("Custom");
- if (!custom.isEmpty()) {
- newCommitMessage += "Custom-Parent: " + custom.get(0) + "\n";
- }
- return newCommitMessage + "Custom: " + destination.get();
- });
- try {
- // change1 is a fast-forward, but should be rebased in cherry pick style
- // anyway, making change2 not a fast-forward, requiring a rebase.
- approve(change1.getChangeId());
- submit(change2.getChangeId());
- } finally {
- handle.remove();
+ try (AutoCloseable ignored = installChangeMessageModifiers(modifier1, modifier2, modifier3)) {
+ ImmutableList<PushOneCommit.Result> changes = submitWithRebase(admin);
+ ChangeData cd1 = changes.get(0).getChange();
+ ChangeData cd2 = changes.get(1).getChange();
+ assertThat(cd2.patchSets()).hasSize(2);
+ String change1CurrentCommit = cd1.currentPatchSet().getRevision().get();
+ String change2Ps1Commit = cd2.patchSet(new PatchSet.Id(cd2.getId(), 1)).getRevision().get();
+
+ assertThat(gApi.changes().id(cd2.getId().get()).revision(2).commit(false).message)
+ .isEqualTo(
+ "Change 2\n\n"
+ + ("Change-Id: " + cd2.change().getKey() + "\n")
+ + ("Reviewed-on: "
+ + urlFormatter.get().getChangeViewUrl(project, cd2.getId()).get()
+ + "\n")
+ + "Reviewed-by: Administrator <admin@example.com>\n"
+ + ("This-change-before-rebase: " + change2Ps1Commit + "\n")
+ + ("Previous-step-tip: " + change1CurrentCommit + "\n")
+ + "Dest: master\n");
}
- // ... but both changes should get custom footers.
- assertThat(getCurrentCommit(change1).getFooterLines("Custom"))
- .containsExactly("refs/heads/master");
- assertThat(getCurrentCommit(change2).getFooterLines("Custom"))
- .containsExactly("refs/heads/master");
- assertThat(getCurrentCommit(change2).getFooterLines("Custom-Parent"))
- .containsExactly("refs/heads/master");
+ }
+
+ @Test
+ public void failingChangeMessageModifierShortCircuits() throws Exception {
+ ChangeMessageModifier modifier1 =
+ (msg, orig, tip, dest) -> {
+ throw new IllegalStateException("boom");
+ };
+ ChangeMessageModifier modifier2 = (msg, orig, tip, dest) -> msg + "A-footer: value\n";
+ try (AutoCloseable ignored = installChangeMessageModifiers(modifier1, modifier2)) {
+ try {
+ submitWithRebase();
+ assert_().fail("expected ResourceConflictException");
+ } catch (ResourceConflictException e) {
+ Throwable cause = Throwables.getRootCause(e);
+ assertThat(cause).isInstanceOf(RuntimeException.class);
+ assertThat(cause).hasMessageThat().isEqualTo("boom");
+ }
+ }
+ }
+
+ @Test
+ public void changeMessageModifierReturningNullShortCircuits() throws Exception {
+ ChangeMessageModifier modifier1 = (msg, orig, tip, dest) -> null;
+ ChangeMessageModifier modifier2 = (msg, orig, tip, dest) -> msg + "A-footer: value\n";
+ try (AutoCloseable ignored = installChangeMessageModifiers(modifier1, modifier2)) {
+ try {
+ submitWithRebase();
+ assert_().fail("expected ResourceConflictException");
+ } catch (ResourceConflictException e) {
+ Throwable cause = Throwables.getRootCause(e);
+ assertThat(cause).isInstanceOf(RuntimeException.class);
+ assertThat(cause)
+ .hasMessageThat()
+ .isEqualTo(
+ modifier1.getClass().getName()
+ + ".onSubmit from plugin modifier-1 returned null instead of new commit"
+ + " message");
+ }
+ }
+ }
+
+ private AutoCloseable installChangeMessageModifiers(ChangeMessageModifier... modifiers) {
+ Deque<RegistrationHandle> handles = new ArrayDeque<>(modifiers.length);
+ for (int i = 0; i < modifiers.length; i++) {
+ handles.push(changeMessageModifiers.add("modifier-" + (i + 1), modifiers[i]));
+ }
+ return () -> {
+ while (!handles.isEmpty()) {
+ handles.pop().remove();
+ }
+ };
}
private void assertLatestRevisionHasFooters(PushOneCommit.Result change) throws Exception {
diff --git a/tools/bzl/classpath.bzl b/tools/bzl/classpath.bzl
index f997fcf..0d43be7 100644
--- a/tools/bzl/classpath.bzl
+++ b/tools/bzl/classpath.bzl
@@ -1,14 +1,14 @@
def _classpath_collector(ctx):
- all = depset()
+ all = []
for d in ctx.attr.deps:
if hasattr(d, "java"):
- all += d.java.transitive_runtime_deps
+ all.append(d.java.transitive_runtime_deps)
if hasattr(d.java.compilation_info, "runtime_classpath"):
- all += d.java.compilation_info.runtime_classpath
+ all.append(d.java.compilation_info.runtime_classpath)
elif hasattr(d, "files"):
- all += d.files
+ all.append(d.files)
- as_strs = [c.path for c in all.to_list()]
+ as_strs = [c.path for c in depset(transitive = all).to_list()]
ctx.actions.write(
output = ctx.outputs.runtime,
content = "\n".join(sorted(as_strs)),
diff --git a/tools/bzl/javadoc.bzl b/tools/bzl/javadoc.bzl
index d315f8f..fcf9f33 100644
--- a/tools/bzl/javadoc.bzl
+++ b/tools/bzl/javadoc.bzl
@@ -17,13 +17,10 @@
def _impl(ctx):
zip_output = ctx.outputs.zip
- transitive_jar_set = depset()
- source_jars = depset()
- for l in ctx.attr.libs:
- source_jars += l.java.source_jars
- transitive_jar_set += l.java.transitive_deps
+ transitive_jars = depset(transitive = [l.java.transitive_deps for l in ctx.attr.libs])
+ source_jars = depset(transitive = [l.java.source_jars for l in ctx.attr.libs])
- transitive_jar_paths = [j.path for j in transitive_jar_set.to_list()]
+ transitive_jar_paths = [j.path for j in transitive_jars.to_list()]
dir = ctx.outputs.zip.path + ".dir"
source = ctx.outputs.zip.path + ".source"
external_docs = ["http://docs.oracle.com/javase/8/docs/api"] + ctx.attr.external_docs
@@ -56,7 +53,7 @@
"(cd %s && zip -Xqr ../%s *)" % (dir, ctx.outputs.zip.basename),
]
ctx.actions.run_shell(
- inputs = transitive_jar_set.to_list() + source_jars.to_list() + ctx.files._jdk,
+ inputs = transitive_jars.to_list() + source_jars.to_list() + ctx.files._jdk,
outputs = [zip_output],
command = " && ".join(cmd),
)
diff --git a/tools/bzl/js.bzl b/tools/bzl/js.bzl
index 19d4436..a7714a1 100644
--- a/tools/bzl/js.bzl
+++ b/tools/bzl/js.bzl
@@ -131,20 +131,20 @@
)
def _bower_component_impl(ctx):
- transitive_zipfiles = depset([ctx.file.zipfile])
- for d in ctx.attr.deps:
- transitive_zipfiles += d.transitive_zipfiles
+ transitive_zipfiles = depset(
+ direct = [ctx.file.zipfile],
+ transitive = [d.transitive_zipfiles for d in ctx.attr.deps],
+ )
- transitive_licenses = depset()
- if ctx.file.license:
- transitive_licenses += depset([ctx.file.license])
+ transitive_licenses = depset(
+ direct = [ctx.file.license],
+ transitive = [d.transitive_licenses for d in ctx.attr.deps],
+ )
- for d in ctx.attr.deps:
- transitive_licenses += d.transitive_licenses
-
- transitive_versions = depset(ctx.files.version_json)
- for d in ctx.attr.deps:
- transitive_versions += d.transitive_versions
+ transitive_versions = depset(
+ direct = ctx.files.version_json,
+ transitive = [d.transitive_versions for d in ctx.attr.deps],
+ )
return struct(
transitive_licenses = transitive_licenses,
@@ -183,12 +183,12 @@
mnemonic = "GenBowerZip",
)
- licenses = depset()
+ licenses = []
if ctx.file.license:
- licenses += depset([ctx.file.license])
+ licenses.append(ctx.file.license)
return struct(
- transitive_licenses = licenses,
+ transitive_licenses = depset(licenses),
transitive_versions = depset(),
transitive_zipfiles = list([ctx.outputs.zip]),
)
@@ -233,15 +233,16 @@
"""A bunch of bower components zipped up."""
zips = depset()
for d in ctx.attr.deps:
- zips += d.transitive_zipfiles
+ files = d.transitive_zipfiles
- versions = depset()
- for d in ctx.attr.deps:
- versions += d.transitive_versions
+ # TODO(davido): Make sure the field always contains a depset
+ if type(files) == "list":
+ files = depset(files)
+ zips = depset(transitive = [zips, files])
- licenses = depset()
- for d in ctx.attr.deps:
- licenses += d.transitive_versions
+ versions = depset(transitive = [d.transitive_versions for d in ctx.attr.deps])
+
+ licenses = depset(transitive = [d.transitive_versions for d in ctx.attr.deps])
out_zip = ctx.outputs.zip
out_versions = ctx.outputs.version_json
@@ -299,11 +300,7 @@
# intermediate artifact if split is wanted.
if ctx.attr.split:
- bundled = ctx.new_file(
- ctx.configuration.genfiles_dir,
- ctx.outputs.html,
- ".bundled.html",
- )
+ bundled = ctx.actions.declare_file(ctx.outputs.html.path + ".bundled.html")
else:
bundled = ctx.outputs.html
destdir = ctx.outputs.html.path + ".dir"
diff --git a/tools/bzl/pkg_war.bzl b/tools/bzl/pkg_war.bzl
index 1dd6d7e..a480908 100644
--- a/tools/bzl/pkg_war.bzl
+++ b/tools/bzl/pkg_war.bzl
@@ -75,35 +75,39 @@
]
# Add lib
- transitive_lib_deps = depset()
+ transitive_libs = []
for l in ctx.attr.libs:
if hasattr(l, "java"):
- transitive_lib_deps += l.java.transitive_runtime_deps
+ transitive_libs.append(l.java.transitive_runtime_deps)
elif hasattr(l, "files"):
- transitive_lib_deps += l.files
+ transitive_libs.append(l.files)
+ transitive_lib_deps = depset(transitive = transitive_libs)
for dep in transitive_lib_deps.to_list():
cmd += _add_file(dep, build_output + "/WEB-INF/lib/")
inputs.append(dep)
# Add pgm lib
- transitive_pgmlib_deps = depset()
+ transitive_pgmlibs = []
for l in ctx.attr.pgmlibs:
- transitive_pgmlib_deps += l.java.transitive_runtime_deps
+ transitive_pgmlibs.append(l.java.transitive_runtime_deps)
+ transitive_pgmlib_deps = depset(transitive = transitive_pgmlibs)
for dep in transitive_pgmlib_deps.to_list():
if dep not in inputs:
cmd += _add_file(dep, build_output + "/WEB-INF/pgm-lib/")
inputs.append(dep)
# Add context
- transitive_context_deps = depset()
+ transitive_context_libs = []
if ctx.attr.context:
for jar in ctx.attr.context:
if hasattr(jar, "java"):
- transitive_context_deps += jar.java.transitive_runtime_deps
+ transitive_context_libs.append(jar.java.transitive_runtime_deps)
elif hasattr(jar, "files"):
- transitive_context_deps += jar.files
+ transitive_context_libs.append(jar.files)
+
+ transitive_context_deps = depset(transitive = transitive_context_libs)
for dep in transitive_context_deps.to_list():
cmd += _add_context(dep, build_output)
inputs.append(dep)