Skip to content

Commit

Permalink
Merge pull request #46 from jglick/JEP-200-JENKINS-49574
Browse files Browse the repository at this point in the history
[JENKINS-49574] JEP-200 compatibility
  • Loading branch information
jglick committed Feb 28, 2018
2 parents 25e0d5f + fa4b67c commit b06434d
Show file tree
Hide file tree
Showing 38 changed files with 134 additions and 246 deletions.
2 changes: 2 additions & 0 deletions Jenkinsfile
@@ -0,0 +1,2 @@
// Build the plugin using https://github.com/jenkins-infra/pipeline-library
buildPlugin(jenkinsVersions: [null, '2.107'])
62 changes: 19 additions & 43 deletions pom.xml
Expand Up @@ -4,15 +4,24 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>1.607</version>
<version>3.5</version>
<relativePath />
</parent>

<artifactId>cvs</artifactId>
<version>2.14-SNAPSHOT</version>
<packaging>hpi</packaging>

<name>Jenkins CVS Plug-in</name>
<url>http://wiki.jenkins-ci.org/display/JENKINS/CVS+Plugin</url>
<url>https://wiki.jenkins.io/display/JENKINS/CVS+Plugin</url>

<properties>
<jenkins.version>1.625.3</jenkins.version>
<java.level>7</java.level>
<!-- TODO: Enable once FindBugs issues are fixed -->
<findbugs.failOnError>false</findbugs.failOnError>
</properties>


<developers>
<developer>
Expand All @@ -25,14 +34,6 @@
</developer>
</developers>


<distributionManagement>
<repository>
<id>maven.jenkins-ci.org</id>
<url>https://repo.jenkins-ci.org/releases</url>
</repository>
</distributionManagement>

