hudson.FilePath.equals()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(3.7k)|赞(0)|评价(0)|浏览(143)

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

FilePath.equals介绍

暂无

代码示例

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

/**
   * To be kept in sync with {@link FileVF#computeRelativePathToRoot()}
   */
  private String computeRelativePathToRoot(){
    if (this.root.equals(this.f)) {
      return "";
    }
    LinkedList<String> relativePath = new LinkedList<>();
    FilePath current = this.f;
    while (current != null && !current.equals(this.root)) {
      relativePath.addFirst(current.getName());
      current = current.getParent();
    }
    return String.join(File.separator, relativePath) + File.separator;
  }
}

代码示例来源:origin: awslabs/aws-codedeploy-plugin

private boolean isSubDirectory(FilePath parent, FilePath child) {
  FilePath parentFolder = child;
  while (parentFolder!=null) {
    if (parent.equals(parentFolder)) {
      return true;
    }
    parentFolder = parentFolder.getParent();
  }
  return false;
}

代码示例来源:origin: jenkinsci/gradle-plugin

private List<FilePath> getPossibleWrapperLocations(AbstractBuild<?, ?> build, Launcher launcher, VariableResolver<String> resolver, FilePath normalizedRootBuildScriptDir) throws IOException, InterruptedException {
  FilePath moduleRoot = build.getModuleRoot();
  if (wrapperLocation != null && wrapperLocation.trim().length() != 0) {
    // Override with provided relative path to gradlew
    String wrapperLocationNormalized = wrapperLocation.trim().replaceAll("[\t\r\n]+", "");
    wrapperLocationNormalized = Util.replaceMacro(wrapperLocationNormalized.trim(), resolver);
    return ImmutableList.of(new FilePath(moduleRoot, wrapperLocationNormalized));
  } else if (buildFile != null && !buildFile.isEmpty()) {
    // Check if the target project is located not at the root dir
    FilePath parentOfBuildFile = new FilePath(normalizedRootBuildScriptDir == null ? moduleRoot : normalizedRootBuildScriptDir, buildFile).getParent();
    if (parentOfBuildFile != null && !parentOfBuildFile.equals(moduleRoot)) {
      return ImmutableList.of(parentOfBuildFile, moduleRoot);
    }
  }
  return ImmutableList.of(moduleRoot);
}

代码示例来源:origin: jenkinsci/email-ext-plugin

@Override
  public Boolean invoke(File parent, VirtualChannel channel) throws IOException, InterruptedException {
    if (potentialChild.isRemote()) {
      //Not on the same machine so can't be a child of the local file
      return false;
    }
    FilePath test = potentialChild.getParent();
    FilePath target = new FilePath(parent);
    while(test != null && !target.equals(test)) {
      test = test.getParent();
    }
    return target.equals(test);
  }
}

代码示例来源:origin: org.jenkins-ci.lib/xtrigger-lib

if (lastBuildOnNode != null && nodeRootPath.equals(lastBuildOnNode.getRootPath())) {
  result.add(0, node);
} else {

代码示例来源:origin: org.jenkins-ci.plugins.workflow/workflow-durable-task-step

@SuppressFBWarnings(value="RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE", justification="TODO 1.653+ switch to Jenkins.getInstanceOrNull")
@Override protected WorkspaceList.Lease tryResolve() throws InterruptedException {
  Jenkins j = Jenkins.getInstance();
  if (j == null) {
    return null;
  }
  // FilePathUtils.find not useful here since we need c anyway, and cannot easily return a tuple
  // (could call toComputer on result but then we iterate computers twice, a possible race condition)
  Computer c = j.getComputer(slave);
  if (c == null) {
    return null;
  }
  VirtualChannel ch = c.getChannel();
  if (ch == null) {
    return null;
  }
  FilePath fp = new FilePath(ch, path);
  // Since there is no equivalent to Lock.tryLock for WorkspaceList (.record would work but throws AssertionError and swaps the holder):
  WorkspaceList.Lease lease = c.getWorkspaceList().allocate(fp);
  if (lease.path.equals(fp)) {
    return lease;
  } else { // @2 or other variant, not what we expected to be able to lock without contention
    lease.release();
    throw new IllegalStateException("JENKINS-37121: something already locked " + fp);
  }
}
@Override public String toString() {

相关文章