提交 1db1d150 编写于 作者: C Chinmay Garde

Create an Xcode project template for dynamic service creation. (#2695)

* Create an Xcode project template for dynamic service creation.

The `create_native_service_sdk.py` will be run on the buildbot similar
to `create_ios_sdk.py`. This will create an Xcode project with both arm
and x64 assets that the user can use to fill in the service
implementation.

* Add the complete_static_lib property to sdk_lib_archive in
dynamic/BUILD.gn
上级 d178eafa
......@@ -11,7 +11,7 @@ group("default") {
if (is_ios) {
deps += [
"//sky/services/dynamic:sdk_lib",
"//sky/services/dynamic:sdk_lib_archive",
"//sky/shell:flutter_framework",
]
}
......
.idea/
.vagrant/
.sconsign.dblite
.svn/
.DS_Store
*.swp
*.lock
profile
DerivedData/
build/
*.pbxuser
*.mode1v3
*.mode2v3
*.perspectivev3
!default.pbxuser
!default.mode1v3
!default.mode2v3
!default.perspectivev3
xcuserdata
*.moved-aside
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
9E90D8621CEBBF2700FBBF40 /* libFlutterService.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9E90D8611CEBBF2700FBBF40 /* libFlutterService.a */; };
9E90D8651CEBCD8400FBBF40 /* ServiceMain.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9E90D8641CEBCD8400FBBF40 /* ServiceMain.cc */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
9E90D8521CEBBCEC00FBBF40 /* FlutterService.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = FlutterService.framework; sourceTree = BUILT_PRODUCTS_DIR; };
9E90D85E1CEBBEA700FBBF40 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
9E90D8611CEBBF2700FBBF40 /* libFlutterService.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libFlutterService.a; sourceTree = "<group>"; };
9E90D8641CEBCD8400FBBF40 /* ServiceMain.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ServiceMain.cc; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
9E90D84E1CEBBCEC00FBBF40 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
9E90D8621CEBBF2700FBBF40 /* libFlutterService.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
9E90D8481CEBBCEC00FBBF40 = {
isa = PBXGroup;
children = (
9E90D8631CEBCD7200FBBF40 /* Source */,
9E90D8601CEBBF2700FBBF40 /* Library */,
9E90D85D1CEBBE9B00FBBF40 /* Supporting Files */,
9E90D8531CEBBCEC00FBBF40 /* Products */,
);
sourceTree = "<group>";
};
9E90D8531CEBBCEC00FBBF40 /* Products */ = {
isa = PBXGroup;
children = (
9E90D8521CEBBCEC00FBBF40 /* FlutterService.framework */,
);
name = Products;
sourceTree = "<group>";
};
9E90D85D1CEBBE9B00FBBF40 /* Supporting Files */ = {
isa = PBXGroup;
children = (
9E90D85E1CEBBEA700FBBF40 /* Info.plist */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
9E90D8601CEBBF2700FBBF40 /* Library */ = {
isa = PBXGroup;
children = (
9E90D8611CEBBF2700FBBF40 /* libFlutterService.a */,
);
path = Library;
sourceTree = "<group>";
};
9E90D8631CEBCD7200FBBF40 /* Source */ = {
isa = PBXGroup;
children = (
9E90D8641CEBCD8400FBBF40 /* ServiceMain.cc */,
);
name = Source;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
9E90D84F1CEBBCEC00FBBF40 /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
9E90D8511CEBBCEC00FBBF40 /* FlutterService */ = {
isa = PBXNativeTarget;
buildConfigurationList = 9E90D85A1CEBBCED00FBBF40 /* Build configuration list for PBXNativeTarget "FlutterService" */;
buildPhases = (
9E90D84D1CEBBCEC00FBBF40 /* Sources */,
9E90D84E1CEBBCEC00FBBF40 /* Frameworks */,
9E90D84F1CEBBCEC00FBBF40 /* Headers */,
9E90D8501CEBBCEC00FBBF40 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = FlutterService;
productName = FlutterService;
productReference = 9E90D8521CEBBCEC00FBBF40 /* FlutterService.framework */;
productType = "com.apple.product-type.framework";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
9E90D8491CEBBCEC00FBBF40 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0730;
ORGANIZATIONNAME = Flutter;
TargetAttributes = {
9E90D8511CEBBCEC00FBBF40 = {
CreatedOnToolsVersion = 7.3;
};
};
};
buildConfigurationList = 9E90D84C1CEBBCEC00FBBF40 /* Build configuration list for PBXProject "FlutterService" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
);
mainGroup = 9E90D8481CEBBCEC00FBBF40;
productRefGroup = 9E90D8531CEBBCEC00FBBF40 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
9E90D8511CEBBCEC00FBBF40 /* FlutterService */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
9E90D8501CEBBCEC00FBBF40 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
9E90D84D1CEBBCEC00FBBF40 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
9E90D8651CEBCD8400FBBF40 /* ServiceMain.cc in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
9E90D8581CEBBCED00FBBF40 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "$(SOURCE_ROOT)/Headers";
IPHONEOS_DEPLOYMENT_TARGET = 9.3;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
name = Debug;
};
9E90D8591CEBBCED00FBBF40 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "$(SOURCE_ROOT)/Headers";
IPHONEOS_DEPLOYMENT_TARGET = 9.3;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
name = Release;
};
9E90D85B1CEBBCED00FBBF40 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = "$(SRCROOT)/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)$(LOCAL_LIBRARY_DIR)",
);
PRODUCT_BUNDLE_IDENTIFIER = io.flutter.flutterservice;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
};
name = Debug;
};
9E90D85C1CEBBCED00FBBF40 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = "$(SRCROOT)/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)$(LOCAL_LIBRARY_DIR)",
);
PRODUCT_BUNDLE_IDENTIFIER = io.flutter.flutterservice;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
9E90D84C1CEBBCEC00FBBF40 /* Build configuration list for PBXProject "FlutterService" */ = {
isa = XCConfigurationList;
buildConfigurations = (
9E90D8581CEBBCED00FBBF40 /* Debug */,
9E90D8591CEBBCED00FBBF40 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
9E90D85A1CEBBCED00FBBF40 /* Build configuration list for PBXNativeTarget "FlutterService" */ = {
isa = XCConfigurationList;
buildConfigurations = (
9E90D85B1CEBBCED00FBBF40 /* Debug */,
9E90D85C1CEBBCED00FBBF40 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 9E90D8491CEBBCEC00FBBF40 /* Project object */;
}
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:FlutterService.xcodeproj">
</FileRef>
</Workspace>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "mojo/public/cpp/application/interface_factory.h"
#include "mojo/public/cpp/bindings/strong_binding.h"
void FlutterServicePerform(mojo::ScopedMessagePipeHandle client_handle,
const mojo::String& service_name) {
// Your service implementation goes here.
}
......@@ -29,19 +29,29 @@ source_set("embedder") {
]
}
source_set("sdk_lib") {
sources = [
"dynamic_service.c",
"dynamic_service.h",
"dynamic_service_dylib.cc",
"dynamic_service_dylib.h",
"dynamic_service_macros.h",
]
lib_sources = [
"dynamic_service.c",
"dynamic_service.h",
"dynamic_service_dylib.cc",
"dynamic_service_dylib.h",
"dynamic_service_macros.h",
]
deps = [
"//mojo/public/c/system",
"//mojo/public/cpp/bindings",
"//mojo/public/cpp/environment:standalone",
"//mojo/public/platform/native:system",
]
lib_deps = [
"//mojo/public/c/system",
"//mojo/public/cpp/bindings",
"//mojo/public/cpp/environment:standalone",
"//mojo/public/platform/native:system",
]
static_library("sdk_lib_archive") {
complete_static_lib = true
output_name = "FlutterService"
sources = lib_sources
deps = lib_deps
}
source_set("sdk_lib") {
sources = lib_sources
deps = lib_deps
}
#!/usr/bin/env python
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
'''Creates the iOS native service SDK that developers can use the create
native services that can be dynamically loaded.'''
import errno
import os
import shutil
import sys
import argparse
import subprocess
def mkdir_p(path):
try:
os.makedirs(path)
except OSError as exc:
if exc.errno == errno.EEXIST and os.path.isdir(path):
pass
else:
raise
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--simulator-out-dir',
dest='simulator_out_dir',
required=True,
help='The out directory for the simulator assets.')
parser.add_argument('--device-out-dir',
dest='device_out_dir',
required=True,
help='The out directory for the device assets.')
parser.add_argument('--dest',
dest='dest',
required=True,
help='The directory in which to create the SDK.')
parser.add_argument('--harness',
dest='harness',
required=True,
help='The SDK harness to use.')
parser.add_argument('headers',
metavar='H',
nargs='+',
help='A list of header directories to copy over to the SDK.')
args = parser.parse_args()
simulator_out_dir = os.path.abspath(args.simulator_out_dir)
device_out_dir = os.path.abspath(args.device_out_dir)
archive_path = 'obj/sky/services/dynamic/libFlutterService.a'
simulator_archive = os.path.join(simulator_out_dir, archive_path)
device_archive = os.path.join(device_out_dir, archive_path)
sdk_dir = os.path.join(os.path.abspath(args.dest), 'ServiceSDK')
if os.path.isdir(sdk_dir):
shutil.rmtree(sdk_dir)
shutil.copytree(os.path.abspath(args.harness), os.path.join(sdk_dir))
library_path = os.path.join(sdk_dir, 'Library')
header_path = os.path.join(sdk_dir, 'Headers')
mkdir_p(library_path)
mkdir_p(header_path)
subprocess.call([
'lipo',
simulator_archive,
device_archive,
'-create',
'-output',
os.path.join(library_path, 'libFlutterService.a'),
])
src_root = os.path.join(os.path.dirname(__file__), '../../')
for headers_dir in args.headers:
for root, _, files in os.walk(headers_dir):
for file in files:
if file.endswith(".h"):
source = os.path.abspath(os.path.join(root, file))
relative = os.path.relpath(source, src_root)
destination = os.path.abspath(os.path.join(header_path, relative))
destination_dir = os.path.dirname(destination)
mkdir_p(destination_dir)
shutil.copyfile(source, destination)
return 0
if __name__ == '__main__':
sys.exit(main())
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册