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.
21prog="$0"
22while [ -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
31done
32oldwd=`pwd`
33progdir=`dirname "${prog}"`
34cd "${progdir}"
35
36resourceDir=../../resources/dalvik/system
37
38rm -rf classes
39rm -rf classes.dex
40rm -rf loading-test2.jar
41
42mkdir classes
43javac -d classes *.java
44dx --dex --output=classes.dex classes
45jar cf loading-test2.jar classes.dex -C resources .
46
47rm -rf classes
48mv classes.dex ${resourceDir}/loading-test2.dex
49mv loading-test2.jar ${resourceDir}
50