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

[ggj][bazel][goldens] fix: use imperative rule names #361

Merged
merged 2 commits into from
Oct 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ java_binary(
# JUnit runner binary, this is used to generate test output for updating goldens files.
# Run `bazel run testTarget_update` will trigger this runner.
java_binary(
name = "junit_runner",
name = "golden_update_junit_runner",
srcs = [
"//src/test/java/com/google/api/generator/gapic/dummy:dummy_files",
"//src/test/java/com/google/api/generator/engine:engine_files",
Expand All @@ -62,7 +62,7 @@ java_binary(
"//src/test/java/com/google/api/generator/gapic/composer/goldens:goldens_files",
"//src/test/java/com/google/api/generator/gapic/testdata:gapic_config_files",
"//src/test/java/com/google/api/generator/gapic/testdata:service_config_files",
],
],
jvm_flags = ["-Xmx512m"],
main_class = "com.google.api.generator.test.framework.SingleJUnitTestRunner",
visibility = ["//visibility:public"],
Expand Down
10 changes: 5 additions & 5 deletions rules_bazel/java/java_diff_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ junit_output_zip = rule(
implementation = _junit_output_impl,
)

def _overwritten_golden_impl(ctx):
def _overwrite_golden_impl(ctx):
script_content = """
#!/bin/bash
cd ${{BUILD_WORKSPACE_DIRECTORY}}
Expand All @@ -60,7 +60,7 @@ def _overwritten_golden_impl(ctx):
return [DefaultInfo(executable = ctx.outputs.bin)]


overwritten_golden = rule(
overwrite_golden = rule(
attrs = {
"unit_test_results": attr.label(
mandatory = True,
Expand All @@ -70,18 +70,18 @@ overwritten_golden = rule(
"bin": "%{name}.sh",
},
executable = True,
implementation = _overwritten_golden_impl,
implementation = _overwrite_golden_impl,
)

def golden_update(name, test_class_name, srcs):
junit_output_name = "%s_output" % name
junit_output_zip(
name = junit_output_name,
test_class_name = test_class_name,
test_runner = "//:junit_runner",
test_runner = "//:golden_update_junit_runner",
srcs = srcs,
)
overwritten_golden(
overwrite_golden(
name = name,
unit_test_results = ":%s" % junit_output_name
)