Skip to content

[Build Script] Fix --infer with earlyswiftdriver. #37349

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
Jun 1, 2021

Conversation

artemcm
Copy link
Contributor

@artemcm artemcm commented May 10, 2021

In the original implementation (#36377), using --infer accidentally disables the earlyswiftdriver product (before_impl_product_classes set to always empty). This change fixes that and makes sure early SwiftDriver is always built, regardless of whether or not --infer is used.

This change also ensures that install_all setting triggered by --infer does not affect before_build_script_impl products, which should not be installed into the toolchain (corresponding build products that use the just-built toolchain are the products that get installed, e.g. swiftdriver to earlyswiftdriver).

@artemcm
Copy link
Contributor Author

artemcm commented May 10, 2021

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 37693865240471625e0d6baa81f8ea9be46548c6

@artemcm artemcm force-pushed the InferEarlyDriver branch from 3769386 to 7894016 Compare May 10, 2021 23:21
@artemcm
Copy link
Contributor Author

artemcm commented May 10, 2021

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 7894016bb4bbc703c9831be40f0868fbf179e64a

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 7894016bb4bbc703c9831be40f0868fbf179e64a

@artemcm artemcm force-pushed the InferEarlyDriver branch from 7894016 to a420936 Compare May 11, 2021 17:20
@artemcm
Copy link
Contributor Author

artemcm commented May 11, 2021

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - a4209364cc7bf06765ef66224a674f085a01088a

@artemcm artemcm force-pushed the InferEarlyDriver branch from a420936 to 875ece9 Compare May 11, 2021 20:11
@artemcm
Copy link
Contributor Author

artemcm commented May 11, 2021

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 875ece94b14116c006ab4f6b59480c4b424eda06

@artemcm
Copy link
Contributor Author

artemcm commented May 11, 2021

@swift-ci please test Linux platform

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 875ece94b14116c006ab4f6b59480c4b424eda06

@artemcm
Copy link
Contributor Author

artemcm commented May 12, 2021

@swift-ci please test Linux platform

@artemcm artemcm requested a review from gottesmm May 12, 2021 22:51
@gottesmm
Copy link
Contributor

Why don't we make swift-driver a dependency of everything rather than adding in special behavior. Feel free to delete cross dependencies.

@artemcm artemcm force-pushed the InferEarlyDriver branch 2 times, most recently from ad8542f to a6b4e36 Compare May 24, 2021 20:58
@artemcm
Copy link
Contributor Author

artemcm commented May 24, 2021

@swift-ci please test

@artemcm
Copy link
Contributor Author

artemcm commented May 24, 2021

Why don't we make swift-driver a dependency of everything rather than adding in special behavior. Feel free to delete cross dependencies.

Good idea. Changed to this.

@artemcm artemcm force-pushed the InferEarlyDriver branch 2 times, most recently from bbf55fa to c0a5832 Compare May 25, 2021 16:13
@artemcm artemcm requested a review from drexin May 25, 2021 16:15
@artemcm artemcm force-pushed the InferEarlyDriver branch from c0a5832 to df4e1a4 Compare May 25, 2021 16:35
@artemcm
Copy link
Contributor Author

artemcm commented May 25, 2021

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - df4e1a4632434549b935d93e13f9c2fcb2a85035

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - df4e1a4632434549b935d93e13f9c2fcb2a85035

@artemcm artemcm force-pushed the InferEarlyDriver branch from df4e1a4 to 48f5d60 Compare May 25, 2021 18:48
@artemcm
Copy link
Contributor Author

artemcm commented May 25, 2021

@swift-ci please test

@artemcm
Copy link
Contributor Author

artemcm commented May 26, 2021

@swift-ci please test Windows platform

@artemcm
Copy link
Contributor Author

artemcm commented Jun 1, 2021

@swift-ci please test

Copy link
Contributor

@gottesmm gottesmm left a comment

Choose a reason for hiding this comment

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

Looks reasonable to me. Fix the comment issues and then let err rip.

@@ -1148,8 +1151,13 @@ class BuildScriptInvocation(object):
print("--- Running tests for %s ---" % product_name)
product.test(host_target)
print("--- Finished tests for %s ---" % product_name)
# Install the product if it should be installed specifically, or
# if it should be built and `install_all` is set to True.
Copy link
Contributor

Choose a reason for hiding this comment

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

This is no longer true. CMark I think does install things and is now an early product. So I would say products like early-swift-driver which are before_build_script_impl products that are never installed.

@@ -32,10 +33,11 @@ def is_before_build_script_impl_product(cls):
"""
return True

# This is the root of the build-graph, so it doesn't have any dependencies.
# EarlySwiftDriver is the root of the graph,
Copy link
Contributor

Choose a reason for hiding this comment

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

Yes! Can you reflow this to 80 columns?

@@ -83,6 +83,10 @@ def should_install(self, host_target):
# product with `--swift-driver --install-swift-driver`.
return False

@classmethod
def is_ignore_install_all_product(cls):
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add your explanation from the commit msg (which is great btw) to this?

In the original implementation (swiftlang#36377), using `--infer` accidentally disables the `earlyswiftdriver` product (`before_impl_product_classes` set to always empty). This change fixes that and makes sure early SwiftDriver is always built, regardless of whether or not `--infer` is used.

This change also ensures that `install_all` setting triggered by `--infer` does not affect products which specify `is_ignore_install_all_product` to return True. This is useful for products which should not be installed into the toolchain (corresponding build products that use the just-built toolchain are the products that get installed, e.g. `swiftdriver` to `earlyswiftdriver`).
@artemcm artemcm force-pushed the InferEarlyDriver branch from 48f5d60 to 3511d5f Compare June 1, 2021 20:13
@artemcm
Copy link
Contributor Author

artemcm commented Jun 1, 2021

@swift-ci please smoke test

@artemcm artemcm merged commit 71fb04a into swiftlang:main Jun 1, 2021
@artemcm
Copy link
Contributor Author

artemcm commented Jun 1, 2021

Thanks, @gottesmm .

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