1#!/bin/bash 2# 3# Copyright 2017 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# 18# Perform a mostly normal build. 19# Since this test imports 'dalvik.annotation.optimization.FastNative' (and CriticalNative), 20# we do a bit of trickery to allow the annotations to be used at javac-compile time, 21# but remove them afterwards so it doesn't end up in the dex file. 22# 23# This enables the test to compile with vanilla RI javac and work on either ART or RI. 24# 25 26# Stop on failure. 27set -e 28 29export ORIGINAL_JAVAC="$JAVAC" 30 31# Wrapper function for javac which invokes the compiler and applies 32# additional setup steps for the test. 33function javac_wrapper { 34 set -e # Stop on error - the caller script may not have this set. 35 $ORIGINAL_JAVAC "$@" 36 # Delete CriticalNative.java, FastNative.java annotations after building the .class files. 37 find classes/dalvik -name '*.class' -exec rm {} \; 38} 39 40export -f javac_wrapper 41export JAVAC=javac_wrapper 42 43###################################################################### 44 45# Use release mode to check optimizations do not break JNI. 46export D8_FLAGS=--release 47./default-build "$@" 48