Skip to content
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

Run build commands without declared outputs #7203

Merged
merged 1 commit into from
Jan 3, 2024

Conversation

neonichu
Copy link
Contributor

It is possible to declare build commands without outputs and the expectation is that those would still run. Currently, that is not the case, since the only condition that makes llbuild run build commands is that there's a client for the output files (either compilation or copying of resources).

This change adds a phony output to any command that has no declared outputs and declares these phony outputs as input for any targets that are asking for the plugin to be applied. This will lead to these commands running unconditionally, fixing the current silent failure to run these.

rdar://100415491

@neonichu neonichu self-assigned this Dec 15, 2023
@neonichu
Copy link
Contributor Author

I need to add a test for this.

@neonichu
Copy link
Contributor Author

@swift-ci please test

@neonichu
Copy link
Contributor Author

I wonder whether we should make this change conditional on the tools-version?

@tomerd
Copy link
Contributor

tomerd commented Dec 15, 2023

I wonder whether we should make this change conditional on the tools-version?

seems like a good idea

@rauhul
Copy link
Member

rauhul commented Dec 16, 2023

Will this allow for swift build --product [SomeLib|SomeExe]?

@neonichu
Copy link
Contributor Author

Will this allow for swift build --product [SomeLib|SomeExe]?

Not sure I understand the question, how is that related to plugins? 🤔

@neonichu
Copy link
Contributor Author

I think what I'll do is make the new behavior 5.11 only but emit a warning on all earlier tools-versions. It is probably never intentional to declare a plugin usage that doesn't actually do anything and it's good to inform people that upgrading will give them the desired behavior.

It is possible to declare build commands without outputs and the expectation is that those would still run. Currently, that is not the case, since the only condition that makes llbuild run build commands is that there's a client for the output files (either compilation or copying of resources).

This change adds a phony output to any command that has no declared outputs and declares these phony outputs as input for any targets that are asking for the plugin to be applied. This will lead to these commands running unconditionally, fixing the current silent failure to run these.

rdar://100415491
@neonichu neonichu force-pushed the run-build-commands-without-declared-outputs branch from 5a2b48e to 5b7bbac Compare January 2, 2024 23:47
@neonichu
Copy link
Contributor Author

neonichu commented Jan 2, 2024

Rebased, added tests and made the fix conditional on the tools-version. On older tools-version, we emit a warning that should explain what's happening and that it can be resolved by upgrading the tools-version.

@neonichu
Copy link
Contributor Author

neonichu commented Jan 2, 2024

@swift-ci please test

@neonichu
Copy link
Contributor Author

neonichu commented Jan 2, 2024

@swift-ci please test windows

1 similar comment
@neonichu
Copy link
Contributor Author

neonichu commented Jan 3, 2024

@swift-ci please test windows

@neonichu neonichu merged commit 3035c56 into main Jan 3, 2024
@neonichu neonichu deleted the run-build-commands-without-declared-outputs branch January 3, 2024 16:59
@finagolfin finagolfin mentioned this pull request Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants