Home | History | Annotate | Download | only in 004-JniTest
      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 export ORIGINAL_JAVAC="$JAVAC"
     27 
     28 # Delete CriticalNative.java, FastNative.java annotations after building the .class files.
     29 function javac_wrapper {
     30   $ORIGINAL_JAVAC "$@"
     31   local stat=$?
     32 
     33   [[ -d classes ]] && (find classes/dalvik -name '*.class' | xargs rm -rf)
     34 
     35   return $stat
     36 }
     37 
     38 export -f javac_wrapper
     39 export JAVAC=javac_wrapper
     40 
     41 ./default-build "$@"
     42