Skip to content

Commit

Permalink
fix: use imperative bazel rule names (#361)
Browse files Browse the repository at this point in the history
  • Loading branch information
miraleung authored and summer-ji-eng committed Oct 7, 2020
1 parent 95cd0f5 commit 8ba5c8e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
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
)

0 comments on commit 8ba5c8e

Please sign in to comment.