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

Add new layout() test for projects sharing common code in parent folders #11556

Merged
merged 8 commits into from Jul 12, 2022

Conversation

memsharded
Copy link
Member

@memsharded memsharded commented Jun 30, 2022

Changelog: Feature: Added a new self.folders.subproject for layout() to be able to define layouts that goes up to the parent or siblings folders, together with the self.folders.root = "..".
Docs: conan-io/docs#2662

@memsharded memsharded added this to the 1.51 milestone Jun 30, 2022
@memsharded memsharded requested a review from jcar87 June 30, 2022 12:53
Copy link
Contributor

@prince-chrismc prince-chrismc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works 🚀

The downside to the custom layout is losing the generator folder being set by cmake_layout and it's handling around the conf and multi

@memsharded memsharded mentioned this pull request Jul 6, 2022
5 tasks
@@ -14,13 +14,13 @@ def cmake_layout(conanfile, generator=None, src_folder="."):
else:
multi = False

conanfile.folders.source = src_folder
conanfile.folders.source = src_folder if not subfolder else os.path.join(subfolder, src_folder)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sub folder is above source dir? 😕 Is that from the perspective of the root folder?

Maybe "nested" or "project" not sure whats better, maybe some is enough?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the idea is that subfolder is from the "root" folder, to get you back to the subproject folder where the conanfile.py is. And then, the src_folder defines the source folder within that subproject (typically, where the CMakeLists.txt of that subproject is)

@memsharded memsharded marked this pull request as ready for review July 8, 2022 18:02
Copy link
Contributor

@lasote lasote left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think understanding why going to .. to later come back to pkg is too much. There is no way a "subfolder" argument will be interpreted and used in the correct way.

@memsharded
Copy link
Member Author

I have changed the approach, with a self.folders.subproject definition, and extended its application to other generators as well. Please re-check.

conans/model/layout.py Outdated Show resolved Hide resolved
Co-authored-by: Luis Martinez <lasote@gmail.com>
Copy link
Contributor

@prince-chrismc prince-chrismc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 subproject is a more clear name

@memsharded memsharded merged commit 3b84d99 into conan-io:develop Jul 12, 2022
@memsharded memsharded deleted the test/layout_sharing branch July 12, 2022 15:16
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

Successfully merging this pull request may close these issues.

None yet

4 participants