Skip to content

Add the target list to build-script --help. #29283

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 18, 2020
Merged

Add the target list to build-script --help. #29283

merged 1 commit into from
Jan 18, 2020

Conversation

atrick
Copy link
Contributor

@atrick atrick commented Jan 17, 2020

Teach build-script to print the list of valid targets for the
--stdlib-deployment-targets option. Unfortunately, passing all
supported targets to this option is the only way to force
configuration of those targets. Simply using --ios is no longer
sufficient--none of the iOS targets are actually configured unless you
ask them to be built.

(The reasonable way to use a build config script is to first configure
for all supported platforms, but only build the platforms/targets one
by one when you actually need them).

This currently prints:

--stdlib-deployment-targets STDLIB_DEPLOYMENT_TARGETS
The targets to compile or cross-compile the Swift
standard library for. None by default. Comma separated
list: android-aarch64 android-armv7 appletvos-arm64
appletvsimulator-x86_64 cygwin-x86_64 freebsd-x86_64
haiku-x86_64 iphoneos-arm64 iphoneos-armv7 iphoneos-
armv7s iphonesimulator-i386 iphonesimulator-x86_64
linux-aarch64 linux-armv6 linux-armv7 linux-i686
linux-powerpc64 linux-powerpc64le linux-s390x linux-
x86_64 macosx-x86_64 watchos-armv7k
watchsimulator-i386 windows-x86_64

@atrick atrick requested a review from Rostepher January 17, 2020 21:13
@atrick
Copy link
Contributor Author

atrick commented Jan 17, 2020

@swift-ci test

'standard library for. %(default)s by default.')
help='The targets to compile or cross-compile the Swift standard '
'library for. %(default)s by default. Comma separated list: '+
" ".join(StdlibDeploymentTarget.get_target_names()))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use single quotes for string literals to keep the style consistent. And avoid string concatenation in this case:

help='The targets to compile or cross-compile the Swift standard '
     'library for. %(default)s by default. Comma separated list: '
     ' '.join(StdlibDeploymentTarget.get_target_names()))

Python has a nifty feature that automatically concatenates string literals that appear sequentially with only whitespace between them:

'Hello, ' 'world!'  # => 'Hello, world!'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need a different string literal for the join. Is this ok?

           help='The targets to compile or cross-compile the Swift standard '
                'library for. %(default)s by default. Comma separated list: '
           + ' '.join(StdlibDeploymentTarget.get_target_names()))

'standard library for. %(default)s by default.')
help='The targets to compile or cross-compile the Swift standard '
'library for. %(default)s by default. Comma separated list: '
+ ' '.join(StdlibDeploymentTarget.get_target_names()))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You shouldn't need this + here. Just indent the statement to keep it inline with the ones above and try running python utils/python_lint.py and python -m unittest discover -s utils/build_swift -t utils/ to make sure the tests pass. Likely you need to add a new test case to utils/build_swift/tests/expected_options.py.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. It is nicer to look at with a trailing .format instead of concatenation.

Copy link
Contributor

@Rostepher Rostepher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! :shipit:

Copy link
Contributor Author

@atrick atrick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the record, lint and python unittest both pass.

@atrick
Copy link
Contributor Author

atrick commented Jan 17, 2020

@swift-ci smoke test

@Rostepher
Copy link
Contributor

For the record, lint and python unittest both pass.

Those both run as part of "test" and "smoke test" so we'd know soon enough. But thanks for running them before hand!

@atrick
Copy link
Contributor Author

atrick commented Jan 18, 2020

@swift-ci smoke test

Teach build-script to print the list of valid targets for the
--stdlib-deployment-targets option. Unfortunately, passing all
supported targets to this option is the only way to force
configuration of those targets. Simply using --ios is no longer
sufficient--none of the iOS targets are actually configured unless you
ask them to be built.

(The reasonable way to use a build config script is to first configure
for all supported platforms, but only build the platforms/targets one
by one when you actually need them).

This currently prints:

  --stdlib-deployment-targets STDLIB_DEPLOYMENT_TARGETS
                        The targets to compile or cross-compile the Swift
                        standard library for. None by default. Comma separated
                        list: android-aarch64 android-armv7 appletvos-arm64
                        appletvsimulator-x86_64 cygwin-x86_64 freebsd-x86_64
                        haiku-x86_64 iphoneos-arm64 iphoneos-armv7 iphoneos-
                        armv7s iphonesimulator-i386 iphonesimulator-x86_64
                        linux-aarch64 linux-armv6 linux-armv7 linux-i686
                        linux-powerpc64 linux-powerpc64le linux-s390x linux-
                        x86_64 macosx-x86_64 watchos-armv7k
                        watchsimulator-i386 windows-x86_64
@atrick
Copy link
Contributor Author

atrick commented Jan 18, 2020

@swift-ci smoke test

@atrick atrick merged commit 5d3e8b5 into swiftlang:master Jan 18, 2020
@atrick atrick deleted the show-build-targets branch January 23, 2020 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants