Skip to content

Fix the build-script --skip-build option. #29500

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 29, 2020
Merged

Fix the build-script --skip-build option. #29500

merged 1 commit into from
Jan 29, 2020

Conversation

atrick
Copy link
Contributor

@atrick atrick commented Jan 28, 2020

This option configures the build directories without building any
targets. Splitting configuration from build allows for the decoupling
of build products. This decoupling is essential for the enlightened
way of developing Swift where the build-script is never actually used
to build anything, and build products can be independently
configured. When fully supported, this avoids many unnecessary
full/clean rebuilds and enables debugging by mixing-and-matching
configurations and rebuilding only select products after a change.

Sadly, the option has degraded, and a recent commit rendered it fully broken:

commit 34848e6
Author: Alex Langford [email protected]
Date: Wed Jan 22 19:27:44 2020

[build] Unify logic to skip building projects in build-script-impl

The breaking commit was itself a reasonable cleanup. The underlying
problem was the original --skip-build was implemented using hacks that
conflated configuration with build.

This fix reinstates a reasonable situation:

--skip-build has no effect on configuration, as documented. It merely
skips building the targets. This is how it must behave to work as
intended.

--skip-build-{product} and its inverse --build-{product} controls
which products will be configured. These options are in heavy use
throughout the scripts, so changing the name (e.g. to --skip-config)
would be disruptive and of questionable benefit.

None of this changes the fact that any required build logic that
people have dumped into build-script-impl still effectively breaks the
enlightened way of building Swift, particularly when building
toolchain components.

@atrick atrick requested review from compnerd and gottesmm January 28, 2020 05:17
@atrick
Copy link
Contributor Author

atrick commented Jan 28, 2020

@swift-ci test

@atrick atrick requested a review from Rostepher January 28, 2020 05:19
@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 632468e386cf88b560a99cea37d4eeb54c2165e3

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 632468e386cf88b560a99cea37d4eeb54c2165e3

@atrick
Copy link
Contributor Author

atrick commented Jan 28, 2020

@swift-ci test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 632468e386cf88b560a99cea37d4eeb54c2165e3

@atrick
Copy link
Contributor Author

atrick commented Jan 28, 2020

For some reason, the unittests fail when I run locally (although this used to work). So, this PR is trial-and-error.
python 2.7.16

FAIL: Swift(macosx-x86_64) :: Python/build_swift.swift (1 of 1)
******************** TEST 'Swift(macosx-x86_64) :: Python/build_swift.swift' FAILED ********************
Script:
--
: 'RUN: at line 10';   /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python /Users/atrick/s/sopt/swift/utils/build_swift/run_tests.py
--
Exit Code: 1

Command Output (stderr):
--
Traceback (most recent call last):
  File "/Users/atrick/s/sopt/swift/utils/build_swift/run_tests.py", line 19, in <module>
    import argparse
  File "/Users/atrick/s/sopt/swift/utils/build_swift/argparse/__init__.py", line 18, in <module>

ImportError: cannot import name ArgumentDefaultsHelpFormatter

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 632468e386cf88b560a99cea37d4eeb54c2165e3

@Rostepher
Copy link
Contributor

@atrick That test failure was caused by a stale Python cache.

@Rostepher
Copy link
Contributor

Rostepher commented Jan 28, 2020

Overall this seems relatively reasonable. Not sure I like the names of --build-{product} and --skip-build-{product} now. I would wait to merge this until @compnerd and @edymtt have had a chance to look at it.

@Rostepher Rostepher requested a review from edymtt January 28, 2020 20:45
@gottesmm
Copy link
Contributor

@Rostepher I wish it was something like --only-configure. That is really what it is = /.

@Rostepher
Copy link
Contributor

Rostepher commented Jan 28, 2020

I'd be fine with eventually renaming all these arguments. We could deprecate the old ones in build-script and have their namespace destinations match the new arguments. Pretty sure we have a deprecation mechanism, we just need to make sure it puts up a warning. Since build-script-impl is an implementation detail we can change all these there.

This option configures the build directories without building any
targets. Splitting configuration from build allows for the decoupling
of build products. This decoupling is essential for the enlightened
way of developing Swift where the build-script is never actually used
to build anything, and build products can be independently
configured. When fully supported, this avoids many unnecessary
full/clean rebuilds and enables debugging by mixing-and-matching
configurations and rebuilding only select products after a change.

Sadly, the option has degraded, and a recent commit rendered it fully broken:

  commit 34848e6
  Author: Alex Langford <[email protected]>
  Date:   Wed Jan 22 19:27:44 2020

    [build] Unify logic to skip building projects in build-script-impl

The breaking commit was itself a reasonable cleanup. The underlying
problem was the original --skip-build was implemented using hacks that
conflated configuration with build.

This fix reinstates a reasonable situation:

--skip-build has no effect on configuration, as documented. It merely
  skips building the targets. This is how it must behave to work as
  intended.

--skip-build-{product} and its inverse --build-{product} controls
  which products will be configured. These options are in heavy use
  throughout the scripts, so changing the name (e.g. to --skip-config)
  would be disruptive and of questionable benefit.

None of this changes the fact that any required build logic that
people have dumped into build-script-impl still effectively breaks the
enlightened way of building Swift, particularly when building
toolchain components.
@atrick
Copy link
Contributor Author

atrick commented Jan 28, 2020

@swift-ci smoke test

@atrick
Copy link
Contributor Author

atrick commented Jan 28, 2020

I don't particularly like the names, but this implementation in this PR now matches the existing documentation of those option names. This is completely blocking me, so any additional cleanup should be proposed in a separate PR.

@atrick
Copy link
Contributor Author

atrick commented Jan 28, 2020

@swift-ci smoke test

@Rostepher Rostepher merged commit 39d28fc into swiftlang:master Jan 29, 2020
@compnerd
Copy link
Member

What we discussed was that it would replace the old options - how come those are not removed?

@Rostepher
Copy link
Contributor

We can remove them in follow-up PRs. This turned out to be blocking both @atrick and others.

@atrick
Copy link
Contributor Author

atrick commented Jan 29, 2020

@compnerd the existing --skip-build-XXX are simply the inverse of the --build-XXX options. These are generally important for controlling which products will be configured. They really haven't changed, it's just that they're no longer serving doing double duty as "configure but don't build" for some subset of the products. With the change in this PR, we no longer need to pass any --skip-build-XXX to the impl script for the normal default configuration. However, I intend to start using --skip-build-llvm to avoid constantly reconfiguring LLVM even when I don't intend to build it. Note that I share the same LLVM build across all my swift configurations and working branches.

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.

5 participants