diff --git a/build/dart/rules.gni b/build/dart/rules.gni index d578b4890102d..0e3a75a6139d6 100644 --- a/build/dart/rules.gni +++ b/build/dart/rules.gni @@ -92,7 +92,7 @@ template("flutter_snapshot") { # Also, this define excludes debugging and profiling code from Flutter. args += [ "-Ddart.vm.product=true" ] } else { - if (!is_debug) { + if (flutter_runtime_mode == "profile") { # The following define excludes debugging code from Flutter. args += [ "-Ddart.vm.profile=true" ] } diff --git a/shell/platform/fuchsia/flutter/integration_flutter_tests/BUILD.gn b/shell/platform/fuchsia/flutter/integration_flutter_tests/BUILD.gn index 3c7142cfa3084..6e5e43e0b05ea 100644 --- a/shell/platform/fuchsia/flutter/integration_flutter_tests/BUILD.gn +++ b/shell/platform/fuchsia/flutter/integration_flutter_tests/BUILD.gn @@ -4,6 +4,5 @@ group("integration_flutter_tests") { testonly = true - # TODO(fxbug.dev/86055): re-enable - # deps = [ "embedder:tests" ] + deps = [ "embedder:tests" ] } diff --git a/tools/fuchsia/dart/config.gni b/tools/fuchsia/dart/config.gni index 8b66a75892678..5b14c9ebfaa67 100644 --- a/tools/fuchsia/dart/config.gni +++ b/tools/fuchsia/dart/config.gni @@ -5,20 +5,19 @@ import("//flutter/tools/fuchsia/dart/dart_build_config.gni") declare_args() { - # Forces all Dart apps to build in product mode which is a - # stripped down version of the VM running in AOT mode. - dart_force_product = false - - # TODO(fxbug.dev/64153) renable aot builds - # if (dart_force_product) { - # Product AOT - # dart_default_build_cfg = dart_release_build_cfg - # } else if (is_debug) { + # TODO(fxbug.dev/86941) enable dart_runner_integration_tests + # TODO(fxbug.dev/64153) renable dart runner aot builds + # if (flutter_runtime_mode == "release") { + # # Product AOT + # dart_default_build_cfg = dart_release_build_cfg + # } else if (flutter_runtime_mode == "jit_release") { + # # Product JIT + # dart_default_build_cfg = dart_jit_release_build_cfg + # } else if (flutter_runtime_mode == "debug") { # Non-product JIT dart_default_build_cfg = dart_debug_build_cfg - - # } else { - # Non-product AOT - # dart_default_build_cfg = dart_profile_build_cfg - # } + # } else { # "profile" + # # Non-product AOT + # dart_default_build_cfg = dart_profile_build_cfg + # } } diff --git a/tools/fuchsia/dart/dart_build_config.gni b/tools/fuchsia/dart/dart_build_config.gni index 76e4cc702ed6e..d9678ba9bfc46 100644 --- a/tools/fuchsia/dart/dart_build_config.gni +++ b/tools/fuchsia/dart/dart_build_config.gni @@ -2,6 +2,8 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//flutter/common/config.gni") + # Builds the component in a non-product JIT build. This will # launch the vm service in the runner. dart_debug_build_cfg = { @@ -13,42 +15,52 @@ dart_debug_build_cfg = { enable_asserts = true } -# TODO(richkadel): Don't confuse these settings with those in dart_build_config.gni, -# in fact, do I really need both? Can I drop flutter_build_config.gni? +# Builds the component in a non-product AOT build. This will +# launch the vm service in the runner. +# This configuration is not compatible with a --release build since the +# profile aot runner is built without asserts. +dart_aot_debug_build_cfg = { + runtime_meta = "//flutter/shell/platform/fuchsia/dart_runner/meta/aot_runtime" + runner_dep = "//flutter/shell/platform/fuchsia/dart_runner:dart_aot_runner" + platform_name = "dart_runner" + is_aot = true + is_product = false + enable_asserts = true +} -# # Builds the component in a non-product AOT build. This will -# # launch the vm service in the runner. -# # This configuration is not compatible with a --release build since the -# # profile aot runner is built without asserts. -# dart_aot_debug_build_cfg = { -# runtime_meta = "//flutter/shell/platform/fuchsia/dart_runner/meta/aot_runtime" -# runner_dep = "//flutter/shell/platform/fuchsia/dart_runner:dart_aot_runner" -# platform_name = "dart_runner" -# is_aot = true -# is_product = false -# enable_asserts = true -# } +# Builds the component in a non-product AOT build. This will +# launch the vm service in the runner. +dart_profile_build_cfg = { + runtime_meta = "//flutter/shell/platform/fuchsia/dart_runner/meta/aot_runtime" + runner_dep = "//flutter/shell/platform/fuchsia/dart_runner:dart_aot_runner" + platform_name = "dart_runner" + is_aot = true + is_product = false + enable_asserts = false +} -# # Builds the component in a non-product AOT build. This will -# # launch the vm service in the runner. -# dart_profile_build_cfg = { -# runtime_meta = "//flutter/shell/platform/fuchsia/dart_runner/meta/aot_runtime" -# runner_dep = "//flutter/shell/platform/fuchsia/dart_runner:dart_aot_runner" -# platform_name = "dart_runner" -# is_aot = true -# is_product = false -# enable_asserts = false -# } +# Builds the component in a product JIT build. This will +# not launch the vm service in the runner. +dart_jit_release_build_cfg = { + runtime_meta = + "//flutter/shell/platform/fuchsia/dart_runner/meta/jit_product_runtime" + runner_dep = + "//flutter/shell/platform/fuchsia/dart_runner:dart_jit_product_runner" + platform_name = "dart_runner" + is_aot = true + is_product = true + enable_asserts = false +} -# # Builds the component in a product AOT build. This will -# # not launch the vm service in the runner. -# dart_release_build_cfg = { -# runtime_meta = -# "//flutter/shell/platform/fuchsia/dart_runner/meta/aot_product_runtime" -# runner_dep = -# "//flutter/shell/platform/fuchsia/dart_runner:dart_aot_product_runner" -# platform_name = "dart_runner" -# is_aot = true -# is_product = true -# enable_asserts = false -# } +# Builds the component in a product AOT build. This will +# not launch the vm service in the runner. +dart_release_build_cfg = { + runtime_meta = + "//flutter/shell/platform/fuchsia/dart_runner/meta/aot_product_runtime" + runner_dep = + "//flutter/shell/platform/fuchsia/dart_runner:dart_aot_product_runner" + platform_name = "dart_runner" + is_aot = true + is_product = true + enable_asserts = false +} diff --git a/tools/fuchsia/dart/kernel/dart_kernel.gni b/tools/fuchsia/dart/kernel/dart_kernel.gni index ae58d1583b751..318546f79d1d9 100644 --- a/tools/fuchsia/dart/kernel/dart_kernel.gni +++ b/tools/fuchsia/dart/kernel/dart_kernel.gni @@ -157,10 +157,9 @@ template("dart_kernel") { _kernel_deps += invoker.deps } - # TODO(richkadel): The manifest is currently used by flutter_dart_component, to populate the file - # it calls `_convert_kernel_manifest_file`, so I can't make this conditional, right? Or is it - # possible to build Dart AOT Fuchsia packages/components without the data in this file (in which - # case I should make it conditional there as well)? + # TODO(richkadel): The manifest (if not using AOT) is used by + # flutter_dart_component, to populate the file it calls + # `_convert_kernel_manifest_file`. _generate_manifest = false if (invoker.is_aot) { not_needed(invoker, [ "generate_manifest" ]) @@ -291,17 +290,11 @@ template("dart_kernel") { ] } - # TODO(richkadel): NEED TO VALIDATE AND/OR CLEAN UP `is_debug` and `is_aot`. - # `is_debug` is set by the flutter `gn` script to true if --unoptimized, - # but `--unoptimized` is broken for Fuchsia, according to an open bug in - # github flutter/flutter issues. But I have a feeling `is_debug` from - # Fuchsia scripts may have a different meaning for dart/flutter at least. - # if (is_debug) { - args += [ "--embed-sources" ] - - # } else { - # args += [ "--no-embed-sources" ] - # } + if (flutter_runtime_mode == "debug") { + args += [ "--embed-sources" ] + } else { + args += [ "--no-embed-sources" ] + } if (invoker.is_aot) { args += [ @@ -320,12 +313,10 @@ template("dart_kernel") { # This define excludes debugging and profiling code from Flutter. args += [ "-Ddart.vm.product=true" ] } else { - # TODO(richkadel): I'm pretty sure we want to assume is_debug even if that's - # not what's set by gn flags (--unoptimized = false because true is currentlyh broken for Fuchsia?) - # if (!is_debug) { - # # The following define excludes debugging code from Flutter. - # args += [ "-Ddart.vm.profile=true" ] - # } + if (flutter_runtime_mode == "profile") { + # The following define excludes debugging code from Flutter. + args += [ "-Ddart.vm.profile=true" ] + } } if (defined(invoker.main_dart)) { diff --git a/tools/fuchsia/dart_kernel.gni b/tools/fuchsia/dart_kernel.gni index 97f098fbf67dd..408ba1840a6cf 100644 --- a/tools/fuchsia/dart_kernel.gni +++ b/tools/fuchsia/dart_kernel.gni @@ -49,7 +49,7 @@ template("dart_kernel") { "--output=" + rebase_path(output), ] - if (is_debug) { + if (flutter_runtime_mode == "debug") { args += [ "--embed-sources" ] } else { args += [ "--no-embed-sources" ] @@ -75,7 +75,7 @@ template("dart_kernel") { # Also, this define excludes debugging and profiling code from Flutter. args += [ "-Ddart.vm.product=true" ] } else { - if (!is_debug) { + if (flutter_runtime_mode == "profile") { # The following define excludes debugging code from Flutter. args += [ "-Ddart.vm.profile=true" ] } diff --git a/tools/fuchsia/flutter/config.gni b/tools/fuchsia/flutter/config.gni index a8ebc4414f863..c1e4285e10a76 100644 --- a/tools/fuchsia/flutter/config.gni +++ b/tools/fuchsia/flutter/config.gni @@ -5,27 +5,17 @@ import("//flutter/tools/fuchsia/flutter/flutter_build_config.gni") declare_args() { - # If set to true, will force the runners to be built in - # product mode which means they will not have an exposed vm service - flutter_force_product = false -} - -declare_args() { - # TODO(richkadel): Make sure we're using 'debug' (non-aot) consistently, - # across dart and flutter rules. - # Since we're not REALLY building flutter apps, can I just git rid of this - # setting, and the configs in flutter/tools/fuchsia/flutter/flutter_build_config.gni? - # I think it's confusing to have both that one and .../dart/dart_build_config.gni. - - # if (flutter_force_product) { - # # Product AOT - # flutter_default_build_cfg = flutter_release_build_cfg - # } else if (is_debug) { - # Non-product JIT - flutter_default_build_cfg = flutter_debug_build_cfg - - # } else { - # # Non-product AOT - # flutter_default_build_cfg = flutter_profile_build_cfg - # } + if (flutter_runtime_mode == "release") { + # Product AOT + flutter_default_build_cfg = flutter_release_build_cfg + } else if (flutter_runtime_mode == "jit_release") { + # Product JIT + flutter_default_build_cfg = flutter_jit_release_build_cfg + } else if (flutter_runtime_mode == "debug") { + # Non-product JIT + flutter_default_build_cfg = flutter_debug_build_cfg + } else { # "profile" + # Non-product AOT + flutter_default_build_cfg = flutter_profile_build_cfg + } } diff --git a/tools/fuchsia/flutter/flutter_build_config.gni b/tools/fuchsia/flutter/flutter_build_config.gni index dd36c0a4dd56f..b7c033a46fc2a 100644 --- a/tools/fuchsia/flutter/flutter_build_config.gni +++ b/tools/fuchsia/flutter/flutter_build_config.gni @@ -2,8 +2,11 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//flutter/common/config.gni") + # Non-product JIT is "debug". It launches the vm service. # Non-product AOT is "profile". It also launches the vm service, but lacks tools that rely on JIT. +# Product JIT is "release". It doesn't launch the vm service. # Product AOT is "release". It doesn't launch the vm service. # Builds the component in a non-product JIT build. This will @@ -17,43 +20,54 @@ flutter_debug_build_cfg = { enable_asserts = true } -# TODO(richkadel): Don't confuse these settings with those in dart_build_config.gni, -# in fact, do I really need both? Can we just use the settings in dart_build_config.gni? +# Builds the component in a non-product AOT build. This will +# launch the vm service in the runner. +# This configuration is not compatible with a --release build since the +# profile aot runner is built without asserts. +flutter_aot_debug_build_cfg = { + runtime_meta = "//flutter/shell/platform/fuchsia/flutter/meta/aot_runtime" + runner_dep = "//flutter/shell/platform/fuchsia/flutter:flutter_aot_runner" + platform_name = "flutter_runner" + is_aot = true + is_product = false + enable_asserts = true +} -# # Builds the component in a non-product AOT build. This will -# # launch the vm service in the runner. -# # This configuration is not compatible with a --release build since the -# # profile aot runner is built without asserts. -# flutter_aot_debug_build_cfg = { -# runtime_meta = "//flutter/shell/platform/fuchsia/flutter/meta/aot_runtime" -# runner_dep = "//flutter/shell/platform/fuchsia/flutter:flutter_aot_runner" -# platform_name = "flutter_runner" -# is_aot = true -# is_product = false -# enable_asserts = true -# } +# Builds the component in a non-product AOT build. This will +# launch the vm service in the runner. +flutter_profile_build_cfg = { + runtime_meta = + "//flutter/shell/platform/fuchsia/flutter/meta/aot_runtime" # profile + # runner + runner_dep = "//flutter/shell/platform/fuchsia/flutter:flutter_aot_runner" + platform_name = "flutter_runner" + is_aot = true + is_product = false + enable_asserts = false +} -# # Builds the component in a non-product AOT build. This will -# # launch the vm service in the runner. -# flutter_profile_build_cfg = { -# runtime_meta = -# "//flutter/shell/platform/fuchsia/flutter/meta/aot_runtime" # profile -# # runner -# runner_dep = "//flutter/shell/platform/fuchsia/flutter:flutter_aot_runner" -# platform_name = "flutter_runner" -# is_aot = true -# is_product = false -# enable_asserts = false -# } +# Builds the component in a product JIT build. This will +# not launch the vm service in the runner. +flutter_jit_release_build_cfg = { + runtime_meta = + "//flutter/shell/platform/fuchsia/flutter/meta/jit_product_runtime" + runner_dep = + "//flutter/shell/platform/fuchsia/flutter:flutter_jit_product_runner" + platform_name = "flutter_runner" + is_aot = false + is_product = true + enable_asserts = false +} -# # Builds the component in a product AOT build. This will -# # not launch the vm service in the runner. -# flutter_release_build_cfg = { -# runtime_meta = -# "//flutter/shell/platform/fuchsia/flutter/meta/aot_product_runtime" -# runner_dep = "//flutter/shell/platform/fuchsia/flutter:flutter_aot_product_runner" -# platform_name = "flutter_runner" -# is_aot = true -# is_product = true -# enable_asserts = false -# } +# Builds the component in a product AOT build. This will +# not launch the vm service in the runner. +flutter_release_build_cfg = { + runtime_meta = + "//flutter/shell/platform/fuchsia/flutter/meta/aot_product_runtime" + runner_dep = + "//flutter/shell/platform/fuchsia/flutter:flutter_aot_product_runner" + platform_name = "flutter_runner" + is_aot = true + is_product = true + enable_asserts = false +} diff --git a/tools/fuchsia/flutter/internal/flutter_dart_component.gni b/tools/fuchsia/flutter/internal/flutter_dart_component.gni index 63f134cb9f00e..23c3217159fc4 100644 --- a/tools/fuchsia/flutter/internal/flutter_dart_component.gni +++ b/tools/fuchsia/flutter/internal/flutter_dart_component.gni @@ -154,11 +154,6 @@ template("flutter_dart_component") { # the kernel will ignore this variable. generate_manifest = true - # TODO(richkadel): verify the above statement about aot is true (AOT builds, - # using these new scripts derived from Fuchsia, have not been tested yet); - # because as of now, the Fuchsia package/component appears to require data - # from `_convert_kernel_manifest`. - platform_name = build_cfg.platform_name product = build_cfg.is_product is_aot = build_cfg.is_aot @@ -230,7 +225,6 @@ template("flutter_dart_component") { # No asserts in debug or release product. # No asserts in non-product release # Yes asserts in non-product debug. - # if (is_debug && !dart_force_product) if (build_cfg.enable_asserts) { args += [ "--enable_asserts" ] } @@ -263,17 +257,23 @@ template("flutter_dart_component") { manifest = _manifest manifest_output_name = _manifest_output_name - _convert_kernel_target_name = - "${_kernel_target_name}_convert_kernel_manifest" - _convert_kernel_manifest_file = - # TODO(richkadel): This is prefixed by "dartlang/", which is not found. - # Is the current toolchain set incorrectly somewhere? - string_replace( - "${target_gen_dir}/${_convert_kernel_target_name}_kernel_manifest.json", - "dartlang/", - "") - - resources_in_json_files = [ rebase_path(_convert_kernel_manifest_file) ] + if (!build_cfg.is_aot) { + _convert_kernel_target_name = + "${_kernel_target_name}_convert_kernel_manifest" + _convert_kernel_manifest_file = + # TODO(richkadel): This is prefixed by "dartlang/", which is not found. + # Is the current toolchain set incorrectly somewhere? + string_replace( + "${target_gen_dir}/${_convert_kernel_target_name}_kernel_manifest.json", + "dartlang/", + "") + + # TODO(richkadel): Adds the json resource names in the manifest to the + # collection of `json_of_resources` files, read by + # `prepare_package_inputs.py`. These resources are computed (only known) + # at some point during the build/compile phase. + resources_in_json_files = [ rebase_path(_convert_kernel_manifest_file) ] + } } group(target_name) {