1# Copyright (c) 2016, the R8 project authors. Please see the AUTHORS file 2# for details. All rights reserved. Use of this source code is governed by a 3# BSD-style license that can be found in the LICENSE file. 4 5# Rudmentary script for generating smali files from a Java file 6# compiled with both javac/dx and jack. 7 8# This requires a Android checkout in $HOME/android/master with the 9# art host test tools build: 10# 11# source build/envsetup.sh 12# lunch <some configuration, e.g. aosp_bullhead-userdebug> 13# m -j30 test-art-host 14# 15# It also requires a checkout of https://github.com/JesusFreke/smali 16# in $HOME/smali build by running "gradle build" in that directory. 17# 18# The output from javac/dx is placed in classes_dx, and the output from 19# Jack is placed in classes_jack. 20 21set -e 22 23JAVA_FILE=Test.java 24 25ANDROID_HOME="$HOME/android/master" 26SMALI_HOME="$HOME/smali" 27 28# Build with javac/dx and decompile dex file. 29mkdir -p classes_dx 30javac -d classes_dx -target 1.7 -source 1.7 $JAVA_FILE 31tools/linux/dx/bin/dx --dex --output classes_dx/classes.dex classes_dx 32java -jar "$SMALI_HOME/baksmali/build/libs/baksmali.jar" --output classes_dx classes_dx/classes.dex 33 34# Build with Jack and decompile dex file. 35mkdir -p classes_jack 36JACK_JAVA_LIBRARIES="$ANDROID_HOME/out/host/common/obj/JAVA_LIBRARIES" 37JACK="$ANDROID_HOME/out/host/linux-x86/bin/jack -cp $JACK_JAVA_LIBRARIES/core-libart-hostdex_intermediates/classes.jack:$JACK_JAVA_LIBRARIES/core-oj-hostdex_intermediates/classes.jack" 38$JACK $JAVA_FILE --output-dex classes_jack 39java -jar $SMALI_HOME/baksmali/build/libs/baksmali.jar --output classes_jack classes_jack/classes.dex 40