-
Notifications
You must be signed in to change notification settings - Fork 448
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix order of libraries in CcInfo (#623)
While there run buildifier again (Bazel folks are figuring out why it's not running reliably on the CI).
- Loading branch information
Showing
15 changed files
with
86 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
load(":interleaved_cc_info_test.bzl", "interleaved_cc_info_test_suite") | ||
|
||
############################ UNIT TESTS ############################# | ||
interleaved_cc_info_test_suite(name = "interleaved_cc_info_test_suite") |
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
72 changes: 72 additions & 0 deletions
72
test/unit/interleaved_cc_info/interleaved_cc_info_test.bzl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
"""Unittests for rust rules.""" | ||
|
||
load("@bazel_skylib//lib:unittest.bzl", "analysistest", "asserts") | ||
load("@rules_cc//cc:defs.bzl", "cc_library") | ||
load("//rust:defs.bzl", "rust_library") | ||
|
||
def _interleaving_cc_link_order_test_impl(ctx): | ||
env = analysistest.begin(ctx) | ||
tut = analysistest.target_under_test(env) | ||
cc_info = tut[CcInfo] | ||
linker_inputs = cc_info.linking_context.linker_inputs.to_list() | ||
a = linker_inputs[0] | ||
b = linker_inputs[1] | ||
c = linker_inputs[2] | ||
d = linker_inputs[3] | ||
e = linker_inputs[4] | ||
|
||
asserts.equals(env, "a", a.owner.name) | ||
asserts.equals(env, "b", b.owner.name) | ||
asserts.equals(env, "c", c.owner.name) | ||
asserts.equals(env, "d", d.owner.name) | ||
asserts.equals(env, "e", e.owner.name) | ||
|
||
return analysistest.end(env) | ||
|
||
interleaving_cc_link_order_test = analysistest.make(_interleaving_cc_link_order_test_impl) | ||
|
||
def _interleaving_link_order_test(): | ||
rust_library( | ||
name = "a", | ||
srcs = ["a.rs"], | ||
deps = [":b"], | ||
) | ||
cc_library( | ||
name = "b", | ||
srcs = ["b.cc"], | ||
deps = [":c"], | ||
) | ||
rust_library( | ||
name = "c", | ||
srcs = ["c.rs"], | ||
deps = [":d"], | ||
) | ||
cc_library( | ||
name = "d", | ||
srcs = ["d.cc"], | ||
deps = [":e"], | ||
) | ||
rust_library( | ||
name = "e", | ||
srcs = ["e.rs"], | ||
) | ||
|
||
interleaving_cc_link_order_test( | ||
name = "interleaving_cc_link_order_test", | ||
target_under_test = ":a", | ||
) | ||
|
||
def interleaved_cc_info_test_suite(name): | ||
"""Entry-point macro called from the BUILD file. | ||
Args: | ||
name: Name of the macro. | ||
""" | ||
_interleaving_link_order_test() | ||
|
||
native.test_suite( | ||
name = name, | ||
tests = [ | ||
":interleaving_cc_link_order_test", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters