Skip to content

[build-script] Extract most parts related to build-script-impl #23982

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

drodriguez
Copy link
Contributor

Most parts related to build-script-impl moved into its own type
BuildScriptImplHelper. This will make moving this helper to its own file
and to a builder easier later.

The parts that haven't moved are the path of the script (still a
constant in the main build-script file), and the invocation to check the
migration parameters. Those will be dealt later.

The changes move the methods that turn build-script args into
build-script-impl args and creates the environment variables into this
new helper. It also moves the specific of building action names and how
to invoke the script from their previous places in BuildScriptInvocation
into the Helper.

Sadly I wasn’t able to modify the resulting diff in a nice way that the implementations of validate_arguments, apply_default_arguments, __init__ and initialize_runtime_environment in BuildScriptInvocation doesn’t seem to be modified. I just simply moved the code around them. At least one can see what the modifications in _convert_to_impl_arguments and _convert_to_impl_arguments looks like.

This was part of #23257. I’m trying to split the PR in smaller ones to make the reviews easier. Other PRs in this group are #23303, #23803, #23810, #23822, #23865, #23915, #23917, and #23918.

@drodriguez
Copy link
Contributor Author

@swift-ci please test

@drodriguez drodriguez force-pushed the build-script-extract-build-script-impl-helper branch from 5880b04 to 7aac72d Compare May 14, 2019 20:18
@drodriguez
Copy link
Contributor Author

Ready for review. Fixed the conflicts with current master, and checked it still works as intended.

@swift-ci please test

@drodriguez drodriguez force-pushed the build-script-extract-build-script-impl-helper branch from 7aac72d to f24db94 Compare May 17, 2019 21:19
@drodriguez
Copy link
Contributor Author

Rebase on top of master to bring the changes from #24330.

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 7aac72d6062bc1c0e0e2da7cd5a7aada01fe0e24

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 7aac72d6062bc1c0e0e2da7cd5a7aada01fe0e24

def validate_arguments(toolchain, args):
if toolchain.cc is None or toolchain.cxx is None:
diagnostics.fatal(
"can't find clang (please install clang-3.5 or a "
Copy link
Member

Choose a reason for hiding this comment

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

I don't think that we should hardcode the version here, its too easy to forget to update it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This code is just a copy of the existing code. You are right that hardcoding '3.5' in the string is not the best idea, but I don’t think there's a good way (right now) to do it better.

The accepted versions are “hardcoded” in swift_build_support.toolchain, and they are not easy to query. I can say that 3.5 seems to still be the minimum version (but this is only the executable suffix, so…).

Most parts related to build-script-impl moved into its own type
BuildScriptImplHelper. This will make moving this helper to its own file
and to a builder easier later.

The parts that haven't moved are the path of the script (still a
constant in the main build-script file), and the invocation to check the
migration parameters. Those will be dealt later.

The changes move the methods that turn build-script args into
build-script-impl args and creates the environment variables into this
new helper. It also moves the specific of building action names and how
to invoke the script from their previous places in BuildScriptInvocation
into the Helper.
@drodriguez drodriguez force-pushed the build-script-extract-build-script-impl-helper branch from f24db94 to eb818b6 Compare June 11, 2019 19:12
@drodriguez
Copy link
Contributor Author

@swift-ci please smoke test

@drodriguez
Copy link
Contributor Author

Abandoning these efforts. It might still be useful for better Windows builds for most of the community, but I will not have time to keep improving this and it doesn't seem to be a lot of interest in improving the build system in this direction.

@drodriguez drodriguez closed this Jan 10, 2020
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.

3 participants