Loading tools/hoststubgen/hoststubgen/test-tiny-framework/diff-and-update-golden.sh +1 −1 Original line number Diff line number Diff line Loading @@ -63,7 +63,7 @@ shift $(($OPTIND - 1)) # Build the dump files, which are the input of this test. run m tiny-framework-dump-test run m dump-jar tiny-framework-dump-test # Get the path to the generate text files. (not the golden files.) Loading tools/hoststubgen/scripts/dump-jar +12 −20 Original line number Diff line number Diff line Loading @@ -26,12 +26,12 @@ help() { Dump a *.class file dump-jar [-v] [-s] [-o OUTPUT-FILENAME] JAR-FILE[: filename regex] [...] dump-jar [-v] [-s] [-o OUTPUT-FILENAME] JAR-FILE[: class internal name regex] [...] Dump a jar file. If a filename contains a ':', then the following part will be used to filter files in the jar file. will be used to filter files in the jar file that matches against class internal names. For example, "file.jar:/MyClass$" will only dump "MyClass" in file.jar. Loading Loading @@ -78,16 +78,6 @@ if (( $simple )) ; then JAVAP_OPTS="-p -c -v" fi # Normalize a java class name. # Convert '.' to '/' # Remove the *.class suffix. normalize() { local name="$1" name="${name%.class}" # Remove the .class suffix. echo "$name" | tr '.' '/' } # Convert the output for `-s` as needed. filter_output() { if (( $simple )) ; then Loading Loading @@ -124,6 +114,12 @@ write_to_out() { fi } # Read jar file names and remove the .class suffix. # Also remove non-class files. to_internal_names() { sed -ne 's/\.class$//p' } for file in "${@}"; do # *.class? Loading @@ -136,7 +132,7 @@ for file in "${@}"; do # Take the regex. Remove everything up to : in $file regex="" if [[ "$file" =~ : ]] ; then regex="$(normalize "${file##*:}")" regex="${file##*:}" fi # Remove everything after ':', inclusively, in $file. Loading @@ -151,13 +147,9 @@ for file in "${@}"; do echo fi jar tf "$file" | grep '\.class$' | sort | while read -r class ; do if normalize "$class" | grep -q -- "$regex" ; then echo "## Class: $class" javap $dump_code_opt $JAVAP_OPTS -cp $file ${class%.class} else (( $verbose )) && echo "## Skipping class: $class" fi jar tf "$file" | sort | to_internal_names | grep -- "$regex" | while read -r class ; do echo "## Class: $class.class" javap $dump_code_opt $JAVAP_OPTS -cp "$file" "${class}" done else Loading Loading
tools/hoststubgen/hoststubgen/test-tiny-framework/diff-and-update-golden.sh +1 −1 Original line number Diff line number Diff line Loading @@ -63,7 +63,7 @@ shift $(($OPTIND - 1)) # Build the dump files, which are the input of this test. run m tiny-framework-dump-test run m dump-jar tiny-framework-dump-test # Get the path to the generate text files. (not the golden files.) Loading
tools/hoststubgen/scripts/dump-jar +12 −20 Original line number Diff line number Diff line Loading @@ -26,12 +26,12 @@ help() { Dump a *.class file dump-jar [-v] [-s] [-o OUTPUT-FILENAME] JAR-FILE[: filename regex] [...] dump-jar [-v] [-s] [-o OUTPUT-FILENAME] JAR-FILE[: class internal name regex] [...] Dump a jar file. If a filename contains a ':', then the following part will be used to filter files in the jar file. will be used to filter files in the jar file that matches against class internal names. For example, "file.jar:/MyClass$" will only dump "MyClass" in file.jar. Loading Loading @@ -78,16 +78,6 @@ if (( $simple )) ; then JAVAP_OPTS="-p -c -v" fi # Normalize a java class name. # Convert '.' to '/' # Remove the *.class suffix. normalize() { local name="$1" name="${name%.class}" # Remove the .class suffix. echo "$name" | tr '.' '/' } # Convert the output for `-s` as needed. filter_output() { if (( $simple )) ; then Loading Loading @@ -124,6 +114,12 @@ write_to_out() { fi } # Read jar file names and remove the .class suffix. # Also remove non-class files. to_internal_names() { sed -ne 's/\.class$//p' } for file in "${@}"; do # *.class? Loading @@ -136,7 +132,7 @@ for file in "${@}"; do # Take the regex. Remove everything up to : in $file regex="" if [[ "$file" =~ : ]] ; then regex="$(normalize "${file##*:}")" regex="${file##*:}" fi # Remove everything after ':', inclusively, in $file. Loading @@ -151,13 +147,9 @@ for file in "${@}"; do echo fi jar tf "$file" | grep '\.class$' | sort | while read -r class ; do if normalize "$class" | grep -q -- "$regex" ; then echo "## Class: $class" javap $dump_code_opt $JAVAP_OPTS -cp $file ${class%.class} else (( $verbose )) && echo "## Skipping class: $class" fi jar tf "$file" | sort | to_internal_names | grep -- "$regex" | while read -r class ; do echo "## Class: $class.class" javap $dump_code_opt $JAVAP_OPTS -cp "$file" "${class}" done else Loading