Some cleanup for tests 960-965 build scripts.
Make all 96* build scripts consistent and update 965 to build and run
with jack.
Change-Id: If27ee9c92880c75307a18b054ba926670877073a
diff --git a/test/960-default-smali/build b/test/960-default-smali/build
index 3946de3..4dc848c 100755
--- a/test/960-default-smali/build
+++ b/test/960-default-smali/build
@@ -20,18 +20,19 @@
# Generate the smali Main.smali file or fail
${ANDROID_BUILD_TOP}/art/test/utils/python/generate_smali_main.py ./smali
-USES_JAVA="false"
+# Should we compile with Java source code. By default we will use Smali.
+USES_JAVA_SOURCE="false"
if [[ $ARGS == *"--jvm"* ]]; then
- USES_JAVA="true"
+ USES_JAVA_SOURCE="true"
elif [[ "$USE_JACK" == "true" ]]; then
if $JACK -D jack.java.source.version=1.8 >& /dev/null; then
- USES_JAVA="true"
+ USES_JAVA_SOURCE="true"
else
echo "WARNING: Cannot use jack because it does not support JLS 1.8. Falling back to smali" >&2
fi
fi
-if [[ "$USES_JAVA" == "true" ]]; then
+if [[ "$USES_JAVA_SOURCE" == "true" ]]; then
# We are compiling java code, create it.
mkdir -p src
${ANDROID_BUILD_TOP}/art/tools/extract-embedded-java ./smali ./src
diff --git a/test/961-default-iface-resolution-generated/build b/test/961-default-iface-resolution-generated/build
index 03cc624..b4ced3e 100755
--- a/test/961-default-iface-resolution-generated/build
+++ b/test/961-default-iface-resolution-generated/build
@@ -31,18 +31,19 @@
# Generate the smali files and expected.txt or fail
./util-src/generate_smali.py ./smali ./expected.txt
-USES_JAVA="false"
+# Should we compile with Java source code. By default we will use Smali.
+USES_JAVA_SOURCE="false"
if [[ $ARGS == *"--jvm"* ]]; then
- USES_JAVA="true"
+ USES_JAVA_SOURCE="true"
elif [[ $USE_JACK == "true" ]]; then
if "$JACK" -D jack.java.source.version=1.8 >& /dev/null; then
- USES_JAVA="true"
+ USES_JAVA_SOURCE="true"
else
echo "WARNING: Cannot use jack because it does not support JLS 1.8. Falling back to smali" >&2
fi
fi
-if [[ "$USES_JAVA" == "true" ]]; then
+if [[ "$USES_JAVA_SOURCE" == "true" ]]; then
# We are compiling java code, create it.
mkdir -p src
${ANDROID_BUILD_TOP}/art/tools/extract-embedded-java ./smali ./src
diff --git a/test/962-iface-static/build b/test/962-iface-static/build
index 24e2feb..e17272f 100755
--- a/test/962-iface-static/build
+++ b/test/962-iface-static/build
@@ -17,18 +17,19 @@
# make us exit on a failure
set -e
-USES_JAVA="false"
+# Should we compile with Java source code. By default we will use Smali.
+USES_JAVA_SOURCE="false"
if [[ $@ == *"--jvm"* ]]; then
- USES_JAVA="true"
+ USES_JAVA_SOURCE="true"
elif [[ "$USE_JACK" == "true" ]]; then
if $JACK -D jack.java.source.version=1.8 2>/dev/null; then
- USES_JAVA="true"
+ USES_JAVA_SOURCE="true"
else
echo "WARNING: Cannot use jack because it does not support JLS 1.8. Falling back to smali" >&2
fi
fi
-if [[ "$USES_JAVA" == "true" ]]; then
+if [[ "$USES_JAVA_SOURCE" == "true" ]]; then
# We are compiling java code, create it.
mkdir -p src
${ANDROID_BUILD_TOP}/art/tools/extract-embedded-java ./smali ./src
diff --git a/test/963-default-range-smali/build b/test/963-default-range-smali/build
index 24e2feb..e17272f 100755
--- a/test/963-default-range-smali/build
+++ b/test/963-default-range-smali/build
@@ -17,18 +17,19 @@
# make us exit on a failure
set -e
-USES_JAVA="false"
+# Should we compile with Java source code. By default we will use Smali.
+USES_JAVA_SOURCE="false"
if [[ $@ == *"--jvm"* ]]; then
- USES_JAVA="true"
+ USES_JAVA_SOURCE="true"
elif [[ "$USE_JACK" == "true" ]]; then
if $JACK -D jack.java.source.version=1.8 2>/dev/null; then
- USES_JAVA="true"
+ USES_JAVA_SOURCE="true"
else
echo "WARNING: Cannot use jack because it does not support JLS 1.8. Falling back to smali" >&2
fi
fi
-if [[ "$USES_JAVA" == "true" ]]; then
+if [[ "$USES_JAVA_SOURCE" == "true" ]]; then
# We are compiling java code, create it.
mkdir -p src
${ANDROID_BUILD_TOP}/art/tools/extract-embedded-java ./smali ./src
diff --git a/test/964-default-iface-init-generated/build b/test/964-default-iface-init-generated/build
index d916f1b..0780da1 100755
--- a/test/964-default-iface-init-generated/build
+++ b/test/964-default-iface-init-generated/build
@@ -29,18 +29,19 @@
# Generate the smali files and expected.txt or fail
./util-src/generate_smali.py ./smali ./expected.txt
-USES_JAVA="false"
+# Should we compile with Java source code. By default we will use Smali.
+USES_JAVA_SOURCE="false"
if [[ $@ == *"--jvm"* ]]; then
- USES_JAVA="true"
+ USES_JAVA_SOURCE="true"
elif [[ "$USE_JACK" == "true" ]]; then
if $JACK -D jack.java.source.version=1.8 2>/dev/null; then
- USES_JAVA="true"
+ USES_JAVA_SOURCE="true"
else
echo "WARNING: Cannot use jack because it does not support JLS 1.8. Falling back to smali" >&2
fi
fi
-if [[ "$USES_JAVA" == "true" ]]; then
+if [[ "$USES_JAVA_SOURCE" == "true" ]]; then
# We are compiling java code, create it.
mkdir -p src
${ANDROID_BUILD_TOP}/art/tools/extract-embedded-java ./smali ./src
diff --git a/test/965-default-verify/build b/test/965-default-verify/build
index 3727f5e..5ba5438 100755
--- a/test/965-default-verify/build
+++ b/test/965-default-verify/build
@@ -17,14 +17,32 @@
# make us exit on a failure
set -e
+# Should we compile with Java source code. By default we will use Smali.
+USES_JAVA_SOURCE="false"
if [[ $@ == *"--jvm"* ]]; then
- # Build the Java files if we are running a --jvm test
- mkdir -p src classes
- ${ANDROID_BUILD_TOP}/art/tools/extract-embedded-java ./smali ./src
- ${JAVAC} -implicit:none -d classes build-src/Statics.java src/Main.java src/Iface.java
- rm -f classes/Statics.class
- ${JAVAC} -implicit:none -d classes src/Statics.java
-else
- # TODO Support building with jack.
- ./default-build "$@" --experimental default-methods
+ USES_JAVA_SOURCE="true"
+elif [[ "$USE_JACK" == "true" ]]; then
+ if $JACK -D jack.java.source.version=1.8 2>/dev/null; then
+ USES_JAVA_SOURCE="true"
+ else
+ echo "WARNING: Cannot use jack because it does not support JLS 1.8. Falling back to smali" >&2
+ fi
fi
+
+if [[ "$USES_JAVA_SOURCE" == "true" ]]; then
+ # We are compiling Java code, create it.
+ mkdir -p src
+ mkdir -p src2
+ ${ANDROID_BUILD_TOP}/art/tools/extract-embedded-java ./smali ./src
+ # Move build-src to src and the src copies to src2. This is needed because of
+ # how our default build script works and we wanted the java and smali code
+ # to be the same in the smali files.
+ for f in `find ./build-src -type f -name "*.java" | xargs -i basename \{\}`; do
+ mv ./src/$f ./src2/$f
+ mv ./build-src/$f ./src/$f
+ done
+ # Ignore the smali directory.
+ EXTRA_ARGS="--no-smali"
+fi
+
+./default-build "$@" "$EXTRA_ARGS" --experimental default-methods