Skip to content

Introduce new ComponentEnabledSpec, removing testEnabled/benchmarkEna… - #3542

Merged
ezyang merged 3 commits into
haskell:masterfrom
ezyang:enabled-refactor
Jul 21, 2016
Merged

ezyang merged 3 commits into
haskell:masterfrom
ezyang:enabled-refactor

Conversation

@ezyang

@ezyang ezyang commented Jul 12, 2016

Copy link
Copy Markdown
Contributor

…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
Copy Markdown
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
Copy Markdown
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

ezyang commented Jul 12, 2016

Copy link
Copy Markdown
Contributor Author

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

@ezyang

ezyang commented Jul 12, 2016

Copy link
Copy Markdown
Contributor Author

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

phadej commented Jul 12, 2016

Copy link
Copy Markdown
Collaborator

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

@ezyang

ezyang commented Jul 12, 2016

Copy link
Copy Markdown
Contributor Author

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

ezyang commented Jul 12, 2016

Copy link
Copy Markdown
Contributor Author

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

ezyang commented Jul 13, 2016

Copy link
Copy Markdown
Contributor Author

I guess this PR is blocked on #3545.

@ezyang

ezyang commented Jul 15, 2016

Copy link
Copy Markdown
Contributor Author

Unblocked!

@ezyang

ezyang commented Jul 21, 2016 •

Copy link
Copy Markdown
Contributor Author

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
23 of 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
Copy Markdown
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
Copy Markdown
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