Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reorganize darwin for shared ios/macOS #9255

Merged
Merged
Show file tree
Hide file tree
Changes from 3 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
37 changes: 10 additions & 27 deletions shell/platform/darwin/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
assert(is_mac || is_ios)

import("$flutter_root/testing/testing.gni")
import("framework_shared.gni")

group("darwin") {
if (is_ios) {
Expand All @@ -24,14 +23,14 @@ source_set("flutter_channels") {
sources = [
"common/buffer_conversions.h",
"common/buffer_conversions.mm",
"ios/framework/Headers/FlutterBinaryMessenger.h",
"ios/framework/Headers/FlutterChannels.h",
"ios/framework/Headers/FlutterCodecs.h",
"ios/framework/Headers/FlutterMacros.h",
"ios/framework/Source/FlutterChannels.mm",
"ios/framework/Source/FlutterCodecs.mm",
"ios/framework/Source/FlutterStandardCodec.mm",
"ios/framework/Source/FlutterStandardCodec_Internal.h",
"common/framework/Headers/FlutterBinaryMessenger.h",
"common/framework/Headers/FlutterChannels.h",
"common/framework/Headers/FlutterCodecs.h",
"common/framework/Headers/FlutterMacros.h",
"common/framework/Source/FlutterChannels.mm",
"common/framework/Source/FlutterCodecs.mm",
"common/framework/Source/FlutterStandardCodec.mm",
"common/framework/Source/FlutterStandardCodec_Internal.h",
]

deps = [
Expand All @@ -46,22 +45,6 @@ source_set("flutter_channels") {
public_configs = [ "$flutter_root:config" ]
}

# Framework code shared between iOS and macOS.
source_set("framework_shared") {
sources = [
"ios/framework/Source/FlutterChannels.mm",
"ios/framework/Source/FlutterCodecs.mm",
"ios/framework/Source/FlutterStandardCodec.mm",
"ios/framework/Source/FlutterStandardCodec_Internal.h",
]

public = framework_shared_headers

defines = [ "FLUTTER_FRAMEWORK" ]

public_configs = [ "$flutter_root:config" ]
}

test_fixtures("flutter_channels_fixtures") {
fixtures = []
}
Expand All @@ -70,8 +53,8 @@ executable("flutter_channels_unittests") {
testonly = true

sources = [
"ios/framework/Source/flutter_codecs_unittest.mm",
"ios/framework/Source/flutter_standard_codec_unittest.mm",
"common/framework/Source/flutter_codecs_unittest.mm",
"common/framework/Source/flutter_standard_codec_unittest.mm",
]

deps = [
Expand Down
28 changes: 28 additions & 0 deletions shell/platform/darwin/common/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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("framework_shared.gni")

source_set("common") {
sources = [
"buffer_conversions.h",
Expand All @@ -22,3 +24,29 @@ source_set("common") {

public_configs = [ "$flutter_root:config" ]
}

# Shared framework headers end up in the same folder as platform-specific
# framework headers when consumed by clients, so the include paths assume they
# are next to each other.
config("framework_relative_headers") {
include_dirs = [ "framework/Headers" ]
}

# Framework code shared between iOS and macOS.
source_set("framework_shared") {
sources = [
"framework/Source/FlutterChannels.mm",
"framework/Source/FlutterCodecs.mm",
"framework/Source/FlutterStandardCodec.mm",
"framework/Source/FlutterStandardCodec_Internal.h",
]

public = framework_shared_headers

defines = [ "FLUTTER_FRAMEWORK" ]

public_configs = [
"$flutter_root:config",
":framework_relative_headers",
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "flutter/shell/platform/darwin/ios/framework/Headers/FlutterChannels.h"
#include "flutter/shell/platform/darwin/common/framework/Headers/FlutterChannels.h"

#pragma mark - Basic message channel

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "flutter/shell/platform/darwin/ios/framework/Headers/FlutterCodecs.h"
#include "flutter/shell/platform/darwin/common/framework/Headers/FlutterCodecs.h"

@implementation FlutterBinaryCodec
+ (instancetype)sharedInstance {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_FLUTTERSTANDARDCODECINTERNAL_H_
#define SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_FLUTTERSTANDARDCODECINTERNAL_H_
#ifndef SHELL_PLATFORM_DARWIN_COMMON_FRAMEWORK_SOURCE_FLUTTERSTANDARDCODECINTERNAL_H_
#define SHELL_PLATFORM_DARWIN_COMMON_FRAMEWORK_SOURCE_FLUTTERSTANDARDCODECINTERNAL_H_

#include "flutter/shell/platform/darwin/ios/framework/Headers/FlutterCodecs.h"
#include "flutter/shell/platform/darwin/common/framework/Headers/FlutterCodecs.h"

typedef NS_ENUM(NSInteger, FlutterStandardField) {
FlutterStandardFieldNil,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "flutter/shell/platform/darwin/ios/framework/Headers/FlutterCodecs.h"
#include "flutter/shell/platform/darwin/common/framework/Headers/FlutterCodecs.h"
#include "gtest/gtest.h"

TEST(FlutterStringCodec, CanEncodeAndDecodeNil) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "flutter/shell/platform/darwin/ios/framework/Headers/FlutterCodecs.h"
#include "flutter/shell/platform/darwin/common/framework/Headers/FlutterCodecs.h"
#include "gtest/gtest.h"

void checkEncodeDecode(id value, NSData* expectedEncoding) {
Expand Down
13 changes: 13 additions & 0 deletions shell/platform/darwin/common/framework_shared.gni
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# 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.

framework_shared_headers =
get_path_info(
[
"framework/Headers/FlutterMacros.h",
"framework/Headers/FlutterBinaryMessenger.h",
"framework/Headers/FlutterChannels.h",
"framework/Headers/FlutterCodecs.h",
],
"abspath")
15 changes: 0 additions & 15 deletions shell/platform/darwin/framework_shared.gni

This file was deleted.

19 changes: 7 additions & 12 deletions shell/platform/darwin/ios/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ assert(is_ios)
import("//build/config/ios/ios_sdk.gni")
import("$flutter_root/common/config.gni")
import("$flutter_root/shell/gpu/gpu.gni")
import("$flutter_root/shell/platform/darwin/common/framework_shared.gni")

_flutter_framework_dir = "$root_out_dir/Flutter.framework"

Expand All @@ -22,14 +23,10 @@ shell_gpu_configuration("ios_gpu_configuration") {
_flutter_framework_headers = [
"framework/Headers/Flutter.h",
"framework/Headers/FlutterAppDelegate.h",
"framework/Headers/FlutterBinaryMessenger.h",
"framework/Headers/FlutterCallbackCache.h",
"framework/Headers/FlutterChannels.h",
"framework/Headers/FlutterCodecs.h",
"framework/Headers/FlutterDartProject.h",
"framework/Headers/FlutterEngine.h",
"framework/Headers/FlutterHeadlessDartRunner.h",
"framework/Headers/FlutterMacros.h",
"framework/Headers/FlutterPlatformViews.h",
"framework/Headers/FlutterPlugin.h",
"framework/Headers/FlutterPluginAppLifeCycleDelegate.h",
Expand All @@ -49,8 +46,6 @@ shared_library("create_flutter_framework_dylib") {
"framework/Source/FlutterAppDelegate_Internal.h",
"framework/Source/FlutterCallbackCache.mm",
"framework/Source/FlutterCallbackCache_Internal.h",
"framework/Source/FlutterChannels.mm",
"framework/Source/FlutterCodecs.mm",
"framework/Source/FlutterDartProject.mm",
"framework/Source/FlutterDartProject_Internal.h",
"framework/Source/FlutterEngine.mm",
Expand All @@ -66,8 +61,6 @@ shared_library("create_flutter_framework_dylib") {
"framework/Source/FlutterPlatformViews_Internal.h",
"framework/Source/FlutterPlatformViews_Internal.mm",
"framework/Source/FlutterPluginAppLifeCycleDelegate.mm",
"framework/Source/FlutterStandardCodec.mm",
"framework/Source/FlutterStandardCodec_Internal.h",
"framework/Source/FlutterTextInputDelegate.h",
"framework/Source/FlutterTextInputPlugin.h",
"framework/Source/FlutterTextInputPlugin.mm",
Expand Down Expand Up @@ -120,6 +113,7 @@ shared_library("create_flutter_framework_dylib") {
"$flutter_root/runtime:libdart",
"$flutter_root/shell/common",
"$flutter_root/shell/platform/darwin/common",
"$flutter_root/shell/platform/darwin/common:framework_shared",
"//third_party/skia",
]

Expand Down Expand Up @@ -205,17 +199,18 @@ copy("copy_framework_module_map") {
action("copy_framework_headers") {
script = "$flutter_root/sky/tools/install_framework_headers.py"
visibility = [ ":*" ]
sources = _flutter_framework_headers
sources = get_path_info(_flutter_framework_headers, "abspath") +
framework_shared_headers
outputs = []
foreach(header, _flutter_framework_headers) {
header_basename = rebase_path(header, "framework/headers")
foreach(header, sources) {
header_basename = get_path_info(header, "file")
outputs += [ "$_flutter_framework_headers_copy_dir/$header_basename" ]
}
args = [
"--location",
rebase_path("$_flutter_framework_headers_copy_dir"),
"--headers",
] + rebase_path(_flutter_framework_headers)
] + rebase_path(sources, "", "//")
}

copy("copy_framework_icu") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#define SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_FLUTTERPLATFORMPLUGIN_H_

#include "flutter/fml/memory/weak_ptr.h"
#include "flutter/shell/platform/darwin/ios/framework/Headers/FlutterChannels.h"
#include "flutter/shell/platform/darwin/common/framework/Headers/FlutterChannels.h"
#include "flutter/shell/platform/darwin/ios/framework/Headers/FlutterEngine.h"

@interface FlutterPlatformPlugin : NSObject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#include "FlutterPlatformViews_Internal.h"
#include "flutter/fml/platform/darwin/scoped_nsobject.h"
#include "flutter/shell/platform/darwin/ios/framework/Headers/FlutterChannels.h"
#include "flutter/shell/platform/darwin/common/framework/Headers/FlutterChannels.h"

namespace flutter {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
#include "flutter/flow/embedded_views.h"
#include "flutter/fml/platform/darwin/scoped_nsobject.h"
#include "flutter/shell/common/shell.h"
#include "flutter/shell/platform/darwin/ios/framework/Headers/FlutterBinaryMessenger.h"
#include "flutter/shell/platform/darwin/ios/framework/Headers/FlutterChannels.h"
#include "flutter/shell/platform/darwin/common/framework/Headers/FlutterBinaryMessenger.h"
#include "flutter/shell/platform/darwin/common/framework/Headers/FlutterChannels.h"
#include "flutter/shell/platform/darwin/ios/framework/Headers/FlutterPlatformViews.h"

// A UIView that is used as the parent for embedded UIViews.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#import <UIKit/UIKit.h>

#include "flutter/shell/platform/darwin/ios/framework/Headers/FlutterChannels.h"
#include "flutter/shell/platform/darwin/common/framework/Headers/FlutterChannels.h"
#include "flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputDelegate.h"

@interface FlutterTextInputPlugin : NSObject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include "flutter/fml/platform/darwin/scoped_nsobject.h"
#include "flutter/lib/ui/semantics/custom_accessibility_action.h"
#include "flutter/lib/ui/semantics/semantics_node.h"
#include "flutter/shell/platform/darwin/ios/framework/Headers/FlutterChannels.h"
#include "flutter/shell/platform/darwin/common/framework/Headers/FlutterChannels.h"
#include "flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.h"
#include "flutter/shell/platform/darwin/ios/framework/Source/FlutterView.h"
#include "third_party/skia/include/core/SkMatrix44.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "flutter/fml/memory/weak_ptr.h"
#include "flutter/fml/platform/darwin/scoped_block.h"
#include "flutter/lib/ui/window/platform_message.h"
#include "flutter/shell/platform/darwin/ios/framework/Headers/FlutterBinaryMessenger.h"
#include "flutter/shell/platform/darwin/common/framework/Headers/FlutterBinaryMessenger.h"

namespace flutter {

Expand Down
4 changes: 2 additions & 2 deletions shell/platform/darwin/macos/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ assert(is_mac)

import("//build/config/mac/mac_sdk.gni")
import("$flutter_root/common/config.gni")
import("$flutter_root/shell/platform/darwin/framework_shared.gni")
import("$flutter_root/shell/platform/darwin/common/framework_shared.gni")
import("$flutter_root/shell/platform/glfw/config.gni")

group("macos") {
Expand Down Expand Up @@ -60,7 +60,7 @@ shared_library("create_flutter_framework_dylib") {
sources += _flutter_framework_headers

deps = [
"$flutter_root/shell/platform/darwin:framework_shared",
"$flutter_root/shell/platform/darwin/common:framework_shared",
"$flutter_root/shell/platform/embedder:embedder",
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#if defined(FLUTTER_FRAMEWORK)
#import "flutter/shell/platform/darwin/ios/framework/Headers/FlutterMacros.h"
#else
#import "FlutterMacros.h"
#endif

/**
* Protocol for views owned by FLEViewController to handle context changes, specifically relating to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@

#import <Cocoa/Cocoa.h>

#if defined(FLUTTER_FRAMEWORK)
#import "flutter/shell/platform/darwin/ios/framework/Headers/FlutterMacros.h"
#else
#import "FlutterMacros.h"
#endif

/**
* Protocol for listening to reshape events on this FlutterView.
Expand Down
5 changes: 0 additions & 5 deletions shell/platform/darwin/macos/framework/Headers/FLEView.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,7 @@

#import "FLEOpenGLContextHandling.h"
#import "FLEReshapeListener.h"

#if defined(FLUTTER_FRAMEWORK)
#import "flutter/shell/platform/darwin/ios/framework/Headers/FlutterMacros.h"
#else
#import "FlutterMacros.h"
#endif

/**
* View capable of acting as a rendering target and input source for the Flutter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,9 @@

#import "FLEOpenGLContextHandling.h"
#import "FLEReshapeListener.h"
#import "FlutterPluginRegistrarMacOS.h"

#if defined(FLUTTER_FRAMEWORK)
#import "flutter/shell/platform/darwin/ios/framework/Headers/FlutterBinaryMessenger.h"
#import "flutter/shell/platform/darwin/ios/framework/Headers/FlutterMacros.h"
#else
#import "FlutterBinaryMessenger.h"
#import "FlutterMacros.h"
#endif
#import "FlutterPluginRegistrarMacOS.h"

typedef NS_ENUM(NSInteger, FlutterMouseTrackingMode) {
// Hover events will never be sent to Flutter.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,9 @@

#import <Foundation/Foundation.h>

#if defined(FLUTTER_FRAMEWORK)
#import "flutter/shell/platform/darwin/ios/framework/Headers/FlutterChannels.h"
#import "flutter/shell/platform/darwin/ios/framework/Headers/FlutterCodecs.h"
#import "flutter/shell/platform/darwin/ios/framework/Headers/FlutterMacros.h"
#else
#import "FlutterChannels.h"
#import "FlutterCodecs.h"
#import "FlutterMacros.h"
#endif

// TODO: Merge this file and FlutterPluginRegistrarMacOS.h with the iOS FlutterPlugin.h, sharing
// all but the platform-specific methods.
Expand Down
Loading