1 package hudson.scm; 2 3 import hudson.ExtensionPoint; 4 import hudson.FilePath; 5 import hudson.Launcher; 6 import hudson.model.AbstractBuild; 7 import hudson.model.AbstractProject; 8 import hudson.model.BuildListener; 9 import hudson.model.Describable; 10 import hudson.model.TaskListener; 11 12 import java.io.File ; 13 import java.io.IOException ; 14 import java.io.FileWriter ; 15 import java.util.Map ; 16 17 26 public abstract class SCM implements Describable<SCM>, ExtensionPoint { 27 28 50 public abstract boolean pollChanges(AbstractProject project, Launcher launcher, FilePath workspace, TaskListener listener) throws IOException , InterruptedException ; 51 52 80 public abstract boolean checkout(AbstractBuild build, Launcher launcher, FilePath workspace, BuildListener listener, File changelogFile) throws IOException , InterruptedException ; 81 82 88 public abstract boolean checkout(Launcher launcher, FilePath workspace, TaskListener listener) throws IOException , InterruptedException ; 89 90 93 public abstract void buildEnvVars(Map <String ,String > env); 94 95 99 public abstract FilePath getModuleRoot(FilePath workspace); 100 101 104 public abstract ChangeLogParser createChangeLogParser(); 105 106 protected final boolean createEmptyChangeLog(File changelogFile, BuildListener listener, String rootTag) { 107 try { 108 FileWriter w = new FileWriter (changelogFile); 109 w.write("<"+rootTag +"/>"); 110 w.close(); 111 return true; 112 } catch (IOException e) { 113 e.printStackTrace(listener.error(e.getMessage())); 114 return false; 115 } 116 } 117 118 protected final String nullify(String s) { 119 if(s==null) return null; 120 if(s.trim().length()==0) return null; 121 return s; 122 } 123 } 124 | Popular Tags |