-
Notifications
You must be signed in to change notification settings - Fork 154
Add '--clang' flag to runner.py #586
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
Conversation
e49379a
to
426f901
Compare
@swift-ci test |
@swift-ci test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The whole approach of swapping a clang
executable into the toolchain seems awfully fragile to me (see the amount of comments I left in that file). Is there a reason why you can’t just specify the clang
executable by setting the CC
environment variable similar to how we set SWIFT_EXEC
?
I also added some comments regarding code style inline.
Thanks @ahoppen for reviewing my PR!
The reason why we couldn't just specify a
Thanks! |
426f901
to
cfe118d
Compare
@swift-ci test |
cfe118d
to
e8c9b6e
Compare
@swift-ci test |
Thanks @ahoppen I addressed the style comments, and as you pointed out it now adds |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is much cleaner with the CC
environment variable now. Thanks!
I’ve added some more comments inline.
run
Outdated
'-DLLVM_TARGETS_TO_BUILD=X86;AArch64;ARM', | ||
source_path] | ||
common.check_execute(cmake_command) | ||
common.check_execute(['xcrun', 'ninja']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose you could just use ninja_path
here again, right? There’s no need to look it up again through xcrun
. Would also make it more robust IMHO if the user xcode-select
ed a different version of Xcode between the two runs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
common.check_execute(['xcrun', 'ninja'])
is to build the project with ninja. I'll add some comments.
run
Outdated
'-DCMAKE_MAKE_PROGRAM={}'.format(ninja_path), | ||
'-DLLVM_ENABLE_PROJECTS=clang;llvm', | ||
'-DCMAKE_BUILD_TYPE=Release', | ||
'-DCLANG_APPLE_BUILD_VERSION_STRING=13000000', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose you are hardcoding this version number because it’s the current clang version and it’s bound to get out of date at some point. I’d prefer something completely non-sensical like 99999999
or to remove it, if possible. Otherwise we’ll wonder in a couple of years why this needs to be 13000000
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That specific string is necessary for building an internal project, but I removed it from this PR.
b1a4686
to
20a5da7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for being patient and addressing all my comments. Looks good to me now 👍
@swift-ci Please test |
'--clang' provides a way to build Xcode projects with a custom clang binary, by adding 'CC=clangc' flag to xcode. With '--clang-source-path', the 'run' script builds clang binary from the clang source in the path and provides this binary path to 'runner.py' using the '--clang' flag.
20a5da7
to
ce448af
Compare
@swift-ci test |
@shahmishal gentle reminder |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! thanks
@swift-ci test |
@shahmishal The test failures are on Swift Packages and don't seem to be related to this change. Would you mind merging it on my behalf? |
Pull Request Description
'--clang' provides a way to build projects with a custom clang binary.
With '--clang-source-path', the 'run' script builds clang binary from
the clang source in the path and provides this binary path to 'runner.py'
using the '--clang' flag.
Acceptance Criteria
To be accepted into the Swift source compatibility test suite, a project must:
./project_precommit_check
script runEnsure project meets all listed requirements before submitting a pull request.