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

[SR-7596] Add new alias 'swift clean' that means 'swift package clean' #4819

Open
alblue opened this issue May 3, 2018 · 4 comments
Open

Comments

@alblue
Copy link
Contributor

alblue commented May 3, 2018

Previous ID SR-7596
Radar None
Original Reporter @alblue
Type New Feature

Attachment: Download

Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels New Feature
Assignee None
Priority Medium

md5: 6aee4842767f1afbc8c6e5c52041ec60

Issue Description:

I have a custom bash script, called swift-clean, which just runs 'swift package clean'. It means that at the command line, I can do:

$ swift clean

in the same way that we do

$ swift build
$ swift test
$ swift run

Having a short cut would increase the utility of the functionality

@ankitspd
Copy link
Member

ankitspd commented May 3, 2018

Why do you need to clean? I think its important to fix the issues that forces people to clean rather than promoting clean operations.

@ankitspd
Copy link
Member

ankitspd commented May 3, 2018

Also, adding a top level command requires an evolution proposal.

@alblue
Copy link
Contributor Author

alblue commented May 3, 2018

At the moment, it's easier to do rm -rf .build, but this blows away the checkouts and caches. It would be fat better to run swift [package] clean, but that's more characters at the moment.

Also, if you consider the scope of other tools 'make clean; make test', 'go test', 'go clean', 'mvn clean', 'mvn compile' they all have a clean command. Even git has a clean command for removing detritus.

I don't think you need to try and justify it because 'you shouldn't need cleaning'. Every build system has it, and swift package manager surfaces it through swift package clean, so it should be a top level command like 'swift test', 'swift run' etc.

@ankitspd
Copy link
Member

ankitspd commented May 4, 2018

I am not sure if I agree with the philosophy of copying things from other build systems just because they have it. IMO the build system should be smart enough to take care of cleaning when required. Currently, cleaning is sometimes required for SwiftPM packages but those are open bugs. Two concrete examples:

  • If you remove a target, its intermediate files will be not be removed from the build directory. This is mostly fine but takes up disk space.

  • If you switch from generated modulemap to hand written modulemap, SwiftPM will not remove the generated modulemap. This is actively harmful because it leads to a build error!

LLBuild has a feature called "stale-file removal" which can solve the above two issues. I think we should try to understand why people are performing clean operations and try to solve those problems.

If you really think `swift clean` should be a top level command, please open a thread on Swift forums 🙂 .

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants