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

[BazelDeps][bugfix] Windows and shared libraries #17045

Merged
merged 7 commits into from
Sep 27, 2024

Conversation

franramirez688
Copy link
Contributor

@franramirez688 franramirez688 commented Sep 23, 2024

Changelog: Bugfix: BazelDeps did not find DLL files as Conan does not model them in the Windows platform.
Docs: omit
Close: #16691

@franramirez688 franramirez688 added this to the 2.8.0 milestone Sep 23, 2024
@franramirez688 franramirez688 force-pushed the frm/bazeldeps_findlibs_bug branch from 9b6bafd to e1ba1cc Compare September 27, 2024 10:38
@franramirez688 franramirez688 marked this pull request as ready for review September 27, 2024 10:39
(["mylibwin2"], True,
[('mylibwin2', True, '{base_folder}/bin/mylibwin2.dll', '{base_folder}/lib/mylibwin2.if.lib')]),
# Win + Mac + shared
(["mylibwin", "mylibmac"], True, [('mylibmac', True, '{base_folder}/bin/mylibmac.dylib', None),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This test did not make much sense. Removed.

('mylibwin', True, '{base_folder}/bin/mylibwin.dll',
'{base_folder}/lib/mylibwin.lib')]),
# Linux + Mac + static
(["myliblin", "mylibmac"], False, [('mylibmac', False, '{base_folder}/lib/mylibmac.a', None),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The same reason

dep = MagicMock()
dep.options.get_safe.return_value = is_shared
dep.ref.name = "my_pkg"
found_libs = _get_libs(dep, cpp_info)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This has not changed but has improved and simplified.

conan/tools/google/bazeldeps.py Outdated Show resolved Hide resolved
interface_lib_paths[lib_] = formatted_path
else:
lib_paths[lib_] = formatted_path
name, ext = file_name.split('.', maxsplit=1) # ext could be .if.lib
Copy link
Member

Choose a reason for hiding this comment

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

Dont we want name, ext = file_name.rsplit(".", 1) to get just the very last extension?

Copy link
Contributor Author

@franramirez688 franramirez688 Sep 27, 2024

Choose a reason for hiding this comment

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

Nope, I need the other one. The difference is:

# libs = ["mylib"]
# file_name = "mylib.if.lib"
name, ext = file_name.rsplit(".", 1)  # mylib.if 
name, ext = file_name.split(".", 1)  # mylib -> I want this one

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The very last extension at this point is not important. The only important thing is to check if it's a dll.

@czoido czoido merged commit 97ab818 into conan-io:develop2 Sep 27, 2024
2 checks passed
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.

[bug] generated BUILD.bazel file does not import dll when shared=True for some packages
3 participants