Merge branch 'stable-2.16' into stable-3.0 * origin/stable-2.16: PG: autocomplete reviewers Bazel: Fix standalone build mode Switch required bazel version to 0.29.1 Change-Id: I269536e99c0f925ac9064a851dc862835f5c4568
diff --git a/BUILD b/BUILD index 0d3e09b..32b4c8d 100644 --- a/BUILD +++ b/BUILD
@@ -9,37 +9,14 @@ load("//tools/bzl:genrule2.bzl", "genrule2") load("//tools/bzl:js.bzl", "polygerrit_plugin") -SRC = "src/main/java/com/googlesource/gerrit/plugins/reviewers/" - -BACKEND_SRCS = glob([ - SRC + "common/*.java", - SRC + "server/*.java", -]) - -gerrit_plugin( - name = "reviewers-backend", - srcs = BACKEND_SRCS, - dir_name = "reviewers", - manifest_entries = [ - # Different jar name, but use same plugin name in manifest so REST API is compatible. - "Gerrit-PluginName: reviewers", - "Gerrit-Module: com.googlesource.gerrit.plugins.reviewers.server.BackendModule", - ], - resources = glob(["src/main/resources/**/*"]), -) - gerrit_plugin( name = "reviewers", - srcs = BACKEND_SRCS + glob([ - SRC + "*.java", - SRC + "client/*.java", - ]), - gwt_module = "com.googlesource.gerrit.plugins.reviewers.ReviewersForm", + srcs = glob(["src/main/java/**/*.java"]), manifest_entries = [ "Gerrit-PluginName: reviewers", "Gerrit-Module: com.googlesource.gerrit.plugins.reviewers.Module", ], - resources = glob(["src/main/**/*"]), + resources = glob(["src/main/resources/**/*"]), resource_jars = [":rv-reviewers-static"], )
diff --git a/WORKSPACE b/WORKSPACE index 8d2e43a..3970fd2 100644 --- a/WORKSPACE +++ b/WORKSPACE
@@ -3,7 +3,7 @@ load("//:bazlets.bzl", "load_bazlets") load_bazlets( - commit = "6af2e084b72d38a3375925c4586ac2278ef95ee9", + commit = "0ca51936ca46049cddd34e971a595d3baafe731b", #local_path = "/home/<user>/projects/bazlets", ) @@ -44,15 +44,9 @@ # "@com_googlesource_gerrit_bazlets//:gerrit_api_maven_local.bzl", # "gerrit_api_maven_local", #) -load( - "@com_googlesource_gerrit_bazlets//:gerrit_gwt.bzl", - "gerrit_gwt", -) # Load release Plugin API gerrit_api() # Load snapshot Plugin API #gerrit_api_maven_local() - -gerrit_gwt()
diff --git a/src/main/java/com/googlesource/gerrit/plugins/reviewers/common/Action.java b/src/main/java/com/googlesource/gerrit/plugins/reviewers/Action.java similarity index 91% rename from src/main/java/com/googlesource/gerrit/plugins/reviewers/common/Action.java rename to src/main/java/com/googlesource/gerrit/plugins/reviewers/Action.java index ebda5e1..04a15fc 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/reviewers/common/Action.java +++ b/src/main/java/com/googlesource/gerrit/plugins/reviewers/Action.java
@@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package com.googlesource.gerrit.plugins.reviewers.common; +package com.googlesource.gerrit.plugins.reviewers; public enum Action { ADD,
diff --git a/src/main/java/com/googlesource/gerrit/plugins/reviewers/server/AddReviewers.java b/src/main/java/com/googlesource/gerrit/plugins/reviewers/AddReviewers.java similarity index 71% rename from src/main/java/com/googlesource/gerrit/plugins/reviewers/server/AddReviewers.java rename to src/main/java/com/googlesource/gerrit/plugins/reviewers/AddReviewers.java index 54d1552..c82fa7c 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/reviewers/server/AddReviewers.java +++ b/src/main/java/com/googlesource/gerrit/plugins/reviewers/AddReviewers.java
@@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package com.googlesource.gerrit.plugins.reviewers.server; +package com.googlesource.gerrit.plugins.reviewers; import com.google.common.flogger.FluentLogger; import com.google.gerrit.extensions.api.GerritApi; @@ -21,15 +21,10 @@ import com.google.gerrit.extensions.common.ChangeInfo; import com.google.gerrit.extensions.restapi.RestApiException; import com.google.gerrit.reviewdb.client.Account; -import com.google.gerrit.reviewdb.server.ReviewDb; import com.google.gerrit.server.CurrentUser; import com.google.gerrit.server.IdentifiedUser; import com.google.gerrit.server.util.RequestContext; import com.google.gerrit.server.util.ThreadLocalRequestContext; -import com.google.gwtorm.server.OrmException; -import com.google.gwtorm.server.SchemaFactory; -import com.google.inject.Provider; -import com.google.inject.ProvisionException; import java.util.ArrayList; import java.util.Set; @@ -39,21 +34,16 @@ private final ThreadLocalRequestContext tl; protected final GerritApi gApi; protected final IdentifiedUser.GenericFactory identifiedUserFactory; - protected final SchemaFactory<ReviewDb> schemaFactory; protected final ChangeInfo changeInfo; - private ReviewDb db = null; - AddReviewers( ThreadLocalRequestContext tl, GerritApi gApi, IdentifiedUser.GenericFactory identifiedUserFactory, - SchemaFactory<ReviewDb> schemaFactory, ChangeInfo changeInfo) { this.tl = tl; this.gApi = gApi; this.identifiedUserFactory = identifiedUserFactory; - this.schemaFactory = schemaFactory; this.changeInfo = changeInfo; } @@ -67,34 +57,13 @@ @Override public CurrentUser getUser() { - return identifiedUserFactory.create(new Account.Id(changeInfo.owner._accountId)); - } - - @Override - public Provider<ReviewDb> getReviewDbProvider() { - return new Provider<ReviewDb>() { - @Override - public ReviewDb get() { - if (db == null) { - try { - db = schemaFactory.open(); - } catch (OrmException e) { - throw new ProvisionException("Cannot open ReviewDb", e); - } - } - return db; - } - }; + return identifiedUserFactory.create(Account.id(changeInfo.owner._accountId)); } }); try { addReviewers(getReviewers(), changeInfo); } finally { tl.setContext(old); - if (db != null) { - db.close(); - db = null; - } } }
diff --git a/src/main/java/com/googlesource/gerrit/plugins/reviewers/server/AddReviewersByConfiguration.java b/src/main/java/com/googlesource/gerrit/plugins/reviewers/AddReviewersByConfiguration.java similarity index 84% rename from src/main/java/com/googlesource/gerrit/plugins/reviewers/server/AddReviewersByConfiguration.java rename to src/main/java/com/googlesource/gerrit/plugins/reviewers/AddReviewersByConfiguration.java index 1ef93f2..6d291a4 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/reviewers/server/AddReviewersByConfiguration.java +++ b/src/main/java/com/googlesource/gerrit/plugins/reviewers/AddReviewersByConfiguration.java
@@ -12,15 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -package com.googlesource.gerrit.plugins.reviewers.server; +package com.googlesource.gerrit.plugins.reviewers; import com.google.gerrit.extensions.api.GerritApi; import com.google.gerrit.extensions.common.ChangeInfo; import com.google.gerrit.reviewdb.client.Account; -import com.google.gerrit.reviewdb.server.ReviewDb; import com.google.gerrit.server.IdentifiedUser; import com.google.gerrit.server.util.ThreadLocalRequestContext; -import com.google.gwtorm.server.SchemaFactory; import com.google.inject.Inject; import com.google.inject.assistedinject.Assisted; import java.util.Set; @@ -37,10 +35,9 @@ ThreadLocalRequestContext tl, GerritApi gApi, IdentifiedUser.GenericFactory identifiedUserFactory, - SchemaFactory<ReviewDb> schemaFactory, @Assisted ChangeInfo changeInfo, @Assisted Set<Account.Id> reviewers) { - super(tl, gApi, identifiedUserFactory, schemaFactory, changeInfo); + super(tl, gApi, identifiedUserFactory, changeInfo); this.reviewers = reviewers; }
diff --git a/src/main/java/com/googlesource/gerrit/plugins/reviewers/ClientModule.java b/src/main/java/com/googlesource/gerrit/plugins/reviewers/ClientModule.java deleted file mode 100644 index bf6acbb..0000000 --- a/src/main/java/com/googlesource/gerrit/plugins/reviewers/ClientModule.java +++ /dev/null
@@ -1,32 +0,0 @@ -// Copyright (C) 2013 The Android Open Source Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package com.googlesource.gerrit.plugins.reviewers; - -import com.google.gerrit.extensions.registration.DynamicSet; -import com.google.gerrit.extensions.webui.GwtPlugin; -import com.google.gerrit.extensions.webui.JavaScriptPlugin; -import com.google.gerrit.extensions.webui.TopMenu; -import com.google.gerrit.extensions.webui.WebUiPlugin; -import com.google.inject.AbstractModule; - -public class ClientModule extends AbstractModule { - @Override - protected void configure() { - DynamicSet.bind(binder(), TopMenu.class).to(ReviewersTopMenu.class); - DynamicSet.bind(binder(), WebUiPlugin.class).toInstance(new GwtPlugin("reviewers")); - DynamicSet.bind(binder(), WebUiPlugin.class) - .toInstance(new JavaScriptPlugin("rv-reviewers.html")); - } -}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/reviewers/server/GetReviewers.java b/src/main/java/com/googlesource/gerrit/plugins/reviewers/GetReviewers.java similarity index 95% rename from src/main/java/com/googlesource/gerrit/plugins/reviewers/server/GetReviewers.java rename to src/main/java/com/googlesource/gerrit/plugins/reviewers/GetReviewers.java index d8ce0ca..7ee4c83 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/reviewers/server/GetReviewers.java +++ b/src/main/java/com/googlesource/gerrit/plugins/reviewers/GetReviewers.java
@@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package com.googlesource.gerrit.plugins.reviewers.server; +package com.googlesource.gerrit.plugins.reviewers; import com.google.gerrit.extensions.restapi.RestApiException; import com.google.gerrit.extensions.restapi.RestReadView;
diff --git a/src/main/java/com/googlesource/gerrit/plugins/reviewers/server/ModifyReviewersConfigCapability.java b/src/main/java/com/googlesource/gerrit/plugins/reviewers/ModifyReviewersConfigCapability.java similarity index 93% rename from src/main/java/com/googlesource/gerrit/plugins/reviewers/server/ModifyReviewersConfigCapability.java rename to src/main/java/com/googlesource/gerrit/plugins/reviewers/ModifyReviewersConfigCapability.java index b97e422..4c6cb9a 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/reviewers/server/ModifyReviewersConfigCapability.java +++ b/src/main/java/com/googlesource/gerrit/plugins/reviewers/ModifyReviewersConfigCapability.java
@@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package com.googlesource.gerrit.plugins.reviewers.server; +package com.googlesource.gerrit.plugins.reviewers; import com.google.gerrit.extensions.config.CapabilityDefinition;
diff --git a/src/main/java/com/googlesource/gerrit/plugins/reviewers/Module.java b/src/main/java/com/googlesource/gerrit/plugins/reviewers/Module.java index 55b663c..efc3614 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/reviewers/Module.java +++ b/src/main/java/com/googlesource/gerrit/plugins/reviewers/Module.java
@@ -14,22 +14,79 @@ package com.googlesource.gerrit.plugins.reviewers; +import static com.google.gerrit.server.project.ProjectResource.PROJECT_KIND; +import static com.googlesource.gerrit.plugins.reviewers.ModifyReviewersConfigCapability.MODIFY_REVIEWERS_CONFIG; + +import com.google.gerrit.extensions.annotations.Exports; +import com.google.gerrit.extensions.config.CapabilityDefinition; +import com.google.gerrit.extensions.config.FactoryModule; +import com.google.gerrit.extensions.events.PrivateStateChangedListener; +import com.google.gerrit.extensions.events.RevisionCreatedListener; +import com.google.gerrit.extensions.events.WorkInProgressStateChangedListener; +import com.google.gerrit.extensions.registration.DynamicSet; +import com.google.gerrit.extensions.restapi.RestApiModule; +import com.google.gerrit.extensions.webui.JavaScriptPlugin; +import com.google.gerrit.extensions.webui.WebUiPlugin; +import com.google.gerrit.server.change.ReviewerSuggestion; import com.google.inject.AbstractModule; import com.google.inject.Inject; -import com.googlesource.gerrit.plugins.reviewers.server.BackendModule; -import com.googlesource.gerrit.plugins.reviewers.server.ReviewersConfig; -public class Module extends AbstractModule { - private final ReviewersConfig cfg; +public class Module extends FactoryModule { + private final boolean enableREST; + private final boolean suggestOnly; @Inject public Module(ReviewersConfig cfg) { - this.cfg = cfg; + this(cfg.enableREST(), cfg.suggestOnly()); + } + + public Module(boolean enableREST, boolean suggestOnly) { + this.enableREST = enableREST; + this.suggestOnly = suggestOnly; } @Override protected void configure() { - install(new BackendModule(cfg.enableREST(), cfg.suggestOnly())); - install(new ClientModule()); + bind(CapabilityDefinition.class) + .annotatedWith(Exports.named(MODIFY_REVIEWERS_CONFIG)) + .to(ModifyReviewersConfigCapability.class); + + if (suggestOnly) { + install( + new AbstractModule() { + @Override + protected void configure() { + bind(ReviewerSuggestion.class) + .annotatedWith(Exports.named("reviewer-suggest")) + .to(Reviewers.class); + } + }); + } else { + DynamicSet.bind(binder(), RevisionCreatedListener.class).to(Reviewers.class); + DynamicSet.bind(binder(), WorkInProgressStateChangedListener.class).to(Reviewers.class); + DynamicSet.bind(binder(), PrivateStateChangedListener.class).to(Reviewers.class); + } + + factory(AddReviewersByConfiguration.Factory.class); + + if (enableREST) { + install( + new RestApiModule() { + @Override + protected void configure() { + get(PROJECT_KIND, "reviewers").to(GetReviewers.class); + put(PROJECT_KIND, "reviewers").to(PutReviewers.class); + get(PROJECT_KIND, "suggest_reviewers").to(SuggestProjectReviewers.class); + } + }); + } + install( + new AbstractModule() { + @Override + protected void configure() { + DynamicSet.bind(binder(), WebUiPlugin.class) + .toInstance(new JavaScriptPlugin("rv-reviewers.html")); + } + }); } }
diff --git a/src/main/java/com/googlesource/gerrit/plugins/reviewers/server/PutReviewers.java b/src/main/java/com/googlesource/gerrit/plugins/reviewers/PutReviewers.java similarity index 86% rename from src/main/java/com/googlesource/gerrit/plugins/reviewers/server/PutReviewers.java rename to src/main/java/com/googlesource/gerrit/plugins/reviewers/PutReviewers.java index cc985df..5240bc8 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/reviewers/server/PutReviewers.java +++ b/src/main/java/com/googlesource/gerrit/plugins/reviewers/PutReviewers.java
@@ -12,11 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -package com.googlesource.gerrit.plugins.reviewers.server; +package com.googlesource.gerrit.plugins.reviewers; -import static com.googlesource.gerrit.plugins.reviewers.server.ModifyReviewersConfigCapability.MODIFY_REVIEWERS_CONFIG; +import static com.googlesource.gerrit.plugins.reviewers.ModifyReviewersConfigCapability.MODIFY_REVIEWERS_CONFIG; import com.google.common.flogger.FluentLogger; +import com.google.gerrit.exceptions.StorageException; import com.google.gerrit.extensions.annotations.PluginName; import com.google.gerrit.extensions.api.access.PluginPermission; import com.google.gerrit.extensions.restapi.AuthException; @@ -25,9 +26,9 @@ import com.google.gerrit.extensions.restapi.RestApiException; import com.google.gerrit.extensions.restapi.RestModifyView; import com.google.gerrit.extensions.restapi.UnprocessableEntityException; -import com.google.gerrit.reviewdb.client.Account; import com.google.gerrit.reviewdb.client.Project; import com.google.gerrit.server.account.AccountResolver; +import com.google.gerrit.server.account.AccountResolver.UnresolvableAccountException; import com.google.gerrit.server.git.meta.MetaDataUpdate; import com.google.gerrit.server.group.GroupResolver; import com.google.gerrit.server.permissions.PermissionBackend; @@ -35,12 +36,10 @@ import com.google.gerrit.server.permissions.ProjectPermission; import com.google.gerrit.server.project.ProjectCache; import com.google.gerrit.server.project.ProjectResource; -import com.google.gwtorm.server.OrmException; import com.google.inject.Inject; import com.google.inject.Provider; import com.google.inject.Singleton; -import com.googlesource.gerrit.plugins.reviewers.common.Action; -import com.googlesource.gerrit.plugins.reviewers.server.PutReviewers.Input; +import com.googlesource.gerrit.plugins.reviewers.PutReviewers.Input; import java.io.IOException; import java.util.List; import org.eclipse.jgit.errors.ConfigInvalidException; @@ -148,15 +147,20 @@ private void validateReviewer(String reviewer) throws RestApiException { try { - Account account = accountResolver.find(reviewer); - if (account == null) { - try { - groupResolver.get().parse(reviewer); - } catch (UnprocessableEntityException e) { - throw new ResourceNotFoundException("Account or group " + reviewer + " not found"); - } + UnresolvableAccountException accountException; + try { + accountResolver.resolve(reviewer).asUnique(); + return; + } catch (UnresolvableAccountException e) { + accountException = e; } - } catch (OrmException | IOException | ConfigInvalidException e) { + try { + groupResolver.get().parse(reviewer); + } catch (UnprocessableEntityException e) { + throw new ResourceNotFoundException( + "Account or group '" + reviewer + "' not found\n" + accountException.getMessage()); + } + } catch (StorageException | IOException | ConfigInvalidException e) { logger.atSevere().log("Failed to resolve account %s", reviewer); } }
diff --git a/src/main/java/com/googlesource/gerrit/plugins/reviewers/server/ReviewerFilterSection.java b/src/main/java/com/googlesource/gerrit/plugins/reviewers/ReviewerFilterSection.java similarity index 95% rename from src/main/java/com/googlesource/gerrit/plugins/reviewers/server/ReviewerFilterSection.java rename to src/main/java/com/googlesource/gerrit/plugins/reviewers/ReviewerFilterSection.java index 7f0000a..06e7387 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/reviewers/server/ReviewerFilterSection.java +++ b/src/main/java/com/googlesource/gerrit/plugins/reviewers/ReviewerFilterSection.java
@@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package com.googlesource.gerrit.plugins.reviewers.server; +package com.googlesource.gerrit.plugins.reviewers; import java.util.Objects; import java.util.Set;
diff --git a/src/main/java/com/googlesource/gerrit/plugins/reviewers/server/Reviewers.java b/src/main/java/com/googlesource/gerrit/plugins/reviewers/Reviewers.java similarity index 92% rename from src/main/java/com/googlesource/gerrit/plugins/reviewers/server/Reviewers.java rename to src/main/java/com/googlesource/gerrit/plugins/reviewers/Reviewers.java index 07a7d18..c2eae68 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/reviewers/server/Reviewers.java +++ b/src/main/java/com/googlesource/gerrit/plugins/reviewers/Reviewers.java
@@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package com.googlesource.gerrit.plugins.reviewers.server; +package com.googlesource.gerrit.plugins.reviewers; import static java.util.stream.Collectors.toSet; @@ -22,6 +22,7 @@ import com.google.common.collect.ImmutableSet; import com.google.common.flogger.FluentLogger; import com.google.gerrit.common.Nullable; +import com.google.gerrit.exceptions.StorageException; import com.google.gerrit.extensions.common.AccountInfo; import com.google.gerrit.extensions.common.ChangeInfo; import com.google.gerrit.extensions.events.ChangeEvent; @@ -38,7 +39,6 @@ import com.google.gerrit.server.git.WorkQueue; import com.google.gerrit.server.query.change.ChangeQueryBuilder; import com.google.gerrit.server.query.change.InternalChangeQuery; -import com.google.gwtorm.server.OrmException; import com.google.inject.Inject; import com.google.inject.Provider; import com.google.inject.Singleton; @@ -113,7 +113,7 @@ .map(a -> suggestedReviewer(a)) .collect(toSet()); } - } catch (OrmException | QueryParseException x) { + } catch (StorageException | QueryParseException x) { logger.atSevere().withCause(x).log(x.getMessage()); } return ImmutableSet.of(); @@ -139,7 +139,7 @@ if (config.ignorePrivate() && (c.isPrivate != null && c.isPrivate)) { return; } - Project.NameKey projectName = new Project.NameKey(c.project); + Project.NameKey projectName = Project.nameKey(c.project); List<ReviewerFilterSection> sections = getSections(projectName); @@ -163,13 +163,13 @@ logger.atWarning().log( "Could not add default reviewers for change %d of project %s, filter is invalid: %s", changeNumber, projectName.get(), e.getMessage()); - } catch (OrmException x) { + } catch (StorageException x) { logger.atSevere().withCause(x).log(x.getMessage()); } } private Set<String> findReviewers(int change, List<ReviewerFilterSection> sections) - throws OrmException, QueryParseException { + throws StorageException, QueryParseException { ImmutableSet.Builder<String> reviewers = ImmutableSet.builder(); List<ReviewerFilterSection> found = findReviewerSections(change, sections); for (ReviewerFilterSection s : found) { @@ -179,7 +179,8 @@ } private List<ReviewerFilterSection> findReviewerSections( - int change, List<ReviewerFilterSection> sections) throws OrmException, QueryParseException { + int change, List<ReviewerFilterSection> sections) + throws StorageException, QueryParseException { ImmutableList.Builder<ReviewerFilterSection> found = ImmutableList.builder(); for (ReviewerFilterSection s : sections) { if (Strings.isNullOrEmpty(s.getFilter()) || s.getFilter().equals("*")) { @@ -191,7 +192,7 @@ return found.build(); } - boolean filterMatch(int change, String filter) throws OrmException, QueryParseException { + boolean filterMatch(int change, String filter) throws StorageException, QueryParseException { Preconditions.checkNotNull(filter); ChangeQueryBuilder qb = queryBuilder.asUser(user.get()); return !queryProvider
diff --git a/src/main/java/com/googlesource/gerrit/plugins/reviewers/server/ReviewersConfig.java b/src/main/java/com/googlesource/gerrit/plugins/reviewers/ReviewersConfig.java similarity index 98% rename from src/main/java/com/googlesource/gerrit/plugins/reviewers/server/ReviewersConfig.java rename to src/main/java/com/googlesource/gerrit/plugins/reviewers/ReviewersConfig.java index fe06aa3..b277d62 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/reviewers/server/ReviewersConfig.java +++ b/src/main/java/com/googlesource/gerrit/plugins/reviewers/ReviewersConfig.java
@@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package com.googlesource.gerrit.plugins.reviewers.server; +package com.googlesource.gerrit.plugins.reviewers; import com.google.common.base.Strings; import com.google.common.collect.ImmutableList;
diff --git a/src/main/java/com/googlesource/gerrit/plugins/reviewers/ReviewersForm.gwt.xml b/src/main/java/com/googlesource/gerrit/plugins/reviewers/ReviewersForm.gwt.xml deleted file mode 100644 index 1ea6083..0000000 --- a/src/main/java/com/googlesource/gerrit/plugins/reviewers/ReviewersForm.gwt.xml +++ /dev/null
@@ -1,31 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Copyright (C) 2014 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<module rename-to="reviewers"> - <!-- Inherit the core Web Toolkit stuff. --> - <inherits name="com.google.gwt.user.User"/> - <!-- Other module inherits --> - <inherits name="com.google.gerrit.Plugin"/> - <inherits name="com.google.gwt.http.HTTP"/> - <inherits name="com.google.gwt.json.JSON"/> - <inherits name="com.google.gwtexpui.globalkey.GlobalKey"/> - <!-- Using GWT built-in themes adds a number of static --> - <!-- resources to the plugin. No theme inherits lines were --> - <!-- added in order to make this plugin as simple as possible --> - <!-- Specify the app entry point class. --> - <entry-point class="com.googlesource.gerrit.plugins.reviewers.client.ReviewersPlugin"/> - <stylesheet src="reviewers.css"/> -</module>
diff --git a/src/main/java/com/googlesource/gerrit/plugins/reviewers/server/ReviewersResolver.java b/src/main/java/com/googlesource/gerrit/plugins/reviewers/ReviewersResolver.java similarity index 84% rename from src/main/java/com/googlesource/gerrit/plugins/reviewers/server/ReviewersResolver.java rename to src/main/java/com/googlesource/gerrit/plugins/reviewers/ReviewersResolver.java index 10785f2..7556553 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/reviewers/server/ReviewersResolver.java +++ b/src/main/java/com/googlesource/gerrit/plugins/reviewers/ReviewersResolver.java
@@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package com.googlesource.gerrit.plugins.reviewers.server; +package com.googlesource.gerrit.plugins.reviewers; import static java.util.stream.Collectors.toSet; @@ -20,6 +20,7 @@ import com.google.common.collect.Sets; import com.google.common.flogger.FluentLogger; import com.google.gerrit.common.Nullable; +import com.google.gerrit.exceptions.StorageException; import com.google.gerrit.extensions.common.AccountInfo; import com.google.gerrit.extensions.restapi.UnprocessableEntityException; import com.google.gerrit.reviewdb.client.Account; @@ -28,7 +29,6 @@ import com.google.gerrit.server.account.GroupMembers; import com.google.gerrit.server.group.GroupResolver; import com.google.gerrit.server.project.NoSuchProjectException; -import com.google.gwtorm.server.OrmException; import com.google.inject.Inject; import com.google.inject.Provider; import com.google.inject.Singleton; @@ -85,31 +85,25 @@ private boolean resolveAccount( Project.NameKey project, int changeNumber, - AccountInfo uploader, + @Nullable AccountInfo uploader, Set<Account.Id> reviewers, String accountName) { try { - Account account = accountResolver.find(accountName); - if (account != null) { - if (account.isActive()) { - if (uploader == null || uploader._accountId != account.getId().get()) { - reviewers.add(account.getId()); - } + AccountResolver.Result result = accountResolver.resolve(accountName); + if (result.asList().size() == 1) { + Account.Id id = result.asList().get(0).getAccount().getId(); + if (uploader == null || id.get() != uploader._accountId) { + reviewers.add(id); return true; } - logger.atWarning().log( - "For the change %d of project %s: account %s is inactive.", - changeNumber, project, accountName); } - } catch (OrmException | IOException | ConfigInvalidException e) { - // If the account doesn't exist, find() will return null. We only - // get here if something went wrong accessing the database + return false; + } catch (StorageException | IOException | ConfigInvalidException e) { logger.atSevere().withCause(e).log( "For the change %d of project %s: failed to resolve account %s.", changeNumber, project, accountName); return true; } - return false; } private void resolveGroup(
diff --git a/src/main/java/com/googlesource/gerrit/plugins/reviewers/ReviewersTopMenu.java b/src/main/java/com/googlesource/gerrit/plugins/reviewers/ReviewersTopMenu.java deleted file mode 100644 index 2c839a0..0000000 --- a/src/main/java/com/googlesource/gerrit/plugins/reviewers/ReviewersTopMenu.java +++ /dev/null
@@ -1,42 +0,0 @@ -// Copyright (C) 2014 The Android Open Source Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package com.googlesource.gerrit.plugins.reviewers; - -import com.google.common.collect.Lists; -import com.google.gerrit.extensions.annotations.PluginName; -import com.google.gerrit.extensions.client.MenuItem; -import com.google.gerrit.extensions.webui.TopMenu; -import com.google.inject.Inject; -import java.util.Collections; -import java.util.List; - -public class ReviewersTopMenu implements TopMenu { - private final List<MenuEntry> menuEntries; - - @Inject - ReviewersTopMenu(@PluginName String pluginName) { - menuEntries = Lists.newArrayList(); - menuEntries.add( - new MenuEntry( - "Projects", - Collections.singletonList( - new MenuItem("Reviewers", "#/x/" + pluginName + "/p/${projectName}", "_self")))); - } - - @Override - public List<MenuEntry> getEntries() { - return this.menuEntries; - } -}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/reviewers/server/SuggestProjectReviewers.java b/src/main/java/com/googlesource/gerrit/plugins/reviewers/SuggestProjectReviewers.java similarity index 87% rename from src/main/java/com/googlesource/gerrit/plugins/reviewers/server/SuggestProjectReviewers.java rename to src/main/java/com/googlesource/gerrit/plugins/reviewers/SuggestProjectReviewers.java index 35619c1..5329f7c 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/reviewers/server/SuggestProjectReviewers.java +++ b/src/main/java/com/googlesource/gerrit/plugins/reviewers/SuggestProjectReviewers.java
@@ -12,14 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -package com.googlesource.gerrit.plugins.reviewers.server; +package com.googlesource.gerrit.plugins.reviewers; +import com.google.gerrit.exceptions.StorageException; import com.google.gerrit.extensions.common.AccountVisibility; import com.google.gerrit.extensions.common.SuggestedReviewerInfo; import com.google.gerrit.extensions.restapi.BadRequestException; import com.google.gerrit.extensions.restapi.RestReadView; import com.google.gerrit.reviewdb.client.Account; -import com.google.gerrit.reviewdb.server.ReviewDb; import com.google.gerrit.server.config.GerritServerConfig; import com.google.gerrit.server.permissions.PermissionBackend; import com.google.gerrit.server.permissions.PermissionBackendException; @@ -28,9 +28,7 @@ import com.google.gerrit.server.restapi.change.ReviewersUtil; import com.google.gerrit.server.restapi.change.ReviewersUtil.VisibilityControl; import com.google.gerrit.server.restapi.change.SuggestReviewers; -import com.google.gwtorm.server.OrmException; import com.google.inject.Inject; -import com.google.inject.Provider; import java.io.IOException; import java.util.List; import org.eclipse.jgit.errors.ConfigInvalidException; @@ -43,17 +41,16 @@ @Inject SuggestProjectReviewers( AccountVisibility av, - Provider<ReviewDb> dbProvider, @GerritServerConfig Config cfg, ReviewersUtil reviewersUtil, PermissionBackend permissionBackend) { - super(av, dbProvider, cfg, reviewersUtil); + super(av, cfg, reviewersUtil); this.permissionBackend = permissionBackend; } @Override public List<SuggestedReviewerInfo> apply(ProjectResource rsrc) - throws BadRequestException, OrmException, IOException, ConfigInvalidException, + throws BadRequestException, StorageException, IOException, ConfigInvalidException, PermissionBackendException { return reviewersUtil.suggestReviewers( null, this, rsrc.getProjectState(), getVisibility(rsrc), true);
diff --git a/src/main/java/com/googlesource/gerrit/plugins/reviewers/client/AccountCapabilities.java b/src/main/java/com/googlesource/gerrit/plugins/reviewers/client/AccountCapabilities.java deleted file mode 100644 index 397ffcb..0000000 --- a/src/main/java/com/googlesource/gerrit/plugins/reviewers/client/AccountCapabilities.java +++ /dev/null
@@ -1,31 +0,0 @@ -// Copyright (C) 2018 The Android Open Source Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package com.googlesource.gerrit.plugins.reviewers.client; - -import com.google.gerrit.plugin.client.rpc.RestApi; -import com.google.gwt.core.client.JavaScriptObject; -import com.google.gwt.user.client.rpc.AsyncCallback; - -public class AccountCapabilities extends JavaScriptObject { - static String MODIFY_REVIEWERS_CONFIG = "reviewers-modifyReviewersConfig"; - - public static void queryPluginCapability(AsyncCallback<AccountCapabilities> cb) { - new RestApi("/accounts/self/capabilities").addParameter("q", MODIFY_REVIEWERS_CONFIG).get(cb); - } - - protected AccountCapabilities() {} - - public final native boolean canPerform(String name) /*-{ return this[name] ? true : false; }-*/; -}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/reviewers/client/Action.java b/src/main/java/com/googlesource/gerrit/plugins/reviewers/client/Action.java deleted file mode 100644 index 96ebd14..0000000 --- a/src/main/java/com/googlesource/gerrit/plugins/reviewers/client/Action.java +++ /dev/null
@@ -1,20 +0,0 @@ -// Copyright (C) 2014 The Android Open Source Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package com.googlesource.gerrit.plugins.reviewers.client; - -public enum Action { - ADD, - REMOVE -}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/reviewers/client/ChangeReviewersInput.java b/src/main/java/com/googlesource/gerrit/plugins/reviewers/client/ChangeReviewersInput.java deleted file mode 100644 index 9560feb..0000000 --- a/src/main/java/com/googlesource/gerrit/plugins/reviewers/client/ChangeReviewersInput.java +++ /dev/null
@@ -1,35 +0,0 @@ -// Copyright (C) 2014 The Android Open Source Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package com.googlesource.gerrit.plugins.reviewers.client; - -import com.google.gwt.core.client.JavaScriptObject; - -public class ChangeReviewersInput extends JavaScriptObject { - public static ChangeReviewersInput create() { - return (ChangeReviewersInput) createObject(); - } - - protected ChangeReviewersInput() {} - - final void setAction(Action a) { - setActionRaw(a.name()); - } - - final native void setActionRaw(String a) /*-{ if(a)this.action=a; }-*/; - - final native void setFilter(String f) /*-{ if(f)this.filter=f; }-*/; - - final native void setReviewer(String r) /*-{ if(r)this.reviewer=r; }-*/; -}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/reviewers/client/ProjectAccessInfo.java b/src/main/java/com/googlesource/gerrit/plugins/reviewers/client/ProjectAccessInfo.java deleted file mode 100644 index 48010ed..0000000 --- a/src/main/java/com/googlesource/gerrit/plugins/reviewers/client/ProjectAccessInfo.java +++ /dev/null
@@ -1,23 +0,0 @@ -// Copyright (C) 2014 The Android Open Source Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package com.googlesource.gerrit.plugins.reviewers.client; - -import com.google.gwt.core.client.JavaScriptObject; - -public class ProjectAccessInfo extends JavaScriptObject { - public final native boolean isOwner() /*-{ return this.is_owner ? true : false; }-*/; - - protected ProjectAccessInfo() {} -}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/reviewers/client/ReviewerFilterSection.java b/src/main/java/com/googlesource/gerrit/plugins/reviewers/client/ReviewerFilterSection.java deleted file mode 100644 index eed5448..0000000 --- a/src/main/java/com/googlesource/gerrit/plugins/reviewers/client/ReviewerFilterSection.java +++ /dev/null
@@ -1,26 +0,0 @@ -// Copyright (C) 2014 The Android Open Source Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package com.googlesource.gerrit.plugins.reviewers.client; - -import com.google.gwt.core.client.JavaScriptObject; -import com.google.gwt.core.client.JsArrayString; - -public class ReviewerFilterSection extends JavaScriptObject { - public final native String filter() /*-{ return this.filter; }-*/; - - public final native JsArrayString reviewers() /*-{ return this.reviewers; }-*/; - - protected ReviewerFilterSection() {} -}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/reviewers/client/ReviewerSuggestOracle.java b/src/main/java/com/googlesource/gerrit/plugins/reviewers/client/ReviewerSuggestOracle.java deleted file mode 100644 index 8bb7556..0000000 --- a/src/main/java/com/googlesource/gerrit/plugins/reviewers/client/ReviewerSuggestOracle.java +++ /dev/null
@@ -1,121 +0,0 @@ -// Copyright (C) 2016 The Android Open Source Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package com.googlesource.gerrit.plugins.reviewers.client; - -import com.google.gerrit.client.rpc.NativeMap; -import com.google.gerrit.client.rpc.Natives; -import com.google.gerrit.client.ui.HighlightSuggestion; -import com.google.gerrit.plugin.client.rpc.RestApi; -import com.google.gwt.core.client.JavaScriptObject; -import com.google.gwt.user.client.rpc.AsyncCallback; -import com.google.gwt.user.client.ui.SuggestOracle; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Set; - -/** A {@code SuggestOracle} for reviewers. */ -public class ReviewerSuggestOracle extends SuggestOracle { - private static final String ACCOUNT_KEY = "account"; - private static final String GROUP_KEY = "group"; - private static final String NAME_KEY = "name"; - private static final String EMAIL_KEY = "email"; - private static final String ACCOUNT_ID_KEY = "_account_id"; - - private final int chars; - private final String projectName; - - /** - * @param chars minimum chars to start suggesting. - * @param projectName the name of the project to check visibility - */ - public ReviewerSuggestOracle(int chars, String projectName) { - this.chars = chars; - this.projectName = projectName; - } - - @Override - public boolean isDisplayStringHTML() { - return true; - } - - private class ReviewerSuggestion extends HighlightSuggestion { - private final String name; - - ReviewerSuggestion(String query, String groupName) { - super(query, groupName + " (group)"); - this.name = groupName; - } - - ReviewerSuggestion(String query, String fullname, String email, String accountId) { - super(query, fullname + ((!email.isEmpty()) ? " <" + email + ">" : " (" + accountId + ")")); - this.name = fullname; - } - - @Override - public String getReplacementString() { - return name; - } - } - - @Override - public void requestSuggestions(final Request req, final Callback done) { - if (req.getQuery().length() < chars) { - responseEmptySuggestion(req, done); - return; - } - RestApi rest = new RestApi("/projects/").id(projectName).view("suggest_reviewers"); - rest.addParameter("q", req.getQuery()); - if (req.getLimit() > 0) { - rest.addParameter("n", req.getLimit()); - } - rest.get( - new AsyncCallback<NativeMap<JavaScriptObject>>() { - @Override - public void onSuccess(NativeMap<JavaScriptObject> result) { - List<String> keys0 = result.sortedKeys(); - List<Suggestion> suggestions = new ArrayList<>(keys0.size()); - for (String key0 : keys0) { - Set<String> keys1 = Natives.keys(result.get(key0)); - NativeMap<JavaScriptObject> map1 = result.get(key0).cast(); - for (String key1 : keys1) { - NativeMap<JavaScriptObject> map2 = map1.get(key1).cast(); - if (ACCOUNT_KEY.equals(key1)) { - String name = map2.get(NAME_KEY).toString(); - String email = - (map2.containsKey(EMAIL_KEY)) ? map2.get(EMAIL_KEY).toString() : ""; - String accountId = map2.get(ACCOUNT_ID_KEY).toString(); - suggestions.add(new ReviewerSuggestion(req.getQuery(), name, email, accountId)); - } else if (GROUP_KEY.equals(key1)) { - String name = map2.get(NAME_KEY).toString(); - suggestions.add(new ReviewerSuggestion(req.getQuery(), name)); - } - } - } - done.onSuggestionsReady(req, new Response(suggestions)); - } - - @Override - public void onFailure(Throwable caught) { - responseEmptySuggestion(req, done); - } - }); - } - - private static void responseEmptySuggestion(Request req, Callback done) { - List<Suggestion> empty = Collections.emptyList(); - done.onSuggestionsReady(req, new Response(empty)); - } -}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/reviewers/client/ReviewersPlugin.java b/src/main/java/com/googlesource/gerrit/plugins/reviewers/client/ReviewersPlugin.java deleted file mode 100644 index 29aecf5..0000000 --- a/src/main/java/com/googlesource/gerrit/plugins/reviewers/client/ReviewersPlugin.java +++ /dev/null
@@ -1,25 +0,0 @@ -// Copyright (C) 2014 The Android Open Source Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package com.googlesource.gerrit.plugins.reviewers.client; - -import com.google.gerrit.plugin.client.Plugin; -import com.google.gerrit.plugin.client.PluginEntryPoint; - -public class ReviewersPlugin extends PluginEntryPoint { - @Override - public void onPluginLoad() { - Plugin.get().screenRegex("p/(.*)", new ReviewersScreen.Factory()); - } -}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/reviewers/client/ReviewersScreen.java b/src/main/java/com/googlesource/gerrit/plugins/reviewers/client/ReviewersScreen.java deleted file mode 100644 index 47bedd7..0000000 --- a/src/main/java/com/googlesource/gerrit/plugins/reviewers/client/ReviewersScreen.java +++ /dev/null
@@ -1,254 +0,0 @@ -// Copyright (C) 2014 The Android Open Source Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package com.googlesource.gerrit.plugins.reviewers.client; - -import static com.googlesource.gerrit.plugins.reviewers.client.AccountCapabilities.MODIFY_REVIEWERS_CONFIG; - -import com.google.gerrit.client.rpc.NativeMap; -import com.google.gerrit.client.rpc.Natives; -import com.google.gerrit.plugin.client.rpc.RestApi; -import com.google.gerrit.plugin.client.screen.Screen; -import com.google.gwt.core.client.JsArray; -import com.google.gwt.event.dom.client.ClickEvent; -import com.google.gwt.event.dom.client.ClickHandler; -import com.google.gwt.http.client.URL; -import com.google.gwt.user.client.rpc.AsyncCallback; -import com.google.gwt.user.client.ui.Button; -import com.google.gwt.user.client.ui.Grid; -import com.google.gwt.user.client.ui.HorizontalPanel; -import com.google.gwt.user.client.ui.Image; -import com.google.gwt.user.client.ui.Label; -import com.google.gwt.user.client.ui.Panel; -import com.google.gwt.user.client.ui.SuggestBox; -import com.google.gwt.user.client.ui.VerticalPanel; -import com.google.gwtexpui.globalkey.client.NpTextBox; -import java.util.HashSet; -import java.util.Objects; -import java.util.Set; - -public class ReviewersScreen extends HorizontalPanel { - private static final String REMOVE_BUTTON_IMG = "plugins/reviewers/static/remove_reviewer.png"; - - static class Factory implements Screen.EntryPoint { - @Override - public void onLoad(Screen screen) { - screen.setPageTitle("Reviewers"); - screen.show(new ReviewersScreen(URL.decodeQueryString(screen.getToken(1)))); - } - } - - private boolean isOwner; - private boolean hasModifyReviewersConfigCapability; - private String projectName; - private Set<ReviewerEntry> rEntries; - - ReviewersScreen(String projectName) { - setStyleName("reviewers-panel"); - this.projectName = projectName; - this.rEntries = new HashSet<>(); - - new RestApi("access/") - .addParameter("project", projectName) - .get( - new AsyncCallback<NativeMap<ProjectAccessInfo>>() { - - @Override - public void onSuccess(NativeMap<ProjectAccessInfo> result) { - isOwner = result.get(projectName).isOwner(); - if (isOwner) { - display(); - } else { - // TODO(davido): Find a way to run above and below requests in parallel - AccountCapabilities.queryPluginCapability( - new AsyncCallback<AccountCapabilities>() { - - @Override - public void onSuccess(AccountCapabilities result) { - hasModifyReviewersConfigCapability = - result.canPerform(MODIFY_REVIEWERS_CONFIG); - display(); - } - - @Override - public void onFailure(Throwable caught) {} - }); - } - } - - @Override - public void onFailure(Throwable caught) {} - }); - } - - void display() { - new RestApi("projects") - .id(projectName) - .view("reviewers") - .get( - new AsyncCallback<JsArray<ReviewerFilterSection>>() { - - @Override - public void onSuccess(JsArray<ReviewerFilterSection> result) { - display(result); - } - - @Override - public void onFailure(Throwable caught) {} - }); - } - - void display(JsArray<ReviewerFilterSection> sections) { - add(createEntriesPanel(sections)); - add(createInputPanel()); - } - - Panel createEntriesPanel(JsArray<ReviewerFilterSection> sections) { - Panel p = new VerticalPanel(); - for (ReviewerFilterSection section : Natives.asList(sections)) { - Label filter = new Label(section.filter()); - filter.addStyleName("reviewers-filterLabel"); - p.add(filter); - for (String reviewer : Natives.asList(section.reviewers())) { - ReviewerEntry rEntry = new ReviewerEntry(section.filter(), reviewer); - rEntries.add(rEntry); - p.add(createOneEntry(rEntry)); - } - } - return p; - } - - Panel createOneEntry(final ReviewerEntry e) { - Label l = new Label(e.reviewer); - l.setStyleName("reviewers-reviewerLabel"); - - Image img = new Image(REMOVE_BUTTON_IMG); - Button removeButton = Button.wrap(img.getElement()); - removeButton.setStyleName("reviewers-removeButton"); - removeButton.setTitle("remove reviewer"); - removeButton.addClickHandler( - new ClickHandler() { - @Override - public void onClick(final ClickEvent event) { - doSave(Action.REMOVE, e); - } - }); - removeButton.setVisible(isModifiable()); - - HorizontalPanel p = new HorizontalPanel(); - p.add(l); - p.add(removeButton); - return p; - } - - Panel createInputPanel() { - Grid inputGrid = new Grid(2, 2); - - final NpTextBox filterBox = new NpTextBox(); - filterBox.getElement().setPropertyString("placeholder", "filter"); - inputGrid.setText(0, 0, "Filter: "); - inputGrid.setWidget(0, 1, filterBox); - - // TODO(davido): Remove hard coded start suggest char 3 - final ReviewerSuggestOracle oracle = new ReviewerSuggestOracle(3, projectName); - final SuggestBox reviewerBox = new SuggestBox(oracle, new NpTextBox()); - reviewerBox.getElement().setPropertyString("placeholder", "reviewer"); - inputGrid.setText(1, 0, "Reviewer: "); - inputGrid.setWidget(1, 1, reviewerBox); - - Button addButton = new Button("Add"); - addButton.setStyleName("reviewers-addButton"); - addButton.addClickHandler( - new ClickHandler() { - @Override - public void onClick(final ClickEvent event) { - ReviewerEntry e = new ReviewerEntry(filterBox.getValue(), reviewerBox.getValue()); - if (!rEntries.contains(e) && !e.filter.isEmpty() && !e.reviewer.isEmpty()) { - doSave(Action.ADD, e); - } - filterBox.setText(""); - reviewerBox.setText(""); - } - }); - filterBox.setEnabled(isModifiable()); - reviewerBox.setEnabled(isModifiable()); - addButton.setEnabled(isModifiable()); - - Panel p = new VerticalPanel(); - p.setStyleName("reviewers-inputPanel"); - p.add(inputGrid); - p.add(addButton); - return p; - } - - boolean isModifiable() { - return isOwner || hasModifyReviewersConfigCapability; - } - - void doSave(Action action, ReviewerEntry entry) { - ChangeReviewersInput in = ChangeReviewersInput.create(); - in.setAction(action); - in.setFilter(entry.filter); - in.setReviewer(entry.reviewer); - reset(); - - new RestApi("projects") - .id(projectName) - .view("reviewers") - .put( - in, - new AsyncCallback<JsArray<ReviewerFilterSection>>() { - - @Override - public void onSuccess(JsArray<ReviewerFilterSection> result) { - display(result); - } - - @Override - public void onFailure(Throwable caught) {} - }); - } - - void reset() { - clear(); - rEntries = new HashSet<>(); - } - - static class ReviewerEntry { - private String filter; - private String reviewer; - - ReviewerEntry(String filter, String reviewer) { - this.filter = filter; - this.reviewer = reviewer; - } - - @Override - public int hashCode() { - return Objects.hash(filter, reviewer); - } - - @Override - public boolean equals(Object o) { - if (o == null || !(o instanceof ReviewerEntry)) { - return false; - } - ReviewerEntry other = (ReviewerEntry) o; - if (!this.filter.equals(other.filter) || !this.reviewer.equals(other.reviewer)) { - return false; - } - return true; - } - } -}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/reviewers/public/reviewers.css b/src/main/java/com/googlesource/gerrit/plugins/reviewers/public/reviewers.css deleted file mode 100644 index 8a09264..0000000 --- a/src/main/java/com/googlesource/gerrit/plugins/reviewers/public/reviewers.css +++ /dev/null
@@ -1,28 +0,0 @@ -.reviewers-panel { - border-spacing: 10px 10px; -} - -.reviewers-addButton { - float: right; - margin-right: 5px; -} - -.reviewers-inputPanel { - margin-left: 15px; -} - -.reviewers-filterLabel { - font-size: 14px; - font-weight: bold; -} - -.reviewers-reviewerLabel { - font-size: 14px; - margin-left: 15px; -} - -.reviewers-removeButton { - margin-left: 10px; - vertical-align: middle; - cursor: pointer; -} \ No newline at end of file
diff --git a/src/main/java/com/googlesource/gerrit/plugins/reviewers/server/BackendModule.java b/src/main/java/com/googlesource/gerrit/plugins/reviewers/server/BackendModule.java deleted file mode 100644 index fc98943..0000000 --- a/src/main/java/com/googlesource/gerrit/plugins/reviewers/server/BackendModule.java +++ /dev/null
@@ -1,82 +0,0 @@ -// Copyright (C) 2018 The Android Open Source Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package com.googlesource.gerrit.plugins.reviewers.server; - -import static com.google.gerrit.server.project.ProjectResource.PROJECT_KIND; -import static com.googlesource.gerrit.plugins.reviewers.server.ModifyReviewersConfigCapability.MODIFY_REVIEWERS_CONFIG; - -import com.google.gerrit.extensions.annotations.Exports; -import com.google.gerrit.extensions.config.CapabilityDefinition; -import com.google.gerrit.extensions.config.FactoryModule; -import com.google.gerrit.extensions.events.PrivateStateChangedListener; -import com.google.gerrit.extensions.events.RevisionCreatedListener; -import com.google.gerrit.extensions.events.WorkInProgressStateChangedListener; -import com.google.gerrit.extensions.registration.DynamicSet; -import com.google.gerrit.extensions.restapi.RestApiModule; -import com.google.gerrit.server.change.ReviewerSuggestion; -import com.google.inject.AbstractModule; -import com.google.inject.Inject; - -public class BackendModule extends FactoryModule { - private final boolean enableREST; - private final boolean suggestOnly; - - @Inject - public BackendModule(ReviewersConfig cfg) { - this(cfg.enableREST(), cfg.suggestOnly()); - } - - public BackendModule(boolean enableREST, boolean suggestOnly) { - this.enableREST = enableREST; - this.suggestOnly = suggestOnly; - } - - @Override - protected void configure() { - bind(CapabilityDefinition.class) - .annotatedWith(Exports.named(MODIFY_REVIEWERS_CONFIG)) - .to(ModifyReviewersConfigCapability.class); - - if (suggestOnly) { - install( - new AbstractModule() { - @Override - protected void configure() { - bind(ReviewerSuggestion.class) - .annotatedWith(Exports.named("reviewer-suggest")) - .to(Reviewers.class); - } - }); - } else { - DynamicSet.bind(binder(), RevisionCreatedListener.class).to(Reviewers.class); - DynamicSet.bind(binder(), WorkInProgressStateChangedListener.class).to(Reviewers.class); - DynamicSet.bind(binder(), PrivateStateChangedListener.class).to(Reviewers.class); - } - - factory(AddReviewersByConfiguration.Factory.class); - - if (enableREST) { - install( - new RestApiModule() { - @Override - protected void configure() { - get(PROJECT_KIND, "reviewers").to(GetReviewers.class); - put(PROJECT_KIND, "reviewers").to(PutReviewers.class); - get(PROJECT_KIND, "suggest_reviewers").to(SuggestProjectReviewers.class); - } - }); - } - } -}
diff --git a/src/main/resources/Documentation/build.md b/src/main/resources/Documentation/build.md index 864485c..156e88b 100644 --- a/src/main/resources/Documentation/build.md +++ b/src/main/resources/Documentation/build.md
@@ -57,13 +57,5 @@ ./tools/eclipse/project.py ``` -### Backend-only - -There are two separate plugin targets, one containing UI components -(`reviewers`), and one with only backend components (`reviewers-backend`). The -UI plugin is only compatible with the GWT UI, and does not work with PolyGerrit. -Both build instructions will work with either `reviewers` or -`reviewers-backend`. - How to build the Gerrit Plugin API is described in the [Gerrit documentation](../../../Documentation/dev-bazel.html#_extension_and_plugin_api_jar_files).
diff --git a/src/main/resources/static/remove_reviewer.png b/src/main/resources/static/remove_reviewer.png deleted file mode 100644 index 5a3e6f0..0000000 --- a/src/main/resources/static/remove_reviewer.png +++ /dev/null Binary files differ
diff --git a/src/test/java/com/googlesource/gerrit/plugins/reviewers/server/ReviewersConfigIT.java b/src/test/java/com/googlesource/gerrit/plugins/reviewers/ReviewersConfigIT.java similarity index 83% rename from src/test/java/com/googlesource/gerrit/plugins/reviewers/server/ReviewersConfigIT.java rename to src/test/java/com/googlesource/gerrit/plugins/reviewers/ReviewersConfigIT.java index 32b2243..4356b90 100644 --- a/src/test/java/com/googlesource/gerrit/plugins/reviewers/server/ReviewersConfigIT.java +++ b/src/test/java/com/googlesource/gerrit/plugins/reviewers/ReviewersConfigIT.java
@@ -12,21 +12,23 @@ // See the License for the specific language governing permissions and // limitations under the License. -package com.googlesource.gerrit.plugins.reviewers.server; +package com.googlesource.gerrit.plugins.reviewers; import static com.google.common.truth.Truth.assertThat; import static com.google.gerrit.acceptance.GitUtil.fetch; -import static com.googlesource.gerrit.plugins.reviewers.server.ReviewersConfig.FILENAME; -import static com.googlesource.gerrit.plugins.reviewers.server.ReviewersConfig.KEY_REVIEWER; -import static com.googlesource.gerrit.plugins.reviewers.server.ReviewersConfig.SECTION_FILTER; +import static com.googlesource.gerrit.plugins.reviewers.ReviewersConfig.FILENAME; +import static com.googlesource.gerrit.plugins.reviewers.ReviewersConfig.KEY_REVIEWER; +import static com.googlesource.gerrit.plugins.reviewers.ReviewersConfig.SECTION_FILTER; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; import com.google.gerrit.acceptance.LightweightPluginDaemonTest; import com.google.gerrit.acceptance.NoHttpd; import com.google.gerrit.acceptance.TestPlugin; +import com.google.gerrit.acceptance.testsuite.project.ProjectOperations; import com.google.gerrit.reviewdb.client.Project; import com.google.gerrit.reviewdb.client.RefNames; +import com.google.inject.Inject; import org.eclipse.jgit.junit.TestRepository; import org.eclipse.jgit.lib.Config; import org.junit.Before; @@ -40,6 +42,8 @@ private static final String JANE_DOE = "jane.doe@example.com"; private static final String JOHN_DOE = "john.doe@example.com"; + @Inject private ProjectOperations projectOperations; + @Before public void setUp() throws Exception { fetch(testRepo, RefNames.REFS_CONFIG + ":refs/heads/config"); @@ -53,7 +57,7 @@ cfg.setString(SECTION_FILTER, BRANCH_MAIN, KEY_REVIEWER, JANE_DOE); pushFactory - .create(db, admin.getIdent(), testRepo, "Add reviewers", FILENAME, cfg.toText()) + .create(admin.newIdent(), testRepo, "Add reviewers", FILENAME, cfg.toText()) .to(RefNames.REFS_CONFIG) .assertOkStatus(); @@ -73,8 +77,7 @@ pushFactory .create( - db, - admin.getIdent(), + admin.newIdent(), testRepo, "Add reviewers parent project", FILENAME, @@ -82,7 +85,7 @@ .to(RefNames.REFS_CONFIG) .assertOkStatus(); - Project.NameKey childProject = createProject("child", project); + Project.NameKey childProject = projectOperations.newProject().parent(project).create(); TestRepository<?> childTestRepo = cloneProject(childProject); fetch(childTestRepo, RefNames.REFS_CONFIG + ":refs/heads/config"); childTestRepo.reset("refs/heads/config"); @@ -93,12 +96,7 @@ pushFactory .create( - db, - admin.getIdent(), - childTestRepo, - "Add reviewers child project", - FILENAME, - cfg.toText()) + admin.newIdent(), childTestRepo, "Add reviewers child project", FILENAME, cfg.toText()) .to(RefNames.REFS_CONFIG) .assertOkStatus();
diff --git a/src/test/java/com/googlesource/gerrit/plugins/reviewers/server/ReviewersIT.java b/src/test/java/com/googlesource/gerrit/plugins/reviewers/ReviewersIT.java similarity index 80% rename from src/test/java/com/googlesource/gerrit/plugins/reviewers/server/ReviewersIT.java rename to src/test/java/com/googlesource/gerrit/plugins/reviewers/ReviewersIT.java index 5c5f478..fdc7fe4 100644 --- a/src/test/java/com/googlesource/gerrit/plugins/reviewers/server/ReviewersIT.java +++ b/src/test/java/com/googlesource/gerrit/plugins/reviewers/ReviewersIT.java
@@ -12,15 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -package com.googlesource.gerrit.plugins.reviewers.server; +package com.googlesource.gerrit.plugins.reviewers; import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assert_; import static com.google.gerrit.acceptance.GitUtil.fetch; import static com.google.gerrit.extensions.client.ReviewerState.REVIEWER; -import static com.googlesource.gerrit.plugins.reviewers.server.ReviewersConfig.FILENAME; -import static com.googlesource.gerrit.plugins.reviewers.server.ReviewersConfig.KEY_REVIEWER; -import static com.googlesource.gerrit.plugins.reviewers.server.ReviewersConfig.SECTION_FILTER; +import static com.googlesource.gerrit.plugins.reviewers.ReviewersConfig.FILENAME; +import static com.googlesource.gerrit.plugins.reviewers.ReviewersConfig.KEY_REVIEWER; +import static com.googlesource.gerrit.plugins.reviewers.ReviewersConfig.SECTION_FILTER; import static java.util.stream.Collectors.toSet; import com.google.common.collect.ImmutableList; @@ -53,10 +53,11 @@ TestAccount user2 = accountCreator.user2(); Config cfg = new Config(); - cfg.setStringList(SECTION_FILTER, "*", KEY_REVIEWER, ImmutableList.of(user.email, user2.email)); + cfg.setStringList( + SECTION_FILTER, "*", KEY_REVIEWER, ImmutableList.of(user.email(), user2.email())); pushFactory - .create(db, admin.getIdent(), testRepo, "Add reviewers", FILENAME, cfg.toText()) + .create(admin.newIdent(), testRepo, "Add reviewers", FILENAME, cfg.toText()) .to(RefNames.REFS_CONFIG) .assertOkStatus(); @@ -79,7 +80,8 @@ } while (reviewers == null); assertThat(reviewers.stream().map(a -> a._accountId).collect(toSet())) - .containsExactlyElementsIn(ImmutableSet.of(admin.id.get(), user.id.get(), user2.id.get())); + .containsExactlyElementsIn( + ImmutableSet.of(admin.id().get(), user.id().get(), user2.id().get())); } @Test @@ -88,11 +90,11 @@ TestAccount user2 = accountCreator.user2(); Config cfg = new Config(); - cfg.setStringList(SECTION_FILTER, "*", KEY_REVIEWER, ImmutableList.of(user.email)); - cfg.setStringList(SECTION_FILTER, "^a.txt", KEY_REVIEWER, ImmutableList.of(user2.email)); + cfg.setStringList(SECTION_FILTER, "*", KEY_REVIEWER, ImmutableList.of(user.email())); + cfg.setStringList(SECTION_FILTER, "^a.txt", KEY_REVIEWER, ImmutableList.of(user2.email())); pushFactory - .create(db, admin.getIdent(), testRepo, "Add reviewers", FILENAME, cfg.toText()) + .create(admin.newIdent(), testRepo, "Add reviewers", FILENAME, cfg.toText()) .to(RefNames.REFS_CONFIG) .assertOkStatus(); @@ -115,7 +117,8 @@ } while (reviewers == null); assertThat(reviewers.stream().map(a -> a._accountId).collect(toSet())) - .containsExactlyElementsIn(ImmutableSet.of(admin.id.get(), user.id.get(), user2.id.get())); + .containsExactlyElementsIn( + ImmutableSet.of(admin.id().get(), user.id().get(), user2.id().get())); } @Test @@ -123,16 +126,16 @@ RevCommit oldHead = getRemoteHead(); Config cfg = new Config(); - cfg.setString(SECTION_FILTER, "branch:master", KEY_REVIEWER, user.email); + cfg.setString(SECTION_FILTER, "branch:master", KEY_REVIEWER, user.email()); pushFactory - .create(db, admin.getIdent(), testRepo, "Add reviewers", FILENAME, cfg.toText()) + .create(admin.newIdent(), testRepo, "Add reviewers", FILENAME, cfg.toText()) .to(RefNames.REFS_CONFIG) .assertOkStatus(); testRepo.reset(oldHead); - createBranch(new Branch.NameKey(project, "other-branch")); + createBranch(Branch.nameKey(project, "other-branch")); // Create a change that matches the filter section. createChange("refs/for/master"); @@ -156,16 +159,16 @@ RevCommit oldHead = getRemoteHead(); Config cfg = new Config(); - cfg.setString(SECTION_FILTER, "branch:other-branch", KEY_REVIEWER, user.email); + cfg.setString(SECTION_FILTER, "branch:other-branch", KEY_REVIEWER, user.email()); pushFactory - .create(db, admin.getIdent(), testRepo, "Add reviewers", FILENAME, cfg.toText()) + .create(admin.newIdent(), testRepo, "Add reviewers", FILENAME, cfg.toText()) .to(RefNames.REFS_CONFIG) .assertOkStatus(); testRepo.reset(oldHead); - createBranch(new Branch.NameKey(project, "other-branch")); + createBranch(Branch.nameKey(project, "other-branch")); // Create a change that doesn't match the filter section. createChange("refs/for/master"); @@ -182,6 +185,6 @@ } while (reviewers == null && wait < 100); assertThat(reviewers.stream().map(a -> a._accountId).collect(toSet())) - .containsExactlyElementsIn(ImmutableSet.of(admin.id.get(), user.id.get())); + .containsExactlyElementsIn(ImmutableSet.of(admin.id().get(), user.id().get())); } }
diff --git a/src/test/java/com/googlesource/gerrit/plugins/reviewers/server/ReviewersResolverIT.java b/src/test/java/com/googlesource/gerrit/plugins/reviewers/ReviewersResolverIT.java similarity index 73% rename from src/test/java/com/googlesource/gerrit/plugins/reviewers/server/ReviewersResolverIT.java rename to src/test/java/com/googlesource/gerrit/plugins/reviewers/ReviewersResolverIT.java index c893a6c..185e4cd 100644 --- a/src/test/java/com/googlesource/gerrit/plugins/reviewers/server/ReviewersResolverIT.java +++ b/src/test/java/com/googlesource/gerrit/plugins/reviewers/ReviewersResolverIT.java
@@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package com.googlesource.gerrit.plugins.reviewers.server; +package com.googlesource.gerrit.plugins.reviewers; import static com.google.common.truth.Truth.assertThat; @@ -20,6 +20,7 @@ import com.google.gerrit.acceptance.AbstractDaemonTest; import com.google.gerrit.acceptance.NoHttpd; import com.google.gerrit.acceptance.TestAccount; +import com.google.gerrit.acceptance.testsuite.group.GroupOperations; import com.google.gerrit.reviewdb.client.Account; import com.google.inject.Inject; import java.util.Collections; @@ -30,6 +31,7 @@ @NoHttpd public class ReviewersResolverIT extends AbstractDaemonTest { + @Inject private GroupOperations groupOperations; @Inject private ReviewersResolver resolver; private int change; @@ -42,10 +44,10 @@ public void testUploaderSkippedAsReviewer() throws Exception { Set<Account.Id> reviewers = resolver.resolve( - Collections.singleton(user.email), + Collections.singleton(user.email()), project, change, - gApi.accounts().id(user.id.get()).get()); + gApi.accounts().id(user.id().get()).get()); assertThat(reviewers).isEmpty(); } @@ -53,20 +55,22 @@ public void testAccountResolve() throws Exception { Set<Account.Id> reviewers = resolver.resolve( - ImmutableSet.of(user.email, admin.email), + ImmutableSet.of(user.email(), admin.email()), project, change, - gApi.accounts().id(admin.id.get()).get()); - assertThat(reviewers).containsExactly(user.id); + gApi.accounts().id(admin.id().get()).get()); + assertThat(reviewers).containsExactly(user.id()); } @Test public void testAccountGroupResolve() throws Exception { - String group1 = createGroup("group1"); + String group1 = "group1"; + groupOperations.newGroup().name(group1).create(); TestAccount foo = createTestAccount("foo", group1); TestAccount bar = createTestAccount("bar", group1); - String group2 = createGroup("group2"); + String group2 = "group2"; + groupOperations.newGroup().name(group2).create(); TestAccount baz = createTestAccount("baz", group2); TestAccount qux = createTestAccount("qux", group2); @@ -74,11 +78,11 @@ Set<Account.Id> reviewers = resolver.resolve( - ImmutableSet.of(system.email, group1, group2), + ImmutableSet.of(system.email(), group1, group2), project, change, - gApi.accounts().id(admin.id.get()).get()); - assertThat(reviewers).containsExactly(system.id, foo.id, bar.id, baz.id, qux.id); + gApi.accounts().id(admin.id().get()).get()); + assertThat(reviewers).containsExactly(system.id(), foo.id(), bar.id(), baz.id(), qux.id()); } private TestAccount createTestAccount(String name, String group) throws Exception {
diff --git a/tools/bzl/plugin.bzl b/tools/bzl/plugin.bzl index ea73147..4d2dbdd 100644 --- a/tools/bzl/plugin.bzl +++ b/tools/bzl/plugin.bzl
@@ -1,12 +1,10 @@ load( "@com_googlesource_gerrit_bazlets//:gerrit_plugin.bzl", _gerrit_plugin = "gerrit_plugin", - _gwt_plugin_deps = "GWT_PLUGIN_DEPS", _plugin_deps = "PLUGIN_DEPS", _plugin_test_deps = "PLUGIN_TEST_DEPS", ) gerrit_plugin = _gerrit_plugin -GWT_PLUGIN_DEPS = _gwt_plugin_deps PLUGIN_DEPS = _plugin_deps PLUGIN_TEST_DEPS = _plugin_test_deps
diff --git a/tools/eclipse/BUILD b/tools/eclipse/BUILD index 77a865e..b51010e 100644 --- a/tools/eclipse/BUILD +++ b/tools/eclipse/BUILD
@@ -1,15 +1,7 @@ load("//tools/bzl:classpath.bzl", "classpath_collector") -load( - "//tools/bzl:plugin.bzl", - "GWT_PLUGIN_DEPS", -) classpath_collector( name = "main_classpath_collect", testonly = 1, - deps = GWT_PLUGIN_DEPS + [ - "//external:gwt-dev", - "//external:gwt-user", - "//:reviewers__plugin_test_deps", - ], + deps = ["//:reviewers__plugin_test_deps"], )