WebKit Bugzilla
Attachment 347178 Details for
Bug 188601
: Add script to generate WebContent service resource files and change XPC service main SPI to have it's own header
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-188601-20180815110548.patch (text/plain), 5.93 KB, created by
Ben Richards
on 2018-08-15 11:05:49 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Ben Richards
Created:
2018-08-15 11:05:49 PDT
Size:
5.93 KB
patch
obsolete
>Subversion Revision: 234865 >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 052c175006f65757655e5979303d3fc18d2c7fc7..799922c3a08ea068a752eb058d16d7c9bd4ca439 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,19 @@ >+2018-08-15 Ben Richards <benton_richards@apple.com> >+ >+ Add script to generate WebContent service resource files >+ https://bugs.webkit.org/show_bug.cgi?id=188601 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Added a script that will generate the Info.plist and entitlements files used by the WebContent service and >+ save them to a specified location. This is to help create a custom WebContent service to be used >+ with the setCustomWebContentServiceBundleIdentifier SPI. >+ >+ * Scripts/generate-webcontent-resources: Added. >+ (generate_resource_files_for_device): >+ (parse_destination_path): >+ (main): >+ > 2018-08-14 Fujii Hironori <Hironori.Fujii@sony.com> > > [webkitpy][Win] LayoutTests: test names should be Unix style, separated by slash not backslash >diff --git a/Tools/Scripts/generate-webcontent-resources b/Tools/Scripts/generate-webcontent-resources >new file mode 100755 >index 0000000000000000000000000000000000000000..208429409b4d6614e85da9d49f81400985499996 >--- /dev/null >+++ b/Tools/Scripts/generate-webcontent-resources >@@ -0,0 +1,100 @@ >+#!/usr/bin/env python >+ >+# Copyright (C) 2018 Apple Inc. All rights reserved. >+# >+# Redistribution and use in source and binary forms, with or without >+# modification, are permitted provided that the following conditions >+# are met: >+# >+# 1. Redistributions of source code must retain the above copyright >+# notice, this list of conditions and the following disclaimer. >+# 2. Redistributions in binary form must reproduce the above copyright >+# notice, this list of conditions and the following disclaimer in the >+# documentation and/or other materials provided with the distribution. >+# 3. Neither the name of Apple Inc. ("Apple") nor the names of >+# its contributors may be used to endorse or promote products derived >+# from this software without specific prior written permission. >+# >+# THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY >+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED >+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE >+# DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY >+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES >+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; >+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND >+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF >+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ >+import argparse >+import os >+from plistlib import readPlist, writePlist >+from shutil import copyfile >+import sys >+ >+ >+def generate_resource_files_for_device(device, destination_path): >+ source_root = os.path.join(os.path.dirname(os.path.abspath(__file__)), '../../Source') >+ >+ # Generate Info.plist >+ info_plist_dir = os.path.join(source_root, 'WebKit/WebProcess/EntryPoint/mac/XPCService/WebContentService') >+ info_plist_path = os.path.join(info_plist_dir, 'Info-{}.plist'.format(device)) >+ if device is 'OSX': >+ info_plist = None >+ with file(info_plist_path) as f: >+ info_plist = f.read() >+ info_plist = info_plist.replace('${RUNLOOP_TYPE}', '_WebKit') >+ with open(os.path.join(destination_path, 'Info-OSX.plist'), 'w+') as f: >+ f.write(info_plist) >+ else: >+ copyfile(info_plist_path, os.path.join(destination_path, 'Info-iOS.plist')) >+ >+ # Copy WebContentProcess.xib >+ xib_source = os.path.join(source_root, 'WebKit/Resources/WebContentProcess.xib') >+ xib_destination = os.path.join(destination_path, 'WebContentProcess.xib') >+ copyfile(xib_source, xib_destination) >+ >+ # Generate entitlements >+ configurations_directory = os.path.join(source_root, 'WebKit/Configurations') >+ general_entitlements = {} >+ restricted_entitlements = {} >+ for file_name in os.listdir(configurations_directory): >+ if 'WebContent' not in file_name or device not in file_name or 'minimalsimulator' in file_name: >+ continue >+ file_path = os.path.join(configurations_directory, file_name) >+ entitlements = readPlist(file_path) >+ if 'restricted' in file_name: >+ restricted_entitlements.update(entitlements) >+ else: >+ general_entitlements.update(entitlements) >+ writePlist(general_entitlements, os.path.join(destination_path, 'WebContent-{}.entitlements'.format(device))) >+ writePlist(restricted_entitlements, os.path.join(destination_path, 'WebContent-{}-restricted.entitlements'.format(device))) >+ >+ print 'Finished generating files for {}'.format(device) >+ >+ >+def parse_destination_path(path): >+ if not os.path.isdir(path): >+ raise argparse.ArgumentTypeError('Invalid destination path: "{}"'.format(path)) >+ return path >+ >+ >+def main(): >+ parser = argparse.ArgumentParser(description='Generate WebContent resource files and store at specified path') >+ parser.add_argument('-p', '--path', type=parse_destination_path, required=True, >+ help='destination path for generated resources') >+ parser.add_argument('-d', '--device', required=True, action='store', choices=['ios', 'osx', 'all'], >+ help='device to generate resources for') >+ args = parser.parse_args() >+ >+ if args.device == 'all': >+ generate_resource_files_for_device('iOS', args.path) >+ generate_resource_files_for_device('OSX', args.path) >+ elif args.device == 'ios': >+ generate_resource_files_for_device('iOS', args.path) >+ elif args.device == 'osx': >+ generate_resource_files_for_device('OSX', args.path) >+ >+ >+if __name__ == '__main__': >+ main()
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 188601
:
347162
|
347166
|
347178
|
347228
|
347285
|
347297
|
347371
|
347405
|
347418
|
349958
|
350038
|
350047