Skip to content
This repository has been archived by the owner on Dec 31, 2019. It is now read-only.

Peering over cabal's shoulder into dist-newstyle. #10

Closed
philderbeast opened this issue Sep 20, 2018 · 7 comments
Closed

Peering over cabal's shoulder into dist-newstyle. #10

philderbeast opened this issue Sep 20, 2018 · 7 comments

Comments

@philderbeast
Copy link
Contributor

The tutorial as it stands builds with bazel. If I make it also build with stack and cabal then bazel is seen to peer over cabal's shoulder into dist-newstyle/** and not like what it sees there. No errors are reported about stuff in .stack-work/**;

tutorial> bazel build //...
ERROR: /.../rules_haskell_examples/tutorial/dist-newstyle/build/x86_64-osx/ghc-8.2.2
/tutorial-1.0.0/cache/BUILD:1:1: invalid character: ''
...
ERROR: /.../rules_haskell_examples/tutorial/dist-newstyle/build/x86_64-osx/ghc-8.2.2
/tutorial-1.0.0/cache/BUILD:5:1: name 'lib' is not defined
ERROR: error loading package 'dist-newstyle/build/x86_64-osx/ghc-8.2.2
/tutorial-1.0.0/cache': Package 'dist-newstyle/build/x86_64-osx/ghc-8.2.2
/tutorial-1.0.0/cache' contains errors
INFO: Elapsed time: 0.307s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (1 packages loaded)
philderbeast added a commit to philderbeast/rules_haskell_examples that referenced this issue Sep 20, 2018
@philderbeast
Copy link
Contributor Author

I have a repo with the reproduction on branch repro/dist-newstyle-10.

tutorial> stack install cabal-install
Copying from /.../.stack/snapshots/x86_64-osx/lts-11.22/8.2.2/bin/cabal to
/Users/pdejoux/dev/src/haskell/rules_haskell_examples/tutorial/__build/cabal

Copied executables to /.../rules_haskell_examples/tutorial/__build:
- cabal
tutorial> stack build
tutorial> __build/cabal new-build all
tutorial> bazel build //...
...
FAILED: Build did NOT complete successfully (1 packages loaded)

@philderbeast
Copy link
Contributor Author

If I rename dist-newstyle to .dist-newstyle the errors are still reported.

@mboes
Copy link
Member

mboes commented Sep 26, 2018

Could this be because of GHC environment files? Cabal generates them by default and GHC picks them up by default. The Cabal maintainers have been asked to stop this but they're adamant. See haskell/cabal#4542

@guibou
Copy link

guibou commented Sep 26, 2018

I think that it is due to the BUILD file inside the dist-newstyle. Bazel recursively go into subdirectories and check for BUILD files.

Does it solve the problem to add a .bazelignore file on top of the directory which contains dist-newstyle? You may need bazel 0.17.1 because that's a new feature.

@philderbeast
Copy link
Contributor Author

@guibou the problem does seem to lie with those BUILD files.

tutorial> bazel build //...
ERROR: /.../dist-newstyle/build/x86_64-osx/ghc-8.2.2/tutorial-1.0.0/cache/BUILD:1:1: invalid character: ''
ERROR: /.../dist-newstyle/build/x86_64-osx/ghc-8.2.2/tutorial-1.0.0/cache/BUILD:1:2: invalid character: ''
...
ERROR: /.../dist-newstyle/build/x86_64-osx/ghc-8.2.2/tutorial-1.0.0/cache/BUILD:4:1: name 'lib' is not defined
ERROR: /.../dist-newstyle/build/x86_64-osx/ghc-8.2.2/tutorial-1.0.0/cache/BUILD:5:1: name 'lib' is not defined
ERROR: error loading package 'dist-newstyle/build/x86_64-osx/ghc-8.2.2/tutorial-1.0.0/cache': 
Package 'dist-newstyle/build/x86_64-osx/ghc-8.2.2/tutorial-1.0.0/cache' contains errors
INFO: Elapsed time: 0.191s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (1 packages loaded)

philderbeast added a commit to philderbeast/rules_haskell_examples that referenced this issue Oct 2, 2018
@philderbeast
Copy link
Contributor Author

I've added the .bazelignore but am now hitting #11 when building with bazel 0.17.2.

@guibou
Copy link

guibou commented Oct 3, 2018

Thank you for theses reports, they are extremely valuable.

I'm closing this bug as resolved because that is not a rules_haskell issue (i.e.: presence of a cabal artefact) and bazel provides a solution in 0.17.2. Discussion will continue on #11 about the too small archive.

@guibou guibou closed this as completed Oct 3, 2018
Profpatsch pushed a commit that referenced this issue Mar 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants