Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,6 @@ group("flutter") {
]
}

if (is_ios || is_android) {
public_deps += [ "//flutter/testing/scenario_app" ]
}

# Compile all unittests targets if enabled.
if (enable_unittests) {
public_deps += [
Expand Down
165 changes: 2 additions & 163 deletions build/dart/rules.gni
Original file line number Diff line number Diff line change
Expand Up @@ -2,171 +2,10 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# This file has rules for making Dart packages and snapshots.
# This file has rules for making Dart packages and Dart-based Mojo applications.
# The entrypoint is the dart_pkg rule.

import("//build/compiled_action.gni")
import("//build/module_args/dart.gni")
import("//flutter/common/config.gni")
import("//third_party/dart/build/dart/dart_action.gni")

# Creates a dart kernel (dill) file suitable for use with gen_snapshot, as well
# as the app-jit, aot-elf, or aot-assembly snapshot for Android or iOS.
#
# Invoker must supply dart_main and package_config. Invoker may optionally
# supply aot as a boolean and product as a boolean.
template("dart_snapshot") {
assert(!is_fuchsia)
assert(defined(invoker.main_dart), "main_dart is a required parameter.")
assert(defined(invoker.package_config),
"package_config is a required parameter.")

kernel_target = "_${target_name}_kernel"
snapshot_target = "_${target_name}_snapshot"
is_aot =
flutter_runtime_mode == "profile" || flutter_runtime_mode == "release"

kernel_output = "$target_gen_dir/kernel_blob.bin"

prebuilt_dart_action(kernel_target) {
script = "//flutter/flutter_frontend_server/bin/starter.dart"

main_dart = rebase_path(invoker.main_dart)
package_config = rebase_path(invoker.package_config)
flutter_patched_sdk = rebase_path("$root_out_dir/flutter_patched_sdk")

deps = [ "//flutter/lib/snapshot:strong_platform" ]

inputs = [
main_dart,
package_config,
]

outputs = [ kernel_output ]

depfile = "$kernel_output.d"
abs_depfile = rebase_path(depfile)
rebased_output = rebase_path(kernel_output, root_build_dir)
vm_args = [
"--depfile=$abs_depfile",
"--depfile_output_filename=$rebased_output",
"--disable-dart-dev",
]

args = [
"--packages=" + rebase_path(package_config),
"--target=flutter",
"--sdk-root=" + flutter_patched_sdk,
"--output-dill=" + rebase_path(kernel_output),
]

if (is_aot) {
args += [
"--aot",
"--tfa",
]
} else {
# --no-link-platform is only valid when --aot isn't specified
args += [ "--no-link-platform" ]
}

if (defined(invoker.product) && invoker.product) {
# Setting this flag in a non-product release build for AOT (a "profile"
# build) causes the vm service isolate code to be tree-shaken from an app.
# See the pragma on the entrypoint here:
#
# https://github.com/dart-lang/sdk/blob/master/sdk/lib/_internal/vm/bin/vmservice_io.dart#L240
#
# Also, this define excludes debugging and profiling code from Flutter.
args += [ "-Ddart.vm.product=true" ]
} else {
if (!is_debug) {
# The following define excludes debugging code from Flutter.
args += [ "-Ddart.vm.profile=true" ]
}
}

args += [ rebase_path(main_dart) ]
}

compiled_action(snapshot_target) {
if (target_cpu == "x86" && host_os == "linux") {
# By default Dart will create a 32-bit gen_snapshot host binary if the target
# platform is 32-bit. Override this to create a 64-bit gen_snapshot for x86
# targets because some host platforms may not support 32-bit binaries.
tool = "//third_party/dart/runtime/bin:gen_snapshot_host_targeting_host"
toolchain = "//build/toolchain/$host_os:clang_x64"
} else {
tool = "//third_party/dart/runtime/bin:gen_snapshot"
}

inputs = [ kernel_output ]
deps = [ ":$kernel_target" ]
outputs = []

args = [ "--lazy_async_stacks" ]

if (is_debug && flutter_runtime_mode != "profile" &&
flutter_runtime_mode != "release" &&
flutter_runtime_mode != "jit_release") {
args += [ "--enable_asserts" ]
}

if (is_aot) {
args += [ "--deterministic" ]
if (is_ios) {
snapshot_assembly = "$target_gen_dir/ios/snapshot_assembly.S"
outputs += [ snapshot_assembly ]
args += [
"--snapshot_kind=app-aot-assembly",
"--assembly=" + rebase_path(snapshot_assembly),
]
} else if (is_android) {
libapp = "$target_gen_dir/android/libs/$android_app_abi/libapp.so"
outputs += [ libapp ]
args += [
"--snapshot_kind=app-aot-elf",
"--elf=" + rebase_path(libapp),
]
} else {
assert(false)
}
} else {
deps += [ "//flutter/lib/snapshot:generate_snapshot_bin" ]
vm_snapshot_data =
"$root_gen_dir/flutter/lib/snapshot/vm_isolate_snapshot.bin"
snapshot_data = "$root_gen_dir/flutter/lib/snapshot/isolate_snapshot.bin"
isolate_snapshot_data = "$target_gen_dir/isolate_snapshot_data"
isolate_snapshot_instructions = "$target_gen_dir/isolate_snapshot_instr"

inputs += [
vm_snapshot_data,
snapshot_data,
]

outputs += [
isolate_snapshot_data,
isolate_snapshot_instructions,
]
args += [
"--snapshot_kind=app-jit",
"--load_vm_snapshot_data=" + rebase_path(vm_snapshot_data),
"--load_isolate_snapshot_data=" + rebase_path(snapshot_data),
"--isolate_snapshot_data=" + rebase_path(isolate_snapshot_data),
"--isolate_snapshot_instructions=" +
rebase_path(isolate_snapshot_instructions),
]
}

args += [ rebase_path(kernel_output) ]
}

group(target_name) {
public_deps = [
":$kernel_target",
":$snapshot_target",
]
}
}

template("dart_pkg_helper") {
assert(defined(invoker.package_name))
Expand Down
49 changes: 0 additions & 49 deletions testing/scenario_app/BUILD.gn

This file was deleted.

50 changes: 0 additions & 50 deletions testing/scenario_app/android/BUILD.gn

This file was deleted.

10 changes: 3 additions & 7 deletions testing/scenario_app/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,14 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
sourceSets.main {
assets.srcDirs += "${project.buildDir}/assets"
if (project.hasProperty('libapp')) {
jni.srcDirs = []
jniLibs.srcDirs = [project.property('libapp')]
}
sourceSets {
main.assets.srcDirs += "${project.buildDir}/assets"
}
}

dependencies {
implementation files(project.property('flutter_jar'))
compile 'com.facebook.testing.screenshot:layout-hierarchy-common:0.12.0'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.0.0'
Expand Down
5 changes: 1 addition & 4 deletions testing/scenario_app/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ allprojects {
}
}

rootProject.buildDir = project.hasProperty('out_dir')
? project.property('out_dir')
: '../build'

rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
Expand Down
26 changes: 0 additions & 26 deletions testing/scenario_app/android/run_gradle.py

This file was deleted.

13 changes: 10 additions & 3 deletions testing/scenario_app/assemble_apk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,16 @@ SCRIPT_DIR=$(follow_links "$(dirname -- "${BASH_SOURCE[0]}")")
SRC_DIR="$(cd "$SCRIPT_DIR/../../.."; pwd -P)"
export ANDROID_HOME="$SRC_DIR/third_party/android_tools/sdk"

# TODO(dnfield): Delete this whole file.
DEVICE_OUT_DIR=${2%"clang_x64"}
"$SRC_DIR/flutter/tools/gn" --unopt
ninja -C "$SRC_DIR/out/host_debug_unopt" sky_engine -j 400

"$SCRIPT_DIR/compile_android_aot.sh" "$1" "$2"

(
cd "$SCRIPT_DIR/android"
./gradlew assembleDebug --no-daemon
)

# LUCI expects to find the APK here
mkdir -p "$SCRIPT_DIR/android/app/build/outputs/apk/debug"
cp "$DEVICE_OUT_DIR/scenario_app/app/outputs/apk/debug/app-debug.apk" "$SCRIPT_DIR/android/app/build/outputs/apk/debug"
cp "$SCRIPT_DIR/build/app/outputs/apk/debug/app-debug.apk" "$SCRIPT_DIR/android/app/build/outputs/apk/debug"
3 changes: 3 additions & 0 deletions testing/scenario_app/build_and_run_android_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,11 @@ fi

if [[ ! -d "$SRC_DIR/out/$FLUTTER_ENGINE" ]]; then
"$GN" --android --unoptimized --android-cpu x64 --runtime-mode debug
"$GN" --unoptimized --runtime-mode debug
fi

autoninja -C "$SRC_DIR/out/$FLUTTER_ENGINE"
autoninja -C "$SRC_DIR/out/host_debug_unopt"

"$SCRIPT_DIR/compile_android_jit.sh" "$SRC_DIR/out/host_debug_unopt" "$SRC_DIR/out/$FLUTTER_ENGINE/clang_x64"
"$SCRIPT_DIR/run_android_tests.sh" "$FLUTTER_ENGINE"
2 changes: 2 additions & 0 deletions testing/scenario_app/build_and_run_ios_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,7 @@ if [ ! -d "$SRC_DIR/out/$FLUTTER_ENGINE" ]; then
fi

autoninja -C "$SRC_DIR/out/$FLUTTER_ENGINE"
autoninja -C "$SRC_DIR/out/host_debug_unopt"

"$SCRIPT_DIR/compile_ios_jit.sh" "$SRC_DIR/out/host_debug_unopt" "$SRC_DIR/out/$FLUTTER_ENGINE/clang_x64"
"$SCRIPT_DIR/run_ios_tests.sh" "$FLUTTER_ENGINE"
Loading