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

[bazel] Split gtest and gmock and become compatible with Bazel incompatible changes #2364

Closed
wants to merge 2 commits into from

Conversation

Yannic
Copy link
Contributor

@Yannic Yannic commented Aug 2, 2019

Fixes googletest for upcoming --incompatible_load_cc_rules_from_bzl (bazelbuild/bazel#8743) and --incompatible_load_python_rules_from_bzl (bazelbuild/bazel#9006).

This change also makes the build more hermetic.

@Yannic Yannic force-pushed the incompatible_bazel branch from e2aeb39 to e499987 Compare August 2, 2019 22:02
@@ -83,7 +83,7 @@
#include "gtest/gtest-message.h"
#include "gtest/internal/gtest-internal.h"
#include "gtest/internal/gtest-string.h"
#include "src/gtest-internal-inl.h"
#include "gtest-internal-inl.h"
Copy link
Contributor

Choose a reason for hiding this comment

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

How is this related to the bazel change? Please revert and just leave the bazel related changes.

@@ -48,7 +48,7 @@
#include <ostream> // NOLINT
#include <string>
#include "gtest/internal/gtest-port.h"
#include "src/gtest-internal-inl.h"
#include "gtest-internal-inl.h"
Copy link
Contributor

Choose a reason for hiding this comment

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

How is this related to the bazel change? Please revert and just leave the bazel related changes.

@@ -31,7 +31,7 @@
// The Google C++ Testing and Mocking Framework (Google Test)

#include "gtest/gtest-test-part.h"
#include "src/gtest-internal-inl.h"
#include "gtest-internal-inl.h"
Copy link
Contributor

Choose a reason for hiding this comment

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

How is this related to the bazel change? Please revert and just leave the bazel related changes.

@@ -119,7 +119,7 @@
# include <sys/types.h> // NOLINT
#endif

#include "src/gtest-internal-inl.h"
#include "gtest-internal-inl.h"
Copy link
Contributor

Choose a reason for hiding this comment

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

How is this related to the bazel change? Please revert and just leave the bazel related changes.

@@ -32,7 +32,7 @@
// Google Test work.

#include "gtest/gtest.h"
#include "googletest-param-test-test.h"
#include "test/googletest-param-test-test.h"
Copy link
Contributor

Choose a reason for hiding this comment

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

How is this related to the bazel change? Please revert and just leave the bazel related changes.

@@ -30,6 +30,6 @@
//
// This is part of the unit test for gtest_prod.h.

#include "production.h"
#include "test/production.h"
Copy link
Contributor

Choose a reason for hiding this comment

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

How is this related to the bazel change? Please revert and just leave the bazel related changes.

#include "gtest/gtest.h"
#include "test/production.h"
Copy link
Contributor

Choose a reason for hiding this comment

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

How is this related to the bazel change? Please revert and just leave the bazel related changes.

@gennadiycivil
Copy link
Contributor

@Yannic Thank you for your PR, please take a look at the comments. In general it is vastly preferred to only have 1 change in the PR

@Yannic
Copy link
Contributor Author

Yannic commented Aug 5, 2019

@gennadiycivil Thanks for your review! The changes to C++ files are necessary because the new Bazel build is more hermetic than the old one was. I.e. the old one leaked headers in src as public headers.

The C++ changes should also work with the old Bazel build. If you prefer, we can split them into a new PR and merge them first.

@gennadiycivil
Copy link
Contributor

gennadiycivil commented Aug 5, 2019

Yes please split them into a separate PR. The code structure is not that easy to change , because there are hidden transformations beween the internal code that has somewhat different structure and the OSS code here. We would have to see proof that the code the way it is has issues with new Bazel.
The preferred way would be to just make .bazel and WORKSPACE changes without changing anything else

@Yannic Yannic force-pushed the incompatible_bazel branch from 1b0d3fd to 5c22842 Compare August 6, 2019 19:28
Yannic added a commit to Yannic/googletest that referenced this pull request Aug 6, 2019
@Yannic
Copy link
Contributor Author

Yannic commented Aug 6, 2019

I split the changes to C++ files off into #2377. The Bazel tests are expectedly failing now. I verified that they'll pass with #2377 merged.

@gennadiycivil
Copy link
Contributor

We should make this work without code structure alterations.

Bazel changes
--incompatible_load_cc_rules_from_bzl (bazelbuild/bazel#8743) and --incompatible_load_python_rules_from_bzl (bazelbuild/bazel#9006).

do not require that the project code change. They only ask to load rules from a different place.

@Yannic
Copy link
Contributor Author

Yannic commented Aug 6, 2019

Okay, let's split this PR again to get a "load rules_{cc,python}" and a "split gtest and gmock" change then, ack?

@gennadiycivil
Copy link
Contributor

Okay, let's split this PR again to get a "load rules_{cc,python}" and a "split gtest and gmock" change then, ack?

I think the "load rules_{cc,python}" is definitely valuable.

The second one you would have to prove that it is indeed an improvement - a strong supporting case would have to be built.

Thank you for this!

@Yannic
Copy link
Contributor Author

Yannic commented Aug 7, 2019

I'll do some more investigations regarding the split into gtest and gmock.

Closing for now.

@Yannic Yannic closed this Aug 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants