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

Introduce new ComponentEnabledSpec, removing testEnabled/benchmarkEna… #3542

Merged
merged 3 commits into from
Jul 21, 2016

Conversation

ezyang
Copy link
Contributor

@ezyang ezyang commented Jul 12, 2016

…bled.

As per an existing TODO in the code, the use of
testEnabled/benchmarkEnabled to indicate if a component
was enabled/disabled by the user command line was an
egregious violation of abstraction. This commit removes
these two fields, instead passing along the necessary
enabling information with ComponentEnabledSpec instead.

As there were not many uses of testEnabled/benchmarkEnabled,
this was not too difficult to do.

Signed-off-by: Edward Z. Yang [email protected]

enabledTests = filter testEnabled . testSuites

-- | Perform an action on each buildable 'TestSuite' in a package.
withTest :: PackageDescription -> (TestSuite -> IO ()) -> IO ()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are this removed because we favour withTestLBI?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct. Unfortunately a backwards compatible interface is not possible because you really do need the CLBI to determine what is enabled.

@ezyang
Copy link
Contributor Author

ezyang commented Jul 12, 2016

I guess I need to push the change through cabal-install too.

@ezyang
Copy link
Contributor Author

ezyang commented Jul 12, 2016

Hmm, I just realized that if I remove 'withTest' and 'withBenchmark' then I really ought to remove 'withLib' and 'withExe'. Maybe it's better to keep them and note that there's been a change in behavior.

@phadej
Copy link
Collaborator

phadej commented Jul 12, 2016

@ezyang you could {-# DEPRECATE #-} them too, say for removal in 1.28?

@ezyang
Copy link
Contributor Author

ezyang commented Jul 12, 2016

I decided to put them back in with copious hyperlinks.

@ezyang ezyang force-pushed the enabled-refactor branch from 6595446 to d489209 Compare July 12, 2016 23:49
@ezyang
Copy link
Contributor Author

ezyang commented Jul 12, 2016

OK so I came up with a way to do Notes that get rendered by Haddock (since the info is relevant to clients). Along the way I fixed a lot of Haddock documentation. Take a look.

@ezyang
Copy link
Contributor Author

ezyang commented Jul 13, 2016

I guess this PR is blocked on #3545.

@ezyang
Copy link
Contributor Author

ezyang commented Jul 15, 2016

Unblocked!

@ezyang
Copy link
Contributor Author

ezyang commented Jul 21, 2016

Calling attention to the finalizePackageDescription BC change: it takes a new EnabledComponentSpec parameter. http://hs01.scs.stanford.edu:8910/search/?q=finalizePackageDescription There seem to be a decent number of packages using it, so I think what I will do is undo this BC-breaking change. The default behavior will be to assume tests and benchmarks are NOT enabled.

And the rest:

After fixing BC, my plan is to push this and the hack for #3545; the yak for that ticket can be shaved later.

ezyang added 3 commits July 20, 2016 23:42
See the comment in the code.  I don't like it but it's BC!

Signed-off-by: Edward Z. Yang <[email protected]>
…bled.

As per an existing TODO in the code, the use of
testEnabled/benchmarkEnabled to indicate if a component
was enabled/disabled by the user command line was an
egregious violation of abstraction.  This commit removes
these two fields, instead passing along the necessary
enabling information with ComponentEnabledSpec instead.

As there were not many uses of testEnabled/benchmarkEnabled,
this was not too difficult to do.

Signed-off-by: Edward Z. Yang <[email protected]>
Signed-off-by: Edward Z. Yang <[email protected]>
@ezyang ezyang force-pushed the enabled-refactor branch from 6cfd663 to 193f49d Compare July 21, 2016 06:51
@ezyang ezyang merged commit 313edf5 into haskell:master Jul 21, 2016
@ezyang ezyang mentioned this pull request Jul 21, 2016
38 tasks
-- | Perform an action on each buildable 'Benchmark' in a package.
-- You probably want 'withBenchLBI' if you have a 'LocalBuildInfo', see the note in
-- "Distribution.Simple.LocalBuildInfo#buildable_vs_enabled_components"
Copy link
Member

Choose a reason for hiding this comment

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

This note lives in Cabal/Distribution/Types/ComponentEnabledSpec.hs now.

Copy link
Member

Choose a reason for hiding this comment

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

Fixed in 463c9a8.

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.

3 participants