Skip to content
Permalink
Browse files

[JENKINS-43507] Update to latest -SNAPSHOT of scm-api

  • Loading branch information...
stephenc committed Jun 12, 2017
1 parent fc22556 commit d41c75101388fd42b4939dab62000329c8e2c6fa
11 pom.xml
@@ -16,7 +16,7 @@
<properties>
<jenkins.version>1.642.3</jenkins.version>
<no-test-jar>false</no-test-jar>
<scm-api-plugin.version>2.2.0-20170504.132618-8</scm-api-plugin.version>
<scm-api-plugin.version>2.2.0-20170612.200107-11</scm-api-plugin.version>
</properties>

<developers>
@@ -70,7 +70,16 @@
<url>https://repo.jenkins-ci.org/public/</url>
</pluginRepository>
</pluginRepositories>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>scm-api</artifactId>
<version>${scm-api-plugin.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>credentials</artifactId>
@@ -1,18 +1,31 @@
package hudson.plugins.mercurial.traits;

import hudson.Extension;
import hudson.plugins.mercurial.MercurialSCM;
import hudson.plugins.mercurial.MercurialSCMBuilder;
import hudson.plugins.mercurial.MercurialSCMSource;
import hudson.scm.SCM;
import javax.annotation.Nonnull;
import jenkins.scm.api.trait.SCMBuilder;
import jenkins.scm.api.trait.SCMSourceTrait;
import jenkins.scm.api.trait.SCMSourceTraitDescriptor;
import org.kohsuke.stapler.DataBoundConstructor;

/**
* A {@link SCMSourceTrait} for {@link MercurialSCMSource} that configures {@link MercurialSCM#setClean(boolean)}.
*
* @since 2.0
*/
public class CleanMercurialSCMSourceTrait extends SCMSourceTrait {
/**
* Constructor.
*/
@DataBoundConstructor public CleanMercurialSCMSourceTrait() { }

@Override protected <B extends SCMBuilder<B, S>, S extends SCM> void decorateBuilder(B builder) {
/**
* {@inheritDoc}
*/
@Override protected void decorateBuilder(SCMBuilder<?, ?> builder) {
((MercurialSCMBuilder<?>) builder).withClean(true);
}

@@ -21,9 +34,18 @@
return "Clean Build";
}

@Override public boolean isApplicableToBuilder(@Nonnull Class<? extends SCMBuilder> builderClass) {
return MercurialSCMBuilder.class.isAssignableFrom(builderClass)
&& super.isApplicableToBuilder(builderClass);
/**
* {@inheritDoc}
*/
@Override public Class<? extends SCMBuilder> getBuilderClass() {
return MercurialSCMBuilder.class;
}

/**
* {@inheritDoc}
*/
@Override public Class<? extends SCM> getScmClass() {
return MercurialSCM.class;
}
}
}
@@ -29,6 +29,7 @@
import edu.umd.cs.findbugs.annotations.NonNull;
import hudson.Extension;
import hudson.model.Descriptor;
import hudson.plugins.mercurial.MercurialSCM;
import hudson.plugins.mercurial.MercurialSCMBuilder;
import hudson.plugins.mercurial.MercurialSCMSource;
import hudson.plugins.mercurial.browser.HgBrowser;
@@ -47,7 +48,7 @@
/**
* Exposes {@link HgBrowser} configuration of a {@link MercurialSCMSource} as a {@link SCMSourceTrait}.
*
* @since 3.4.0
* @since 2.0
*/
public class MercurialBrowserSCMSourceTrait extends SCMSourceTrait {

@@ -80,22 +81,19 @@ public HgBrowser getBrowser() {
/**
* {@inheritDoc}
*/
@Override
protected <B extends SCMBuilder<B, S>, S extends SCM> void decorateBuilder(B builder) {
@Override protected void decorateBuilder(SCMBuilder<?, ?> builder) {
((MercurialSCMBuilder<?>) builder).withBrowser(browser);
}

/**
* Our {@link Descriptor}
*/
@Extension
public static class DescriptorImpl extends SCMSourceTraitDescriptor {
@Extension public static class DescriptorImpl extends SCMSourceTraitDescriptor {

/**
* {@inheritDoc}
*/
@Override
public @Nonnull String getDisplayName() {
@Override public @Nonnull String getDisplayName() {
return "Configure Repository Browser";
}

@@ -112,10 +110,15 @@ public HgBrowser getBrowser() {
/**
* {@inheritDoc}
*/
@Override
public boolean isApplicableToBuilder(@NonNull Class<? extends SCMBuilder> builderClass) {
return super.isApplicableToBuilder(builderClass)
&& MercurialSCMBuilder.class.isAssignableFrom(builderClass);
@Override public Class<? extends SCMBuilder> getBuilderClass() {
return MercurialSCMBuilder.class;
}

/**
* {@inheritDoc}
*/
@Override public Class<? extends SCM> getScmClass() {
return MercurialSCM.class;
}
}
}
@@ -49,7 +49,7 @@
/**
* Exposes {@link MercurialInstallation} configuration of a {@link MercurialSCMSource} as a {@link SCMSourceTrait}.
*
* @since 3.4.0
* @since 2.0
*/
public class MercurialInstallationSCMSourceTrait extends SCMSourceTrait {
/**
@@ -78,14 +78,14 @@
/**
* {@inheritDoc}
*/
@Override protected <B extends SCMSourceContext<B, R>, R extends SCMSourceRequest> void decorateContext(B context) {
@Override protected void decorateContext(SCMSourceContext<?, ?> context) {
((MercurialSCMSourceContext<?>)context).withInstallation(installation);
}

/**
* {@inheritDoc}
*/
@Override protected <B extends SCMBuilder<B, S>, S extends SCM> void decorateBuilder(B builder) {
@Override protected void decorateBuilder(SCMBuilder<?, ?> builder) {
((MercurialSCMBuilder<?>) builder).withInstallation(installation);
}

@@ -101,11 +101,32 @@
return "Select Mercurial installation";
}

/**
* {@inheritDoc}
*/
@Override public Class<? extends SCMBuilder> getBuilderClass() {
return MercurialSCMBuilder.class;
}

/**
* {@inheritDoc}
*/
@Override public Class<? extends SCMSourceContext> getContextClass() {
return MercurialSCMSourceContext.class;
}

/**
* {@inheritDoc}
*/
@Override public Class<? extends SCM> getScmClass() {
return MercurialSCM.class;
}

/**
* {@inheritDoc}
*/
@Override public boolean isApplicableToBuilder(@Nonnull Class<? extends SCMBuilder> builderClass) {
if (super.isApplicableToBuilder(builderClass) && MercurialSCMBuilder.class.isAssignableFrom(builderClass)) {
if (super.isApplicableToBuilder(builderClass)) {
for (MercurialInstallation i : MercurialInstallation.allInstallations()) {
if (i.isUseCaches()) {
return true;
@@ -119,22 +140,28 @@
* {@inheritDoc}
*/
@Override public boolean isApplicableToContext(@Nonnull Class<? extends SCMSourceContext> contextClass) {
return super.isApplicableToContext(contextClass) && MercurialSCMSourceContext.class
.isAssignableFrom(contextClass);
if (super.isApplicableToContext(contextClass)) {
for (MercurialInstallation i : MercurialInstallation.allInstallations()) {
if (i.isUseCaches()) {
return true;
}
}
}
return false;
}

/**
* {@inheritDoc}
*/
@Override public boolean isApplicableToSCM(@Nonnull Class<? extends SCM> scmClass) {
return super.isApplicableToSCM(scmClass) && MercurialSCM.class.isAssignableFrom(scmClass);
}

/**
* {@inheritDoc}
*/
@Override public boolean isApplicableTo(@Nonnull SCMSource source) {
return super.isApplicableTo(source) && source instanceof MercurialSCMSource;
if (super.isApplicableToSCM(scmClass)) {
for (MercurialInstallation i : MercurialInstallation.allInstallations()) {
if (i.isUseCaches()) {
return true;
}
}
}
return false;
}

/**

0 comments on commit d41c751

Please sign in to comment.
You can’t perform that action at this time.