/** * Compares the two given archives. * * @param oldArchive the old version of the archive * @param newArchive the new version of the archive * @return a list which contains one instance of {@link japicmp.model.JApiClass} for each class found in one of the two archives * @throws JApiCmpException if the comparison fails */ public List<JApiClass> compare(JApiCmpArchive oldArchive, JApiCmpArchive newArchive) { return compare(Collections.singletonList(oldArchive), Collections.singletonList(newArchive)); }
private String setupClasspath(ClassPool classPool, List<String> classPathEntries) { String classPathAsString = appendUserDefinedClassPathEntries(classPool, classPathEntries); return appendSystemClassPath(classPool, classPathAsString); }
@Override public void execute() { if (oldJar == null) { throw new BuildException("Path to old jar must be specified using the oldjar attribute."); } if (newJar == null) { throw new BuildException("Path to new jar must be specified using the newjar attribute."); } Options options = createOptionsFromAntAttrs(); JarArchiveComparator jarArchiveComparator = new JarArchiveComparator(JarArchiveComparatorOptions.of(options)); List<JApiClass> jApiClasses = jarArchiveComparator.compare(options.getOldArchives(), options.getNewArchives()); generateOutput(options, jApiClasses, jarArchiveComparator); }
@Override public void run() { JarArchiveComparatorOptions comparatorOptions = createOptions(); JarArchiveComparator jarArchiveComparator = new JarArchiveComparator(comparatorOptions); generateOutput(jarArchiveComparator); }
/** * Compares the two lists with CtClass objects using the provided options instance. * * @param options the options to use * @param oldClasses a list of CtClasses that represent the old version * @param newClasses a list of CtClasses that represent the new version * @return a list of {@link japicmp.model.JApiClass} that represent the changes */ List<JApiClass> compareClassLists(JarArchiveComparatorOptions options, List<CtClass> oldClasses, List<CtClass> newClasses) { List<CtClass> oldClassesFiltered = applyFilter(options, oldClasses); List<CtClass> newClassesFiltered = applyFilter(options, newClasses); ClassesComparator classesComparator = new ClassesComparator(this, options); classesComparator.compare(oldClassesFiltered, newClassesFiltered); List<JApiClass> classList = classesComparator.getClasses(); if (LOGGER.isLoggable(Level.FINE)) { for (JApiClass jApiClass : classList) { LOGGER.fine(jApiClass.toString()); } } checkBinaryCompatibility(classList); checkJavaObjectSerializationCompatibility(classList); OutputFilter.sortClassesAndMethods(classList); return classList; }
public void run(String[] args) { CliParser cliParser = new CliParser(); Options options = cliParser.parse(args); if (options.isHelpRequested()) { CliParser.printHelp(); return; } JarArchiveComparator jarArchiveComparator = new JarArchiveComparator(JarArchiveComparatorOptions.of(options)); List<JApiClass> jApiClasses = jarArchiveComparator.compare(options.getOldArchives(), options.getNewArchives()); generateOutput(options, jApiClasses, jarArchiveComparator); }
/** * Compares the two lists with CtClass objects using the provided options instance. * * @param options the options to use * @param oldClasses a list of CtClasses that represent the old version * @param newClasses a list of CtClasses that represent the new version * @return a list of {@link japicmp.model.JApiClass} that represent the changes */ List<JApiClass> compareClassLists(JarArchiveComparatorOptions options, List<CtClass> oldClasses, List<CtClass> newClasses) { List<CtClass> oldClassesFiltered = applyFilter(options, oldClasses); List<CtClass> newClassesFiltered = applyFilter(options, newClasses); ClassesComparator classesComparator = new ClassesComparator(this, options); classesComparator.compare(oldClassesFiltered, newClassesFiltered); List<JApiClass> classList = classesComparator.getClasses(); if (LOGGER.isLoggable(Level.FINE)) { for (JApiClass jApiClass : classList) { LOGGER.fine(jApiClass.toString()); } } checkBinaryCompatibility(classList); checkJavaObjectSerializationCompatibility(classList); OutputFilter.sortClassesAndMethods(classList); return classList; }
public void run(String[] args) { CliParser cliParser = new CliParser(); Options options = cliParser.parse(args); if (options.isHelpRequested()) { CliParser.printHelp(); return; } JarArchiveComparator jarArchiveComparator = new JarArchiveComparator(JarArchiveComparatorOptions.of(options)); List<JApiClass> jApiClasses = jarArchiveComparator.compare(options.getOldArchives(), options.getNewArchives()); generateOutput(options, jApiClasses, jarArchiveComparator); }
/** * Compares the two given archives. * * @param oldArchive the old version of the archive * @param newArchive the new version of the archive * @return a list which contains one instance of {@link japicmp.model.JApiClass} for each class found in one of the two archives * @throws JApiCmpException if the comparison fails */ public List<JApiClass> compare(JApiCmpArchive oldArchive, JApiCmpArchive newArchive) { return compare(Collections.singletonList(oldArchive), Collections.singletonList(newArchive)); }
private String setupClasspath(ClassPool classPool, List<String> classPathEntries) { String classPathAsString = appendUserDefinedClassPathEntries(classPool, classPathEntries); return appendSystemClassPath(classPool, classPathAsString); }
setUpClassPath(comparatorOptions, pluginParameters, mavenParameters); setUpOverrideCompatibilityChanges(comparatorOptions, pluginParameters); JarArchiveComparator jarArchiveComparator = new JarArchiveComparator(comparatorOptions); if (options.getNewArchives().isEmpty()) { getLog().warn("Skipping execution because no new version could be resolved/found."); return Optional.absent(); List<JApiClass> jApiClasses = jarArchiveComparator.compare(options.getOldArchives(), options.getNewArchives()); try { jApiClasses = applyPostAnalysisScript(pluginParameters.getParameterParam(), jApiClasses);
final List<JApiCmpArchive> baseline = toJapiCmpArchives(oldArchives); final List<JApiCmpArchive> current = toJapiCmpArchives(newArchives); List<JApiClass> jApiClasses = jarArchiveComparator.compare(baseline, current); options.setOutputOnlyModifications(onlyModified); options.setOutputOnlyBinaryIncompatibleModifications(onlyBinaryIncompatibleModified);