I have run into an issue in trying to apply a project structure I have seen in some successful projects. Similar to StaticArrays.jl and StaticArraysCore.jl, I have MyProject.jl and MyProjectCore.jl, each with their own Git repository and Project.toml. So, picture the following directory structure on the local workstation (irrelevant files omitted):
git_repos
├── MyProjectCore.jl
│ ├── Project.toml
│ └── README.md
└── MyProject.jl
├── Project.toml
├── README.md
└── test
└── runtests.jl
(It is fairly easy to mock this up using PkgTemplates.jl but hard to show the interactive input in this forum post.)
MyProject.jl has MyProjectCore.jl as a dev dependency (julia --project in MyProject.jl/, then in REPL ]dev ../MyProjectCore.jl.
This works just fine, but as I continued to build out MyProject.jl, I realized I wanted to add (for example) DataFrames.jl as a test dependency. That is, DataFrames.jl is needed to run the tests for MyProject.jl, but is not needed for MyProject.jl itself, nor for MyProjectCore.jl.
So, I created MyProject.jl/test/Project.toml by running julia --project in MyProject.jl/, then in the REPL ]activate test followed by ]add DataFrames. No problems so far.
But now, I realized that I want to access some of the methods from MyProjectCore.jl directly in the MyProject.jl tests. Before, when I didn’t have a MyProject.jl/test/Project.toml, this was easy, because I was already deving MyProjectCore.jl. Now, I need to add MyProjectCore.jl as a dev dependency of the test projects, so again, from MyProject.jl/ I run ]activate test and dev ../MyProjectCore.jl.
This is where the trouble begins: If I now reactivate the MyProject.jl project (]activate .) and attempt to ]test it, I get the infamous
ERROR: can not merge projects
error.
Is there a way to make this project and dependency structure work?