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 bazel build for libsbp c library #1224

Merged
merged 10 commits into from
Sep 21, 2022
Merged

Add bazel build for libsbp c library #1224

merged 10 commits into from
Sep 21, 2022

Conversation

jungleraptor
Copy link
Contributor

Description

Adds support for building libsbp c library using bazel. Adds a submodules that contains common helper scritps.

@swift-nav/devinfra

API compatibility

Does this change introduce a API compatibility risk?

No API compatibility risks.

@jungleraptor jungleraptor changed the title Bazel Add Bazel Support for libsbp c library Sep 19, 2022
@jungleraptor jungleraptor changed the title Add Bazel Support for libsbp c library Add bazel build for libsbp c library Sep 19, 2022
@jungleraptor jungleraptor marked this pull request as ready for review September 19, 2022 21:56
@jungleraptor jungleraptor requested review from a team and silverjam as code owners September 19, 2022 21:56
@@ -13,4 +13,4 @@ swift_add_test(test-libsbp-cpp-legacy
swift_set_language_standards(test-libsbp-cpp-legacy)
swift_set_compile_options(test-libsbp-cpp-legacy ADD -Wno-error=array-bounds)

file(COPY sbp_data/ DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY sbp_data/ DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/c/test/legacy/cpp/sbp_data/)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Bazel copies all files into a sandbox for building and execution. Data file dependencies are declared using the data attribute and are copied into the sandbox with the same path they have relative to the project root. This makes it so that the cmake version of the tests and the bazel version of the test have the files in the same place at runtime.

WORKSPACE Show resolved Hide resolved
@@ -97,11 +96,12 @@ class SbpStdioTest : public ::testing::Test {
};

TEST_F(SbpStdioTest, ReadsSbpFiles) {
EXPECT_EQ(num_entries_in_file("gnss_data.sbp"), 3);
EXPECT_EQ(num_entries_in_file("c/test/legacy/cpp/sbp_data/gnss_data.sbp"), 3);

Choose a reason for hiding this comment

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

Please replace magic number 3 or leave a comment describing why 3 entries in the file are expected.

Comments indicating what this test seeks to validate and documentation of num_entries_in_file would also be appreciated

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm just updating the path here. I don't know the context behind the magic numbers in these tests.

}

TEST_F(SbpStdioTest, WritesToSbpFiles) {
write_to_file("gnss_data.sbp", "gnss_data_output.sbp");
write_to_file("c/test/legacy/cpp/sbp_data/gnss_data.sbp",
"gnss_data_output.sbp");
EXPECT_EQ(num_entries_in_file("gnss_data_output.sbp"), 9);
Copy link

@achubbic-snav achubbic-snav Sep 21, 2022

Choose a reason for hiding this comment

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

Ditto regarding magic numbers and documentation

Copy link

@achubbic-snav achubbic-snav left a comment

Choose a reason for hiding this comment

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

Left some comments about magic numbers and documentation

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.

4 participants