Skip to content

Commit 48a952b

Browse files
author
Nathan Hawes
authored
Merge pull request swiftlang#97 from nathawes/added-swift-flags
Support substituting the values of fields in the current project's action and repo into runner.py's --added-swift-args
2 parents 112421c + 8548a2e commit 48a952b

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

project.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,15 @@ def dispatch(root_path, repo, action, swiftc, swift_version,
283283
incremental=False):
284284
"""Call functions corresponding to actions."""
285285

286+
if added_swift_flags:
287+
# Support added swift flags specific to the current repository and
288+
# action by passing their fields as keyword arguments to format, e.g.
289+
# so that {path} in '-index-store-path /tmp/index/{path}' is replaced
290+
# with the value of repo's path field.
291+
substitutions = action.copy()
292+
substitutions.update(repo)
293+
added_swift_flags = added_swift_flags.format(**substitutions)
294+
286295
if action['action'] == 'BuildSwiftPackage':
287296
if not build_config:
288297
build_config = action['configuration']
@@ -456,7 +465,9 @@ def add_arguments(parser):
456465
action='store_true')
457466
parser.add_argument("--add-swift-flags",
458467
metavar="FLAGS",
459-
help='add flags to each Swift invocation',
468+
help='add flags to each Swift invocation (note: field '
469+
'names from projects.json enclosed in {} will be '
470+
'replaced with their value)',
460471
default='')
461472
parser.add_argument("--skip-clean",
462473
help='skip all git and build clean steps before '

0 commit comments

Comments
 (0)