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

Can't find module sources for *dependency* that has nonstandard location #313

Closed
bbarker opened this issue Jul 11, 2019 · 11 comments
Closed

Comments

@bbarker
Copy link
Contributor

bbarker commented Jul 11, 2019

I have a dependency (that I wrote) with the project under REPO_ROOT/app.

But when I try to use this from spago, I get:

purs compile: No files found using pattern: .spago/metajelo-web/v1.0.1/src/**/*.purs
purs compile: No files found using pattern: test/**/*.purs
Error found:
in module Metajelo.UI
at src/Metajelo/UI.purs:15:1 - 15:35 (line 15, column 1 - line 15, column 35)

  Module Metajelo.View was not found.
  Make sure the source file exists, and that it has been provided as an input to the compiler.

It notes that it is searching in .spago/metajelo-web/v1.0.1/src/**/*.purs, but should be searching under .spago/metajelo-web/v1.0.1/src/**/*.purs:

$ ls -last .spago/metajelo-web/v1.0.1/app/src/
total 8
4 drwxrwxrwx 1 brandon node 4096 Jul 11 00:59 ..
0 drwxrwxrwx 1 brandon node    0 Jul 11 00:59 Metajelo
0 drwxrwxrwx 1 brandon node    0 Jul 11 00:59 .
4 -rwxrwxrwx 1 brandon node 1405 Jul 11 00:59 Metajelo.purs

I saw that it is possible to define the source location for the builds of a current project, but shouldn't this be possible to detect for dependencies? If not, is it possible to override in some way?

@f-f
Copy link
Member

f-f commented Jul 11, 2019

@bbarker sources for dependencies are searched in the src of every package, and this is hardcoded because it's a convention in the ecosystem (I.e. also other tools make this assumption)

For more context see #288

@bbarker
Copy link
Contributor Author

bbarker commented Jul 11, 2019

Thanks, that's an interesting thread, lots to think about. Will try one of the immediate solutions for now. I'll probably try having a separate git repo for publishing, using your suggestion to pull in the code from the mono repo.

@f-f
Copy link
Member

f-f commented Jul 11, 2019

@bbarker if you have a monorepo and you are the only consumer of these packages we could introduce reading the sources key from the locally imported packages' spago.dhall (in #301)

Would this work for you?

@bbarker
Copy link
Contributor Author

bbarker commented Jul 11, 2019

Effectively I am the only consumer, though in principle there could be other consumers. Right now, I have two mono repos, and one depends on the other. They are mono repos because each repo has a test "project" in the repo as well. so each Repo is like:

REPO/app/src/...
REPO/test/src/...

I'll take a closer look at the options when I get into the office, thanks for pointing this out.

@bbarker
Copy link
Contributor Author

bbarker commented Jul 11, 2019

I'll just quickly note that my confusion came from the fact that I believed I could have bower.json, etc in the REPO/app directory and everything would be happy with regard to bower publishing.

@f-f
Copy link
Member

f-f commented Jul 11, 2019

@bbarker if you just move your sources from app/src to just src everything should work then? (i.e. you can keep the tests where they are)

@bbarker
Copy link
Contributor Author

bbarker commented Jul 11, 2019

@f-f That's a very good point! I should have thought of that, will give it a try.

@bbarker
Copy link
Contributor Author

bbarker commented Jul 11, 2019

Getting there, still fixing some things up, but one thing I noticed is that test should be moved to e.g. tests, otherwise Spago will try to build what is in there at the same time, which can be a problem if you have a Main module in both places.

@bbarker
Copy link
Contributor Author

bbarker commented Jul 11, 2019

OK, that works; summary: for these pseudo-mono-repo projects, use REPO/src and a test directory other than REPO/test; here's a commit documenting my changes, though probably only of interest to me.

Would it be useful to add this information to the README where tests are discussed with separate dev dependencies?

@bbarker bbarker closed this as completed Jul 11, 2019
@f-f
Copy link
Member

f-f commented Jul 11, 2019

@bbarker I believe then you're on an old version of Spago, in the latest you should get a sources key in the spago.dhall so you can decide which sources are included in the build

I'm also rewriting that section in #301, so if we want to add something that's the new base

@bbarker
Copy link
Contributor Author

bbarker commented Jul 11, 2019 via email

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

No branches or pull requests

2 participants