hudson.model.AbstractProject.getScm()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(8.0k)|赞(0)|评价(0)|浏览(121)

本文整理了Java中hudson.model.AbstractProject.getScm()方法的一些代码示例,展示了AbstractProject.getScm()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AbstractProject.getScm()方法的具体详情如下:
包路径:hudson.model.AbstractProject
类名称:AbstractProject
方法名:getScm

AbstractProject.getScm介绍

暂无

代码示例

代码示例来源:origin: jenkinsci/jenkins

private static RepositoryBrowser<?> browserFromBuild(AbstractBuild<?,?> build) {
  if (build == null) { // not generally allowed, but sometimes done in unit tests
    return null;
  }
  return build.getParent().getScm().getEffectiveBrowser();
}

代码示例来源:origin: jenkinsci/jenkins

@Deprecated
public void onChangeLogParsed(AbstractBuild<?,?> build, BuildListener listener, ChangeLogSet<?> changelog) throws Exception {
  if (Util.isOverridden(SCMListener.class, getClass(), "onChangeLogParsed", Run.class, SCM.class, TaskListener.class, ChangeLogSet.class)) {
    onChangeLogParsed((Run) build, build.getProject().getScm(), listener, changelog);
  }
}

代码示例来源:origin: jenkinsci/jenkins

@Override public Collection<? extends SCM> getSCMs() {
    return resolveMultiScmIfConfigured(delegate.asProject().getScm());
  }
}

代码示例来源:origin: jenkinsci/jenkins

@Deprecated
  public ChangeLogSet<? extends Entry> parse(AbstractBuild build, File changelogFile) throws IOException, SAXException {
    return parse((Run) build, build.getProject().getScm().getEffectiveBrowser(), changelogFile);
  }
}

代码示例来源:origin: jenkinsci/jenkins

/**
 * Returns the root directory of the checked-out module.
 * <p>
 * This is usually where {@code pom.xml}, {@code build.xml}
 * and so on exists.
 */
public final FilePath getModuleRoot() {
  FilePath ws = getWorkspace();
  if (ws==null)    return null;
  return getParent().getScm().getModuleRoot(ws, this);
}

代码示例来源:origin: jenkinsci/jenkins

/**
 * Returns the root directories of all checked-out modules.
 * <p>
 * Some SCMs support checking out multiple modules into the same workspace.
 * In these cases, the returned array will have a length greater than one.
 * @return The roots of all modules checked out from the SCM.
 */
public FilePath[] getModuleRoots() {
  FilePath ws = getWorkspace();
  if (ws==null)    return null;
  return getParent().getScm().getModuleRoots(ws, this);
}

代码示例来源:origin: jenkinsci/jenkins

/**
 * Pushes the baseline up to the newly checked out revision.
 */
private void calcPollingBaseline(AbstractBuild build, Launcher launcher, TaskListener listener) throws IOException, InterruptedException {
  SCMRevisionState baseline = build.getAction(SCMRevisionState.class);
  if (baseline==null) {
    try {
      baseline = getScm().calcRevisionsFromBuild(build, launcher, listener);
    } catch (AbstractMethodError e) {
      baseline = SCMRevisionState.NONE; // pre-1.345 SCM implementations, which doesn't use the baseline in polling
    }
    if (baseline!=null)
      build.addAction(baseline);
  }
  pollingBaseline = baseline;
}

代码示例来源:origin: jenkinsci/jenkins

if(!p.getScm().processWorkspaceBeforeDeletion((Job<?, ?>) p,dir,n)) {
  LOGGER.log(Level.FINE, "Directory deletion of {0} is vetoed by SCM", dir);
  return false;

代码示例来源:origin: jenkinsci/jenkins

/**
   * Picks up a {@link RepositoryBrowser} that matches the
   * given {@link SCM} from existing other jobs.
   *
   * @return
   *      null if no applicable configuration was found.
   */
  private RepositoryBrowser infer() {
    for( AbstractProject p : Jenkins.getInstance().allItems(AbstractProject.class) ) {
      SCM scm = p.getScm();
      if (scm!=null && scm.getClass()==owner.getClass() && scm.getBrowser()!=null &&
          ((SCMDescriptor)scm.getDescriptor()).isBrowserReusable(scm,owner)) {
        return scm.getBrowser();
      }
    }
    return null;
  }
}

代码示例来源:origin: jenkinsci/jenkins

public boolean checkout(AbstractBuild build, Launcher launcher, BuildListener listener, File changelogFile) throws IOException, InterruptedException {
  SCM scm = getScm();
  if(scm==null)
    return true;    // no SCM
  FilePath workspace = build.getWorkspace();
  if(workspace!=null){
    workspace.mkdirs();
  } else {
    throw new AbortException("Cannot checkout SCM, workspace is not defined");
  }
  boolean r = scm.checkout(build, launcher, workspace, listener, changelogFile);
  if (r) {
    // Only calcRevisionsFromBuild if checkout was successful. Note that modern SCM implementations
    // won't reach this line anyway, as they throw AbortExceptions on checkout failure.
    calcPollingBaseline(build, launcher, listener);
  }
  return r;
}

代码示例来源:origin: jenkinsci/jenkins

@Override
protected void performDelete() throws IOException, InterruptedException {
  // prevent a new build while a delete operation is in progress
  makeDisabled(true);
  FilePath ws = getWorkspace();
  if(ws!=null) {
    Node on = getLastBuiltOn();
    getScm().processWorkspaceBeforeDeletion(this, ws, on);
    if(on!=null)
      on.getFileSystemProvisioner().discardWorkspace(this,ws);
  }
  super.performDelete();
}

代码示例来源:origin: jenkinsci/jenkins

SCM scm = getScm();
if (scm==null) {
  listener.getLogger().println(Messages.AbstractProject_NoSCM());

代码示例来源:origin: jenkinsci/jenkins

@Override
public EnvVars getEnvironment(TaskListener log) throws IOException, InterruptedException {
  EnvVars env = super.getEnvironment(log);
  FilePath ws = getWorkspace();
  if (ws!=null)   // if this is done very early on in the build, workspace may not be decided yet. see HUDSON-3997
    env.put("WORKSPACE", ws.getRemote());
  project.getScm().buildEnvVars(this,env);
  if (buildEnvironments!=null)
    for (Environment e : buildEnvironments)
      e.buildEnvVars(env);
  for (EnvironmentContributingAction a : getActions(EnvironmentContributingAction.class))
    a.buildEnvVars(this,env);
  EnvVars.resolve(env);
  return env;
}

代码示例来源:origin: jenkinsci/jenkins

/**
 * Wipes out the workspace.
 */
@RequirePOST
public HttpResponse doDoWipeOutWorkspace() throws IOException, ServletException, InterruptedException {
  checkPermission(Functions.isWipeOutPermissionEnabled() ? WIPEOUT : BUILD);
  R b = getSomeBuildWithWorkspace();
  FilePath ws = b!=null ? b.getWorkspace() : null;
  if (ws!=null && getScm().processWorkspaceBeforeDeletion(this, ws, b.getBuiltOn())) {
    ws.deleteRecursive();
    for (WorkspaceListener wl : WorkspaceListener.all()) {
      wl.afterDelete(this);
    }
    return new HttpRedirect(".");
  } else {
    // If we get here, that means the SCM blocked the workspace deletion.
    return new ForwardToView(this,"wipeOutWorkspaceBlocked.jelly");
  }
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

/**
 * For reasons I don't understand, if I inline this method,
 * AbstractMethodError escapes try/catch block.
 */
private SCMRevisionState safeCalcRevisionsFromBuild(AbstractBuild build, Launcher launcher, TaskListener listener) throws IOException, InterruptedException {
  return getScm()._calcRevisionsFromBuild(build, launcher, listener);
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

/**
 * Returns the root directory of the checked-out module.
 * <p>
 * This is usually where <tt>pom.xml</tt>, <tt>build.xml</tt>
 * and so on exists.
 */
public final FilePath getModuleRoot() {
  FilePath ws = getWorkspace();
  if (ws==null)    return null;
  return getParent().getScm().getModuleRoot(ws,this);
}

代码示例来源:origin: org.hudsonci.plugins/git

private boolean isCreateAccountBaseOnCommitterEmail() {
  ChangeLogSet parent = getParent();
  boolean createAccountBaseOnCommitterEmail = false;
  if (parent != null) {
    SCM scm = parent.getBuild().getProject().getScm();
    if (scm instanceof GitSCM) {
      createAccountBaseOnCommitterEmail = ((GitSCM) parent.getBuild().getProject().getScm()).
          isCreateAccountBaseOnCommitterEmail();
    }
  }
  return createAccountBaseOnCommitterEmail;
}

代码示例来源:origin: org.eclipse.hudson/hudson-core

public boolean checkout(AbstractBuild build, Launcher launcher, BuildListener listener, File changelogFile) throws IOException, InterruptedException {
  SCM scm = getScm();
  if (scm == null) {
    return true;    // no SCM
  }
  FilePath workspace = build.getWorkspace();
  workspace.mkdirs();
  boolean r = scm.checkout(build, launcher, workspace, listener, changelogFile);
  calcPollingBaseline(build, launcher, listener);
  return r;
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

public boolean checkout(AbstractBuild build, Launcher launcher, BuildListener listener, File changelogFile) throws IOException, InterruptedException {
  SCM scm = getScm();
  if (scm == null) {
    return true;    // no SCM
  }
  FilePath workspace = build.getWorkspace();
  workspace.mkdirs();
  boolean r = scm.checkout(build, launcher, workspace, listener, changelogFile);
  calcPollingBaseline(build, launcher, listener);
  return r;
}

代码示例来源:origin: org.eclipse.hudson/hudson-core

public boolean cleanWorkspace() throws IOException, InterruptedException {
  checkPermission(BUILD);
  R b = getSomeBuildWithWorkspace();
  FilePath ws = b != null ? b.getWorkspace() : null;
  if (ws != null && getScm().processWorkspaceBeforeDeletion(this, ws, b.getBuiltOn())) {
    ws.deleteRecursive();
    return true;
  } else {
    // If we get here, that means the SCM blocked the workspace deletion.
    return false;
  }
}

相关文章

微信公众号

最新文章

更多

AbstractProject类方法