1eb7c144a6aff7da673ba53d501c46f00311d4d7fAlex Light#!/bin/bash
2eb7c144a6aff7da673ba53d501c46f00311d4d7fAlex Light#
3eb7c144a6aff7da673ba53d501c46f00311d4d7fAlex Light# Copyright 2015 The Android Open Source Project
4eb7c144a6aff7da673ba53d501c46f00311d4d7fAlex Light#
5eb7c144a6aff7da673ba53d501c46f00311d4d7fAlex Light# Licensed under the Apache License, Version 2.0 (the "License");
6eb7c144a6aff7da673ba53d501c46f00311d4d7fAlex Light# you may not use this file except in compliance with the License.
7eb7c144a6aff7da673ba53d501c46f00311d4d7fAlex Light# You may obtain a copy of the License at
8eb7c144a6aff7da673ba53d501c46f00311d4d7fAlex Light#
9eb7c144a6aff7da673ba53d501c46f00311d4d7fAlex Light#      http://www.apache.org/licenses/LICENSE-2.0
10eb7c144a6aff7da673ba53d501c46f00311d4d7fAlex Light#
11eb7c144a6aff7da673ba53d501c46f00311d4d7fAlex Light# Unless required by applicable law or agreed to in writing, software
12eb7c144a6aff7da673ba53d501c46f00311d4d7fAlex Light# distributed under the License is distributed on an "AS IS" BASIS,
13eb7c144a6aff7da673ba53d501c46f00311d4d7fAlex Light# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14eb7c144a6aff7da673ba53d501c46f00311d4d7fAlex Light# See the License for the specific language governing permissions and
15eb7c144a6aff7da673ba53d501c46f00311d4d7fAlex Light# limitations under the License.
16eb7c144a6aff7da673ba53d501c46f00311d4d7fAlex Light
17eb7c144a6aff7da673ba53d501c46f00311d4d7fAlex Light# make us exit on a failure
18eb7c144a6aff7da673ba53d501c46f00311d4d7fAlex Lightset -e
19eb7c144a6aff7da673ba53d501c46f00311d4d7fAlex Light
20eb7c144a6aff7da673ba53d501c46f00311d4d7fAlex Light# We will be making more files than the ulimit is set to allow. Remove it temporarily.
21eb7c144a6aff7da673ba53d501c46f00311d4d7fAlex LightOLD_ULIMIT=`ulimit -S`
22eb7c144a6aff7da673ba53d501c46f00311d4d7fAlex Lightulimit -S unlimited
23eb7c144a6aff7da673ba53d501c46f00311d4d7fAlex Light
24eb7c144a6aff7da673ba53d501c46f00311d4d7fAlex Lightrestore_ulimit() {
25eb7c144a6aff7da673ba53d501c46f00311d4d7fAlex Light  ulimit -S "$OLD_ULIMIT"
26eb7c144a6aff7da673ba53d501c46f00311d4d7fAlex Light}
27eb7c144a6aff7da673ba53d501c46f00311d4d7fAlex Lighttrap 'restore_ulimit' ERR
28eb7c144a6aff7da673ba53d501c46f00311d4d7fAlex Light
29d204ba5ac9c5488880d85dc198e7b6aefea2f0bbAlex Lightif [[ $@ != *"--jvm"* ]]; then
30d204ba5ac9c5488880d85dc198e7b6aefea2f0bbAlex Light  # Don't do anything with jvm
31d204ba5ac9c5488880d85dc198e7b6aefea2f0bbAlex Light  # Hard-wired use of experimental jack.
32d204ba5ac9c5488880d85dc198e7b6aefea2f0bbAlex Light  # TODO: fix this temporary work-around for default-methods, see b/19467889
33d204ba5ac9c5488880d85dc198e7b6aefea2f0bbAlex Light  export USE_JACK=true
346a439bc85bbe4076c152ebf86a721d5c827384f8Alex Lightfi
356a439bc85bbe4076c152ebf86a721d5c827384f8Alex Light
36d204ba5ac9c5488880d85dc198e7b6aefea2f0bbAlex Lightmkdir -p ./src
37d204ba5ac9c5488880d85dc198e7b6aefea2f0bbAlex Light
38d204ba5ac9c5488880d85dc198e7b6aefea2f0bbAlex Light# Generate the smali files and expected.txt or fail
39d204ba5ac9c5488880d85dc198e7b6aefea2f0bbAlex Light./util-src/generate_java.py ./src ./expected.txt
40eb7c144a6aff7da673ba53d501c46f00311d4d7fAlex Light
41d204ba5ac9c5488880d85dc198e7b6aefea2f0bbAlex Light./default-build "$@" --experimental default-methods
42eb7c144a6aff7da673ba53d501c46f00311d4d7fAlex Light
43eb7c144a6aff7da673ba53d501c46f00311d4d7fAlex Light# Reset the ulimit back to its initial value
44eb7c144a6aff7da673ba53d501c46f00311d4d7fAlex Lightrestore_ulimit
45