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

Specify intra-package target (like 'cabal build COMPONENTS') #201

Closed
chreekat opened this Issue Jun 6, 2015 · 11 comments

Comments

Projects
None yet
4 participants
@chreekat
Contributor

chreekat commented Jun 6, 2015

This may fit in with the talk of building test suites somewhat independently of a project itself.

Suggest keeping stack build TARGET syntax, just making TARGET more flexible — So I can do any of

stack build .              # everything
stack build Snowdrift      # Snowdrift package
stack build exe:Snowdrift  # Snowdrift component

May be slightly ambiguous, but I doubt that would be a problem very often.

@snoyberg

This comment has been minimized.

Contributor

snoyberg commented Jun 7, 2015

Worth exploring, but we may be constrained by what Cabal allows us to do here. If anyone has experience with Cabal on this front, please speak up.

@snoyberg snoyberg added this to the Third release milestone Jun 7, 2015

@bitemyapp

This comment has been minimized.

Contributor

bitemyapp commented Jun 7, 2015

+1 if it doesn't get ornate or complicated.

I don't have a lot to contribute re: Cabal. I've gotten away with specifying specific suites/stanzas by name, cabal test, and cabal build without needing much else so far.

@snoyberg

This comment has been minimized.

Contributor

snoyberg commented Jun 8, 2015

Gah, I can't believe I never realized that you can just pass in the components to runghc Setup.hs build. OK, this should be trivial to implement. I think I'd prefer to reverse the order of your TARGET syntax to be PACKAGE:COMPONENT, which would be symmetrical with the flag syntax (which is PACKAGE:FLAG).

@chreekat

This comment has been minimized.

Contributor

chreekat commented Jun 8, 2015

Fwiw, in my example "exe:Snowdrift" is the component (not 'component:package' — just 'component'). If we tacked package on to that, it would be Snowdrift:exe:Snowdrift. That's why I hoped it wouldn't be hard to add a heuristic to figure out which package a particular component belonged to, so one could simply specify a component by itself.

Of course, Snowdrift:exe:Snowdrift would be an acceptable first pass.

@snoyberg

This comment has been minimized.

Contributor

snoyberg commented Jun 8, 2015

Is the exe necessary to disambiguate? I thought there was a requirement in cabal files that you couldn't give a test suite and executable the same name.

@chreekat

This comment has been minimized.

Contributor

chreekat commented Jun 8, 2015

In this case the choices are exe:Snowdrift and lib:Snowdrift.

@snoyberg snoyberg self-assigned this Jun 17, 2015

@snoyberg snoyberg added ready and removed ready labels Jun 17, 2015

snoyberg added a commit that referenced this issue Jun 17, 2015

@snoyberg

This comment has been minimized.

Contributor

snoyberg commented Jun 17, 2015

@chreekat This is now implemented. This does require prefixing the component name with the package name (doing otherwise would have led to ambiguities with the current syntax). This, for example, works:

stack build stack:lib:stack

Can you try it out?

@chreekat

This comment has been minimized.

Contributor

chreekat commented Jun 17, 2015

Looks good

@chreekat chreekat closed this Jun 17, 2015

@snoyberg snoyberg removed the in progress label Jun 17, 2015

@snoyberg

This comment has been minimized.

Contributor

snoyberg commented Aug 12, 2015

FYI, with the latest stack, running stack build :Snowdrift will build the component named Snowdrift, wherever it's defined in a local package.

@chreekat

This comment has been minimized.

Contributor

chreekat commented Aug 12, 2015

Great!

@RasmusWL

This comment has been minimized.

RasmusWL commented Dec 13, 2016

For reference I will point to #1406 (stack 0.1.8 lost ability to build individual executables or library) so other people will realise faster that they are not idiots, and that this feature is just not working right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment