2
0
Fork 0
mirror of https://github.com/bazelbuild/rules_cc synced 2024-11-28 21:34:00 +00:00
Commit graph

211 commits

Author SHA1 Message Date
Googler a2060ec7c9 C++: Remove linked_statically_by from cc_shared_library
RELNOTES:none
PiperOrigin-RevId: 295131987
Change-Id: I507106a7553da61f706b64c9232e4b7ea9a180d9
2020-02-14 06:11:35 -08:00
Googler 4de26b53a6 Remove need for exported_by or linked_statically_by
For now we will restrict allowed exports to the same package. At the same time
static_deps should be used to take into account what should be linked into a
shared library.

RELNOTES:none
PiperOrigin-RevId: 294668451
Change-Id: Ia087519106983bfa9a980e471d3102ab391a53eb
2020-02-12 08:01:50 -08:00
Googler cd0fa354f6 Remove linked_statically_by attribute for test
This is in preparation to renaming linked_statically_by to exported_by. The attribute linked_statically_by became redundant in a previous CL that added the static_deps attribute and made libraries in exports be linked statically automatically.

RELNOTES:none
PiperOrigin-RevId: 293355106
Change-Id: Iac987087e2f8e280f0fcaa2b7fcf61c55542825b
2020-02-05 06:24:04 -08:00
Googler 519989d3d5 Introduces static_deps attribute to cc_shared_library.
This removes the need for linked_statically_by, although both attributes work for now. The attribute linked_statically_by will disappear from cc_library and instead we will add exported_by which will allow library authors to retain the power of deciding who exports their library.

When a library is linked statically by more than one shared library and this library was only supposed to be linked once, i.e. it contains static initializers, then Bazel will give an error.

PiperOrigin-RevId: 293319906
Change-Id: I3713511e09feffb9429d38ac3ae868498ed4afe6
2020-02-05 01:25:55 -08:00
Copybara-Service 6546ee9822 Merge pull request #54 from arturdryomov:ad/readme
PiperOrigin-RevId: 292902629
Change-Id: I96ce35f974d4a0700008124ad9b66bff6d6ff254
2020-02-03 05:52:18 -08:00
Artur Dryomov 2d1f48d061
Replace Python with Starlark. 2020-02-03 09:25:33 +03:00
Artur Dryomov 6600161826
Merge branch 'master' into ad/readme 2020-02-03 09:24:32 +03:00
Googler 9e10b8a6db Include static libraries in link order before dynamic libraries
PiperOrigin-RevId: 291984417
Change-Id: I3135a5eac0ff41e976da04e3e2691da841e4a741
2020-01-28 12:00:30 -08:00
Artur Dryomov 7849626f6e
Merge branch 'master' into ad/readme 2020-01-28 19:39:45 +03:00
Googler 8774a4decd C++: cc_shared_library tests for attribute added in unknown commit
RELNOTES:none
PiperOrigin-RevId: 291150536
Change-Id: Ic11732ffb76cc2e2c775f5952d0f9aeb5324ae36
2020-01-23 05:50:17 -08:00
Googler 0489ba308b C++: Prepare experimental_cc_shared_library for cc_library change
linked_statically_by attribute in cc_library will have a nodep label type
instead of a string type.

RELNOTES:none
PiperOrigin-RevId: 289665470
Change-Id: Ic86f3cd0fecf1ad8befb21844c0d7176dc898934
2020-01-14 09:16:25 -08:00
Googler 771ab665a9 Add user_link_flags attribute to cc_shared_library
PiperOrigin-RevId: 289444795
Change-Id: I705a315b58212c60f63e63a371e1c8dc6e00f48e
2020-01-13 08:16:27 -08:00
Googler 7e650b11fe Fix cc toolchain autodetection to not error when BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN is set.
Copies the fix from bazelbuild/bazel#10440.

PiperOrigin-RevId: 287988047
Change-Id: I7a6bf88cf13996022c43bde872ff7874b60b04fb
2020-01-03 07:17:37 -08:00
Artur Dryomov e111086ab3
Add syntax highlighting to the readme file. 2019-12-12 08:49:12 +03:00
Googler cd7e8a690c C++: Tests for cc_binary linking shared libraries
This is guarded behind the --experimental_cc_shared_library flag

PiperOrigin-RevId: 283982821
Change-Id: Ifec330c01d7b480b641f8432ce94175291e79238
2019-12-05 08:49:55 -08:00
Googler 01d4a48911 C++: Add preloaded_deps support for cc_binary
RELNOTES:none
PiperOrigin-RevId: 283748069
Change-Id: Ife31d30ddca38e0f34fa2004a1e75de5ccd696fe
2019-12-04 06:57:51 -08:00
Googler cfe68f6bc7 Fix immutable frozen set bug in defs.bzl
When adding tags to a native cc_library rule that is created through a macro we
were not properly considering the case where the tags came from a different
file and therefore were frozen. This caused an error.

RELNOTES:none
PiperOrigin-RevId: 283039855
Change-Id: Id4cb45675a08ca65196f4f7771abdd5bb0705b79
2019-11-29 04:19:02 -08:00
Googler 03ae87bea3 C++: Updates linking for cc_shared_library
Order of libraries should be topological sort when constructing depset for
LinkingContext.

Also remove condition that failed when it shouldn't with a valid combination of
libraries.

RELNOTES:none
PiperOrigin-RevId: 282943411
Change-Id: I0b727c4cdeaf484e1c4177a714542eae7f167613
2019-11-28 07:53:21 -08:00
Googler 1f87a00b38 C++: Fix @rules_cc for toolchain type in cc_shared_library
We need @rules_cc in front of the toolchain type in cc_shared_library. This is
still experimental.

More complete test suite is on the way in a separate CL I'm working on.

RELNOTES:none
PiperOrigin-RevId: 282716323
Change-Id: I797ef08f18987adef82b7c7d484e2838f4e1ba6a
2019-11-27 00:40:18 -08:00
Googler d562dc8046 CcSharedLibraryInfo propagates labels for exports now
It used to propagate TransitiveInfoCollections for exports which is not ideal.

RELNOTES:none
PiperOrigin-RevId: 281056556
Change-Id: I2ec39292aefb55369720fbbb93ee1e2f8704b8db
2019-11-18 06:33:34 -08:00
Googler c2b692b4e4 Adds integration test for cc_shared_library.
We use BUILD example added in previous CL and inspect the resulting *.so files with nm.

Also fixes implementation of shared library to work with Bazel after having flipped the legacy whole archive flag. This caused exported libraries to be dropped by the linker unless they were alwayslink.

Still more tests to come.

RELNOTES:none
PiperOrigin-RevId: 280640226
Change-Id: I34b48ce7379536352f87b703580083eb85ca67b3
2019-11-15 05:36:47 -08:00
Googler bf6a32cff5 Adds example usage of cc_shared_library
This is only tested with Bazel at head. We modify the presubmits file so that we don't use release. The reason we don't use release is because we need very recent changes to Bazel to test cc_shared_library. In the future we will also test with release.

Also in following CLs, we will inspect in integration test the *.so output from these example builds to make sure that the correct symbols are linked statically and are visible.

After that we will add Starlark unit test to check error conditions.

RELNOTES:none
PiperOrigin-RevId: 280381939
Change-Id: I5de9b364a2a3db28d99558fbfca7bea8052e5114
2019-11-14 02:03:24 -08:00
Googler 31c46f250a Explicitly export files needed by other packages
Add an explicit export statement (with the same visibility) for
files that are currently only implicitly exported and used by other
pacakges. This prepares changing the visibility of implicitly-exported
files to be package private without causing a breakage.

PiperOrigin-RevId: 280171386
Change-Id: I083a9d4f82067b4d4c94d7b554013aeb91e401cc
2019-11-13 04:27:16 -08:00
Googler 8e88d89faf C++: Checks in prototype of cc_shared_libraryA
Design doc at:
https://docs.google.com/document/d/13nolQXvXDsJ4yjWP1FRd-WscP2-rHZcR3Zb__js6mLA/edit?ts=5dc40747#

RELNOTES:none
PiperOrigin-RevId: 279939859
Change-Id: Ib68ef39e42237962c53e72f79f0389906c4e61a5
2019-11-12 05:06:44 -08:00
Googler 6cfb2fba70 Fix codebase in preparation for incompatible_use_cc_configure_from_rules_cc
We're working on removing C++ toolchain autoconfiguration logic out of Bazel,
and moving towards using rules_cc repository for it. Some bzl files will no
longer be available through bazel/tools/cpp/*, but through
@rules_cc/cc/*.

RELNOTES: None.
PiperOrigin-RevId: 279935457
Change-Id: I3bae259548dacc5c6789efe0f27dd07738c1057c
2019-11-12 04:35:10 -08:00
Googler 8bd6cd75d0 Keep @rules_cc//cc:toolchain_type as fully-qualified label always
Labels in toolchains attribute need to include the repository, otherwise the resolution won't work.

RELNOTES: None.
PiperOrigin-RevId: 279347045
Change-Id: Iba1eb8bb677771e2c089ab6bc1b5e019c4da434e
2019-11-08 10:50:36 -08:00
Googler fe8f0a4cf9 Add //cc:srcs filegroup that Bazel can depend on in unittests
RELNOTES: None.
PiperOrigin-RevId: 279041716
Change-Id: I90ce28031a4f2ac737cffbe57d42030c0d1d862b
2019-11-07 02:27:13 -08:00
Copybara-Service e7c97c3af7 Merge pull request #45 from hlopko:fix_cc_configure
PiperOrigin-RevId: 278612577
Change-Id: I70ed5cfba7bc5c5ee5cb0db45e0f072a36a49cff
2019-11-05 06:40:31 -08:00
Copybara-Service 99a7a02b7b Merge pull request #46 from bazelbuild:hlopko-patch-2
PiperOrigin-RevId: 278581955
Change-Id: I2058d69e8e7c9418e5d9a773cbc056c3da1d9ec8
2019-11-05 03:22:24 -08:00
Copybara-Service 5c0675a136 Merge pull request #48 from hlopko:fix_gold
PiperOrigin-RevId: 278581858
Change-Id: Id8791b4b1405f5210cc60714ed8d77feddc800dd
2019-11-05 03:21:47 -08:00
Marcel Hlopko d978571909
Merge branch 'master' into hlopko-patch-2 2019-11-05 11:16:12 +01:00
Marcel Hlopko 1f8a00e6b8 Skip gcc build configuration options mentioning gold 2019-11-04 20:02:10 +01:00
Marcel Hlopko fbde6cceb5
Merge branch 'master' into fix_cc_configure 2019-11-04 15:47:01 +01:00
Copybara-Service 252442d133 Merge pull request #44 from bazelbuild:hlopko-patch-1
PiperOrigin-RevId: 278347427
Change-Id: Ib0f20fa111e1074dc67fbd53596e8b41a94bf8e3
2019-11-04 04:02:23 -08:00
Marcel Hlopko 0d35394cd6 Add badge for incompatible flag pipeline
https://buildkite.com/bazel/rules-cc-plus-bazelisk-migrate
2019-11-04 12:38:06 +01:00
Copybara-Service 81e8a6c100 Merge pull request #47 from hlopko:fix_typo
PiperOrigin-RevId: 278333623
Change-Id: Ifd26dbe5dc3544a1f20bcac3548b5b7a1cad2abe
2019-11-04 02:18:47 -08:00
Marcel Hlopko 4420fcb440 Fix typo 2019-11-04 09:38:06 +01:00
Marcel Hlopko 80b5b6b64b
Update renovate.json
Apparently formatting json with buildifier results in something that is not json. Who would have thought.
2019-11-03 11:40:55 +01:00
Marcel Hlopko 199157190a Use wrapped_clang for C++ link actions (port of 2682688331) 2019-11-01 17:02:17 +01:00
Marcel Hlopko 157a07b53c Fix call in WORKSPACE 2019-11-01 16:39:47 +01:00
Marcel Hlopko 4f8676f6ca Add rules_cc_toolchains to repositories.bzl
This is the new entry point for registering C++ toolchains (replacing
implicit cc_configure()).

While at it, fix one misnamed function.
2019-11-01 16:36:34 +01:00
Googler 262ebec3c2 Fix buildifier warnings in @rules_cc
Fixes:

* Enabled buildifier on the Bazel CI again
* Added Skydocs where missing
* Moved public files out of .../private/... (e.g. cc_toolchain_config_lib.bzl)
* Reformatted
* Removed unused loads
* Using relative labels for cc_configure related files
* Added development dependency on rules_proto
    * they're not in the federation yet, so hand rolling in rules_cc's WORKSPACE file
* Added development dependency on rules_python (from federation)
* Cleaned up copybara (notable change - not using @rules_cc in labels inside rules_cc repo)
* Made cc_flags_supplier usable internally
* Moved load statements to the top of the bzl file
* Moved runfiles to the tools directory
* Unified toolchain_utils.bzl and find_cc_toolchain.bzl

RELNOTES: None.
PiperOrigin-RevId: 276479521
Change-Id: I3196896061fa2ee61a3efb130c214d288782066a
2019-10-24 07:01:25 -07:00
Googler 0e66ef31d6 rules_cc: Add top-level BUILD file to distribution.
Before this commit Bazel could not use the distribution since it failed with "Every .bzl file must have a corresponding package, but '@rules_cc//:internal_deps.bzl' does not have one."

https://buildkite.com/bazel/bazel-federation-distro-pre-release-testing/builds/20#29164fc9-b0bb-41aa-b62f-e2f3f20e9efc

PiperOrigin-RevId: 275263945
Change-Id: I12216f2070ddc579f553a22975790bbc9a18f0f9
2019-10-17 08:30:50 -07:00
Copybara-Service 12a2d801f6 Merge pull request #38 from hlopko:update_gtest
PiperOrigin-RevId: 274161434
Change-Id: Ic7cc0802695afff00095d5565496f7db46fe83e4
2019-10-11 06:35:58 -07:00
Marcel Hlopko 54c783c4d9 Actually, lets depend on the release archive, not the branch 2019-10-09 15:18:06 +02:00
Marcel Hlopko 2c9c93bc07 Update googletest to 1.10.x 2019-10-09 09:49:37 +02:00
Googler a508235df9 Add missing bzl files to rules_cc distribution.
PiperOrigin-RevId: 272505874
Change-Id: I68d1b43c859db54abf3da71ce1e11d5c15567257
2019-10-02 13:25:11 -07:00
Copybara-Service f871759081 Merge pull request #35 from fweikert:distro
PiperOrigin-RevId: 272444545
Change-Id: I8d582773c5ef124ecafe77a353434887f1abc1aa
2019-10-02 08:49:43 -07:00
fweikert 182a477244 Add version number to a dedicated bzl file
Adding the version number to defs.bzl caused some problems in our internal codebase.
2019-10-02 15:25:05 +02:00
Florian Weikert eae134361b Make Buildifier happy 2019-09-30 15:58:14 +02:00