<scm>
<connection>scm:git:https://github.com/jenkinsci/cvs-plugin.git</connection>
<developerConnection>scm:git:https://github.com/jenkinsci/cvs-plugin.git</developerConnection>
Expand All @@ -46,52 +47,27 @@
<artifactId>cvsclient</artifactId>
<version>71-jenkins-11</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.main</groupId>
<artifactId>jenkins-test-harness</artifactId>
<version>${project.parent.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>subversion</artifactId>
<groupId>org.jvnet.hudson.plugins</groupId>
</exclusion>
</exclusions>

<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
<version>0.9.9</version>
<scope>test</scope>
</dependency>
</dependencies>

<properties>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<project.build.outputEncoding>UTF-8</project.build.outputEncoding>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
<url>http://repo.jenkins-ci.org/public/</url>
<url>https://repo.jenkins-ci.org/public/</url>
</repository>
</repositories>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>


<pluginRepositories>
<pluginRepository>
<id>repo.jenkins-ci.org</id>
<url>http://repo.jenkins-ci.org/public/</url>
<url>https://repo.jenkins-ci.org/public/</url>
</pluginRepository>
</pluginRepositories>
</project>
Expand Down
35 changes: 6 additions & 29 deletions src/main/java/hudson/scm/AbstractCvs.java
Expand Up @@ -36,10 +36,10 @@
import hudson.remoting.VirtualChannel;
import hudson.scm.cvstagging.CvsTagAction;
import hudson.util.Secret;
import jenkins.MasterToSlaveFileCallable;
import jenkins.scm.cvs.QuietPeriodCompleted;

import org.apache.commons.io.output.DeferredFileOutputStream;
import org.jenkinsci.remoting.RoleChecker;
import org.netbeans.lib.cvsclient.CVSRoot;
import org.netbeans.lib.cvsclient.Client;
import org.netbeans.lib.cvsclient.admin.AdminHandler;
Expand Down Expand Up @@ -254,7 +254,7 @@ private boolean perform(final Command cvsCommand, final FilePath workspace, fina
final GlobalOptions globalOptions = getGlobalOptions(repository, envVars);


if (!workspace.act(new FilePath.FileCallable<Boolean>() {
if (!workspace.act(new MasterToSlaveFileCallable<Boolean>() {

private static final long serialVersionUID = -7517978923721181408L;

Expand Down Expand Up @@ -307,11 +307,6 @@ public Boolean invoke(final File workspace, final VirtualChannel channel) throws
}
}

@Override
public void checkRoles(RoleChecker checker)
throws SecurityException {
// Do nothing
}
})) {
listener.error("Cvs task failed");
return false;
Expand Down Expand Up @@ -472,7 +467,7 @@ public boolean isDisableCvsQuiet() {
* (so we can get the current workspace state), this method should never be
* called. Just for safety, we get the action and return it.
*
* @see {@link SCM#calcRevisionsFromBuild(hudson.model.AbstractBuild, hudson.Launcher, TaskListener)}
* @see SCM#calcRevisionsFromBuild(hudson.model.AbstractBuild, hudson.Launcher, TaskListener)
*/
@Override
public SCMRevisionState calcRevisionsFromBuild(final AbstractBuild<?, ?> build, final Launcher launcher,
Expand Down Expand Up @@ -690,17 +685,11 @@ private CvsChangeSet getRemoteLogForModule(final CvsRepository repository, final
return executeRlog(cvsClient, rlogCommand, listener, encoding, globalOptions, repository, envVars, item.getLocation());
}
else {
return workspace.act(new FilePath.FileCallable<CvsChangeSet>() {
return workspace.act(new MasterToSlaveFileCallable<CvsChangeSet>() {
@Override
public CvsChangeSet invoke(File file, VirtualChannel virtualChannel) throws IOException, InterruptedException {
return executeRlog(cvsClient, rlogCommand, listener, encoding, globalOptions, repository, envVars, item.getLocation());
}

@Override
public void checkRoles(RoleChecker checker)
throws SecurityException {
// Do nothing
}
});
}

Expand Down Expand Up @@ -852,7 +841,7 @@ protected void postCheckout(Run<?, ?> build, File changelogFile, CvsRepository[]
for (final CvsRepositoryItem repositoryItem : repository.getRepositoryItems()) {
for (final CvsModule module : repositoryItem.getModules()) {
FilePath target = (flatten ? workspace : workspace.child(module.getCheckoutName()));
target.act(new FilePath.FileCallable<Void>() {
target.act(new MasterToSlaveFileCallable<Void>() {
@Override
public Void invoke(File module, VirtualChannel virtualChannel) throws IOException, InterruptedException {
final AdminHandler adminHandler = new StandardAdminHandler();
Expand All @@ -862,12 +851,6 @@ public Void invoke(File module, VirtualChannel virtualChannel) throws IOExceptio
return null;
}

@Override
public void checkRoles(RoleChecker checker)
throws SecurityException {
// Do nothing
}

private void cleanup(File directory, AdminHandler adminHandler) throws IOException {
for (File file : adminHandler.getAllFiles(directory)) {
Entry entry = adminHandler.getEntry(file);
Expand Down Expand Up @@ -974,7 +957,7 @@ private List<CvsFile> getCvsFiles(final FilePath workspace, final CvsModule modu
targetWorkspace = workspace.child(envVars.expand(module.getCheckoutName()));
}

return targetWorkspace.act(new FilePath.FileCallable<List<CvsFile>>() {
return targetWorkspace.act(new MasterToSlaveFileCallable<List<CvsFile>>() {

private static final long serialVersionUID = 8158155902777163137L;

Expand All @@ -990,12 +973,6 @@ public List<CvsFile> invoke(final File moduleLocation, final VirtualChannel chan
return buildFileList(moduleLocation, envVars.expand(module.getRemoteName()));
}

@Override
public void checkRoles(RoleChecker checker)
throws SecurityException {
// Do nothing
}

public List<CvsFile> buildFileList(final File moduleLocation, final String prefix) throws IOException {
AdminHandler adminHandler = new StandardAdminHandler();
List<CvsFile> fileList = new ArrayList<CvsFile>();
Expand Down

0 comments on commit b06434d

Please sign in to comment.