org.shipkit.internal.comparison.ZipComparator.areEqual()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(4.3k)|赞(0)|评价(0)|浏览(107)

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

ZipComparator.areEqual介绍

暂无

代码示例

代码示例来源:origin: gradle.plugin.org.shipkit/shipkit

@TaskAction public void comparePublications() {
  if(previousVersion == null){
    getLogger().lifecycle("{} - previousVersion is not set, nothing to compare", getPath());
    publicationsEqual = false;
    return;
  }
  GenerateMavenPom pomTask = (GenerateMavenPom) getProject().getTasks().getByName(pomTaskName);
  //TODO let's add decent validation and descriptive error messages to the user
  assert pomTask.getDestination().isFile();
  assert sourcesJar.getArchivePath().isFile();
  File currentVersionPomFile = pomTask.getDestination();
  File currentVersionSourcesJarFile = sourcesJar.getArchivePath();
  getLogger().lifecycle("{} - about to compare publications, for versions {} and {}",
        getPath(), previousVersion, currentVersion);
  PomComparator pomComparator = new PomComparator(projectGroup, previousVersion, currentVersion);
  Diff pomsDiff = pomComparator.areEqual(previousVersionPomFile, currentVersionPomFile);
  getLogger().lifecycle("{} - pom files equal: {}", getPath(), pomsDiff.areFilesEqual());
  ZipComparator sourcesJarComparator = new ZipComparator();
  Diff jarsDiff = sourcesJarComparator.areEqual(previousVersionSourcesJarFile, currentVersionSourcesJarFile);
  getLogger().lifecycle("{} - source jars equal: {}", getPath(), jarsDiff.areFilesEqual());
  differences.add(jarsDiff);
  differences.add(pomsDiff);
  this.publicationsEqual = jarsDiff.areFilesEqual() && pomsDiff.areFilesEqual();
}

代码示例来源:origin: org.shipkit/shipkit

public void comparePublications(ComparePublicationsTask task) {
  if (!task.getPreviousSourcesJar().exists()) {
    LOG.lifecycle("{} - previous publications not found, nothing to compare, skipping", task.getPath());
    return;
  }
  //TODO let's add decent validation and descriptive error messages to the user
  assert task.getSourcesJar().getArchivePath().isFile();
  File currentVersionSourcesJarFile = task.getSourcesJar().getArchivePath();
  LOG.lifecycle("{} - about to compare publications",
      task.getPath());
  Diff depInfoDiff = getDependencyInfoDiff(task, currentVersionSourcesJarFile);
  LOG.lifecycle("{} - {} files equal: {}", task.getPath(), DEPENDENCY_INFO_FILEPATH, depInfoDiff.areFilesEqual());
  ZipComparator sourcesJarComparator = new ZipComparator();
  Diff jarsDiff = sourcesJarComparator.areEqual(task.getPreviousSourcesJar(), currentVersionSourcesJarFile);
  LOG.lifecycle("{} - source jars equal: {}", task.getPath(), jarsDiff.areFilesEqual());
  String comparisonResult = new ComparePublicationsResultFormatter().formatResults(
    task.getPreviousSourcesJar(), currentVersionSourcesJarFile, jarsDiff, depInfoDiff);
  LOG.lifecycle("{} - You can find detailed publication comparison results in file {}.", task.getPath(), task.getComparisonResult());
  IOUtil.writeFile(task.getComparisonResult(), comparisonResult);
}

代码示例来源:origin: mockito/shipkit

public void comparePublications(ComparePublicationsTask task) {
  if (!task.getPreviousSourcesJar().exists()) {
    LOG.lifecycle("{} - previous publications not found, nothing to compare, skipping", task.getPath());
    return;
  }
  //TODO let's add decent validation and descriptive error messages to the user
  assert task.getSourcesJar().getArchivePath().isFile();
  File currentVersionSourcesJarFile = task.getSourcesJar().getArchivePath();
  LOG.lifecycle("{} - about to compare publications",
      task.getPath());
  Diff depInfoDiff = getDependencyInfoDiff(task, currentVersionSourcesJarFile);
  LOG.lifecycle("{} - {} files equal: {}", task.getPath(), DEPENDENCY_INFO_FILEPATH, depInfoDiff.areFilesEqual());
  ZipComparator sourcesJarComparator = new ZipComparator();
  Diff jarsDiff = sourcesJarComparator.areEqual(task.getPreviousSourcesJar(), currentVersionSourcesJarFile);
  LOG.lifecycle("{} - source jars equal: {}", task.getPath(), jarsDiff.areFilesEqual());
  String comparisonResult = new ComparePublicationsResultFormatter().formatResults(
    task.getPreviousSourcesJar(), currentVersionSourcesJarFile, jarsDiff, depInfoDiff);
  LOG.lifecycle("{} - You can find detailed publication comparison results in file {}.", task.getPath(), task.getComparisonResult());
  IOUtil.writeFile(task.getComparisonResult(), comparisonResult);
}

相关文章