提交 57043227 编写于 作者: J Jason Simmons

Add a --deploy build option that enables Dart product mode (#2598)

上级 68cc67f2
......@@ -25,7 +25,7 @@ vars = {
# Note: When updating the Dart revision, ensure that all entries that are
# dependencies of dart are also updated
'dart_revision': '7060b6a07b74da52492be4469da5cd150a2ef940',
'dart_revision': '01c543cb0abadba28bec2fda8c72e2b8b431314d',
'dart_observatory_packages_revision': 'cf90eb9077177d3d6b3fd5e8289477c2385c026a',
'dart_root_certificates_revision': 'aed07942ce98507d2be28cbd29e879525410c7fc',
......
......@@ -28,6 +28,8 @@ declare_args() {
} else {
sky_dart_strict_mode = false
}
flutter_develop_mode = false
}
# feature_defines_list ---------------------------------------------------------
......@@ -56,3 +58,7 @@ if (sky_dart_strict_mode) {
if (sky_use_dart) {
feature_defines_list += [ "WTF_USE_DART=1" ]
}
if (flutter_develop_mode) {
feature_defines_list += [ "FLUTTER_DEVELOP_MODE=1" ]
}
......@@ -199,8 +199,6 @@ sky_core_files = [
"rendering/style/StyleVisualData.h",
"script/dart_controller.cc",
"script/dart_controller.h",
"script/dart_debugger.cc",
"script/dart_debugger.h",
"script/dart_init.cc",
"script/dart_init.h",
"script/dart_service_isolate.cc",
......@@ -220,6 +218,13 @@ sky_core_files = [
"window/window.h",
]
if (flutter_develop_mode) {
sky_core_files += [
"script/dart_debugger.cc",
"script/dart_debugger.h",
]
}
core_dart_files = get_path_info([
"dart/compositing.dart",
"dart/hash_codes.dart",
......
......@@ -325,6 +325,14 @@ bool IsRunningPrecompiledCode() {
#endif // DART_ALLOW_DYNAMIC_RESOLUTION
bool IsDevelopMode() {
#ifdef FLUTTER_DEVELOP_MODE
return true;
#else
return false;
#endif
}
static base::LazyInstance<std::unique_ptr<EmbedderTracingCallbacks>>::Leaky
g_tracing_callbacks = LAZY_INSTANCE_INITIALIZER;
......@@ -376,7 +384,7 @@ void InitDartVM() {
enable_checked_mode = true;
#endif
if (IsRunningPrecompiledCode()) {
if (IsRunningPrecompiledCode() || !IsDevelopMode()) {
enable_checked_mode = false;
}
......@@ -387,9 +395,11 @@ void InitDartVM() {
// The version of the VM setup to run precompiled code does not recognize
// the mirrors or the background compilation flags. They are never enabled.
// Make sure we dont pass in unrecognized flags.
args.append(kDartMirrorsArgs, arraysize(kDartMirrorsArgs));
args.append(kDartBackgroundCompilationArgs,
arraysize(kDartBackgroundCompilationArgs));
if (IsDevelopMode()) {
args.append(kDartMirrorsArgs, arraysize(kDartMirrorsArgs));
args.append(kDartBackgroundCompilationArgs,
arraysize(kDartBackgroundCompilationArgs));
}
} else {
args.append(kDartPrecompilationArgs, arraysize(kDartPrecompilationArgs));
}
......@@ -420,11 +430,13 @@ void InitDartVM() {
}
CHECK(Dart_SetVMFlags(args.size(), args.data()));
#ifdef FLUTTER_DEVELOP_MODE
{
TRACE_EVENT0("flutter", "DartDebugger::InitDebugger");
// This should be called before calling Dart_Initialize.
DartDebugger::InitDebugger();
}
#endif
DartUI::InitForGlobal();
#ifdef OS_ANDROID
......
......@@ -27,6 +27,10 @@ def get_out_dir(args):
else:
target_dir += 'Release'
# Currently --develop does not change the out-dir.
if not args.develop:
target_dir += '_Deploy'
if args.ios_force_armv7:
target_dir += '_armv7'
......@@ -44,6 +48,7 @@ def to_gn_args(args):
gn_args['is_debug'] = args.debug
gn_args['is_clang'] = args.clang and args.target_os not in ['android', 'fnl']
gn_args['flutter_develop_mode'] = args.develop
ios_target_cpu = 'arm64'
if args.ios_force_armv7:
......@@ -102,6 +107,7 @@ def to_gn_args(args):
gn_args['enable_gcm'] = args.enable_gcm
gn_args['enable_google_sign_in'] = args.enable_google_sign_in
gn_args['use_glfw'] = args.use_glfw
gn_args['dart_product'] = not args.develop
return gn_args
......@@ -112,6 +118,11 @@ def parse_args(args):
parser.add_argument('--debug', default=True, action='store_true')
parser.add_argument('--release', default=False, dest='debug', action='store_false')
# Deploy is a placeholder for https://github.com/flutter/flutter/issues/3263
# Adding it now unblocks bot/tool work.
parser.add_argument('--develop', default=True, action='store_true')
parser.add_argument('--deploy', default=False, dest='develop', action='store_false')
parser.add_argument('--target-os', type=str, choices=['android', 'ios'])
parser.add_argument('--android', dest='target_os', action='store_const', const='android')
parser.add_argument('--fnl', dest='target_os', action='store_const', const='fnl')
......
......@@ -34,4 +34,8 @@ executable("sky_snapshot") {
"-lgcc_s",
]
}
if (flutter_develop_mode) {
defines = [ "FLUTTER_DEVELOP_MODE=1" ]
}
}
......@@ -14,8 +14,10 @@ extern void* kDartIsolateSnapshotBuffer;
}
static const char* kDartArgs[] = {
#ifdef FLUTTER_DEVELOP_MODE
"--enable_mirrors=false",
"--load_deferred_eagerly=true",
#endif
"--conditional_directives",
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册