Created
November 25, 2010 04:21
-
-
Save rednaxelafx/714896 to your computer and use it in GitHub Desktop.
A script to verify classes within a JAR file. Depends on the ASM, specifically asm-all-<ver>.jar. Edit the ASM_PATH constant to match your installation. Requires Ruby 1.9+
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
ASM_PATH = "asm-all-3.3.jar" | |
SEP = File::PATH_SEPARATOR | |
jar_file, additional_classpath = ARGV | |
raise "usage: check_jar <jar_file> <additional_classpath>" unless jar_file | |
`jar tf #{jar_file}`.lines.grep(/\.class$/i). | |
map {|s| s.chomp[0..-7].gsub '/', '.'}. | |
each do |c| | |
puts "checking #{c}" | |
`java -cp #{[ASM_PATH, jar_file, additional_classpath].compact.join(SEP)} org.objectweb.asm.util.CheckClassAdapter #{c}` | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment