Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

Umbrella apps and location #96

Open
ghost opened this issue Jul 5, 2017 · 12 comments
Open

Umbrella apps and location #96

ghost opened this issue Jul 5, 2017 · 12 comments
Assignees
Labels

Comments

@ghost
Copy link

ghost commented Jul 5, 2017

linter-elixirc execute for my umbrella application,

filePath = ensureAbsolutePath(projectPath, reResult[3]);
 const fileEditor = findTextEditor(filePath);

But, the filePath returned is "projet/lib/example.ex" instead of "project/apps/my_app/example.ex". so linter-elixirc retunr an empty message list and I don't show my errors.

Sorry for my English, i'm french people. Thank you in advance.

@mauricerkelly
Copy link
Contributor

Thank you @ZackEyston, for this bug report. I will investigate this at the weekend. Votre Anglais ç'est bien! Merci!

@ghost
Copy link
Author

ghost commented Jul 6, 2017

@mauricerkelly Merci beaucoup 👍

@mauricerkelly
Copy link
Contributor

Hi @ZackEyston, I cannot reproduce this using a test project (https://github.com/mauricerkelly/linter-test-umbrella). The test project displays a warning in the file dryapp.ex.

screenshot of atom 09-07-2017 20-30-55

Can you download the test project and try it? Also, can you confirm the installed versions of these:

  • Atom
  • linter package
  • linter-elixirc package

Merci!

@ghost
Copy link
Author

ghost commented Jul 9, 2017

Hi @mauricerkelly, in my test :

  • I have remove ~/.atom
  • I have install linter-elixric, that recursively install linter (and linter-ui-default etc etc)

The problem, errors and warning is present in my status bar, but not in messages. (In my project)

I just did what you asked me, and it's works well. Very well. But in my umbrella project, i doesn't function. So, Would the problem come from my umbrella project (or mix) ? My mix version return :

> mix --version
Erlang/OTP 20 [erts-9.0] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:10] [hipe] [kernel-poll:false]
Mix 1.4.5

And i'm in ;

> uname -a
Linux ZackEystonHome 4.11.7-1-ARCH #1 SMP PREEMPT Sat Jun 24 09:07:09 CEST 2017 x86_64 GNU/Linux

@mauricerkelly
Copy link
Contributor

If you are using the same version of mix in both projects then I suspect it is the content of your project.

Is it a new project? What version of mix was it created with? Are you able to create a new umbrella project with your setup that has the same problem?

@ghost
Copy link
Author

ghost commented Jul 9, 2017

I have the same problem with all project I create with mix. And my current version of mix is in the precedent commenter. The only difference between yours project and my projet is "elixirc_paths" in mix.exs, that I add in my projet (it's doesn't function ...) and the version of elixir in mix.exs. My version is elixir ~> 1.4, your version is elixir ~> 1.2. I have made the change, but it's not function ...

This problem make me crazy.

If you want, I can push my prototype of umbrella in a public depo and you can try it with this ? (If you upgrade your's elixir version .. haha)

@mauricerkelly
Copy link
Contributor

Please push your prototype to a public repo and I will try it too. Also I will update my Elixir too!

Merci de votre aide. C'est très utile!

@ghost
Copy link
Author

ghost commented Jul 10, 2017

@mauricerkelly Okay, i have push my prototype in this repo, it have make a bug in Arenaria app, in lib/Arenaria.ex.

Merci à vous de votre réactivité, c'est très utile aussi 👍 (@mauricerkelly You come from North Ireland ! Great, you love great beers no ? I come from North of France, and we love great beers too, if we treat this problem, i send you a great beer from North of France !)

@mauricerkelly
Copy link
Contributor

Je l'ai reproduit avec votre repo! Je vais l'utiliser pour trouver le bug.

Oui, j'habite Irlande du Nord, et j'adore bonne bière!

@mauricerkelly
Copy link
Contributor

The bug here is down to the handling of the paths being output by the mix compile application for umbrella projects. When Mix compiles an umbrella project, it compiles each app separately, using it's own "app root". In the case of Zack's demo app this is:

== Compilation error on file lib/arenaria.ex ==
** (SyntaxError) lib/arenaria.ex:12: unexpected token: end
    (elixir) lib/kernel/parallel_compiler.ex:117: anonymous fn/4 in Kernel.ParallelCompiler.spawn_compilers/1

I need to figure out a way to associate the file lib/arenaria.ex back to the app that it is part of. In theory this is simple - just look for a file called arenaria.ex in the project tree, but this is I/O expensive, and doesn't account for multiple files with the same name in different directories.

An alternative approach could rely upon the fact that Mix outputs the name of the app before it starts to compile it. For example, in Zack's demo app, this is output as follows:

==> arenaria

This tells us the app that contains the error. For an umbrella project, the linter can create an array of child apps with their paths, and use this to create the correct path.

For example, for Zack's project, the following paths can be used:

  • project path: /Users/mkelly/Dropbox/Development/linter-testing/archimedes
  • child app path: apps/arenaria
  • error path: lib/arenaria.ex

Until I get a reliable solution in place, I recommend using the "Always use elixirc" option for umbrella projects.

@ghost
Copy link
Author

ghost commented Jul 13, 2017

@mauricerkelly Okay I just force the elixirc for umbrella with two lines of codes and you correct the bug with yours recommendations in future ! I test that today.


@mauricerkelly send me an email, yours is private, okay ? Thx a lot, you save life :)

Sent from my HUAWEI VNS-L31 using FastHub

@mauricerkelly
Copy link
Contributor

mauricerkelly commented Jul 15, 2017

This is going to be tougher than expected. I was hoping to use ==> app_name output to determine the current app being compiled, but unfortunately I have discovered that this will only work for errors, and not for warnings.

The mix output sends all compilation output to STDOUT, except for warning output which is sent to STDERR. (I'm trying to figure out if this is a bug in Mix or an intentional design). This becomes problematic because the STDERR data is appended to the end of the STDOUT data, and so warnings will be encountered out of order.

I'll keep working on this, but for now I believe that the best approach will be to force elixirc for umbrella projects in the code (regardless of whether the "force elixirc" option is set).

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

No branches or pull requests

1 participant