This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to annotated tag japicmp-base-0.1.0 in repository https://gitbox.apache.org/repos/asf/commons-vfs.git
commit 761f276fca683df8e42e0e0670310940331fdc29 Merge: 3111346 2f3b431 Author: siom79 <[email protected]> AuthorDate: Sun Jun 22 00:26:03 2014 +0200 Merged development branch to master .gitignore | 1 + LICENSE | 382 ++++++++++----------- README.md | 67 +++- japicmp-maven-plugin/pom.xml | 87 +++++ .../main/java/japicmp/maven/ConfigurationFile.java | 13 + .../src/main/java/japicmp/maven/Dependency.java | 31 ++ .../src/main/java/japicmp/maven/JApiCmpMojo.java | 259 ++++++++++++++ .../src/main/java/japicmp/maven/Parameter.java | 49 +++ .../src/main/java/japicmp/maven/Version.java | 22 ++ japicmp-testbase/japicmp-test-maven-plugin/pom.xml | 62 ++++ japicmp-testbase/japicmp-test-v1/pom.xml | 20 +- .../src/main/java/japicmp/test/Modifier.java | 24 +- .../src/main/java/japicmp/test/Removed.java | 8 +- .../src/main/java/japicmp/test/Unchanged.java | 16 +- .../java/japicmp/test/packageOne/PackageOne.java | 8 +- .../java/japicmp/test/packageTwo/PackageTwo.java | 8 +- japicmp-testbase/japicmp-test-v2/pom.xml | 52 ++- .../src/main/java/japicmp/test/Added.java | 8 +- .../src/main/java/japicmp/test/Modifier.java | 24 +- .../src/main/java/japicmp/test/Unchanged.java | 16 +- .../java/japicmp/test/packageOne/PackageOne.java | 8 +- .../java/japicmp/test/packageTwo/PackageTwo.java | 8 +- japicmp-testbase/japicmp-test/pom.xml | 144 ++++---- .../src/test/java/japicmp/test/BasicTest.java | 72 ++-- .../src/test/java/japicmp/test/ModifierTest.java | 88 ++--- .../test/java/japicmp/test/PackageFilterTest.java | 192 +++++------ .../src/test/java/japicmp/test/util/Helper.java | 64 ++-- japicmp-testbase/pom.xml | 35 +- japicmp/pom.xml | 148 ++++---- japicmp/src/main/java/japicmp/JApiCmp.java | 200 +++++------ japicmp/src/main/java/japicmp/cli/CliParser.java | 208 +++++------ .../src/main/java/japicmp/cmp/AccessModifier.java | 15 - .../src/main/java/japicmp/cmp/ClassComparator.java | 157 +++++---- .../main/java/japicmp/cmp/ClassesComparator.java | 129 +++---- .../java/japicmp/cmp/JarArchiveComparator.java | 221 ++++++------ .../japicmp/cmp/JarArchiveComparatorOptions.java | 55 +-- japicmp/src/main/java/japicmp/config/Options.java | 155 +++++---- .../japicmp/{cmp => config}/PackageFilter.java | 36 +- .../java/japicmp/exception/JApiCmpException.java | 44 +-- .../main/java/japicmp/model/AccessModifier.java | 28 ++ .../main/java/japicmp/model/JApiChangeStatus.java | 10 +- japicmp/src/main/java/japicmp/model/JApiClass.java | 207 ++++++----- .../src/main/java/japicmp/model/JApiMethod.java | 163 +++++---- .../src/main/java/japicmp/model/JApiParameter.java | 32 +- .../java/japicmp/output/OutputTransformer.java | 110 +++--- .../output/stdout/StdoutOutputGenerator.java | 142 ++++---- .../japicmp/output/xml/XmlOutputGenerator.java | 48 +-- .../japicmp/output/xml/model/JApiCmpXmlRoot.java | 86 ++--- .../src/main/java/japicmp/util/ModifierHelper.java | 58 ++-- .../main/java/japicmp/util/SignatureParser.java | 206 +++++------ .../java/japicmp/util/StringArrayEnumeration.java | 54 +-- japicmp/src/main/resources/log4j.properties | 14 +- .../src/test/java/japicmp/cli/CliParserTest.java | 80 ++--- .../test/java/japicmp/cmp/PackageFilterTest.java | 89 ++--- .../test/java/japicmp/util/ModifierHelperTest.java | 82 ++--- .../java/japicmp/util/SignatureParserTest.java | 198 +++++------ .../japicmp/util/StringArrayEnumerationTest.java | 74 ++-- pom.xml | 324 ++++++++--------- 58 files changed, 2888 insertions(+), 2253 deletions(-) diff --cc README.md index 04469f1,391cec5..85b40fa --- a/README.md +++ b/README.md @@@ -1,107 -1,166 +1,166 @@@ -japicmp -======= - -japicmp is a tool to compare two versions of a jar archive: - - java -jar japicmp-0.0.3.jar -n new-version.jar -o old-version.jar - -It can also be used as a library: - - JarArchiveComparatorOptions comparatorOptions = new JarArchiveComparatorOptions(); - JarArchiveComparator jarArchiveComparator = new JarArchiveComparator(comparatorOptions); - List<JApiClass> jApiClasses = jarArchiveComparator.compare(oldArchive, newArchive); - -##Motivation## - -Every time you make a new release of a library or a product, you have to tell your clients or customers what -has changed in comparison to the last release. Without the appropriate tooling, this task is tedious and error-prone. -This tool/library helps you to determine the differences between the java class files that are contained in the two -jar archives. -In contrast to other libraries/tools, this library does not use the Java Reflection API to compute -the differences, as the usage of the Reflection API makes it necessary to include all classes the jar archive under -investigation depends on are available on the classpath. To prevent the inclusion of all dependent libraries, which -can be a lot of work for bigger applications, this library makes use of the [javassist](http://www.csg.ci.i.u-tokyo.ac.jp/~chiba/javassist/) -library to inspect the class files. This way you only have to provide the two jar archives on the command line, that's it. - -##Features## - -* Comparison of two jar archives without the need to add all of their dependencies to the classpath. -* Differences are printed on the command line in a simple diff format. -* Differences can optionally be printed to an xml file. This can be transformed to an HTML file using XSLT. -* Per default only public classes and class members are compared. If necessary, the access modifier of the classes and class members to be - compared can be set to package, protected or private. -* Per default classes from all packages are compared. If necessary, certain packages can be excluded or only specific packages can be included. -* A maven plugin is available that allows you to compare the current artifact version with some older version from the repository. - -##Usage CLI tool## - -The tool has a set of CLI parameters that are described in the following: - - -h Prints this help. - -o <pathToOldVersionJar> Provides the path to the old version of the jar. - -n <pathToNewVersionJar> Provides the path to the new version of the jar. - -x <pathToXmlOutputFile> Provides the path to the xml output file. If not given, stdout is used. - -a <accessModifier> Sets the access modifier level (public, package, protected, private), which should be used. - -i <packagesToInclude> Comma separated list of package names to include, * can be used as wildcard. - -e <packagesToExclude> Comma separated list of package names to exclude, * can be used as wildcard. - -m Outputs only modified classes/methods. If not given, all classes and methods are printed. - -##Usage maven plugin## - -The maven plugin can be included in the pom.xml file of your artifact in the following way: - - <build> - <plugins> - <plugin> - <groupId>japicmp</groupId> - <artifactId>japicmp-maven-plugin</artifactId> - <version>0.0.3</version> - <configuration> - <oldVersion> - <dependency> - <groupId>japicmp</groupId> - <artifactId>japicmp-test-v1</artifactId> - <version>${project.version}</version> - </dependency> - </oldVersion> - <newVersion> - <file> - <path>${project.build.directory}/${project.artifactId}-${project.version}.jar</path> - </file> - </newVersion> - <parameter> - <onlyModified>true</onlyModified> - <packagesToInclude>example</packagesToInclude> - <packagesToExclude>excludeMe</packagesToExclude> - <accessModifier>public</accessModifier> - <breakBuildOnModifications>false</breakBuildOnModifications> - </parameter> - </configuration> - <executions> - <execution> - <phase>verify</phase> - <goals> - <goal>cmp</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> - -The elements <oldVersion> and <newVersion> elements let you specify which version you want to compare. Both elements - support either a <dependency> or a <file> element. Through the <parameter> element you can provide the following options: - -* onlyModified: Outputs only modified classes/methods. If not set to true, all classes and methods are printed. -* packagesToInclude: Comma separated list of package names to include, * can be used as wildcard. -* packagesToExclude: Comma separated list of package names to exclude, * can be used as wildcard. -* accessModifier: Sets the access modifier level (public, package, protected, private). -* breakBuildOnModifications: When set to true, the build breaks in case a modification has been detected. - -The maven plugin produces the two files japicmp.diff and japicmp.xml within the directory ${project.build.directory}/japicmp -of your artifact. - -###Example### - -In the following you see the beginning of the xml output file after having computed the differences between the versions 4.0.1 and 4.2.3 of httpclient: - - <?xml version="1.0" encoding="UTF-8" standalone="yes"?> - <japicmp newJar="D:\Programmierung\japicmp\github\japicmp\japicmp\httpclient-4.2.3.jar" oldJar="D:\Programmierung\japicmp\github\japicmp\japicmp\httpclient-4.0.1.jar"> - <class accessModifierNew="n.a." accessModifierOld="PUBLIC" changeStatus="REMOVED" fullyQualifiedName="org.apache.http.annotation.GuardedBy" type="ANNOTATION"> - <method accessModifierNew="n.a." accessModifierOld="PUBLIC" changeStatus="REMOVED" name="value" returnType="java.lang.String"/> - </class> - <class accessModifierNew="n.a." accessModifierOld="PUBLIC" changeStatus="REMOVED" fullyQualifiedName="org.apache.http.annotation.Immutable" type="ANNOTATION"/> - <class accessModifierNew="n.a." accessModifierOld="PUBLIC" changeStatus="REMOVED" fullyQualifiedName="org.apache.http.annotation.NotThreadSafe" type="ANNOTATION"/> - <class accessModifierNew="n.a." accessModifierOld="PUBLIC" changeStatus="REMOVED" fullyQualifiedName="org.apache.http.annotation.ThreadSafe" type="ANNOTATION"/> - <class accessModifierNew="PUBLIC" accessModifierOld="PUBLIC" changeStatus="UNCHANGED" fullyQualifiedName="org.apache.http.auth.AUTH" type="CLASS"/> - <class accessModifierNew="PUBLIC" accessModifierOld="PUBLIC" changeStatus="UNCHANGED" fullyQualifiedName="org.apache.http.auth.AuthenticationException" type="CLASS"/> - <class accessModifierNew="PUBLIC" accessModifierOld="n.a." changeStatus="NEW" fullyQualifiedName="org.apache.http.auth.AuthOption" type="CLASS"> - <method accessModifierNew="PUBLIC" accessModifierOld="n.a." changeStatus="NEW" name="getAuthScheme" returnType="org.apache.http.auth.AuthScheme"/> - <method accessModifierNew="PUBLIC" accessModifierOld="n.a." changeStatus="NEW" name="getCredentials" returnType="org.apache.http.auth.Credentials"/> - <method accessModifierNew="PUBLIC" accessModifierOld="n.a." changeStatus="NEW" name="toString" returnType="java.lang.String"/> - </class> - <class accessModifierNew="PUBLIC" accessModifierOld="n.a." changeStatus="NEW" fullyQualifiedName="org.apache.http.auth.AuthProtocolState" type="ENUM"> - <method accessModifierNew="PUBLIC" accessModifierOld="n.a." changeStatus="NEW" name="valueOf" returnType="org.apache.http.auth.AuthProtocolState"> - <parameter type="java.lang.String"/> - </method> - <method accessModifierNew="PUBLIC" accessModifierOld="n.a." changeStatus="NEW" name="values" returnType="org.apache.http.auth.AuthProtocolState[]"/> - </class> - ... - -The differences between the two Java APIs are also printed on the command line for a quick overview: - - --- REMOVED ANNOTATION org.apache.http.annotation.GuardedBy - --- REMOVED METHOD value() - --- REMOVED ANNOTATION org.apache.http.annotation.Immutable - --- REMOVED ANNOTATION org.apache.http.annotation.NotThreadSafe - --- REMOVED ANNOTATION org.apache.http.annotation.ThreadSafe - === UNCHANGED CLASS org.apache.http.auth.AUTH - === UNCHANGED CLASS org.apache.http.auth.AuthenticationException - +++ NEW CLASS org.apache.http.auth.AuthOption - +++ NEW METHOD getAuthScheme() - +++ NEW METHOD getCredentials() - +++ NEW METHOD toString() - +++ NEW ENUM org.apache.http.auth.AuthProtocolState - +++ NEW METHOD valueOf(java.lang.String) - +++ NEW METHOD values() - -##Downloads## - -The following releases are available: - -* [Version 0.0.2](https://github.com/siom79/japicmp/releases/tag/japicmp-base-0.0.2) - * Changes: - * [Command-line option to filter packages](https://github.com/siom79/japicmp/issues/1) - * [CLI option for comparing public, package, protected or private classes/class members](https://github.com/siom79/japicmp/issues/2) - * ["No differences" output when comparing the same file](https://github.com/siom79/japicmp/issues/4) - * [Giving a non-jar file as argument should not output "Comparing..."](https://github.com/siom79/japicmp/issues/5) -* [Version 0.0.1](https://github.com/siom79/japicmp/releases/tag/japicmp-base-0.0.1) - -The latest snapshot version can be downloaded here: [japicmp-SNAPSHOT](http://repository-siom79.forge.cloudbees.com/snapshot/japicmp/japicmp/) - -##Development## - -* [Jenkins build server](https://siom79.ci.cloudbees.com/job/japicmp) -* [Maven snapshot repository](https://repository-siom79.forge.cloudbees.com/snapshot) -* [Maven release repository](https://repository-siom79.forge.cloudbees.com/release) +japicmp +======= + +japicmp is a tool to compare two versions of a jar archive: + - java -jar japicmp-0.0.2.jar -n new-version.jar -o old-version.jar ++ java -jar japicmp-0.0.3.jar -n new-version.jar -o old-version.jar + +It can also be used as a library: + - JarArchiveComparator jarArchiveComparator = new JarArchiveComparator(); ++ JarArchiveComparatorOptions comparatorOptions = new JarArchiveComparatorOptions(); ++ JarArchiveComparator jarArchiveComparator = new JarArchiveComparator(comparatorOptions); + List<JApiClass> jApiClasses = jarArchiveComparator.compare(oldArchive, newArchive); + +##Motivation## + +Every time you make a new release of a library or a product, you have to tell your clients or customers what +has changed in comparison to the last release. Without the appropriate tooling, this task is tedious and error-prone. +This tool/library helps you to determine the differences between the java class files that are contained in the two +jar archives. +In contrast to other libraries/tools, this library does not use the Java Reflection API to compute +the differences, as the usage of the Reflection API makes it necessary to include all classes the jar archive under +investigation depends on are available on the classpath. To prevent the inclusion of all dependent libraries, which +can be a lot of work for bigger applications, this library makes use of the [javassist](http://www.csg.ci.i.u-tokyo.ac.jp/~chiba/javassist/) +library to inspect the class files. This way you only have to provide the two jar archives on the command line, that's it. + +##Features## + +* Comparison of two jar archives without the need to add all of their dependencies to the classpath. +* Differences are printed on the command line in a simple diff format. +* Differences can optionally be printed to an xml file. This can be transformed to an HTML file using XSLT. +* Per default only public classes and class members are compared. If necessary, the access modifier of the classes and class members to be + compared can be set to package, protected or private. +* Per default classes from all packages are compared. If necessary, certain packages can be excluded or only specific packages can be included. ++* A maven plugin is available that allows you to compare the current artifact version with some older version from the repository. + - ##Usage## ++##Usage CLI tool## + +The tool has a set of CLI parameters that are described in the following: + + -h Prints this help. + -o <pathToOldVersionJar> Provides the path to the old version of the jar. + -n <pathToNewVersionJar> Provides the path to the new version of the jar. + -x <pathToXmlOutputFile> Provides the path to the xml output file. If not given, stdout is used. + -a <accessModifier> Sets the access modifier level (public, package, protected, private), which should be used. + -i <packagesToInclude> Comma separated list of package names to include, * can be used as wildcard. + -e <packagesToExclude> Comma separated list of package names to exclude, * can be used as wildcard. + -m Outputs only modified classes/methods. If not given, all classes and methods are printed. ++ ++##Usage maven plugin## ++ ++The maven plugin can be included in the pom.xml file of your artifact in the following way: ++ ++ <build> ++ <plugins> ++ <plugin> ++ <groupId>japicmp</groupId> ++ <artifactId>japicmp-maven-plugin</artifactId> ++ <version>0.0.3</version> ++ <configuration> ++ <oldVersion> ++ <dependency> ++ <groupId>japicmp</groupId> ++ <artifactId>japicmp-test-v1</artifactId> ++ <version>${project.version}</version> ++ </dependency> ++ </oldVersion> ++ <newVersion> ++ <file> ++ <path>${project.build.directory}/${project.artifactId}-${project.version}.jar</path> ++ </file> ++ </newVersion> ++ <parameter> ++ <onlyModified>true</onlyModified> ++ <packagesToInclude>example</packagesToInclude> ++ <packagesToExclude>excludeMe</packagesToExclude> ++ <accessModifier>public</accessModifier> ++ <breakBuildOnModifications>false</breakBuildOnModifications> ++ </parameter> ++ </configuration> ++ <executions> ++ <execution> ++ <phase>verify</phase> ++ <goals> ++ <goal>cmp</goal> ++ </goals> ++ </execution> ++ </executions> ++ </plugin> ++ </plugins> ++ </build> ++ ++The elements <oldVersion> and <newVersion> elements let you specify which version you want to compare. Both elements ++ support either a <dependency> or a <file> element. Through the <parameter> element you can provide the following options: ++ ++* onlyModified: Outputs only modified classes/methods. If not set to true, all classes and methods are printed. ++* packagesToInclude: Comma separated list of package names to include, * can be used as wildcard. ++* packagesToExclude: Comma separated list of package names to exclude, * can be used as wildcard. ++* accessModifier: Sets the access modifier level (public, package, protected, private). ++* breakBuildOnModifications: When set to true, the build breaks in case a modification has been detected. ++ ++The maven plugin produces the two files japicmp.diff and japicmp.xml within the directory ${project.build.directory}/japicmp ++of your artifact. + +###Example### + +In the following you see the beginning of the xml output file after having computed the differences between the versions 4.0.1 and 4.2.3 of httpclient: + + <?xml version="1.0" encoding="UTF-8" standalone="yes"?> + <japicmp newJar="D:\Programmierung\japicmp\github\japicmp\japicmp\httpclient-4.2.3.jar" oldJar="D:\Programmierung\japicmp\github\japicmp\japicmp\httpclient-4.0.1.jar"> + <class accessModifierNew="n.a." accessModifierOld="PUBLIC" changeStatus="REMOVED" fullyQualifiedName="org.apache.http.annotation.GuardedBy" type="ANNOTATION"> + <method accessModifierNew="n.a." accessModifierOld="PUBLIC" changeStatus="REMOVED" name="value" returnType="java.lang.String"/> + </class> + <class accessModifierNew="n.a." accessModifierOld="PUBLIC" changeStatus="REMOVED" fullyQualifiedName="org.apache.http.annotation.Immutable" type="ANNOTATION"/> + <class accessModifierNew="n.a." accessModifierOld="PUBLIC" changeStatus="REMOVED" fullyQualifiedName="org.apache.http.annotation.NotThreadSafe" type="ANNOTATION"/> + <class accessModifierNew="n.a." accessModifierOld="PUBLIC" changeStatus="REMOVED" fullyQualifiedName="org.apache.http.annotation.ThreadSafe" type="ANNOTATION"/> + <class accessModifierNew="PUBLIC" accessModifierOld="PUBLIC" changeStatus="UNCHANGED" fullyQualifiedName="org.apache.http.auth.AUTH" type="CLASS"/> + <class accessModifierNew="PUBLIC" accessModifierOld="PUBLIC" changeStatus="UNCHANGED" fullyQualifiedName="org.apache.http.auth.AuthenticationException" type="CLASS"/> + <class accessModifierNew="PUBLIC" accessModifierOld="n.a." changeStatus="NEW" fullyQualifiedName="org.apache.http.auth.AuthOption" type="CLASS"> + <method accessModifierNew="PUBLIC" accessModifierOld="n.a." changeStatus="NEW" name="getAuthScheme" returnType="org.apache.http.auth.AuthScheme"/> + <method accessModifierNew="PUBLIC" accessModifierOld="n.a." changeStatus="NEW" name="getCredentials" returnType="org.apache.http.auth.Credentials"/> + <method accessModifierNew="PUBLIC" accessModifierOld="n.a." changeStatus="NEW" name="toString" returnType="java.lang.String"/> + </class> + <class accessModifierNew="PUBLIC" accessModifierOld="n.a." changeStatus="NEW" fullyQualifiedName="org.apache.http.auth.AuthProtocolState" type="ENUM"> + <method accessModifierNew="PUBLIC" accessModifierOld="n.a." changeStatus="NEW" name="valueOf" returnType="org.apache.http.auth.AuthProtocolState"> + <parameter type="java.lang.String"/> + </method> + <method accessModifierNew="PUBLIC" accessModifierOld="n.a." changeStatus="NEW" name="values" returnType="org.apache.http.auth.AuthProtocolState[]"/> + </class> + ... + +The differences between the two Java APIs are also printed on the command line for a quick overview: + + --- REMOVED ANNOTATION org.apache.http.annotation.GuardedBy + --- REMOVED METHOD value() + --- REMOVED ANNOTATION org.apache.http.annotation.Immutable + --- REMOVED ANNOTATION org.apache.http.annotation.NotThreadSafe + --- REMOVED ANNOTATION org.apache.http.annotation.ThreadSafe + === UNCHANGED CLASS org.apache.http.auth.AUTH + === UNCHANGED CLASS org.apache.http.auth.AuthenticationException + +++ NEW CLASS org.apache.http.auth.AuthOption + +++ NEW METHOD getAuthScheme() + +++ NEW METHOD getCredentials() + +++ NEW METHOD toString() + +++ NEW ENUM org.apache.http.auth.AuthProtocolState + +++ NEW METHOD valueOf(java.lang.String) + +++ NEW METHOD values() + +##Downloads## + +The following releases are available: + +* [Version 0.0.2](https://github.com/siom79/japicmp/releases/tag/japicmp-base-0.0.2) + * Changes: + * [Command-line option to filter packages](https://github.com/siom79/japicmp/issues/1) + * [CLI option for comparing public, package, protected or private classes/class members](https://github.com/siom79/japicmp/issues/2) + * ["No differences" output when comparing the same file](https://github.com/siom79/japicmp/issues/4) + * [Giving a non-jar file as argument should not output "Comparing..."](https://github.com/siom79/japicmp/issues/5) +* [Version 0.0.1](https://github.com/siom79/japicmp/releases/tag/japicmp-base-0.0.1) + ++The latest snapshot version can be downloaded here: [japicmp-SNAPSHOT](http://repository-siom79.forge.cloudbees.com/snapshot/japicmp/japicmp/) ++ +##Development## + +* [Jenkins build server](https://siom79.ci.cloudbees.com/job/japicmp) +* [Maven snapshot repository](https://repository-siom79.forge.cloudbees.com/snapshot) - * [Maven release repository](https://repository-siom79.forge.cloudbees.com/release) ++* [Maven release repository](https://repository-siom79.forge.cloudbees.com/release)
