[iOS/OSX] Remove unused GN templates and helper scripts.
BUG=297668 Review URL: https://codereview.chromium.org/1871063002 Cr-Original-Commit-Position: refs/heads/master@{#386191} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: e55c3133a80f3f4b3540af8a17f0173ea93f9328
This commit is contained in:
Родитель
5adfde60fa
Коммит
7becd5c6e5
|
@ -1,99 +0,0 @@
|
|||
# Copyright (c) 2015 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.
|
||||
|
||||
import argparse
|
||||
import errno
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
||||
def ProcessInfoPlist(args):
|
||||
output_plist_file = os.path.abspath(os.path.join(args.output, 'Info.plist'))
|
||||
return subprocess.check_call( [
|
||||
'/usr/bin/env',
|
||||
'xcrun',
|
||||
'plutil',
|
||||
'-convert',
|
||||
'binary1',
|
||||
'-o',
|
||||
output_plist_file,
|
||||
'--',
|
||||
args.input,
|
||||
])
|
||||
|
||||
|
||||
def PerformCodeSigning(args):
|
||||
return subprocess.check_call([
|
||||
'/usr/bin/env',
|
||||
'xcrun',
|
||||
'codesign',
|
||||
'--entitlements',
|
||||
args.entitlements_path,
|
||||
'--sign',
|
||||
args.identity,
|
||||
'-f',
|
||||
args.application_path,
|
||||
])
|
||||
|
||||
|
||||
def MakeDirectories(path):
|
||||
try:
|
||||
os.makedirs(path)
|
||||
except OSError as exc:
|
||||
if exc.errno == errno.EEXIST and os.path.isdir(path):
|
||||
return 0
|
||||
else:
|
||||
return -1
|
||||
return 0
|
||||
|
||||
|
||||
def GenerateProjectStructure(args):
|
||||
application_path = os.path.join(args.dir, args.name + ".app")
|
||||
return MakeDirectories( application_path )
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description='A script that aids in '
|
||||
'the creation of an iOS application')
|
||||
subparsers = parser.add_subparsers()
|
||||
|
||||
# Plist Parser
|
||||
plist_parser = subparsers.add_parser('plist',
|
||||
help='Process the Info.plist')
|
||||
plist_parser.set_defaults(func=ProcessInfoPlist)
|
||||
|
||||
plist_parser.add_argument('-i', dest='input', help='The input plist path')
|
||||
plist_parser.add_argument('-o', dest='output', help='The output plist dir')
|
||||
|
||||
# Directory Structure Parser
|
||||
dir_struct_parser = subparsers.add_parser('structure',
|
||||
help='Creates the directory of an iOS application')
|
||||
|
||||
dir_struct_parser.set_defaults(func=GenerateProjectStructure)
|
||||
|
||||
dir_struct_parser.add_argument('-d', dest='dir', help='Out directory')
|
||||
dir_struct_parser.add_argument('-n', dest='name', help='App name')
|
||||
|
||||
# Code Signing
|
||||
code_signing_parser = subparsers.add_parser('codesign',
|
||||
help='Code sign the specified application')
|
||||
|
||||
code_signing_parser.set_defaults(func=PerformCodeSigning)
|
||||
|
||||
code_signing_parser.add_argument('-p', dest='application_path', required=True,
|
||||
help='The application path')
|
||||
code_signing_parser.add_argument('-i', dest='identity', required=True,
|
||||
help='The code signing identity to use')
|
||||
code_signing_parser.add_argument('-e', dest='entitlements_path',
|
||||
required=True,
|
||||
help='The path to the entitlements .xcent')
|
||||
|
||||
# Engage!
|
||||
args = parser.parse_args()
|
||||
return args.func(args)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
|
@ -1,106 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
# Copyright (c) 2015 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.
|
||||
|
||||
import argparse
|
||||
import errno
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
import re
|
||||
|
||||
SIMCTL_PATH = [
|
||||
'/usr/bin/env',
|
||||
'xcrun',
|
||||
'simctl',
|
||||
]
|
||||
|
||||
PLIST_BUDDY_PATH = [
|
||||
'/usr/bin/env',
|
||||
'xcrun',
|
||||
'PlistBuddy',
|
||||
]
|
||||
|
||||
|
||||
def ApplicationIdentifier(path):
|
||||
identifier = subprocess.check_output(PLIST_BUDDY_PATH + [
|
||||
'-c',
|
||||
'Print CFBundleIdentifier',
|
||||
'%s/Info.plist' % path,
|
||||
])
|
||||
return identifier.strip()
|
||||
|
||||
|
||||
def Install(args):
|
||||
return subprocess.check_call(SIMCTL_PATH + [
|
||||
'install',
|
||||
'booted',
|
||||
args.path,
|
||||
])
|
||||
|
||||
|
||||
def InstallLaunchAndWait(args, wait):
|
||||
res = Install(args)
|
||||
|
||||
if res != 0:
|
||||
return res
|
||||
|
||||
identifier = ApplicationIdentifier(args.path)
|
||||
|
||||
launch_args = [ 'launch' ]
|
||||
|
||||
if wait:
|
||||
launch_args += [ '-w' ]
|
||||
|
||||
launch_args += [
|
||||
'booted',
|
||||
identifier,
|
||||
]
|
||||
|
||||
return subprocess.check_output(SIMCTL_PATH + launch_arg).strip()
|
||||
|
||||
|
||||
def Launch(args):
|
||||
InstallLaunchAndWait(args, False)
|
||||
|
||||
|
||||
def Debug(args):
|
||||
launch_res = InstallLaunchAndWait(args, True)
|
||||
launch_pid = re.search('.*: (\d+)', launch_res).group(1)
|
||||
return os.system(' '.join([
|
||||
'/usr/bin/env',
|
||||
'xcrun',
|
||||
'lldb',
|
||||
'-s',
|
||||
os.path.join(os.path.dirname(__file__), 'lldb_start_commands.txt'),
|
||||
'-p',
|
||||
launch_pid,
|
||||
]))
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description='A script that launches an'
|
||||
' application in the simulator and attaches'
|
||||
' the debugger to the same')
|
||||
|
||||
parser.add_argument('-p', dest='path', required=True,
|
||||
help='Path the the simulator application')
|
||||
|
||||
subparsers = parser.add_subparsers()
|
||||
|
||||
launch_parser = subparsers.add_parser('launch', help='Launch')
|
||||
launch_parser.set_defaults(func=Launch)
|
||||
|
||||
install_parser = subparsers.add_parser('install', help='Install')
|
||||
install_parser.set_defaults(func=Install)
|
||||
|
||||
debug_parser = subparsers.add_parser('debug', help='Debug')
|
||||
debug_parser.set_defaults(func=Debug)
|
||||
|
||||
args = parser.parse_args()
|
||||
return args.func(args)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
|
@ -1,4 +0,0 @@
|
|||
breakpoint set --name UIApplicationMain
|
||||
breakpoint set --name objc_exception_throw
|
||||
continue
|
||||
script print "........ Debugger break on main() ........"
|
|
@ -1,99 +0,0 @@
|
|||
# Copyright (c) 2015 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.
|
||||
|
||||
import argparse
|
||||
import errno
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
def MakeDirectories(path):
|
||||
try:
|
||||
os.makedirs(path)
|
||||
except OSError as exc:
|
||||
if exc.errno == errno.EEXIST and os.path.isdir(path):
|
||||
return 0
|
||||
else:
|
||||
return -1
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
def ProcessInfoPlist(args):
|
||||
output_plist_file = os.path.abspath(os.path.join(args.output, 'Info.plist'))
|
||||
return subprocess.check_call([
|
||||
'/usr/bin/env',
|
||||
'xcrun',
|
||||
'plutil',
|
||||
'-convert',
|
||||
'binary1',
|
||||
'-o',
|
||||
output_plist_file,
|
||||
'--',
|
||||
args.input,
|
||||
])
|
||||
|
||||
|
||||
def ProcessNIB(args):
|
||||
output_nib_file = os.path.join(os.path.abspath(args.output),
|
||||
"%s.nib" % os.path.splitext(os.path.basename(args.input))[0])
|
||||
|
||||
return subprocess.check_call([
|
||||
'/usr/bin/env',
|
||||
'xcrun',
|
||||
'ibtool',
|
||||
'--module',
|
||||
args.module,
|
||||
'--auto-activate-custom-fonts',
|
||||
'--target-device',
|
||||
'mac',
|
||||
'--compile',
|
||||
output_nib_file,
|
||||
os.path.abspath(args.input),
|
||||
])
|
||||
|
||||
|
||||
def GenerateProjectStructure(args):
|
||||
application_path = os.path.join( args.dir, args.name + ".app", "Contents" )
|
||||
return MakeDirectories( application_path )
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description='A script that aids in '
|
||||
'the creation of an Mac application')
|
||||
|
||||
subparsers = parser.add_subparsers()
|
||||
|
||||
# Plist Parser
|
||||
plist_parser = subparsers.add_parser('plist',
|
||||
help='Process the Info.plist')
|
||||
plist_parser.set_defaults(func=ProcessInfoPlist)
|
||||
|
||||
plist_parser.add_argument('-i', dest='input', help='The input plist path')
|
||||
plist_parser.add_argument('-o', dest='output', help='The output plist dir')
|
||||
|
||||
# NIB Parser
|
||||
plist_parser = subparsers.add_parser('nib',
|
||||
help='Process a NIB file')
|
||||
plist_parser.set_defaults(func=ProcessNIB)
|
||||
|
||||
plist_parser.add_argument('-i', dest='input', help='The input nib path')
|
||||
plist_parser.add_argument('-o', dest='output', help='The output nib dir')
|
||||
plist_parser.add_argument('-m', dest='module', help='The module name')
|
||||
|
||||
# Directory Structure Parser
|
||||
dir_struct_parser = subparsers.add_parser('structure',
|
||||
help='Creates the directory of an Mac application')
|
||||
|
||||
dir_struct_parser.set_defaults(func=GenerateProjectStructure)
|
||||
|
||||
dir_struct_parser.add_argument('-d', dest='dir', help='Out directory')
|
||||
dir_struct_parser.add_argument('-n', dest='name', help='App name')
|
||||
|
||||
args = parser.parse_args()
|
||||
return args.func(args)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
|
@ -4,215 +4,6 @@
|
|||
|
||||
import("//build/toolchain/toolchain.gni")
|
||||
|
||||
mac_app_script = "//build/config/mac/mac_app.py"
|
||||
|
||||
template("code_sign_mac") {
|
||||
assert(defined(invoker.entitlements_path),
|
||||
"The path to the entitlements .xcent file")
|
||||
assert(defined(invoker.identity), "The code signing identity")
|
||||
assert(defined(invoker.application_path), "The application to code sign")
|
||||
assert(defined(invoker.deps))
|
||||
|
||||
action(target_name) {
|
||||
sources = [
|
||||
invoker.entitlements_path,
|
||||
]
|
||||
|
||||
_application_path = invoker.application_path
|
||||
|
||||
script = mac_app_script
|
||||
|
||||
outputs = [
|
||||
"$_application_path/_CodeSignature/CodeResources",
|
||||
]
|
||||
|
||||
args = [
|
||||
"codesign",
|
||||
"-p",
|
||||
rebase_path(invoker.application_path, root_build_dir),
|
||||
"-i",
|
||||
invoker.identity,
|
||||
"-e",
|
||||
rebase_path(invoker.entitlements_path, root_build_dir),
|
||||
]
|
||||
|
||||
forward_variables_from(invoker,
|
||||
[
|
||||
"deps",
|
||||
"public_deps",
|
||||
"visibility",
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
template("process_nibs_mac") {
|
||||
assert(defined(invoker.sources), "The nib sources must be specified")
|
||||
assert(defined(invoker.module), "The nib module must be specified")
|
||||
assert(defined(invoker.output_dir), "The output directory must be specified")
|
||||
|
||||
action_foreach(target_name) {
|
||||
sources = invoker.sources
|
||||
|
||||
script = mac_app_script
|
||||
|
||||
invoker_out_dir = invoker.output_dir
|
||||
|
||||
outputs = [
|
||||
"$root_build_dir/$invoker_out_dir/{{source_name_part}}.nib",
|
||||
]
|
||||
|
||||
args = [
|
||||
"nib",
|
||||
"-i",
|
||||
"{{source}}",
|
||||
"-o",
|
||||
invoker_out_dir,
|
||||
"-m",
|
||||
invoker.module,
|
||||
]
|
||||
}
|
||||
|
||||
forward_variables_from(invoker,
|
||||
[
|
||||
"deps",
|
||||
"public_deps",
|
||||
"visibility",
|
||||
])
|
||||
}
|
||||
|
||||
template("resource_copy_mac") {
|
||||
assert(defined(invoker.resources),
|
||||
"The source list of resources to copy over")
|
||||
assert(defined(invoker.bundle_directory),
|
||||
"The directory within the bundle to place the sources in")
|
||||
|
||||
if (defined(invoker.app_name)) {
|
||||
_app_name = invoker.app_name
|
||||
} else {
|
||||
_app_name = target_name
|
||||
}
|
||||
|
||||
_bundle_directory = invoker.bundle_directory
|
||||
_resources = invoker.resources
|
||||
|
||||
copy(target_name) {
|
||||
set_sources_assignment_filter([])
|
||||
sources = _resources
|
||||
outputs = [
|
||||
"$root_build_dir/$_app_name.app/$_bundle_directory/Contents/Resources/{{source_file_part}}",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
template("mac_app") {
|
||||
assert(defined(invoker.deps),
|
||||
"Dependencies must be specified for $target_name")
|
||||
assert(defined(invoker.info_plist),
|
||||
"The application plist file must be specified for $target_name")
|
||||
assert(defined(invoker.xibs),
|
||||
"The list of XIB files must be specified for $target_name")
|
||||
|
||||
group_gen_target_name = target_name
|
||||
copy_all_target_name = target_name + "_all_copy"
|
||||
|
||||
# We just create a variable so we can use the same in interpolation
|
||||
if (defined(invoker.app_name)) {
|
||||
_app_name = invoker.app_name
|
||||
} else {
|
||||
_app_name = target_name
|
||||
}
|
||||
|
||||
# Generate the executable
|
||||
bin_gen_target_name = target_name + "_bin"
|
||||
executable(bin_gen_target_name) {
|
||||
visibility = [ ":$group_gen_target_name" ]
|
||||
deps = invoker.deps
|
||||
output_name = app_name
|
||||
}
|
||||
|
||||
# Process the Info.plist
|
||||
plist_gen_target_name = target_name + "_plist"
|
||||
|
||||
action(plist_gen_target_name) {
|
||||
visibility = [ ":$group_gen_target_name" ]
|
||||
script = mac_app_script
|
||||
|
||||
sources = [
|
||||
invoker.info_plist,
|
||||
]
|
||||
outputs = [
|
||||
"$root_build_dir/Info.plist",
|
||||
]
|
||||
|
||||
args = [
|
||||
"plist",
|
||||
"-i",
|
||||
rebase_path(invoker.info_plist, root_build_dir),
|
||||
"-o",
|
||||
rebase_path(root_build_dir),
|
||||
]
|
||||
}
|
||||
|
||||
# Copy the generated binaries and assets to their appropriate locations
|
||||
copy_plist_gen_target_name = target_name + "_plist_copy"
|
||||
copy(copy_plist_gen_target_name) {
|
||||
visibility = [ ":$group_gen_target_name" ]
|
||||
sources = [
|
||||
"$root_build_dir/Info.plist",
|
||||
]
|
||||
|
||||
outputs = [
|
||||
"$root_build_dir/$app_name.app/Contents/{{source_file_part}}",
|
||||
]
|
||||
|
||||
deps = [
|
||||
":$plist_gen_target_name",
|
||||
]
|
||||
}
|
||||
|
||||
copy_bin_target_name = target_name + "_bin_copy"
|
||||
copy(copy_bin_target_name) {
|
||||
visibility = [ ":$group_gen_target_name" ]
|
||||
sources = [
|
||||
"$root_build_dir/$app_name",
|
||||
]
|
||||
|
||||
outputs = [
|
||||
"$root_build_dir/$app_name.app/Contents/MacOS/{{source_file_part}}",
|
||||
]
|
||||
|
||||
deps = [
|
||||
":$bin_gen_target_name",
|
||||
]
|
||||
}
|
||||
|
||||
copy_xib_target_name = target_name + "_xib_copy"
|
||||
process_nibs_mac(copy_xib_target_name) {
|
||||
visibility = [ ":$group_gen_target_name" ]
|
||||
sources = invoker.xibs
|
||||
module = app_name
|
||||
output_dir = "$app_name.app/Contents/Resources"
|
||||
}
|
||||
|
||||
group(copy_all_target_name) {
|
||||
visibility = [ ":$group_gen_target_name" ]
|
||||
deps = [
|
||||
":$copy_bin_target_name",
|
||||
":$copy_plist_gen_target_name",
|
||||
":$copy_xib_target_name",
|
||||
":$struct_gen_target_name",
|
||||
]
|
||||
}
|
||||
|
||||
# Top level group
|
||||
|
||||
group(group_gen_target_name) {
|
||||
deps = [
|
||||
":$copy_all_target_name",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
# Template to package a shared library into a Mac framework bundle.
|
||||
#
|
||||
# Arguments
|
||||
|
|
Загрузка…
Ссылка в новой задаче