-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[build-script] Determine HOST_CC in build-script #761
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
[build-script] Determine HOST_CC in build-script #761
Conversation
c804cc9
to
00b9f7d
Compare
def _freebsd_release_date(): | ||
""" | ||
Return the release date for FreeBSD operating system on this host. | ||
If the release date cannot be ascertained, return None. |
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 it will return 0
instead, or sometimes throw an error, if sysctl
returns a non-integer.
I'd just halt the execution at that point. There is no reasonable way a caller could recover from an error in this function. They either need the version and they call this function, or they don't, and they shouldn't be calling it.
@modocache Awesome improvements! |
9043cf5
to
a7e10b6
Compare
@gribozavr Addressed your comments, except for the one about adding the unit tests to |
@@ -0,0 +1,10 @@ | |||
# builcli |
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.
Stale module name.
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.
Good catch!
@modocache Thank you! Unfortunately, one more issue with argument handling came up in my testing... |
a7e10b6
to
547b26c
Compare
@gribozavr Good point, I'll update I also realized I forgot to add the code headers you mentioned! I added the ones from #762, since it looks like that was just merged. Thanks! |
@gribozavr I've added some logic to the argument parser that enables the backwards-compatibility you described. I wanted to make sure we could test the new behavior in isolation, which meant moving the argument parser itself. Hopefully the commits aren't so big that they're unreviewable... 😟 Let me know if you have any additional thoughts--and thanks for all the reviews! |
67629c6
to
71deb46
Compare
A proposal to add Python unit tests to the validation tests is up at #778. |
@modocache Thanks! I think your patch will work, but... Sorry for sounding picky, but I think we can use a simpler approach. Subclassing of What do you think about the following approach? Add a function in the module (so that it is testable) that accepts a command line and a list of options to migrate, and returns the rewritten command line, which is then passed to
|
71deb46
to
e382cbe
Compare
@gribozavr Updated as per your suggestions! 👍 I think I'd still like to move the argument parser out into its own module someday, though. We could probably discuss this on the mailing lists, in the comments on SR-237, or in another pull request. My reasoning is that it's pretty cool to be able to call Anyway, thanks for all the dedicated reviews! |
@modocache Yes, that would be definitely useful -- I was thinking about a feature in build-script that would validate all presets, for example. I wouldn't mind if you move it to a module in this PR, but it is the subclassing that looks strange -- I could imagine a function that accepts a list of command line arguments and returns a parsed representation as the API that the module should expose for this purpose. |
Ah, gotcha. Well, definitely expect more PRs on this topic, then! 😉 I feel like this one is in a pretty good state, though. I'm eager to merge it so I can add its tests to the validation tests from #778. |
""" | ||
for suffix in suffixes: | ||
cc_path = which('clang{}'.format(suffix)) | ||
cxx_path = which('clang{}'.format(suffix)) |
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.
This should say clang++
-- I'm getting strange linker errors because CMake is trying to link C++ programs with the C compiler.
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.
Oops! Good catch, thanks--this was a typo. 😊
@modocache Thank you! This patch is much simpler and I like it. There's one issue though, the C++ compiler name is not correct, see above. |
e382cbe
to
7e6dfe2
Compare
@gribozavr Updated! Thanks. |
https://bugs.swift.org/browse/SR-237 calls for `build-script` and `build-script-impl` to be merged. This commit takes another step towards that goal by moving the logic that finds the path to the `clang` and `clang++` executables up into Python-land. Rather than simply moving all of the logic into `utils/build-script`, this commit moves relevant functions into a new Python module, named `swift_build_support`. This has several benefits: - The logic can be tested. Whereas `build-script-impl` needed to be run in order to verify its behavior, the logic extracted out of it into `swift_build_support` can be tested in isolation. - The logic can be split up into several files without polluting the `utils` directory, which now contains many different files that are unrelated to `build-script`.
7e6dfe2
to
ca3e11b
Compare
Also went ahead and added the tests to |
@modocache Thank you! Your PR passes all tests I did. Merging. |
…-host-cc [build-script] Determine HOST_CC in build-script
SR-237 calls for
build-script
andbuild-script-impl
to be merged. This commit takes another step towards that goal by moving the logic that finds the path to theclang
andclang++
executables up into Python-land.Rather than simply moving all of the logic into
utils/build-script
, this commit moves relevant functions into a new Python module, namedbuildcli
. This has several benefits:build-script-impl
needed to be run in order to verify its behavior, the logic extracted out of it intobuildcli
can be tested in isolation.utils
directory, which now contains many different files that are unrelated tobuild-script
./cc @gottesmm and @jrose-apple, since they've commented on SR-237 in the past.