public
Created

Invoke javap with latest Scala 2.9.1 and Akka 2.0 jars from ivy cache

  • Download Gist
javap
Shell
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
#!/bin/bash
# Author Mike Slinn
# Invoke javap with latest Scala 2.9.1 and Akka 2.0 jars
# Does not use SBT or scala scripts, so this actually works on all platforms that have bash, including Cygwin.
# Invoke javap as usual with all options except classpath:
# javap scala.None
# You can add to the classpath with -cp, if that option is provided first:
# javap -cp org.apache.httpcomponents/httpclient/jars/ scala.None
# The additions to the classpath are assumed to exist in the ~.ivy2/cache and must end with /jars/
# The latest jar in that directory will be used
 
if [ $OSTYPE == cygwin ]; then
DELIM=";"
DHOME=`cygpath -dmas "$HOMEDRIVE$HOMEPATH"`
IVY=$DHOME/.ivy2/cache
else
IVY=~/.ivy2/cache
DELIM=:
fi
 
function newest {
for f in $IVY/${1}*.jar; do JAR=$f; done
echo $JAR
}
 
function D {
if [ "$CP" != "" ]; then
echo "$DELIM"
else
echo ""
fi
}
 
# Include SBT/Maven compiled project classes if invoked from root of project
if [ -d target/scala-2.9.1/classes ]; then
CP=target/scala-2.9.1/classes:
fi
 
# getopts is broken under cygwin :(
while [ "$1" == -cp ]; do
shift
CP=$CP$(D)$(newest $1)
shift
done
 
CP=$CP$(D)$(newest com.typesafe.akka/akka-actor/jars/)
CP=$CP$(D)$(newest org.scala-lang/scala-library/jars/)
CP=$CP$(D)$(newest com.github.scala-incubator.io/scala-io-core_2.9.1/jars/)
CP=$CP$(D)$(newest com.github.scala-incubator.io/scala-io-file_2.9.1/jars/)
CP=$CP$(D)$(newest org.scala-tools/scala-stm_2.9.1/jars/)
#echo $CP
$JAVA_HOME/bin/javap -classpath $CP "$@"

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.