Skip to content

move generated test code from out/ to test/gen/ #1009

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

Merged
merged 2 commits into from
May 27, 2025

Conversation

devoncarew
Copy link
Collaborator

@devoncarew devoncarew commented May 23, 2025

Some mechanical refactors to the test dirs layout:

  • don't generate two copies of the test protos (into out/ and into out/constructor_args); just generate code (using constructor_args) into out/
  • refactor the code that is testing use of constructor args from portions of two separate test files into one new test file (constructor_args_test.dart)
  • move generated test code from out/ to test/gen/

We have half as much generated code for use by the tests now, and having it in test/gen/ is maybe a little more clear that it's used by the tests than having it in out/.

Some future work might be to de-dup the protos in test/protos/google and instead reuse the ones in protos/google.

@devoncarew devoncarew requested a review from osa1 May 26, 2025 20:33
@@ -81,16 +81,7 @@ $(TEST_PROTO_LIBS): $(PLUGIN_SRC) $(TEST_PROTO_SRCS)
mkdir -p $(TEST_PROTO_DIR)

protoc\
--dart_out="disable_constructor_args:$(TEST_PROTO_DIR)"\
Copy link
Member

Choose a reason for hiding this comment

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

So we no longer disable_constror_args? Is it not necessary?

Maybe we could rely on g3 tests for this. In g3 disable_constructor_args is the default as it causes binary size bloat.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We're generating two versions of the test protos output for this one option - I'm just trying to dial things back a bit (we don't do this for other options). The disable_constructor_args option is tested in protoc_plugin/test/file_generator_test.dart and a bit in message_generator_test.dart.

Given the history in the changelog It sounds like having ctor args is the default externally, and not having them is the default internally.

@devoncarew devoncarew merged commit 86dfa6b into google:master May 27, 2025
16 checks passed
copybara-service bot pushed a commit to dart-lang/sdk that referenced this pull request Jun 2, 2025
Revisions updated by `dart tools/rev_sdk_deps.dart`.

ecosystem (https://github.com/dart-lang/ecosystem/compare/815d4ba..8cebaf0):
  8cebaf0  2025-05-28  Kevin Moore  team lints: update to latest pkg:lints (dart-lang/ecosystem#359)

protobuf (https://github.com/dart-lang/protobuf/compare/d940c8d..c69077d):
  c69077d  2025-05-30  Devon Carew  revert the change to not generate empty enum files (google/protobuf.dart#1016)
  08e7410  2025-05-29  Devon Carew  ignore unused_imports for json files (google/protobuf.dart#1013)
  efdabd7  2025-05-29  Devon Carew  update how we calculate import prefixes (google/protobuf.dart#1012)
  60dfaed  2025-05-28  Devon Carew  rev package:protoc_plugin to 22.3.0 (google/protobuf.dart#1011)
  86dfa6b  2025-05-27  Devon Carew  move generated test code from out/ to test/gen/ (google/protobuf.dart#1009)

test (https://github.com/dart-lang/test/compare/42a6d33..e2ddae9):
  e2ddae9f  2025-06-01  dependabot[bot]  Bump the github-actions group with 2 updates (dart-lang/test#2506)

tools (https://github.com/dart-lang/tools/compare/a0dda7e..04c6849):
  04c68495  2025-06-01  dependabot[bot]  Bump actions/setup-node from 3 to 4 in the github-actions group (dart-lang/tools#2106)

webdev (https://github.com/dart-lang/webdev/compare/5dbb30e..64492b2):
  64492b2d  2025-05-27  Nate Biggs  Fix e2e 'evaluate' test to use new Closure toString format. (dart-lang/webdev#2624)

webdriver (https://github.com/google/webdriver.dart/compare/f52afbf..b8f511d):
  b8f511d  2025-06-02  dependabot[bot]  Bump nanasess/setup-chromedriver (google/webdriver.dart#329)

Change-Id: If832327efab4615677528599ac51cecf4bb09fdf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432362
Reviewed-by: Konstantin Shcheglov <[email protected]>
Commit-Queue: Konstantin Shcheglov <[email protected]>
Auto-Submit: Devon Carew <[email protected]>
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.

2 participants