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 experimental cc_static_library rule #16954

Closed
wants to merge 11 commits into from

Conversation

fmeum
Copy link
Collaborator

@fmeum fmeum commented Dec 7, 2022

RELNOTES: The new cc_static_library rule produces a static library that bundles given targets and all their transitive dependencies. It has to be enabled via --experimental_cc_static_library.

Implements https://docs.google.com/document/d/1jN0LUmp6_-rV9_f-Chx-Cs6t_5iOm3fziOklzBGjGIg/edit

Fixes #1920

@fmeum fmeum force-pushed the 1920-cc-static-library branch 11 times, most recently from fbcb331 to a42ff75 Compare December 8, 2022 16:57
@fmeum fmeum force-pushed the 1920-cc-static-library branch 2 times, most recently from 0f9622b to f260501 Compare April 4, 2023 13:06
@fmeum fmeum force-pushed the 1920-cc-static-library branch 5 times, most recently from 799d1e8 to dce3fe7 Compare April 26, 2023 14:53
@aminya
Copy link

aminya commented Nov 6, 2023

@fmeum I made a pull request for your fork. Could you merge fmeum#1 to this branch so that it is updated? It is behind 2114 commits.

#1920

@aminya aminya mentioned this pull request Nov 6, 2023
@aminya
Copy link

aminya commented Jan 3, 2024

@fmeum Any update on my comments?

#16954 (comment)

@Algomorph
Copy link

Algomorph commented Mar 7, 2024

@aminya and @fmeum any updates on the status / timeline for this? We (as in, my company) are considering moving off Bazel partially or completely and lack of transitive static libraries is one of the major factors in making such decisions. We need to understand our timeline and resource allocation should be and that hinges on this MR + issue thread.

@fmeum
Copy link
Collaborator Author

fmeum commented Mar 8, 2024

Sorry for the lack of response, other efforts kept needing priority over the one. I'm planning to get back to it in April.

@Algomorph If you really just want to build transitive static libraries, then you could really use any of the Starlark rules proposed on the original issue without being blocked on me. Do you have any special requirements that only my design would address?

@Algomorph
Copy link

Algomorph commented Mar 8, 2024

@fmeum thanks for getting back to me so promptly and sharing the plan. April will probably work for us. I got the general sense from reading through the thread that people are running into issues with the proposed rules, but granted, I haven't personally tried any of them yet. We will review further at our next planning session and reevaluate, perhaps even assist -- if we can allocate the resources for it.

@aminya
Copy link

aminya commented Mar 8, 2024

We (as in, my company) are considering moving off Bazel partially or completely and lack of transitive static libraries

Unfortunately, one of my dependencies uses Bazel, and I am stuck in the walled garden of Bazel without a way out. Having static libraries is the only way that allows us to build the dependency in isolation and use it in other projects without the fragile and bulky alternative of whole archive shared libraries.
RobotLocomotion/drake#16882

Do you have any special requirements that only my design would address?

I tried all the proposed rules, and only this PR seems to partially work for me except for the errors I mentioned here
#16954 (comment)

I'm planning to get back to it in April.

@fmeum
Could you at least update the branch via fmeum#1?

@fmeum
Copy link
Collaborator Author

fmeum commented Mar 8, 2024

Could you at least update the branch via fmeum#1?

@aminya Sorry, I didn't want to merge it directly due to its size and then forgot about it. I just rebased the current PR, please let me know if anything broke due to that.

@comius comius added awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally and removed awaiting-review PR is awaiting review from an assigned reviewer labels Jul 29, 2024
@fmeum
Copy link
Collaborator Author

fmeum commented Jul 29, 2024

@bazel-io fork 7.3.0

@iancha1992
Copy link
Member

@fmeum Please add docstring in src/main/starlark/tests/builtins_bzl/cc/cc_static_library/test_cc_static_library/mock_toolchain.bzl for mock_cc_toolchain

@fmeum
Copy link
Collaborator Author

fmeum commented Jul 30, 2024

@fmeum Please add docstring in src/main/starlark/tests/builtins_bzl/cc/cc_static_library/test_cc_static_library/mock_toolchain.bzl for mock_cc_toolchain

@iancha1992 Done. Despite the src/main prefix, this file is actually test code. Unless test code also requires doc strings, it could make sense to exclude src/main/starlark/tests from the linter.

@iancha1992
Copy link
Member

iancha1992 commented Jul 30, 2024

@fmeum Please add docstring in src/main/starlark/tests/builtins_bzl/cc/cc_static_library/test_cc_static_library/mock_toolchain.bzl for mock_cc_toolchain

@iancha1992 Done. Despite the src/main prefix, this file is actually test code. Unless test code also requires doc strings, it could make sense to exclude src/main/starlark/tests from the linter.

@comius WDYT? The internal CL is still blocked because of it.

@fmeum
Copy link
Collaborator Author

fmeum commented Aug 1, 2024

@comius WDYT? The internal CL is still blocked because of it.

I added a doc string, do I need to do anything else to unblock it?

@iancha1992
Copy link
Member

iancha1992 commented Aug 1, 2024

@comius WDYT? The internal CL is still blocked because of it.

I added a doc string, do I need to do anything else to unblock it?

@fmeum The function "mock_cc_toolchain" has no docstring. Looks like from line 101, the def mock_cc_toolchain(name, provide_validate_static_library = True)

@fmeum
Copy link
Collaborator Author

fmeum commented Aug 1, 2024

@comius WDYT? The internal CL is still blocked because of it.

I added a doc string, do I need to do anything else to unblock it?

@fmeum The function "mock_cc_toolchain" has no docstring. Looks like from line 101, the def mock_cc_toolchain(name, provide_validate_static_library = True)

@iancha1992 Should be fixed now, could you run the linter again?

@fmeum
Copy link
Collaborator Author

fmeum commented Aug 1, 2024

@bazel-io fork 7.4.0

@iancha1992
Copy link
Member

iancha1992 commented Aug 1, 2024

@comius WDYT? The internal CL is still blocked because of it.

I added a doc string, do I need to do anything else to unblock it?

@fmeum The function "mock_cc_toolchain" has no docstring. Looks like from line 101, the def mock_cc_toolchain(name, provide_validate_static_library = True)

@iancha1992 Should be fixed now, could you run the linter again?

I think also adding a docstring at the first statement of the file is needed. This will do. @fmeum

@fmeum
Copy link
Collaborator Author

fmeum commented Aug 1, 2024

@iancha1992 Added!

@copybara-service copybara-service bot closed this in c945740 Aug 9, 2024
@github-actions github-actions bot removed the awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally label Aug 9, 2024
@fmeum fmeum deleted the 1920-cc-static-library branch August 9, 2024 22:15
fmeum added a commit to fmeum/bazel that referenced this pull request Aug 22, 2024
RELNOTES: The new `cc_static_library` rule produces a static library that bundles given targets and all their transitive dependencies. It has to be enabled via `--experimental_cc_static_library`.

Implements https://docs.google.com/document/d/1jN0LUmp6_-rV9_f-Chx-Cs6t_5iOm3fziOklzBGjGIg/edit

Fixes bazelbuild#1920

Closes bazelbuild#16954.

PiperOrigin-RevId: 661382285
Change-Id: I972afd1a38d50ab4e48d9b3c189f1662b0096bbf
github-merge-queue bot pushed a commit that referenced this pull request Aug 26, 2024
RELNOTES: The new `cc_static_library` rule produces a static library
that bundles given targets and all their transitive dependencies. It has
to be enabled via `--experimental_cc_static_library`.

Implements
https://docs.google.com/document/d/1jN0LUmp6_-rV9_f-Chx-Cs6t_5iOm3fziOklzBGjGIg/edit

Fixes #1920

Closes #16954.

PiperOrigin-RevId: 661382285
Change-Id: I972afd1a38d50ab4e48d9b3c189f1662b0096bbf

Closes #23192
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-Rules-CPP Issues for C++ rules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rule to build a fully static library
7 participants