Skip to content
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
13 changes: 11 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
// Build on ci.jenkins.io; see https://github.com/jenkins-infra/pipeline-library
buildPlugin(jdkVersions: [8, 11])
/*
See the documentation for more options:
https://github.com/jenkins-infra/pipeline-library/
*/
buildPlugin(
forkCount: '1C', // run this number of tests in parallel for faster feedback. If the number terminates with a 'C', the value will be multiplied by the number of available CPU cores
useContainerAgent: true, // Set to `false` if you need to use Docker for containerized tests
configurations: [
[platform: 'linux', jdk: 21],
[platform: 'windows', jdk: 17],
])
24 changes: 11 additions & 13 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.2</version>
<version>4.75</version>
<relativePath />
</parent>

<properties>
<jenkins.version>2.222.4</jenkins.version>
<jenkins.bom.artifactId>2.222.x</jenkins.bom.artifactId>
<jenkins.bom.version>29</jenkins.bom.version>
<java.level>8</java.level>
<jenkins.version>2.387.3</jenkins.version>
<jenkins.bom.artifactId>2.387.x</jenkins.bom.artifactId>
<jenkins.bom.version>2329.v078520e55c19</jenkins.bom.version>
</properties>

<artifactId>google-play-android-publisher</artifactId>
Expand All @@ -21,7 +20,6 @@

<name>Google Play Android Publisher Plugin</name>
<url>https://github.com/jenkinsci/google-play-android-publisher-plugin</url>
<description>Enables Jenkins to manage and upload Android app files (AAB or APK) to Google Play.</description>
<developers>
<developer>
<id>orrc</id>
Expand All @@ -44,12 +42,10 @@
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>apache-httpcomponents-client-4-api</artifactId>
<version>4.5.10-2.0</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>jackson2-api</artifactId>
<version>2.12.3</version>
</dependency>

<!-- Official bindings for the Android Publisher API -->
Expand Down Expand Up @@ -82,7 +78,6 @@
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>token-macro</artifactId>
<version>2.12</version>
</dependency>

<dependency>
Expand All @@ -95,6 +90,12 @@
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client</artifactId>
<version>1.25.0</version>
<exclusions>
<exclusion>
<groupId>com.google.j2objc</groupId>
<artifactId>j2objc-annotations</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
Expand All @@ -111,7 +112,7 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>3.3.3</version>
<version>3.2.4</version>
<scope>test</scope>
</dependency>

Expand All @@ -127,7 +128,6 @@
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>cloudbees-folder</artifactId>
<version>6.15</version>
<scope>test</scope>
</dependency>

Expand Down Expand Up @@ -158,15 +158,13 @@
<dependency>
<groupId>org.jenkinsci.plugins</groupId>
<artifactId>pipeline-model-definition</artifactId>
<version>1.6.0</version>
<scope>test</scope>
</dependency>

<!-- Pinning these versions as various other dependencies rely on them -->
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>2.2</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.jenkinsci.plugins.googleplayandroidpublisher;

import com.google.jenkins.plugins.credentials.oauth.GoogleRobotCredentials;
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import hudson.AbortException;
import hudson.Extension;
Expand All @@ -25,8 +26,7 @@
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.export.Exported;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import edu.umd.cs.findbugs.annotations.Nullable;
import java.io.IOException;
import java.io.PrintStream;
import java.io.Serializable;
Expand Down Expand Up @@ -117,15 +117,15 @@ public void setFilesPattern(String pattern) {
this.filesPattern = DescriptorImpl.defaultFilesPattern.equals(pattern) ? null : pattern;
}

@Nonnull
@NonNull
public String getFilesPattern() {
return fixEmptyAndTrim(filesPattern) == null ? DescriptorImpl.defaultFilesPattern : filesPattern;
}

