blob: 44459ebf037d05b7ba037c0f3874d92775c921cc [file] [log] [blame]
Stephen Twiggd74bf362017-05-05 15:44:40 +02001#!/bin/bash
2#
3# Copyright 2015 The Bazel Authors. All rights reserved.
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
17set -eux
18
19CUT="$(cd $(dirname ${BASH_SOURCE[0]}) && pwd)/build_incremental_dexmanifest"
20ZIPPER=$(pwd)/$1
21
22cd $TEST_TMPDIR
23echo 1 > 1.dex
24echo 2 > 2.dex
25echo 3 > 3.dex
26echo 4 > 4.dex
27
28$ZIPPER c 1.zip 1.dex 2.dex
29$ZIPPER c 2.zip 3.dex
30
31$CUT output.manifest 1.zip 2.zip 4.dex
32IFS=$'\n' MANIFEST=($(cat output.manifest | cut -d' ' -f1-3))
33[[ ${MANIFEST[0]} == "1.zip 1.dex incremental_classes1.dex" ]]
34[[ ${MANIFEST[1]} == "1.zip 2.dex incremental_classes2.dex" ]]
35[[ ${MANIFEST[2]} == "2.zip 3.dex incremental_classes3.dex" ]]
36[[ ${MANIFEST[3]} == "4.dex - incremental_classes4.dex" ]]