Skip to content

Commit 91003af

Browse files
committed
---
yaml --- r: 323057 b: refs/heads/tensorflow-next c: 6fef9ed h: refs/heads/master i: 323055: 8151d5a
1 parent 7b0a90d commit 91003af

File tree

5 files changed

+40
-12
lines changed

5 files changed

+40
-12
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1461,4 +1461,4 @@ refs/heads/master-rebranch: 86e95c23aa0d37f24ec138b7853146c1cead2e40
14611461
refs/heads/rdar-53901732: 9bd06af3284e18a109cdbf9aa59d833b24eeca7b
14621462
refs/heads/revert-26776-subst-always-returns-a-type: 1b8e18fdd391903a348970a4c848995d4cdd789c
14631463
refs/heads/tensorflow-merge: 8b854f62f80d4476cb383d43c4aac2001dde3cec
1464-
refs/heads/tensorflow-next: f754d30de9fccf1b960f99d4acad9301957ff29d
1464+
refs/heads/tensorflow-next: 6fef9edaaf6b06dc377d9c363dcb85b5e34a070a

branches/tensorflow-next/utils/build-script

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from __future__ import print_function
1313

1414
import argparse
15+
import json
1516
import os
1617
import pipes
1718
import platform
@@ -56,6 +57,15 @@ def exit_rejecting_arguments(message, parser=None):
5657
sys.exit(2) # 2 is the same as `argparse` error exit code.
5758

5859

60+
class JSONDumper(json.JSONEncoder):
61+
def __init__(self, *args, **kwargs):
62+
json.JSONEncoder.__init__(self, indent=2, separators=(',', ': '),
63+
*args, **kwargs)
64+
65+
def default(self, o):
66+
return vars(o)
67+
68+
5969
class HostSpecificConfiguration(object):
6070

6171
"""Configuration information for an individual host."""
@@ -1082,7 +1092,7 @@ def main_preset():
10821092
nargs="*",
10831093
metavar="SUBSTITUTION")
10841094
parser.add_argument(
1085-
"--expand-build-script-invocation",
1095+
"--expand-invocation", "--expand-build-script-invocation",
10861096
help="Print the expanded build-script invocation generated "
10871097
"by the preset, but do not run the preset",
10881098
action=arguments.action.optional_bool)
@@ -1092,6 +1102,12 @@ def main_preset():
10921102
parser.add_argument(
10931103
"--build-dir",
10941104
help="specify the directory where build artifact should be stored")
1105+
parser.add_argument(
1106+
"--dump-config",
1107+
help="instead of building, write JSON to stdout containing "
1108+
"various values used to build in this configuration",
1109+
action="store_true",
1110+
default=False)
10951111
args = parser.parse_args()
10961112
if len(args.preset_file_names) == 0:
10971113
args.preset_file_names = [
@@ -1141,6 +1157,8 @@ def main_preset():
11411157
build_script_args = [sys.argv[0]]
11421158
if args.dry_run:
11431159
build_script_args += ["--dry-run"]
1160+
if args.dump_config:
1161+
build_script_args += ["--dump-config"]
11441162

11451163
build_script_args += preset_args
11461164
if args.distcc:
@@ -1158,13 +1176,13 @@ def main_preset():
11581176
if args.cmake_cxx_launcher:
11591177
build_script_args += ["--cmake-cxx-launcher", args.cmake_cxx_launcher]
11601178

1161-
diagnostics.note('using preset "{}", which expands to \n\n{}\n'.format(
1162-
args.preset, shell.quote_command(build_script_args)))
1163-
1164-
if args.expand_build_script_invocation:
1165-
return 0
1166-
1167-
shell.call_without_sleeping(build_script_args)
1179+
printable_command = shell.quote_command(build_script_args)
1180+
if args.expand_invocation:
1181+
print(printable_command)
1182+
else:
1183+
diagnostics.note('using preset "{}", which expands to \n\n{}\n'.format(
1184+
args.preset, printable_command))
1185+
shell.call_without_sleeping(build_script_args)
11681186
return 0
11691187

11701188

@@ -1226,6 +1244,10 @@ def main_normal():
12261244
if args.show_sdks:
12271245
debug.print_xcodebuild_versions()
12281246

1247+
if args.dump_config:
1248+
print(JSONDumper().encode(invocation))
1249+
return 0
1250+
12291251
# Clean build directory if requested.
12301252
if args.clean:
12311253
clean_delay()

branches/tensorflow-next/utils/build_swift/driver_arguments.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,10 @@ def create_argument_parser():
287287
option(['-n', '--dry-run'], store_true,
288288
help='print the commands that would be executed, but do not '
289289
'execute them')
290+
option('--dump-config', toggle_true,
291+
help='instead of building, write JSON to stdout containing '
292+
'various values used to build in this configuration')
293+
290294
option('--legacy-impl', store_true('legacy_impl'),
291295
help='use legacy implementation')
292296

branches/tensorflow-next/utils/build_swift/tests/expected_options.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@
161161
'tsan_libdispatch_test': False,
162162
'long_test': False,
163163
'lto_type': None,
164+
'dump_config': False,
164165
'show_sdks': False,
165166
'skip_build': False,
166167
'stdlib_deployment_targets': None,
@@ -402,6 +403,7 @@ class IgnoreOption(_BaseOption):
402403
SetTrueOption('--benchmark'),
403404
SetTrueOption('--clean'),
404405
SetTrueOption('--dry-run'),
406+
SetTrueOption('--dump-config'),
405407
SetTrueOption('--disable-guaranteed-normal-arguments'),
406408
SetTrueOption('--enable-stdlibcore-exclusivity-checking'),
407409
SetTrueOption('--force-optimized-typechecker'),

branches/tensorflow-next/utils/swift_build_support/swift_build_support/diagnostics.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ def note(message):
1919
"""
2020
note(message)
2121
22-
Print a diagnostic notification to the standard output.
22+
Print a diagnostic notification to the standard error stream.
2323
"""
24-
print(sys.argv[0] + ": note: " + message)
25-
sys.stdout.flush()
24+
print(sys.argv[0] + ": note: " + message, file=sys.stderr)
25+
sys.stderr.flush()
2626

2727

2828
def fatal(message):

0 commit comments

Comments
 (0)