Skip to content

Commit

Permalink
tfs: add pipeline support
Browse files Browse the repository at this point in the history
Follow the guide on https://github.com/jenkinsci/pipeline-plugin/blob/master/DEVGUIDE.md.

Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
  • Loading branch information
Alejandro del Castillo committed Oct 16, 2017
1 parent 4b4198e commit f585335
Show file tree
Hide file tree
Showing 6 changed files with 225 additions and 149 deletions.
19 changes: 10 additions & 9 deletions tfs/src/main/java/hudson/plugins/tfs/ChangeSetReader.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//CHECKSTYLE:OFF
package hudson.plugins.tfs;

import java.io.File;
Expand All @@ -10,30 +9,32 @@
import java.util.ArrayList;
import java.util.List;

import hudson.model.Run;
import hudson.scm.RepositoryBrowser;
import org.apache.commons.digester.Digester;
import org.xml.sax.SAXException;

import hudson.model.AbstractBuild;
import hudson.plugins.tfs.model.ChangeLogSet;
import hudson.plugins.tfs.model.ChangeSet;
import hudson.scm.ChangeLogParser;
import hudson.util.Digester2;

/**
* TeamFoundation change log reader.
*
*
* @author Erik Ramfelt
*/
*/
public class ChangeSetReader extends ChangeLogParser {

@Override
public ChangeLogSet parse(AbstractBuild build, File changelogFile) throws IOException, SAXException {
public ChangeLogSet parse(final Run build, final RepositoryBrowser<?> browser, final File changelogFile) throws IOException, SAXException {
try (FileInputStream stream = new FileInputStream(changelogFile); Reader reader = new InputStreamReader(stream, Charset.defaultCharset())) {
return parse(build, reader);
return parse(build, browser, reader);
}
}

public ChangeLogSet parse(AbstractBuild<?,?> build, Reader reader) throws IOException, SAXException {
/** Performs the actual parsing. */
public ChangeLogSet parse(final Run build, final RepositoryBrowser<?> browser, final Reader reader) throws IOException, SAXException {
List<ChangeSet> changesetList = new ArrayList<ChangeSet>();
Digester digester = new Digester2();
digester.push(changesetList);
Expand All @@ -50,9 +51,9 @@ public ChangeLogSet parse(AbstractBuild<?,?> build, Reader reader) throws IOExce
digester.addSetProperties("*/changeset/items/item");
digester.addBeanPropertySetter("*/changeset/items/item", "path");
digester.addSetNext("*/changeset/items/item", "add");

digester.parse(reader);

return new ChangeLogSet(build, changesetList);
return new ChangeLogSet(build, browser, changesetList);
}
}
Loading

0 comments on commit f585335

Please sign in to comment.