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

Build with stack on the back of building with cabal. #515

Closed
wants to merge 1 commit into from

Conversation

philderbeast
Copy link
Contributor

@philderbeast philderbeast commented Mar 18, 2022

Description

Even though building with cabal is now preferred some outside contributors might well prefer to build with stack. Now that waspc.cabal is committed to source control that is possible. I've not put back the stan, hlint or ormolu tool setup nor have I added CI for stack.

On the back of the fix for #453.

@Martinsos
Copy link
Member

@philderbeast thanks for this, I haven't thought about this option really!

Interesting, so this way they can also use Stack, due to resolver being specified (+ additional packages).

I had experience offering two different build systems in the past, on my other open source project (https://github.com/Martinsos/edlib), and I have to admit I found it to be hard to maintain. For edlib it was more important though due to CMake being so widely used. With Wasp, I would love us to avoid this situation. I do see that we don't need much to configure Stack, but still we need to make sure to update resolved, add packages, ... . And since it is not in CI, we will forget to do so and it will become broken at some point. Or, if we put it in CI, then we have to think about it every time, and that is also work that I would rather avoid.

So for now I would skip doing this, but it is good that we have an idea it can be done, so if we realize in the feature that people actually want/need this, we can reconsider it!

@Martinsos Martinsos closed this Mar 18, 2022
@philderbeast
Copy link
Contributor Author

philderbeast commented Mar 19, 2022

In case someone is searching this repo for "stack". These are the steps to get going with stack.

> stack init --resolver=lts-18.28 --omit-packages
Looking for .cabal or package.yaml files to use to init the project.
Using cabal packages:
- ./

Selected resolver: lts-18.28
*** Resolver lts-18.28 will need external packages:
    dir-traverse not found
        - waspc requires >=0.2.3 && <0.3
    path version 0.8.0 found
        - waspc requires >=0.9.2 && <0.10
    strong-path not found
        - waspc requires >=1.1.2 && <1.2

*** Omitting packages with unsatisfied dependencies
*** Could not find a working plan for any of the user packages.
Proceeding to create a config anyway.
Initialising configuration using resolver: lts-18.28
Total number of user packages considered: 1
Warning! Ignoring 1 packages due to dependency conflicts:
        - waspc.cabal

Writing configuration to file: stack.yaml
All done.
> stack build
Warning (added by new or init): Some packages were found to be incompatible with the resolver
and have been left commented out in the packages section.
You can omit this message by removing it from stack.yaml

Error parsing targets: The project contains no local packages (packages not marked with 'extra-dep')

Add waspc anyway:

# stack.yaml
  resolver: lts-18.28
- packages: []
+ packages: [.]

Build now fails.

> stack build

Error: While constructing the build plan, the following exceptions were encountered:

In the dependencies for waspc-0.4.0.0:
    dir-traverse must match ^>=0.2.3,
        but the stack configuration has no specified version  (latest matching version is 0.2.3.0)

    path-0.8.0 from stack configuration does not match >=0.9.2 && <0.10
        (latest matching version is 0.9.2)

    strong-path must match >=1.1.2 && <1.2,
        but the stack configuration has no specified version  (latest matching version is 1.1.3.0)

needed since waspc is a build target.

Some different approaches to resolving this:

  * Recommended action: try adding the following to your extra-deps in /.../wasp/waspc/stack.yaml:

- dir-traverse-0.2.3.0@sha256:adcc128f201ff95131b15ffe41365dc99c50dc3fa3a910f021521dc734013bfa,2137
- path-0.9.2@sha256:2f2a7f01737cd350b30381b619e1a862601c83f10ede4d6935f76f66e63ae0c7,3273
- strong-path-1.1.3.0@sha256:6f20e9a9fc39ec359d119bd23a402ed1869653b98224d530645a41fe0ddb9357,2247

Plan construction failed.

Follow the recommendation.

# stack.yaml
  resolver: lts-18.28
  packages: [.]
+ extra-deps:
+ - dir-traverse-0.2.3.0@sha256:adcc128f201ff95131b15ffe41365dc99c50dc3fa3a910f021521dc734013bfa,2137
+ - path-0.9.2@sha256:2f2a7f01737cd350b30381b619e1a862601c83f10ede4d6935f76f66e63ae0c7,3273
+ - strong-path-1.1.3.0@sha256:6f20e9a9fc39ec359d119bd23a402ed1869653b98224d530645a41fe0ddb9357,2247

Build now works.

@philderbeast
Copy link
Contributor Author

@Martinsos having a stack.yaml file shows which of the project's dependencies build together on stackage and which extra-deps might need special care and attention or vendoring.

@Martinsos
Copy link
Member

Thanks @philderbeast ! Ok let's see, maybe we will do it in the future, but for now better to skip it since we don't have the bandwidth. Still, good that we now have some info here in this PR regarding this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants