Add script to compile JIT on x86 (flutter/engine#20315)
This commit is contained in:
@@ -42,6 +42,18 @@ compared against golden reside.
|
||||
|
||||
## Running for Android
|
||||
|
||||
The test is run on a x86 emulator. To run the test locally, you must create an emulator running API level 28, and set the following screen settings in the avd's `config.ini` file:
|
||||
|
||||
```
|
||||
hw.lcd.density = 480
|
||||
hw.lcd.height = 1920
|
||||
hw.lcd.width = 1080
|
||||
```
|
||||
|
||||
This file is typically located in your `$HOME/.android/avd/<avd>` folder.
|
||||
|
||||
Once the emulator is up, you can run the test by running:
|
||||
|
||||
```bash
|
||||
./build_and_run_android_tests.sh
|
||||
```
|
||||
|
||||
@@ -26,6 +26,9 @@ android {
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
sourceSets {
|
||||
main.assets.srcDirs += "${project.buildDir}/assets"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
@@ -3,13 +3,9 @@
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
# Runs the Android scenario tests on a connected device.
|
||||
# TODO(https://github.com/flutter/flutter/issues/55326): use Flutter tool and
|
||||
# just build debug JIT for emulator.
|
||||
|
||||
set -e
|
||||
|
||||
FLUTTER_ENGINE=android_profile_unopt_arm64
|
||||
FLUTTER_ENGINE=android_debug_unopt_x64
|
||||
|
||||
if [ $# -eq 1 ]; then
|
||||
FLUTTER_ENGINE=$1
|
||||
@@ -22,9 +18,9 @@ pushd ../../..
|
||||
if [ ! -d "out/$FLUTTER_ENGINE" ]; then
|
||||
echo "You must GN to generate out/$FLUTTER_ENGINE and its host engine."
|
||||
echo "Example: "
|
||||
echo " ./tools/gn --android --unoptimized --android-cpu arm64 --runtime-mode profile"
|
||||
echo " ./tools/gn --unoptimized --runtime-mode profile"
|
||||
echo "to create out/android_profile_unopt_arm64 and out/host_profile_unopt."
|
||||
echo " ./tools/gn --android --unoptimized --android-cpu x64 --runtime-mode debug"
|
||||
echo " ./tools/gn --unoptimized --runtime-mode debug"
|
||||
echo "to create out/android_debug_unopt_x64 and out/host_debug_unopt."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -32,6 +28,6 @@ autoninja -C out/$FLUTTER_ENGINE
|
||||
|
||||
popd
|
||||
|
||||
./compile_android_aot.sh ../../../out/host_profile_unopt ../../../out/$FLUTTER_ENGINE/clang_x64
|
||||
./compile_android_jit.sh ../../../out/host_debug_unopt ../../../out/$FLUTTER_ENGINE/clang_x64
|
||||
|
||||
./run_android_tests.sh $FLUTTER_ENGINE
|
||||
|
||||
64
engine/src/flutter/testing/scenario_app/compile_android_jit.sh
Executable file
64
engine/src/flutter/testing/scenario_app/compile_android_jit.sh
Executable file
@@ -0,0 +1,64 @@
|
||||
#!/bin/bash
|
||||
# Copyright 2013 The Flutter Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
set -e
|
||||
|
||||
HOST_TOOLS=$1
|
||||
DEVICE_TOOLS=$2
|
||||
|
||||
if [[ ! -d "$HOST_TOOLS" ]]; then
|
||||
echo "Must specify the host out directory containing dart."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -d "$DEVICE_TOOLS" ]]; then
|
||||
echo "Must specify the device out directory containing gen_snapshot."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PUB_VERSION=$($HOST_TOOLS/dart-sdk/bin/pub --version)
|
||||
echo "Using Pub ${PUB_VERSION} from $HOST_TOOLS/dart-sdk/bin/pub"
|
||||
|
||||
$HOST_TOOLS/dart-sdk/bin/pub get
|
||||
|
||||
echo "Using dart from $HOST_TOOLS, gen_snapshot from $DEVICE_TOOLS."
|
||||
|
||||
OUTDIR="${BASH_SOURCE%/*}/build/app"
|
||||
FLUTTER_ASSETS_DIR=$OUTDIR/assets/flutter_assets
|
||||
LIBS_DIR="${BASH_SOURCE%/*}/android/app/libs"
|
||||
|
||||
echo "Creating directories..."
|
||||
|
||||
mkdir -p $OUTDIR
|
||||
mkdir -p $FLUTTER_ASSETS_DIR
|
||||
mkdir -p $LIBS_DIR
|
||||
|
||||
echo "Compiling kernel..."
|
||||
|
||||
"$HOST_TOOLS/dart" \
|
||||
"$HOST_TOOLS/gen/frontend_server.dart.snapshot" \
|
||||
--sdk-root "$HOST_TOOLS/flutter_patched_sdk" \
|
||||
--target=flutter \
|
||||
--no-link-platform \
|
||||
--output-dill "$FLUTTER_ASSETS_DIR/kernel_blob.bin" \
|
||||
"${BASH_SOURCE%/*}/lib/main.dart"
|
||||
|
||||
echo "Compiling JIT Snapshot..."
|
||||
|
||||
"$DEVICE_TOOLS/gen_snapshot" --deterministic \
|
||||
--enable-asserts \
|
||||
--no-causal_async_stacks \
|
||||
--lazy_async_stacks \
|
||||
--isolate_snapshot_instructions="$OUTDIR/isolate_snapshot_instr" \
|
||||
--snapshot_kind=app-jit \
|
||||
--load_vm_snapshot_data="$DEVICE_TOOLS/../gen/flutter/lib/snapshot/vm_isolate_snapshot.bin" \
|
||||
--load_isolate_snapshot_data="$DEVICE_TOOLS/../gen/flutter/lib/snapshot/isolate_snapshot.bin" \
|
||||
--isolate_snapshot_data="$FLUTTER_ASSETS_DIR/isolate_snapshot_data" \
|
||||
--isolate_snapshot_instructions="$FLUTTER_ASSETS_DIR/isolate_snapshot_instr" \
|
||||
"$FLUTTER_ASSETS_DIR/kernel_blob.bin"
|
||||
|
||||
cp "$DEVICE_TOOLS/../flutter.jar" "$LIBS_DIR"
|
||||
|
||||
echo "Created $OUTDIR."
|
||||
@@ -7,12 +7,6 @@
|
||||
|
||||
set -e
|
||||
|
||||
FLUTTER_ENGINE=android_profile_unopt_arm64
|
||||
|
||||
if [ $# -eq 1 ]; then
|
||||
FLUTTER_ENGINE=$1
|
||||
fi
|
||||
|
||||
cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd
|
||||
|
||||
pushd android
|
||||
|
||||
Reference in New Issue
Block a user