Home | History | Annotate | Download | only in loading-test-jar
      1 #!/bin/bash -e
      2 #
      3 # Copyright (C) 2011 The Android Open Source Project
      4 #
      5 # Licensed under the Apache License, Version 2.0 (the "License");
      6 # you may not use this file except in compliance with the License.
      7 # You may obtain a copy of the License at
      8 #
      9 #      http://www.apache.org/licenses/LICENSE-2.0
     10 #
     11 # Unless required by applicable law or agreed to in writing, software
     12 # distributed under the License is distributed on an "AS IS" BASIS,
     13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14 # See the License for the specific language governing permissions and
     15 # limitations under the License.
     16 
     17 # Set up prog to be the path of this script, including following
     18 # symlinks, and set up progdir to be the fully-qualified pathname of
     19 # its directory.  Switch the current directory to progdir for the
     20 # remainder of the script.
     21 prog="$0"
     22 while [ -h "${prog}" ]; do
     23     newProg=`/bin/ls -ld "${prog}"`
     24     newProg=`expr "${newProg}" : ".* -> \(.*\)$"`
     25     if expr "x${newProg}" : 'x/' >/dev/null; then
     26         prog="${newProg}"
     27     else
     28         progdir=`dirname "${prog}"`
     29         prog="${progdir}/${newProg}"
     30     fi
     31 done
     32 oldwd=`pwd`
     33 progdir=`dirname "${prog}"`
     34 cd "${progdir}"
     35 
     36 resourceDir=../../resources/dalvik/system
     37 
     38 rm -rf classes
     39 rm -rf classes2
     40 rm -rf classes.dex
     41 rm -rf loading-test.jar
     42 
     43 # This library depends on loading-test2, so compile those classes first,
     44 # but keep them separate.
     45 mkdir classes2
     46 javac -d classes2 ../loading-test2-jar/*.java
     47 
     48 mkdir classes
     49 javac -classpath classes2 -d classes *.java
     50 dx --dex --output=classes.dex classes
     51 jar cf loading-test.jar classes.dex -C resources .
     52 
     53 rm -rf classes
     54 rm -rf classes2
     55 mv classes.dex ${resourceDir}/loading-test.dex
     56 mv loading-test.jar ${resourceDir}
     57