Skip to content

Commit 74721cc

Browse files
A Googlercopybara-github
authored andcommitted
Automated rollback of commit 5dcb28a.
PiperOrigin-RevId: 624005266 Change-Id: I91dc1f3a763727657f3cc3e7192649a515c40cc8
1 parent 5dcb28a commit 74721cc

File tree

6 files changed

+18
-45
lines changed

6 files changed

+18
-45
lines changed

launcher/extension.bzl

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def extension_to_proto(target):
3838
label = target.label.name,
3939
),
4040
class_name = info.java_class,
41-
jar = [absolute_path_struct(x) for x in info.binary],
41+
jar = [absolute_path_struct(info.binary)],
4242
)
4343
if info.text_proto != None:
4444
message["resource"] = struct(
@@ -85,20 +85,19 @@ def extension_direct_deps(target):
8585
A list of Files.
8686
"""
8787
if utp_provider.UTPExtensionInfo in target:
88-
return target[utp_provider.UTPExtensionInfo].binary
88+
return [target[utp_provider.UTPExtensionInfo].binary]
8989
return []
9090

9191
def _utp_host_plugin_impl(ctx):
92-
deploy = [x.files.to_list()[0] for x in ctx.attr.shared_jars] + [ctx.file.binary]
93-
deps = depset(direct = [ctx.file.binary], transitive = [x.files for x in ctx.attr.shared_jars])
92+
deploy = ctx.file.binary
9493
return [
9594
extension.utp_extension_info(
9695
ctx = ctx,
9796
extension_rule = "{}:{}".format(ctx.label.package, ctx.label.name),
9897
java_class = ctx.attr.class_name,
9998
binary = deploy,
10099
config_struct = struct(),
101-
files = deps,
100+
files = depset([deploy]),
102101
),
103102
]
104103

@@ -113,11 +112,6 @@ utp_host_plugin = rule(
113112
providers = [[JavaInfo]],
114113
allow_single_file = ["_deploy.jar"],
115114
),
116-
shared_jars = attr.label_list(
117-
doc = "Binary deploy jars shared by this host plugin.",
118-
providers = [[JavaInfo]],
119-
allow_files = ["_deploy.jar"],
120-
),
121115
class_name = attr.string(
122116
doc = "Class name of the host plugin.",
123117
mandatory = True,

provider/extension/providers.bzl

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
UTPExtensionInfo = provider(
1818
doc = "Unified Test Platform Extension classloading and configuration information.",
1919
fields = {
20-
"extension_rule": "(Target) The target for this extension rule.",
21-
"extension_target": "(Target) The target that configures this extension",
20+
"extension_rule": "(Label) The target for this extension rule.",
21+
"extension_target": "(Label) The target that configures this extension",
2222
"java_class": "(string) The Extension's Java class.",
23-
"binary": "([File]) The Java binaries to load the Extension from.",
23+
"binary": "(Label) The Java binary to load the Extension from.",
2424
"text_proto": "(string) The textproto representation of this config.",
2525
"proto_type": "(string or None) If specified, the type of the text_proto (protobuf package + name, not Java type name).",
2626
"files": "(depset) Data dependencies to be made available at runtime. Deprecated; use DefaultInfo instead.",
@@ -34,15 +34,13 @@ def utp_extension_info(ctx, extension_rule, java_class, binary, config_struct, f
3434
ctx: Starlark rule context.
3535
extension_rule: The target for this extension rule.
3636
java_class: The Extension's Java class.
37-
binary: (File or [File]) The Java binary to load the Extension from.
37+
binary: The Java binary to load the Extension from.
3838
config_struct: Struct representation of the configuration proto for this extension.
3939
files: (depset) Data dependencies to be made available at runtime.
4040
proto_type: (str) The type of the proto represented in config_struct (protobuf package + name, not Java type name).
4141
Returns:
4242
A UTPExtensionInfo provider containing information needed to create an extension proto.
4343
"""
44-
if type(binary) != type([]):
45-
binary = [binary]
4644
return utp_extension_info_from_textpb(
4745
ctx = ctx,
4846
extension_rule = extension_rule,
@@ -60,21 +58,20 @@ def utp_extension_info_from_textpb(ctx, extension_rule, java_class, binary, text
6058
ctx: Starlark rule context.
6159
extension_rule: The target for this extension rule.
6260
java_class: The Extension's Java class.
63-
binary: (File or [File]) The Java binary to load the Extension from.
61+
binary: The Java binary to load the Extension from.
6462
text_proto: The string representation of the configuration proto for this extension.
6563
files: (depset) Data dependencies to be made available at runtime.
6664
proto_type: (str) The type of the proto in text_proto (protobuf package + name, not Java type name).
6765
Returns:
6866
A UTPExtensionInfo provider containing information needed to create an extension proto.
6967
"""
70-
if type(binary) != type([]):
71-
binary = [binary]
68+
7269
return UTPExtensionInfo(
7370
extension_rule = extension_rule,
7471
extension_target = str(ctx.label),
7572
java_class = java_class,
7673
binary = binary,
7774
text_proto = text_proto.strip(),
7875
proto_type = proto_type,
79-
files = depset(binary, transitive = [files]),
76+
files = depset([binary], transitive = [files]),
8077
)

provider/extension/textproto.bzl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ _TEMPLATE = """label {
2222
namespace: "%s"
2323
}
2424
class_name: "%s"
25-
%s
25+
jar {
26+
path: "%s"
27+
}
2628
resource {
2729
encoding: TEXT
2830
raw: '%s'
@@ -46,7 +48,7 @@ def extension_to_textproto(ctx, extension):
4648
extension.extension_rule,
4749
extension.extension_target,
4850
extension.java_class,
49-
"\n".join(['jar {{\n path: "{}"\n}}'.format(x.short_path) for x in extension.binary]),
51+
extension.binary.short_path,
5052
extension.text_proto.replace("\n", "\\n"),
5153
)
5254
name = extension.extension_target.split(":")[-1] + "_extension.textproto"

test/launcher/BUILD

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,6 @@ java_binary(
3434
main_class = "EmptyJava",
3535
)
3636

37-
java_binary(
38-
name = "empty_shared_java_binary_deploy",
39-
main_class = "EmptySharedJava",
40-
)
41-
4237
bzl_library(
4338
name = "android_instrumentation_driver_test_bzl",
4439
srcs = ["android_instrumentation_driver_test.bzl"],

test/launcher/extension_test.bzl

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,7 @@
1616

1717
load("//launcher:extension.bzl", "extension_to_proto", "utp_host_plugin")
1818
load("//provider:provider.bzl", "utp_provider")
19-
load(
20-
"//tools/utp:constants.bzl",
21-
"JAR_PATH_EMPTY_BINARY",
22-
"JAR_PATH_EMPTY_SHARED_BINARY",
23-
"TARGET_EMPTY_BINARY",
24-
"TARGET_EMPTY_SHARED_BINARY",
25-
)
19+
load("//tools/utp:constants.bzl", "JAR_PATH_EMPTY_BINARY", "TARGET_EMPTY_BINARY")
2620
load("@bazel_skylib//lib:unittest.bzl", "asserts", "unittest")
2721

2822
def _extension_to_proto_test(ctx):
@@ -43,15 +37,10 @@ def _extension_to_proto_test(ctx):
4337
"com.google.testing.platform.plugin.android.AndroidDevicePlugin",
4438
message.class_name,
4539
)
46-
asserts.equals(
47-
env,
48-
"@@PWD@@/" + JAR_PATH_EMPTY_SHARED_BINARY,
49-
message.jar[0].path,
50-
)
5140
asserts.equals(
5241
env,
5342
"@@PWD@@/" + JAR_PATH_EMPTY_BINARY,
54-
message.jar[1].path,
43+
message.jar[0].path,
5544
)
5645
return unittest.end(env)
5746

@@ -71,7 +60,6 @@ def extension_test_suite(name):
7160
testonly = True,
7261
class_name = "com.google.testing.platform.plugin.android.AndroidDevicePlugin",
7362
binary = TARGET_EMPTY_BINARY,
74-
shared_jars = [TARGET_EMPTY_SHARED_BINARY],
7563
)
7664

7765
unittest.suite(

tools/utp/constants.bzl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,4 @@ JAR_PATH_LOCAL_ANDROID_DEVICE_PROVIDER = "../rules_jvm_external~~maven~maven/com
2020
JAR_PATH_ANDROID_INSTRUMENTATION_DRIVER="../rules_jvm_external~~maven~maven/com/google/testing/platform/android-driver-instrumentation/0.0.9-alpha01/processed_android-driver-instrumentation-0.0.9-alpha01.jar"
2121

2222
TARGET_EMPTY_BINARY = "//test/launcher:empty_java_binary_deploy.jar"
23-
JAR_PATH_EMPTY_BINARY="test/launcher/empty_java_binary_deploy.jar"
24-
25-
TARGET_EMPTY_SHARED_BINARY = "//test/launcher:empty_java_shared_binary_deploy.jar"
26-
JAR_PATH_EMPTY_SHARED_BINARY = "test/launcher/empty_java_shared_binary_deploy.jar"
23+
JAR_PATH_EMPTY_BINARY="test/launcher/empty_java_binary_deploy.jar"

0 commit comments

Comments
 (0)