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

[question] Shared code and workspaces #5939

Closed
1 task done
fischjo3SICKAG opened this issue Oct 18, 2019 · 7 comments
Closed
1 task done

[question] Shared code and workspaces #5939

fischjo3SICKAG opened this issue Oct 18, 2019 · 7 comments

Comments

@fischjo3SICKAG
Copy link

I have a library A that also exports some headers/cpp (mainly (google) mocks from some interfaces) files as resources for consumers. These public files are installed into resources directory after building. Consumers have to import these files into their cmake binary directory (otherwise, paths tend to get too long for cmake to handle). This worked fine, until I've tried out workspaces with A and a consumer B:

  1. 'conan workspace ...' calls install() on A and B. A has not yet been built, therefore, no shared files have been copied to resources directory. Then B tries to import() everything from A's empty resource directory.
  2. When building, B's test suite compilation fails due to missing files.

Questions:
I'm a bit reluctant to split A into two packages A and A_mocks because then number of dependencies increase by factor of two and versions can happen to mismatch (e.g., version A gets upgraded, but not the A_mock version in test-suites dependencies). But the sharing process I've described above also seems quite complex and fragile to me. Do you know any 'conanian' way to solve this more elegantly?

@Lawrencemm
Copy link

Shouldn't library A be sending those files through exports_sources?

@fischjo3SICKAG
Copy link
Author

@Lawrencemm: Thank you for your suggestion. As far as I understand it, the export sources mechanism is used to provide the source code for compiling and testing the whole package (=code + regression test code + mock code). There are also mocks that are used only package-internally (i.e., not suitable for re-use). Therefore I want package to export an additional subset of these sources (== only the re-usable mocks). If I would rely on the export sources mechanism, each client would need to sift through all sources and select the mocks.

@lasote
Copy link
Contributor

lasote commented Oct 21, 2019

Yes, for the consumers, you would need anyway to package these mocks, so the issue would remain the same. Building first A is not a possibility?

@fischjo3SICKAG
Copy link
Author

Yes, building A would definitely solve it. I've done so when I used lib A as editable. But in the context this would mean a change 'workspace install'. Currently, 'workspace install' calls 'conan install' for all packages of workspace in order of their dependency graph. If we would require dependencies to be built first, then 'workspace install' would need to call 'conan install && conan build' for all packages of workspace. You might skip conan build for root packages.

@lasote
Copy link
Contributor

lasote commented Oct 21, 2019

Yes, you are right. I tagged the issue and added to the workspace "project", the workspace feature definitely needs to improve.

@fischjo3SICKAG
Copy link
Author

Thank you. Workspaces are a good concept and my colleagues and I definitely need them.

@memsharded
Copy link
Member

#15992 is centralizing feedback and effort for Conan 2 workspaces, lets close this one and track progress there.

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

No branches or pull requests

4 participants