diff --git a/sdk/BUILD.gn b/sdk/BUILD.gn index 3896bef9d4..121e47c7aa 100644 --- a/sdk/BUILD.gn +++ b/sdk/BUILD.gn @@ -562,6 +562,7 @@ if (is_ios || is_mac) { } deps = [ ":common_objc", + ":framework_objc", ":peerconnection_objc", ":peerconnectionfactory_objc", ":videotoolbox_objc", @@ -576,6 +577,7 @@ if (is_ios || is_mac) { "//build/config/ios:xctest", "//third_party/ocmock", ] + include_dirs += [ "$root_out_dir/WebRTC.framework/Headers/" ] } bundle_data("sdk_unittests_bundle_data") { @@ -665,7 +667,7 @@ if (is_ios || is_mac) { } if (is_ios) { - ios_framework_bundle("framework_objc") { + ios_framework_bundle_with_umbrella_header("framework_objc") { info_plist = "objc/Framework/Info.plist" output_name = "WebRTC" @@ -723,7 +725,6 @@ if (is_ios || is_mac) { "objc/Framework/Headers/WebRTC/RTCVideoTrack.h", "objc/Framework/Headers/WebRTC/RTCVideoViewShading.h", "objc/Framework/Headers/WebRTC/UIDevice+RTCDevice.h", - "objc/Framework/Headers/WebRTC/WebRTC.h", ] if (rtc_use_metal_rendering) { common_objc_headers += diff --git a/sdk/objc/Framework/Headers/WebRTC/WebRTC.h b/sdk/objc/Framework/Headers/WebRTC/WebRTC.h deleted file mode 100644 index b9e0149e99..0000000000 --- a/sdk/objc/Framework/Headers/WebRTC/WebRTC.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright 2016 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#import -#if TARGET_OS_IPHONE -#import -#import -#endif -#import -#import -#import -#import -#if TARGET_OS_IPHONE -#import -#endif -#import -#import -#import -#import -#if TARGET_OS_IPHONE -#import -#import -#import -#endif -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#if TARGET_OS_IPHONE -#import -#endif diff --git a/sdk/objc/Framework/UnitTests/RTCDoNotPutCPlusPlusInFrameworkHeaders_xctest.m b/sdk/objc/Framework/UnitTests/RTCDoNotPutCPlusPlusInFrameworkHeaders_xctest.m index 02bef9bfb7..754810199f 100644 --- a/sdk/objc/Framework/UnitTests/RTCDoNotPutCPlusPlusInFrameworkHeaders_xctest.m +++ b/sdk/objc/Framework/UnitTests/RTCDoNotPutCPlusPlusInFrameworkHeaders_xctest.m @@ -12,7 +12,7 @@ #import -#import +#import @interface RTCDoNotPutCPlusPlusInFrameworkHeaders : XCTestCase @end diff --git a/tools_webrtc/ios/generate_umbrella_header.py b/tools_webrtc/ios/generate_umbrella_header.py new file mode 100644 index 0000000000..d8a87bf72a --- /dev/null +++ b/tools_webrtc/ios/generate_umbrella_header.py @@ -0,0 +1,40 @@ +# Copyright (c) 2018 The WebRTC project authors. All Rights Reserved. +# +# Use of this source code is governed by a BSD-style license +# that can be found in the LICENSE file in the root of the source +# tree. An additional intellectual property rights grant can be found +# in the file PATENTS. All contributing project authors may +# be found in the AUTHORS file in the root of the source tree. + +import argparse +import datetime +import sys + + +def GenerateUmbrellaHeader(): + parser = argparse.ArgumentParser(description='Generate umbrella header') + parser.add_argument("-o", "--out", type=str, help="Output file.") + parser.add_argument("-s", "--sources", default=[], type=str, nargs='+', + help="Headers to include.") + + args = parser.parse_args() + + with open(args.out, "w") as outfile: + outfile.write("""/* + * Copyright %d The WebRTC project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */\n\n""" % datetime.datetime.now().year) + + for s in args.sources: + outfile.write("#import <{}>\n".format(s)) + + return 0 + + +if __name__ == '__main__': + sys.exit(GenerateUmbrellaHeader()) diff --git a/webrtc.gni b/webrtc.gni index ffa92d4c4a..ae68318306 100644 --- a/webrtc.gni +++ b/webrtc.gni @@ -431,6 +431,50 @@ if (is_ios) { } } } + + template("ios_framework_bundle_with_umbrella_header") { + forward_variables_from(invoker, [ "output_name" ]) + umbrella_header_path = + "$target_gen_dir/$output_name.framework/Headers/$output_name.h" + + ios_framework_bundle(target_name) { + forward_variables_from(invoker, "*", []) + + deps += [ ":copy_umbrella_header_$target_name" ] + } + + action("umbrella_header_$target_name") { + forward_variables_from(invoker, [ "public_headers" ]) + + script = "//tools_webrtc/ios/generate_umbrella_header.py" + + outputs = [ + umbrella_header_path, + ] + args = [ + "--out", + rebase_path(umbrella_header_path, root_build_dir), + "--sources", + ] + rebase_path(public_headers, "objc/Framework/Headers/") + } + + copy("copy_umbrella_header_$target_name") { + sources = [ + umbrella_header_path, + ] + outputs = [ + "$root_out_dir/$output_name.framework/Headers/$output_name.h", + ] + + deps = [ + ":umbrella_header_$target_name", + ] + } + } + + set_defaults("ios_framework_bundle_with_umbrella_header") { + configs = default_shared_library_configs + } } if (is_android) {