@DataBoundSetter
@SuppressWarnings("ConstantConditions")
@SuppressFBWarnings("NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE")
public void setRolloutPercentage(@Nonnull String percentage) {
public void setRolloutPercentage(@NonNull String percentage) {
// If the value is an expression, just store it directly
if (percentage.matches(REGEX_VARIABLE)) {
this.rolloutPercentage = percentage;
Expand Down Expand Up @@ -320,7 +320,7 @@ private String getExpandedAdditionalVersionCodesString() throws IOException, Int
return expand(getAdditionalVersionCodes());
}

@Nonnull
@NonNull
private List<Long> getExpandedAdditionalVersionCodes() throws IOException, InterruptedException {
String versionCodesStr = getExpandedAdditionalVersionCodesString();
if (versionCodesStr == null) {
Expand Down Expand Up @@ -402,8 +402,8 @@ private boolean isConfigValid(PrintStream logger) throws IOException, Interrupte
}

@Override
public void perform(@Nonnull Run<?, ?> run, @Nonnull FilePath workspace, @Nonnull Launcher launcher,
@Nonnull TaskListener listener) throws InterruptedException, IOException {
public void perform(@NonNull Run<?, ?> run, @NonNull FilePath workspace, @NonNull Launcher launcher,
@NonNull TaskListener listener) throws InterruptedException, IOException {
super.perform(run, workspace, launcher, listener);

// Calling publishApk logs the reason when a failure occurs, so in that case we just need to throw here
Expand All @@ -412,7 +412,7 @@ public void perform(@Nonnull Run<?, ?> run, @Nonnull FilePath workspace, @Nonnul
}
}

private boolean publishApk(@Nonnull Run<?, ?> run, @Nonnull FilePath workspace, @Nonnull TaskListener listener)
private boolean publishApk(@NonNull Run<?, ?> run, @NonNull FilePath workspace, @NonNull TaskListener listener)
throws InterruptedException, IOException {
final PrintStream logger = listener.getLogger();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
import com.google.api.services.androidpublisher.model.LocalizedText;
import com.google.api.services.androidpublisher.model.Track;
import com.google.jenkins.plugins.credentials.oauth.GoogleRobotCredentials;
import edu.umd.cs.findbugs.annotations.NonNull;
import hudson.FilePath;
import hudson.model.TaskListener;
import org.jenkinsci.plugins.googleplayandroidpublisher.internal.AppFileFormat;
import org.jenkinsci.plugins.googleplayandroidpublisher.internal.UploadFile;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import edu.umd.cs.findbugs.annotations.Nullable;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
Expand Down Expand Up @@ -336,7 +336,7 @@ private ExpansionFilesUploadResponse uploadExpansionFile(long versionCode, Strin
}

@Nullable
private static String expandReleaseName(@Nullable String releaseName, @Nonnull List<UploadFile> appFilesToUpload) {
private static String expandReleaseName(@Nullable String releaseName, @NonNull List<UploadFile> appFilesToUpload) {
if (releaseName == null) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.google.jenkins.plugins.credentials.oauth.GoogleRobotCredentials;
import com.google.jenkins.plugins.credentials.oauth.GoogleRobotPrivateKeyCredentials.AccountIdNotSetException;
import com.google.jenkins.plugins.credentials.oauth.GoogleRobotPrivateKeyCredentials.PrivateKeyNotSetException;
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import hudson.model.Item;
import hudson.model.Queue;
Expand All @@ -15,8 +16,7 @@
import org.acegisecurity.Authentication;
import org.apache.commons.lang.exception.ExceptionUtils;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import edu.umd.cs.findbugs.annotations.Nullable;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.security.GeneralSecurityException;
Expand Down Expand Up @@ -54,14 +54,6 @@ public final GoogleRobotCredentials getServiceAccountCredentials(Item item) thro
throw new CredentialsException(String.format("The Google Service Account credential '%s' "
+ "has not been configured correctly.%n\tUpdate the credential, ensuring that the required data "
+ "have been entered, then try again", googleCredentialsId));
} catch (NullPointerException e) {
// This should really be handled by the Google OAuth plugin
throw new UploadException("Failed to get Google service account info.\n" +
"\tCheck that the correct 'Client Secrets JSON' file has been uploaded for the " +
"'" + googleCredentialsId + "' credential.\n" +
"\tThe correct JSON file can be obtained by visiting the *old* Google APIs Console, selecting " +
"'API Access' and then clicking 'Download JSON' for the appropriate service account.\n" +
"\tSee: https://code.google.com/apis/console/?noredirect", e);
} catch (IllegalStateException e) {
if (ExceptionUtils.getRootCause(e) instanceof FileNotFoundException) {
throw new UploadException("Failed to get Google service account info. Ensure that the JSON file and " +
Expand All @@ -79,7 +71,7 @@ public final GoogleRobotCredentials getServiceAccountCredentials(Item item) thro
}

/** @return A list of Google Play-compatible credentials visible to the given item. */
@Nonnull
@NonNull
static List<GoogleRobotCredentials> getCredentials(Item item) {
GoogleOAuth2ScopeRequirement requirement = DomainRequirementProvider.of(
GooglePlayPublisher.class, GoogleOAuth2ScopeRequirement.class
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.jenkinsci.plugins.googleplayandroidpublisher;

import com.cloudbees.plugins.credentials.CredentialsNameProvider;
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import hudson.model.AbstractProject;
import hudson.model.Describable;
Expand All @@ -15,7 +16,6 @@
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.StaplerRequest;

import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
Expand All @@ -40,7 +40,7 @@ public ListBoxModel doFillGoogleCredentialsIdItems(@AncestorInPath Item item) {

ListBoxModel credentials = getCredentialsListBox(item);
if (credentials.isEmpty()) {
credentials.add("(No Google Play account credentials have been added to Jenkins)", null);
credentials.add("(No Google Play account credentials have been added to Jenkins)", "");
}
return credentials;
}
Expand Down Expand Up @@ -76,7 +76,7 @@ public FormValidation doCheckGoogleCredentialsId(@AncestorInPath Item item, @Que
return FormValidation.ok();
}

@Nonnull
@NonNull
private static ListBoxModel getCredentialsListBox(Item item) {
ListBoxModel listBox = new ListBoxModel();
CredentialsHandler.getCredentials(item).forEach(credential -> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.jenkinsci.plugins.googleplayandroidpublisher;

import com.google.jenkins.plugins.credentials.domains.RequiresDomain;
import edu.umd.cs.findbugs.annotations.NonNull;
import hudson.FilePath;
import hudson.Launcher;
import hudson.model.Run;
Expand All @@ -10,7 +11,6 @@
import jenkins.tasks.SimpleBuildStep;
import org.kohsuke.stapler.DataBoundSetter;

import javax.annotation.Nonnull;
import java.io.IOException;

@RequiresDomain(value = AndroidPublisherScopeRequirement.class)
Expand All @@ -33,8 +33,8 @@ public final String getGoogleCredentialsId() {
}

@Override
public void perform(@Nonnull Run<?, ?> run, @Nonnull FilePath workspace, @Nonnull Launcher launcher,
@Nonnull TaskListener listener) throws InterruptedException, IOException {
public void perform(@NonNull Run<?, ?> run, @NonNull FilePath workspace, @NonNull Launcher launcher,
@NonNull TaskListener listener) throws InterruptedException, IOException {
currentBuild.set(run);
currentListener.set(listener);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.jenkinsci.plugins.googleplayandroidpublisher;

import com.google.jenkins.plugins.credentials.domains.RequiresDomain;
import edu.umd.cs.findbugs.annotations.NonNull;
import hudson.FilePath;
import hudson.Launcher;
import hudson.model.Run;
Expand All @@ -10,8 +11,7 @@
import jenkins.tasks.SimpleBuildStep;
import org.kohsuke.stapler.DataBoundSetter;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import edu.umd.cs.findbugs.annotations.Nullable;
import java.io.IOException;

@RequiresDomain(value = AndroidPublisherScopeRequirement.class)
Expand All @@ -34,8 +34,8 @@ public final String getGoogleCredentialsId() {
}

@Override
public void perform(@Nonnull Run<?, ?> run, @Nonnull FilePath workspace, @Nonnull Launcher launcher,
@Nonnull TaskListener listener) throws InterruptedException, IOException {
public void perform(@NonNull Run<?, ?> run, @NonNull FilePath workspace, @NonNull Launcher launcher,
@NonNull TaskListener listener) throws InterruptedException, IOException {
currentBuild.set(run);
currentListener.set(listener);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
import com.google.api.client.googleapis.json.GoogleJsonError;
import com.google.api.client.googleapis.json.GoogleJsonResponseException;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import edu.umd.cs.findbugs.annotations.Nullable;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
Expand Down
Loading