Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/fix issue to build #2

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 27 additions & 2 deletions github-oauth/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ limitations under the License.
<parent>
<groupId>com.googlesource.gerrit.plugins.github</groupId>
<artifactId>github-parent</artifactId>
<version>2.14-SNAPSHOT</version>
<version>2.13-SNAPSHOT</version>
</parent>
<artifactId>github-oauth</artifactId>
<name>Gerrit Code Review - GitHub OAuth login</name>
Expand Down Expand Up @@ -59,6 +59,26 @@ limitations under the License.
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<executions>
<execution>
<id>install_local</id>
<phase>install</phase>
<goals>
<goal>install-file</goal>
</goals>
<configuration>
<groupId>com.google.gerrit</groupId>
<artifactId>github-oauth</artifactId>
<version>${project.version}</version>
<file>target/github-oauth-${project.version}.jar</file>
<generatePom>true</generatePom>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
Expand All @@ -68,6 +88,11 @@ limitations under the License.
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gerrit</groupId>
<artifactId>gerrit-extension-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
Expand Down Expand Up @@ -107,7 +132,7 @@ limitations under the License.
<dependency>
<groupId>org.kohsuke</groupId>
<artifactId>github-api</artifactId>
<version>1.70</version>
<version>1.85</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import com.google.common.collect.Maps;
import com.google.gerrit.extensions.client.AuthType;
import com.google.gerrit.reviewdb.client.AuthType;
import com.google.gerrit.server.config.AuthConfig;
import com.google.gerrit.server.config.CanonicalWebUrl;
import com.google.gerrit.server.config.ConfigUtil;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import com.google.gerrit.server.IdentifiedUser;
import com.google.gerrit.server.account.AccountCache;
import com.google.gerrit.server.account.AccountState;
import com.google.gerrit.server.account.ExternalId;
import com.google.gerrit.reviewdb.client.AccountExternalId;
import com.google.inject.Inject;
import com.google.inject.Provider;
import com.google.inject.Singleton;
Expand Down Expand Up @@ -81,9 +81,9 @@ public GitHubLogin get(String username) {

private AccessToken newAccessTokenFromUser(String username) {
AccountState account = accountCache.getByUsername(username);
Collection<ExternalId> externalIds = account.getExternalIds();
for (ExternalId accountExternalId : externalIds) {
String key = accountExternalId.asAccountExternalId().getKey().get();
Collection<AccountExternalId> externalIds = account.getExternalIds();
for (AccountExternalId accountExternalId : externalIds) {
String key = accountExternalId.getKey().get();
if (key.startsWith(EXTERNAL_ID_PREFIX)) {
return new AccessToken(key.substring(EXTERNAL_ID_PREFIX.length()));
}
Expand Down
8 changes: 7 additions & 1 deletion github-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ limitations under the License.
<parent>
<artifactId>github-parent</artifactId>
<groupId>com.googlesource.gerrit.plugins.github</groupId>
<version>2.14-SNAPSHOT</version>
<version>2.13-SNAPSHOT</version>
</parent>

<artifactId>github-plugin</artifactId>
Expand Down Expand Up @@ -96,6 +96,12 @@ limitations under the License.
<version>${Gerrit-ApiVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gerrit</groupId>
<artifactId>github-oauth</artifactId>
<version>${Gerrit-ApiVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

import com.google.gerrit.extensions.annotations.Listen;
import com.google.gerrit.extensions.annotations.PluginName;
import com.google.gerrit.extensions.client.AuthType;
import com.google.gerrit.reviewdb.client.AuthType;
import com.google.gerrit.extensions.client.MenuItem;
import com.google.gerrit.extensions.webui.TopMenu;
import com.google.gerrit.server.CurrentUser;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import com.google.gerrit.server.CurrentUser;
import com.google.gerrit.server.IdentifiedUser;
import com.google.gerrit.server.account.AccountCache;
import com.google.gerrit.server.account.ExternalId;
import com.google.inject.Inject;
import com.google.inject.Provider;
import com.google.inject.Singleton;
Expand Down Expand Up @@ -86,16 +85,16 @@ public void doFilter(ServletRequest request, ServletResponse response,
}

private AccountExternalId getGitHubExternalId(CurrentUser user) {
Collection<ExternalId> accountExtIds =
Collection<AccountExternalId> accountExtIds =
accountCache.get(((IdentifiedUser) user).getAccountId())
.getExternalIds();
Collection<ExternalId> gitHubExtId =
Collection<AccountExternalId> gitHubExtId =
Collections2.filter(accountExtIds,
new Predicate<ExternalId>() {
new Predicate<AccountExternalId>() {
@Override
public boolean apply(ExternalId externalId) {
public boolean apply(AccountExternalId externalId) {
return externalId
.key()
.getKey()
.get()
.startsWith(
IdentifiedUserGitHubLoginProvider.EXTERNAL_ID_PREFIX);
Expand All @@ -106,7 +105,7 @@ public boolean apply(ExternalId externalId) {
throw new IllegalStateException("Current Gerrit user "
+ user.getUserName() + " has no GitHub OAuth external ID");
}
return gitHubExtId.iterator().next().asAccountExternalId();
return gitHubExtId.iterator().next();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
import com.google.gerrit.server.query.change.ChangeQueryBuilder;
import com.google.gerrit.server.query.change.ChangeQueryProcessor;
import com.google.gerrit.server.query.change.InternalChangeQuery;
import com.google.gerrit.server.update.BatchUpdate;
import com.google.gerrit.server.update.UpdateException;
import com.google.gerrit.server.git.BatchUpdate;
import com.google.gerrit.server.git.UpdateException;
import com.google.gwtorm.server.OrmException;
import com.google.inject.Inject;
import com.google.inject.Provider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

import com.google.gerrit.extensions.annotations.PluginName;
import com.google.gerrit.server.config.SitePaths;
import com.google.gerrit.server.mail.send.VelocityRuntimeProvider.Slf4jLogChute;
import com.google.gerrit.server.mail.VelocityRuntimeProvider.Slf4jLogChute;
import com.google.inject.Inject;
import com.google.inject.Provider;
import com.google.inject.ProvisionException;
Expand Down
11 changes: 11 additions & 0 deletions install_jars.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh

# $1 is the path to the gerrit site where to install the packages
if [ "$1" = "" ];then
echo "Please, pass the path to the gerrit site for install"
else
GERRIT_SITE="$1"
fi

cp github-oauth/target/github-oauth-*.jar $GERRIT_SITE/lib
cp github-plugin/target/github-plugin-*.jar $GERRIT_SITE/plugins
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ limitations under the License.
<modelVersion>4.0.0</modelVersion>
<groupId>com.googlesource.gerrit.plugins.github</groupId>
<artifactId>github-parent</artifactId>
<version>2.14-SNAPSHOT</version>
<version>2.13-SNAPSHOT</version>
<name>Gerrit Code Review - GitHub integration</name>
<url>http://www.gerritforge.com</url>
<packaging>pom</packaging>
Expand Down