[ios/goma] Create symlinks to Xcode SDK in $root_build_dir/sdk
Creating symlinks in src/ can mess with the build because some scripts incorrectly re-invoke `gn gen` as part of the build. Also, it does not make sense to create symlinks in src/ based on a gn variable that can have different value for different build directories. Bug: 1060666, 1061419 Change-Id: I2367aa6436489b77540454da8f7ae17d41c6f9fb Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2102649 Reviewed-by: Nico Weber <thakis@chromium.org> Commit-Queue: Sylvain Defresne <sdefresne@chromium.org> Cr-Original-Commit-Position: refs/heads/master@{#750187} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: 909de78b93850db4371465c23d4593fdda93c8c4
This commit is contained in:
Родитель
f77aabe80a
Коммит
5a1f629cdf
|
@ -22,6 +22,5 @@ ciopfs
|
|||
/linux/ubuntu_*-sysroot/
|
||||
/ios_files
|
||||
/mac_files
|
||||
/xcode_links
|
||||
|
||||
!/util/LASTCHANGE.dummy
|
||||
|
|
|
@ -106,7 +106,10 @@ if (ios_sdk_path == "") {
|
|||
]
|
||||
}
|
||||
if (ios_use_goma_rbe) {
|
||||
ios_sdk_info_args += [ "--create_symlink_under_src" ]
|
||||
ios_sdk_info_args += [
|
||||
"--create_symlink_at",
|
||||
rebase_path("$root_build_dir/sdk/xcode_links", "//"),
|
||||
]
|
||||
}
|
||||
script_name = "//build/config/mac/sdk_info.py"
|
||||
_ios_sdk_result = exec_script(script_name, ios_sdk_info_args, "scope")
|
||||
|
|
|
@ -92,8 +92,9 @@ if (!use_system_xcode) {
|
|||
# put system xcode under src to avoid absolute path.
|
||||
if (use_system_xcode && ios_use_goma_rbe) {
|
||||
sdk_info_args += [
|
||||
"--create_symlink_under_src",
|
||||
"--get_sdk_info",
|
||||
"--create_symlink_at",
|
||||
rebase_path("$root_build_dir/sdk/xcode_links", "//"),
|
||||
]
|
||||
}
|
||||
sdk_info_args += [ mac_sdk_name ]
|
||||
|
|
|
@ -108,39 +108,42 @@ def FillSDKPathAndVersion(settings, platform, xcode_version):
|
|||
settings['sdk_build'] = settings['sdk_version']
|
||||
|
||||
|
||||
def CreateXcodeSymlinkUnderChromiumSource(src):
|
||||
"""Create symlink to Xcode directory under Chromium source."""
|
||||
def CreateXcodeSymlinkAt(src, dst):
|
||||
"""Create symlink to Xcode directory at target location."""
|
||||
|
||||
if not os.path.isdir(XCODE_LINK_DIR):
|
||||
os.makedirs(XCODE_LINK_DIR)
|
||||
if not os.path.isdir(dst):
|
||||
os.makedirs(dst)
|
||||
|
||||
dst = os.path.join(dst, os.path.basename(src))
|
||||
updated_value = '//' + os.path.relpath(dst, ROOT_SRC_DIR)
|
||||
|
||||
dst = os.path.join(XCODE_LINK_DIR, os.path.basename(src))
|
||||
# Update the symlink only if it is different from the current destination.
|
||||
if os.path.islink(dst):
|
||||
current_dst = os.readlink(src)
|
||||
if current_dst != dst:
|
||||
os.unlink(src)
|
||||
sys.stderr.write('existing symlink %s points %s; want %s. Removed.' %
|
||||
(src, current_dst, dst))
|
||||
current_src = os.readlink(dst)
|
||||
if current_src == src:
|
||||
return updated_value
|
||||
os.unlink(dst)
|
||||
sys.stderr.write('existing symlink %s points %s; want %s. Removed.' %
|
||||
(dst, current_src, src))
|
||||
os.symlink(src, dst)
|
||||
|
||||
return '//' + os.path.relpath(dst, ROOT_SRC_DIR)
|
||||
return updated_value
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
doctest.testmod()
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--developer_dir", required=False)
|
||||
parser.add_argument("--developer_dir", dest="developer_dir", required=False)
|
||||
parser.add_argument("--get_sdk_info",
|
||||
action="store_true", dest="get_sdk_info", default=False,
|
||||
help="Returns SDK info in addition to xcode/machine info.")
|
||||
parser.add_argument("--create_symlink_under_src",
|
||||
action="store_true", dest="create_symlink_under_src",
|
||||
default=False,
|
||||
help="Create symlink of SDK under Chromium source "
|
||||
"and returns the symlinked paths as SDK info instead "
|
||||
"of the original location.")
|
||||
parser.add_argument(
|
||||
"--create_symlink_at",
|
||||
action="store",
|
||||
dest="create_symlink_at",
|
||||
help="Create symlink of SDK at given location and "
|
||||
"returns the symlinked paths as SDK info instead "
|
||||
"of the original location.")
|
||||
args, unknownargs = parser.parse_known_args()
|
||||
if args.developer_dir:
|
||||
os.environ['DEVELOPER_DIR'] = args.developer_dir
|
||||
|
@ -159,8 +162,8 @@ if __name__ == '__main__':
|
|||
|
||||
for key in sorted(settings):
|
||||
value = settings[key]
|
||||
if args.create_symlink_under_src and '_path' in key:
|
||||
value = CreateXcodeSymlinkUnderChromiumSource(value)
|
||||
if args.create_symlink_at and '_path' in key:
|
||||
value = CreateXcodeSymlinkAt(value, args.create_symlink_at)
|
||||
if isinstance(value, str):
|
||||
value = '"%s"' % value
|
||||
print('%s=%s' % (key, value))
|
||||
|
|
Загрузка…
Ссылка в новой задаче