1081c7142b29ccd6e1744b26e097b6a4d7c12f2bdJesse Wilson#!/bin/bash 2081c7142b29ccd6e1744b26e097b6a4d7c12f2bdJesse Wilson# 3081c7142b29ccd6e1744b26e097b6a4d7c12f2bdJesse Wilson# Copyright (C) 2007 The Android Open Source Project 4081c7142b29ccd6e1744b26e097b6a4d7c12f2bdJesse Wilson# 5081c7142b29ccd6e1744b26e097b6a4d7c12f2bdJesse Wilson# Licensed under the Apache License, Version 2.0 (the "License"); 6081c7142b29ccd6e1744b26e097b6a4d7c12f2bdJesse Wilson# you may not use this file except in compliance with the License. 7081c7142b29ccd6e1744b26e097b6a4d7c12f2bdJesse Wilson# You may obtain a copy of the License at 8081c7142b29ccd6e1744b26e097b6a4d7c12f2bdJesse Wilson# 9081c7142b29ccd6e1744b26e097b6a4d7c12f2bdJesse Wilson# http://www.apache.org/licenses/LICENSE-2.0 10081c7142b29ccd6e1744b26e097b6a4d7c12f2bdJesse Wilson# 11081c7142b29ccd6e1744b26e097b6a4d7c12f2bdJesse Wilson# Unless required by applicable law or agreed to in writing, software 12081c7142b29ccd6e1744b26e097b6a4d7c12f2bdJesse Wilson# distributed under the License is distributed on an "AS IS" BASIS, 13081c7142b29ccd6e1744b26e097b6a4d7c12f2bdJesse Wilson# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14081c7142b29ccd6e1744b26e097b6a4d7c12f2bdJesse Wilson# See the License for the specific language governing permissions and 15081c7142b29ccd6e1744b26e097b6a4d7c12f2bdJesse Wilson# limitations under the License. 16081c7142b29ccd6e1744b26e097b6a4d7c12f2bdJesse Wilson 17081c7142b29ccd6e1744b26e097b6a4d7c12f2bdJesse Wilson# Find dx.jar from dx in the android dev tree 18081c7142b29ccd6e1744b26e097b6a4d7c12f2bdJesse Wilsonprog=`which dx` 19081c7142b29ccd6e1744b26e097b6a4d7c12f2bdJesse Wilsonprogdir=`dirname "${prog}"` 20324d2f23a7174848f7d130c43c903325c99a93c7Jesse Wilsondxjar=$progdir/../framework/dx.jar 21c5aae57e6be7a72fdf16d5d0fc2abc084e8ab30aPaul Duffinjunitjar=$progdir/../framework/junit-host.jar 22a5c69c45cfecc26291672378a3e4438c411d07a1Andreas Gampejunitdex=$progdir/../framework/junit-hostdex.jar 23081c7142b29ccd6e1744b26e097b6a4d7c12f2bdJesse Wilson 24324d2f23a7174848f7d130c43c903325c99a93c7Jesse Wilsondx --dex --output=test.jar com/android/dx/merge/* $dxjar 25324d2f23a7174848f7d130c43c903325c99a93c7Jesse Wilson 26324d2f23a7174848f7d130c43c903325c99a93c7Jesse Wilson# Build a resource .jar containing the .dex files to merge 2709d308b04b7c4fd3ed83a8f8f4c07be67a25478cJesse Wilsondx --dex --output=testdata/Annotated.dex testdata/Annotated* 2809d308b04b7c4fd3ed83a8f8f4c07be67a25478cJesse Wilsondx --dex --output=testdata/Basic.dex testdata/Basic* 2909d308b04b7c4fd3ed83a8f8f4c07be67a25478cJesse Wilsondx --dex --output=testdata/FillArrayData.dex testdata/FillArrayData* 3009d308b04b7c4fd3ed83a8f8f4c07be67a25478cJesse Wilsondx --dex --output=testdata/StaticValues.dex testdata/StaticValues* 3109d308b04b7c4fd3ed83a8f8f4c07be67a25478cJesse Wilsondx --dex --output=testdata/TryCatchFinally.dex testdata/TryCatchFinally* 32081c7142b29ccd6e1744b26e097b6a4d7c12f2bdJesse Wilsonjar cfM resources.jar testdata/*.dex 33081c7142b29ccd6e1744b26e097b6a4d7c12f2bdJesse Wilson 34a5c69c45cfecc26291672378a3e4438c411d07a1Andreas Gampeart -classpath test.jar:$junitdex:resources.jar \ 35a5c69c45cfecc26291672378a3e4438c411d07a1Andreas Gampe junit.textui.TestRunner com.android.dx.merge.DexMergeTest > unit-out.txt 2>&1 36081c7142b29ccd6e1744b26e097b6a4d7c12f2bdJesse Wilson 37081c7142b29ccd6e1744b26e097b6a4d7c12f2bdJesse Wilsonif [ "$?" = "0" ]; then 38081c7142b29ccd6e1744b26e097b6a4d7c12f2bdJesse Wilson echo "Yay!" 39081c7142b29ccd6e1744b26e097b6a4d7c12f2bdJesse Wilsonelse 40081c7142b29ccd6e1744b26e097b6a4d7c12f2bdJesse Wilson cat unit-out.txt 41081c7142b29ccd6e1744b26e097b6a4d7c12f2bdJesse Wilsonfi 42