use of org.evosuite.jenkins.scm.Mercurial in project evosuite by EvoSuite.
the class EvoSuiteRecorder method perform.
@Override
public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
if (build.getResult().isWorseThan(Result.SUCCESS)) {
listener.getLogger().println(EvoSuiteRecorder.LOG_PREFIX + "Build did not succeed, so no test case generation by EvoSuite will occur.");
return true;
}
AbstractMavenProject<?, ?> project = ((AbstractMavenProject<?, ?>) build.getProject());
ProjectAction projectAction = new ProjectAction(project);
projectAction.perform(project, build, listener);
BuildAction build_action = new BuildAction(build, projectAction);
build.addAction(build_action);
if (this.disableAutoCommit) {
return true;
}
SCM scm = project.getScm();
if (scm == null) {
listener.getLogger().println(EvoSuiteRecorder.LOG_PREFIX + "Project '" + project.getName() + "' has no Source-Control-Management (SCM) defined.");
return true;
}
org.evosuite.jenkins.scm.SCM scmWrapper = null;
if (scm instanceof MercurialSCM) {
scmWrapper = new Mercurial((MercurialSCM) scm, project, build, launcher, listener);
} else if (scm instanceof GitSCM) {
scmWrapper = new Git((GitSCM) scm, build, listener);
} else {
listener.getLogger().println(EvoSuiteRecorder.LOG_PREFIX + "SCM of type " + scm.getType() + " not supported!");
return true;
}
assert scmWrapper != null;
// perform commit action
int number_of_files_committed = scmWrapper.commit(project, build, listener, this.branchName, this.ctgBestsDir);
if (number_of_files_committed == -1) {
return false;
}
if (!this.disableAutoPush && number_of_files_committed > 0) {
if (!scmWrapper.push(build, listener, this.branchName)) {
return false;
}
}
return true;
}
Aggregations