Open alblue opened 6 years ago
Why do you need to clean? I think its important to fix the issues that forces people to clean rather than promoting clean operations.
Also, adding a top level command requires an evolution proposal.
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.
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 🙂 .
Attachment: Download
Additional Detail from JIRA
| | | |------------------|-----------------| |Votes | 0 | |Component/s | Package Manager | |Labels | New Feature | |Assignee | None | |Priority | Medium | md5: 6aee4842767f1afbc8c6e5c52041ec60Issue 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