Wire up Fuchsia SDK related updated for shell dependencies. #8869

This does not actually import the runners into the engine. It only sets up the targets so they need no modifications are necessary when the migration is done. The engine has been verified to build in both buildroots.
This commit is contained in:
Chinmay Garde
2019-05-06 18:01:59 -07:00
committed by GitHub
parent e1e51dc7c4
commit 56e7bf84b1
18 changed files with 113 additions and 47 deletions

View File

@@ -4,6 +4,10 @@
import("$flutter_root/common/config.gni")
if (is_fuchsia) {
import("//build/fuchsia/sdk.gni")
}
# Whether to build the dartdevc sdk, libraries, and source files
# required for the flutter web sdk.
declare_args() {
@@ -24,6 +28,10 @@ group("flutter") {
public_deps += [ "$flutter_root/shell/testing" ]
}
if (is_fuchsia && using_fuchsia_sdk) {
public_deps += [ "$flutter_root/shell/platform/fuchsia" ]
}
if (!is_fuchsia && !is_fuchsia_host) {
if (current_toolchain == host_toolchain) {
public_deps += [

View File

@@ -736,7 +736,6 @@ FILE: ../../../flutter/third_party/txt/src/txt/platform.h
FILE: ../../../flutter/third_party/txt/src/txt/platform_android.cc
FILE: ../../../flutter/third_party/txt/src/txt/platform_linux.cc
FILE: ../../../flutter/third_party/txt/src/txt/platform_mac.mm
FILE: ../../../flutter/vulkan/skia_vulkan_header.h
FILE: ../../../flutter/vulkan/vulkan_application.cc
FILE: ../../../flutter/vulkan/vulkan_application.h
FILE: ../../../flutter/vulkan/vulkan_backbuffer.cc

View File

@@ -6,6 +6,10 @@ if (is_android) {
import("//build/config/android/config.gni")
}
if (is_fuchsia) {
import("//build/fuchsia/sdk.gni")
}
if (target_cpu == "arm" || target_cpu == "arm64") {
import("//build/config/arm.gni")
}
@@ -38,3 +42,7 @@ if (flutter_runtime_mode == "debug") {
} else {
feature_defines_list += [ "FLUTTER_RUNTIME_MODE=0" ]
}
if (is_fuchsia && using_fuchsia_sdk) {
feature_defines_list += [ "FUCHSIA_SDK=1" ]
}

View File

@@ -2,6 +2,10 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
if (is_fuchsia) {
import("//build/fuchsia/sdk.gni")
}
source_set("flow") {
sources = [
"compositor_context.cc",
@@ -80,13 +84,19 @@ source_set("flow") {
"view_holder.h",
]
public_deps += [
"//sdk/fidl/fuchsia.ui.scenic",
"//sdk/fidl/fuchsia.ui.views",
"//sdk/lib/ui/scenic/cpp",
"//topaz/public/dart-pkg/zircon",
"//zircon/public/lib/zx",
]
if (using_fuchsia_sdk) {
public_deps += [
"$fuchsia_sdk_root/fidl:fuchsia.ui.gfx",
"$fuchsia_sdk_root/pkg:scenic_cpp",
]
} else {
public_deps += [
"//garnet/public/lib/ui/scenic/cpp",
"//sdk/fidl/fuchsia.ui.scenic",
"//topaz/public/dart-pkg/zircon",
"//zircon/public/lib/zx",
]
}
}
}
@@ -98,7 +108,6 @@ executable("flow_unittests") {
"flow_test_utils.cc",
"flow_test_utils.h",
"layers/performance_overlay_layer_unittests.cc",
"layers/physical_shape_layer_unittests.cc",
"matrix_decomposition_unittests.cc",
"raster_cache_unittests.cc",
]

View File

@@ -7,7 +7,6 @@
#include "flutter/flow/layers/layer.h"
#include "flutter/flow/matrix_decomposition.h"
#include "flutter/fml/trace_event.h"
#include "flutter/lib/ui/window/viewport_metrics.h"
namespace flutter {
@@ -301,7 +300,7 @@ SceneUpdateContext::Frame::Frame(SceneUpdateContext& context,
paint_bounds_(SkRect::MakeEmpty()),
layer_(layer) {
if (local_elevation != 0.0) {
if (depth > flutter::kUnsetDepth && world_elevation >= depth) {
if (depth > -1 && world_elevation >= depth) {
// TODO(mklim): Deal with bounds overflow correctly.
FML_LOG(ERROR) << "Elevation " << world_elevation << " is outside of "
<< depth;

View File

@@ -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("//build/fuchsia/sdk.gni")
source_set("fml") {
sources = [
"arraysize.h",
@@ -83,7 +85,10 @@ source_set("fml") {
configs += [ "//third_party/icu:icu_config" ]
public_configs = [ "$flutter_root:config" ]
public_configs = [
"$flutter_root:config",
"$flutter_root/common:flutter_config",
]
libs = []
@@ -153,7 +158,9 @@ source_set("fml") {
if (is_fuchsia) {
sources += [ "platform/fuchsia/paths_fuchsia.cc" ]
public_deps += [ "//zircon/public/lib/trace" ]
if (!using_fuchsia_sdk) {
public_deps += [ "//zircon/public/lib/trace" ]
}
}
if (is_win) {

View File

@@ -8,6 +8,7 @@
#include "flutter/fml/build_config.h"
#if defined(OS_FUCHSIA)
#if !defined(FUCHSIA_SDK)
// Forward to the system tracing mechanism on Fuchsia.
@@ -27,7 +28,8 @@
#define TRACE_EVENT_ASYNC_END1(a, b, c, d, e) TRACE_ASYNC_END(a, b, c, d, e)
#define TRACE_EVENT_INSTANT0(a, b) TRACE_INSTANT(a, b, TRACE_SCOPE_THREAD)
#endif // defined(OS_FUCHSIA)
#endif // !defined(FUCHSIA_SDK)
#endif // defined(OS_FUCHSIA)
#include <cstddef>
#include <cstdint>
@@ -39,8 +41,7 @@
#include "flutter/fml/time/time_point.h"
#include "third_party/dart/runtime/include/dart_tools_api.h"
#if !defined(OS_FUCHSIA)
#if !defined(OS_FUCHSIA) || defined(FUCHSIA_SDK)
#ifndef TRACE_EVENT_HIDE_MACROS
#define __FML__TOKEN_CAT__(x, y) x##y
@@ -103,8 +104,7 @@
::fml::tracing::TraceEventFlowEnd0(category, name, id);
#endif // TRACE_EVENT_HIDE_MACROS
#endif // !defined(OS_FUCHSIA)
#endif // !defined(OS_FUCHSIA) || defined(FUCHSIA_SDK)
namespace fml {
namespace tracing {

View File

@@ -3,6 +3,7 @@
# found in the LICENSE file.
import("//build/compiled_action.gni")
import("//build/fuchsia/sdk.gni")
import("//third_party/dart/utils/compile_platform.gni")
import("$flutter_root/common/config.gni")
import("$flutter_root/lib/ui/dart_ui.gni")
@@ -10,6 +11,7 @@ import("$flutter_root/lib/ui/dart_ui.gni")
bindings_output_dir = "$root_gen_dir/sky/bindings"
copy("generate_dart_ui") {
visibility = [ ":*" ]
sources = dart_ui_files
outputs = [
@@ -20,7 +22,7 @@ copy("generate_dart_ui") {
compiled_action("generate_snapshot_bin") {
tool = "//third_party/dart/runtime/bin:gen_snapshot"
if (is_fuchsia || is_fuchsia_host) {
if ((is_fuchsia || is_fuchsia_host) && !using_fuchsia_sdk) {
platform_kernel =
"$root_out_dir/flutter_runner_patched_sdk/platform_strong.dill"
} else {
@@ -56,8 +58,7 @@ compiled_action("generate_snapshot_bin") {
rebase_path(isolate_snapshot_instructions),
]
if (is_debug && flutter_runtime_mode != "profile" &&
flutter_runtime_mode != "release") {
if (is_debug) {
args += [ "--enable_asserts" ]
}
@@ -206,7 +207,7 @@ bin_to_linkable("platform_strong_dill_linkable") {
deps = [
":kernel_platform_files",
]
if (is_fuchsia || is_fuchsia_host) {
if ((is_fuchsia || is_fuchsia_host) && !using_fuchsia_sdk) {
input = "$root_out_dir/flutter_runner_patched_sdk/platform_strong.dill"
} else {
input = "$root_out_dir/flutter_patched_sdk/platform_strong.dill"
@@ -231,6 +232,23 @@ source_set("snapshot") {
get_target_outputs(":platform_strong_dill_linkable")
}
compile_platform("non_strong_platform") {
single_root_scheme = "org-dartlang-sdk"
single_root_base = rebase_path("../../../")
libraries_specification_uri =
"org-dartlang-sdk:///flutter/lib/snapshot/libraries.json"
outputs = [
"$root_out_dir/flutter_patched_sdk/platform.dill",
"$root_out_dir/flutter_patched_sdk/vm_outline.dill",
]
args = [
"--target=flutter",
"dart:core",
]
}
compile_platform("strong_platform") {
single_root_scheme = "org-dartlang-sdk"
single_root_base = rebase_path("../../../")
@@ -254,7 +272,7 @@ compile_platform("strong_platform") {
}
# Fuchsia's snapshot requires a different platform with extra dart: libraries.
if (is_fuchsia || is_fuchsia_host) {
if ((is_fuchsia || is_fuchsia_host) && !using_fuchsia_sdk) {
group("kernel_platform_files") {
public_deps = [
"//topaz/runtime/flutter_runner/kernel:kernel_platform_files",

View File

@@ -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("//build/fuchsia/sdk.gni")
source_set("ui") {
sources = [
"compositing/scene.cc",
@@ -121,6 +123,14 @@ source_set("ui") {
"compositing/scene_host.h",
]
deps += [ "//topaz/public/dart-pkg/zircon" ]
if (using_fuchsia_sdk) {
deps += [
"$flutter_root/shell/platform/fuchsia/dart-pkg/fuchsia",
"$flutter_root/shell/platform/fuchsia/dart-pkg/zircon",
"$fuchsia_sdk_root/pkg:async-cpp",
]
} else {
deps += [ "//topaz/public/dart-pkg/zircon" ]
}
}
}

View File

@@ -4,7 +4,6 @@
#include "flutter/lib/ui/compositing/scene_host.h"
#include <lib/fsl/handles/object_info.h>
#include <lib/ui/scenic/cpp/view_token_pair.h>
#include <lib/zx/eventpair.h>
#include <third_party/tonic/dart_args.h>
@@ -75,6 +74,13 @@ void InvokeDartFunction(tonic::DartPersistentValue* function, T& arg) {
}
}
zx_koid_t GetKoid(zx_handle_t handle) {
zx_info_handle_basic_t info;
zx_status_t status = zx_object_get_info(handle, ZX_INFO_HANDLE_BASIC, &info,
sizeof(info), nullptr, nullptr);
return status == ZX_OK ? info.koid : ZX_KOID_INVALID;
}
} // namespace
namespace flutter {
@@ -113,7 +119,7 @@ fml::RefPtr<SceneHost> SceneHost::CreateViewHolder(
SceneHost::SceneHost(fml::RefPtr<zircon::dart::Handle> exportTokenHandle)
: gpu_task_runner_(
UIDartState::Current()->GetTaskRunners().GetGPUTaskRunner()),
id_(fsl::GetKoid(exportTokenHandle->handle())),
id_(GetKoid(exportTokenHandle->handle())),
use_view_holder_(false) {
gpu_task_runner_->PostTask(
[id = id_, handle = std::move(exportTokenHandle)]() {
@@ -128,7 +134,7 @@ SceneHost::SceneHost(fml::RefPtr<zircon::dart::Handle> viewHolderTokenHandle,
Dart_Handle viewStateChangedCallback)
: gpu_task_runner_(
UIDartState::Current()->GetTaskRunners().GetGPUTaskRunner()),
id_(fsl::GetKoid(viewHolderTokenHandle->handle())),
id_(GetKoid(viewHolderTokenHandle->handle())),
use_view_holder_(true) {
if (Dart_IsClosure(viewConnectedCallback)) {
view_connected_callback_ = std::make_unique<tonic::DartPersistentValue>(

View File

@@ -5,12 +5,12 @@
#ifndef FLUTTER_LIB_UI_COMPOSITING_SCENE_HOST_H_
#define FLUTTER_LIB_UI_COMPOSITING_SCENE_HOST_H_
#include <dart-pkg/zircon/sdk_ext/handle.h>
#include <lib/ui/scenic/cpp/id.h>
#include <stdint.h>
#include <third_party/tonic/dart_library_natives.h>
#include <third_party/tonic/dart_persistent_value.h>
#include <zircon/types.h>
#include "dart-pkg/zircon/sdk_ext/handle.h"
#include "flutter/fml/memory/ref_counted.h"
#include "flutter/fml/task_runner.h"

View File

@@ -32,7 +32,7 @@ class FlutterEventTracer : public SkEventTracer {
const uint8_t* p_arg_types,
const uint64_t* p_arg_values,
uint8_t flags) override {
#if defined(OS_FUCHSIA)
#if defined(OS_FUCHSIA) && !defined(FUCHSIA_SDK)
// In a manner analogous to "fml/trace_event.h", use Fuchsia's system
// tracing macros when running on Fuchsia.
switch (phase) {
@@ -85,7 +85,7 @@ class FlutterEventTracer : public SkEventTracer {
SkEventTracer::Handle handle) override {
// This is only ever called from a scoped trace event so we will just end
// the section.
#if defined(OS_FUCHSIA)
#if defined(OS_FUCHSIA) && !defined(FUCHSIA_SDK)
TRACE_DURATION_END(kSkiaTag, name);
#else
fml::tracing::TraceEventEnd(name);

View File

@@ -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("//build/fuchsia/sdk.gni")
executable("testing") {
testonly = true
@@ -25,7 +27,7 @@ executable("testing") {
"//third_party/tonic",
]
if (is_fuchsia) {
if (is_fuchsia && !is_fuchsia_sdk) {
deps += [
"//garnet/public/lib/ui/scenic:client",
"//zircon/public/lib/trace",

View File

@@ -2,6 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/fuchsia/sdk.gni")
import("//third_party/dart/sdk/lib/_http/http_sources.gni")
import("//third_party/dart/sdk/lib/async/async_sources.gni")
import("//third_party/dart/sdk/lib/collection/collection_sources.gni")
@@ -13,7 +14,6 @@ import("//third_party/dart/sdk/lib/io/io_sources.gni")
import("//third_party/dart/sdk/lib/isolate/isolate_sources.gni")
import("//third_party/dart/sdk/lib/math/math_sources.gni")
import("//third_party/dart/sdk/lib/typed_data/typed_data_sources.gni")
import("$flutter_root/build/dart/rules.gni")
import("$flutter_root/lib/ui/dart_ui.gni")
@@ -170,7 +170,7 @@ dart_pkg("sky_engine") {
]
}
if (is_fuchsia) {
if (is_fuchsia && !using_fuchsia_sdk) {
import("//build/dart/dart_library.gni")
dart_library("sky_engine_dart") {

View File

@@ -86,7 +86,7 @@ def to_gn_args(args):
gn_args['skia_use_expat'] = args.target_os == 'android'
gn_args['skia_use_fontconfig'] = False # Use the custom font manager instead.
gn_args['is_official_build'] = True # Disable Skia test utilities.
gn_args['dart_component_kind'] = 'static_library' # Always link Dart in statically.
gn_args['is_debug'] = args.unoptimized
gn_args['android_full_debug'] = args.target_os == 'android' and args.unoptimized
gn_args['is_clang'] = not sys.platform.startswith(('cygwin', 'win'))
@@ -256,12 +256,13 @@ def parse_args(args):
parser.add_argument('--full-dart-debug', default=False, action='store_true', help='Implies --dart-debug ' +
'and also disables optimizations in the Dart VM making it easier to step through VM code in the debugger.')
parser.add_argument('--target-os', type=str, choices=['android', 'ios', 'linux'])
parser.add_argument('--target-os', type=str, choices=['android', 'ios', 'linux', 'fuchsia'])
parser.add_argument('--android', dest='target_os', action='store_const', const='android')
parser.add_argument('--android-cpu', type=str, choices=['arm', 'x64', 'x86', 'arm64'], default='arm')
parser.add_argument('--ios', dest='target_os', action='store_const', const='ios')
parser.add_argument('--ios-cpu', type=str, choices=['arm', 'arm64'], default='arm64')
parser.add_argument('--simulator', action='store_true', default=False)
parser.add_argument('--fuchsia', dest='target_os', action='store_const', const='fuchsia')
parser.add_argument('--linux-cpu', type=str, choices=['x64', 'x86', 'arm64', 'arm'])
parser.add_argument('--arm-float-abi', type=str, choices=['hard', 'soft', 'softfp'])

View File

@@ -2,13 +2,21 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/fuchsia/sdk.gni")
config("vulkan_config") {
if (is_fuchsia) {
if (using_fuchsia_sdk) {
include_dirs = [ "$fuchsia_sdk_root/vulkan/include" ]
} else if (is_fuchsia) {
include_dirs =
[ "//third_party/vulkan_loader_and_validation_layers/include" ]
} else {
include_dirs = [ "//third_party/vulkan/src" ]
}
if (is_fuchsia) {
defines = [ "VK_USE_PLATFORM_FUCHSIA=1" ]
}
}
source_set("vulkan") {

View File

@@ -1,11 +0,0 @@
// 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.
#ifdef __ANDROID__
#ifndef VK_USE_PLATFORM_ANDROID_KHR
#define VK_USE_PLATFORM_ANDROID_KHR 1
#endif // VK_USE_PLATFORM_ANDROID_KHR
#endif // __ANDROID__
#include "third_party/vulkan/src/vulkan/vulkan.h"

View File

@@ -10,7 +10,9 @@
#include "flutter/fml/build_config.h"
#include "flutter/fml/logging.h"
#if !defined(FUCHSIA_SDK)
#define VULKAN_LINK_STATICALLY OS_FUCHSIA
#endif // !defined(FUCHSIA_SDK)
#if OS_ANDROID
#ifndef VK_USE_PLATFORM_ANDROID_KHR