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

Fatal recursive dependency on local project #2198

Closed
rjraya opened this issue Nov 10, 2020 · 8 comments
Closed

Fatal recursive dependency on local project #2198

rjraya opened this issue Nov 10, 2020 · 8 comments

Comments

@rjraya
Copy link

rjraya commented Nov 10, 2020

General context

I'm working on a project called Stainless which builds on another project called Inox. I want to be able to navigate to definitions by doing control + click on a keyword. I would like to edit Inox code after navigating to it through the Stainless code. Originally, my build.sbt file used an online version of Inox and not the local copy. So I could navigate to Inox definitions, but any changes on their code were erased after closing the files. Now I'm using another build.sbt file that will use the local copy of Inox placed in the ../ directory relative to the Stainless directory of my machine. However, the following bug is encountered:

Bug description

After loading Stainless on VSCode, I get the following error on the right lower part of the screen:

Fatal recursive dependency detected in 'root-test': List(root-test, stainless-core-test,root-test)

Source: Scala (Metals) (Extension)

To Reproduce

Steps to reproduce the behavior:

  1. Clone Inox and Stainless. Place them on the same folder. On Stainless, checkout the tracked branch master-with-local-inox.
  2. Optionally, in the Stainless folder, run sbt clean and sbt universal:stage to compile the program. Open VSCode. If needed delete the .bloop file.
  3. Import the sbt file when required by VSCode.
  4. See error at the right lower part of the screen.

Expected behavior

The error itself does not prevent me from writing code in VSCode but it seems to interfere with Metals functionality. I can no longer navigate to definitions. In particular, to Inox definitions.

Screenshots

Installation:

  • Operating system: Linux
  • Editor: Visual Studio Code
  • Metals version: v1.9.5

Additional context

This is related to #768 and #1049. However, there the problem occurred while working with a dependency to be found online.

Search terms

@rjraya
Copy link
Author

rjraya commented Nov 10, 2020

After renaming root to stainlessroot and inoxroot in the corresponding files. The error disappears. However, I cannot navigate to many definitions both in Inox and Stainless. Including definitions I could navigate previously in Stainless.

@tgodzik
Copy link
Contributor

tgodzik commented Nov 11, 2020

Thanks for reporting! The issue is probably connected to the identically named modules, Bloop doesn't allow for that unfortunately and I doubt we will change it anytime soon.

With the changed names this should work though. I will need to try to reproduce your issue.

@tgodzik
Copy link
Contributor

tgodzik commented Nov 11, 2020

I checked out the repositories and it seems inox is not being found and compiled by Bloop. This is most likely connected to scalacenter/bloop#1002.

The alternative would be to checkout inox as a submodule or use sbt BSP, which has been recently introduced. More info here: https://scalameta.org/metals/blog/2020/11/06/sbt-BSP-support.html

@tgodzik
Copy link
Contributor

tgodzik commented Nov 12, 2020

I am closing this as it's not possible to fix in the current Bloop plugin, the alternative is sbt BSP, which should work without problems.

@tgodzik tgodzik closed this as completed Nov 12, 2020
@mbovel
Copy link

mbovel commented Jan 11, 2023

I am faced with the same issue today.

As @rjraya mentioned, renaming the respective parent and child projects so that they are not both called root solve the “Fatal recursive dependency” error.

Then, using the Bloop server, code navigation doesn't work at all.

Using the SBT sever, code navigation works only in the parent project, but not in child projects. That is, importing scala-smtlib from inox with `lazy val smtlib = RootProject(file("../scala-smtlib")), Metals Doctor shows:

image

@tgodzik
Copy link
Contributor

tgodzik commented Jan 11, 2023

Looks like the issue is that we are unable to add the metals.sbt plugin file to the other project. Maybe you can copy it over to ../scala-smtlib project dir?

@mbovel
Copy link

mbovel commented Jan 11, 2023

Looks like the issue is that we are unable to add the metals.sbt plugin file to the other project. Maybe you can copy it over to ../scala-smtlib project dir?

Youhou, indeed, that works! Thanks! 😄

@mbovel
Copy link

mbovel commented Jan 11, 2023

For the record, this is what I did:

  1. Clone inox and stainless in the same dir,
  2. Rename root SBT projects so that they are not all named root,
  3. Setup inox dependency in stainless to use the local repo: uncomment RootProject(file("../inox")) in stainless/build.sbt.
  4. Open both projects (first inox and then stainless) with VSCode, set build server to SBT and ”Import Build“.

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

3 participants