本文整理了Java中org.shipkit.internal.comparison.ZipComparator
类的一些代码示例,展示了ZipComparator
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZipComparator
类的具体详情如下:
包路径:org.shipkit.internal.comparison.ZipComparator
类名称:ZipComparator
暂无
代码示例来源:origin: gradle.plugin.org.shipkit/shipkit
public Diff areEqual(File previousFile, File currentFile) {
notNull(previousFile, "previous version file to compare", currentFile, "current version file to compare");
return compareZips(previousFile, currentFile);
}
代码示例来源:origin: gradle.plugin.org.shipkit/shipkit
Diff compareZips(File previousFile, File currentFile) {
ZipFile file1 = openZipFile(previousFile.getAbsolutePath());
ZipFile file2 = openZipFile(currentFile.getAbsolutePath());
Set<String> previous = extractEntries(file1);
Set<String> current = extractEntries(file2);
if (!streamsEqual(file1.getInputStream(file1.getEntry(name)), file2.getInputStream(file2
.getEntry(name)))) {
changedFiles.add(name);
代码示例来源: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
if (!streamsEqual(previousFile.getInputStream(previousFile.getEntry(name)),
currentFile.getInputStream(currentFile.getEntry(name)))) {
changedFiles.add(name);
代码示例来源: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
if (!streamsEqual(previousFile.getInputStream(previousFile.getEntry(name)),
currentFile.getInputStream(currentFile.getEntry(name)))) {
changedFiles.add(name);
代码示例来源: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);
}
代码示例来源:origin: org.shipkit/shipkit
public Diff areEqual(File previousFile, File currentFile) {
notNull(previousFile, "previous version file to compare", currentFile, "current version file to compare");
ZipFile previousZip = null;
ZipFile currentZip = null;
try {
previousZip = ZipUtil.openZipFile(previousFile);
currentZip = ZipUtil.openZipFile(currentFile);
return compareZips(previousZip, currentZip);
} finally {
ZipUtil.closeZipFile(previousZip);
ZipUtil.closeZipFile(currentZip);
}
}
代码示例来源:origin: mockito/shipkit
public Diff areEqual(File previousFile, File currentFile) {
notNull(previousFile, "previous version file to compare", currentFile, "current version file to compare");
ZipFile previousZip = null;
ZipFile currentZip = null;
try {
previousZip = ZipUtil.openZipFile(previousFile);
currentZip = ZipUtil.openZipFile(currentFile);
return compareZips(previousZip, currentZip);
} finally {
ZipUtil.closeZipFile(previousZip);
ZipUtil.closeZipFile(currentZip);
}
}
内容来源于网络,如有侵权,请联系作者删除!