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

cabal new-clean #5357

Merged
merged 1 commit into from Jun 11, 2018
Merged

cabal new-clean #5357

merged 1 commit into from Jun 11, 2018

Conversation

@typedrat
Copy link
Collaborator

@typedrat typedrat commented Jun 1, 2018

I think it needs some clean-up most likely, but by my understanding of what it's supposed to do, it's at least feature complete.

Please include the following checklist in your PR:

  • Patches conform to the coding conventions.
  • Any changes that could be relevant to users have been recorded in the changelog.
  • The documentation has been updated, if necessary.
  • If the change is docs-only, [ci skip] is used to avoid triggering the build bots.

Please also shortly describe how you tested your change. Bonus points for added tests!


Fixes #2957

Copy link
Contributor

@dcoutts dcoutts left a comment

Looks ok, but I think that because we extend the install command, this will give the new-clean command a bazillion flags that are effectively unused and so unnecessary.

Have a look at the project orchestration module and see if we can get ahold of a dist dir layout without needing much more than the GlobalFlags.

( removeDirectoryRecursive )

cleanCommand :: CommandUI (ConfigFlags, ConfigExFlags, InstallFlags, HaddockFlags)
cleanCommand = Client.installCommand

This comment has been minimized.

@dcoutts

dcoutts Jun 1, 2018
Contributor

Why is it derived from the install command? Do we need so many flags?


let distDir = distDirectory (distDirLayout baseCtx)

removeDirectoryRecursive distDir

This comment has been minimized.

@dcoutts

dcoutts Jun 1, 2018
Contributor

Ahh I see, so using the ProjectOrchestration it looks like we need all this info just to establish the dist dir layout. I strongly suspect however that we could construct the dist dir layout from a whole lot less, and then we wouldn't need to take all these various sets of flags, and would not need to derive from the install command UI.

@typedrat
Copy link
Collaborator Author

@typedrat typedrat commented Jun 1, 2018

@dcoutts I know this was covered in IRC but just for others/posterity, the reason it's like that is to support removing individual targets, which requires knowing most of the build information.

@typedrat
Copy link
Collaborator Author

@typedrat typedrat commented Jun 6, 2018

Huh, was when exported from somewhere else but only in 7.10.3? I'm trying to figure out why that CI error is showing up.

@typedrat
Copy link
Collaborator Author

@typedrat typedrat commented Jun 8, 2018

Do we want to keep the wildly argumentative new-clean that allows selective cleaning (and refine that feature so it works better than it does now) or do we give up on that functionality to be able to simplify the flags it will take?

Even dropping the functionality, there are a few things that we can't get around being able to know (unless we want to only support default use): dist dir prefix and project file name. That's not that bad, though.

@typedrat
Copy link
Collaborator Author

@typedrat typedrat commented Jun 8, 2018

I like that a lot better, and personally I don't know if the trade-off in complexity is worth it. If it's going to know how to map a target into the information it needs to clean things up, it'll need to know enough to build stuff.

@typedrat typedrat dismissed dcoutts’s stale review Jun 9, 2018

Made changes in question, no longer uses the complex UI.

@typedrat
Copy link
Collaborator Author

@typedrat typedrat commented Jun 9, 2018

It is now properly documented, and unless we really want target-specific cleaning enough to add the substantial complexity increase, I believe this just needs squashing and merging.

@typedrat typedrat moved this from In Progress to Done in Have new-build become build (GSOC2018) Jun 9, 2018
@23Skidoo
Copy link
Member

@23Skidoo 23Skidoo commented Jun 10, 2018

I agree that granular clean is not required for 3.0, for which our main goal is feature parity.

Copy link
Member

@23Skidoo 23Skidoo left a comment

Code LGTM, but I'd like the documentation to explicitly list the supported flags, especially --save-config.


``cabal new-clean [FLAGS]`` cleans up the temporary files and build artifacts
stored in the ``dist-newstyle`` folder. By default, it removes the entire folder,
but it can also selectively remove the build artifacts and spare the caches within.

This comment has been minimized.

@23Skidoo

23Skidoo Jun 10, 2018
Member

I guess this is no longer true? Or does this mean --save-config? In any case, the wording is a bit vague.

This comment has been minimized.

@23Skidoo

23Skidoo Jun 10, 2018
Member

Also please document the distPref and projectFile flags here.

This comment has been minimized.

@typedrat

typedrat Jun 10, 2018
Author Collaborator

That does mean --save-config.

Those flags aren't documented for any of the other commands that take them, they're exactly the same as the ones of the same meaning taken by every other new- command so far, just replicated so I don't drag in every flag down to the municipal flag of Kansas City to get the two things I need.

@@ -1,6 +1,9 @@
-*-change-log-*-

2.4.0.0 (current development version)
* Completed the 'new-clean' command (#5357). By default it removes
the entire 'dist-newstyle' directory, but can also selectively remove

This comment has been minimized.

@23Skidoo

23Skidoo Jun 10, 2018
Member

but can also selectively remove only build artifacts.

Seems like this bit also needs updating/rewording.

cleanProjectFile (\pf flags -> flags {cleanProjectFile = pf})
(reqArg "FILE" (succeedReadE Flag) flagToList)
, option ['s'] ["save-configure"]
"Save configuration, only remove build artefacts"

This comment has been minimized.

@quasicomputational

quasicomputational Jun 10, 2018
Contributor

s/artefacts/artifacts/

}

cleanAction :: CleanFlags -> [String] -> GlobalFlags -> IO ()
cleanAction CleanFlags{..} _ _ = do

This comment has been minimized.

@quasicomputational

quasicomputational Jun 10, 2018
Contributor

Maybe fail on unexpected arguments, so that, if we want to extend new-clean, we won't be breaking any code mistakenly relying on being able to pass junk on the command line.

This comment has been minimized.

@typedrat

typedrat Jun 10, 2018
Author Collaborator

You're right, that's pretty important/basic.

@typedrat typedrat force-pushed the typedrat:new-clean branch from 2efeee5 to e931db4 Jun 11, 2018
@typedrat typedrat merged commit e5f8dc3 into haskell:master Jun 11, 2018
0 of 2 checks passed
0 of 2 checks passed
continuous-integration/appveyor/pr Waiting for AppVeyor build to complete
Details
continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
@quasicomputational
Copy link
Contributor

@quasicomputational quasicomputational commented Jun 11, 2018

Oh, changelog note? Actually I'll go ahead and write one up myself.

@typedrat typedrat changed the title [WIP!] cabal new-clean cabal new-clean Jun 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants