Skip to content

Commit 3b338d5

Browse files
Remove dependency on @bazel_tools (required for Bazel 9) (#1412)
* remove dependencies on @bazel_tools * fix formatting --------- Co-authored-by: Corbin McNeely-Smith <58151731+restingbull@users.noreply.github.com>
1 parent c90a028 commit 3b338d5

File tree

3 files changed

+117
-53
lines changed

3 files changed

+117
-53
lines changed

src/main/protobuf/BUILD

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,24 @@ load("@rules_java//java:java_library.bzl", "java_library")
44

55
package(default_visibility = ["//visibility:public"])
66

7-
alias(
7+
proto_library(
8+
name = "deps_proto",
9+
srcs = [":deps.proto"],
10+
)
11+
12+
java_proto_library(
813
name = "deps_java_proto",
9-
actual = "@bazel_tools//src/main/protobuf:deps_java_proto",
14+
deps = [":deps_proto"],
1015
)
1116

12-
alias(
17+
proto_library(
18+
name = "worker_protocol_proto",
19+
srcs = [":worker_protocol.proto"],
20+
)
21+
22+
java_proto_library(
1323
name = "worker_protocol_java_proto",
14-
actual = "@bazel_tools//src/main/protobuf:worker_protocol_java_proto",
24+
deps = [":worker_protocol_proto"],
1525
)
1626

1727
proto_library(

src/main/protobuf/deps.proto

Lines changed: 34 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2018 The Bazel Authors. All rights reserved.
1+
// Copyright 2014 The Bazel Authors. All rights reserved.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -22,45 +22,50 @@ option java_package = "com.google.devtools.build.lib.view.proto";
2222

2323
// A specific location within a source file.
2424
message SourceLocation {
25-
required string path = 1;
26-
optional int32 line = 2;
27-
optional int32 column = 3;
25+
required string path = 1;
26+
optional int32 line = 2;
27+
optional int32 column = 3;
2828
}
2929

3030
message Dependency {
3131

32-
enum Kind {
33-
// Dependency used explicitly in the source.
34-
EXPLICIT = 0;
35-
// Dependency that is implicitly loaded and used by the compiler.
36-
IMPLICIT = 1;
37-
// Unused dependency.
38-
UNUSED = 2;
39-
// Implicit dependency considered by the compiler but not completed.
40-
INCOMPLETE = 3;
41-
}
32+
enum Kind {
33+
// Dependency used explicitly in the source.
34+
EXPLICIT = 0;
35+
// Dependency that is implicitly loaded and used by the compiler.
36+
IMPLICIT = 1;
37+
// Unused dependency.
38+
UNUSED = 2;
39+
// Implicit dependency considered by the compiler but not completed.
40+
INCOMPLETE = 3;
41+
}
4242

43-
// Path to the artifact representing this dependency.
44-
required string path = 1;
43+
// Path to the artifact representing this dependency.
44+
required string path = 1;
4545

46-
// Dependency kind
47-
required Kind kind = 2;
46+
// Dependency kind
47+
required Kind kind = 2;
4848

49-
// Source file locations: compilers can pinpoint the uses of a dependency.
50-
repeated SourceLocation location = 3;
49+
// Source file locations: compilers can pinpoint the uses of a dependency.
50+
repeated SourceLocation location = 3;
5151
}
5252

5353
// Top-level message found in .deps artifacts
5454
message Dependencies {
55-
repeated Dependency dependency = 1;
55+
repeated Dependency dependency = 1;
5656

57-
// Name of the rule being analyzed.
58-
optional string rule_label = 2;
57+
// Name of the rule being analyzed.
58+
optional string rule_label = 2;
5959

60-
// Whether the action was successful; even when compilation fails, partial
61-
// dependency information can be useful.
62-
optional bool success = 3;
60+
// Whether the action was successful; even when compilation fails, partial
61+
// dependency information can be useful.
62+
optional bool success = 3;
6363

64-
// Packages contained in the output jar, sorted alphabetically.
65-
repeated string contained_package = 4;
66-
}
64+
// Packages contained in the output jar, sorted alphabetically.
65+
repeated string contained_package = 4;
66+
67+
// If the Java action was started with a reduced classpath and an error
68+
// occurred suggesting that it should be rerun with the full classpath, this
69+
// will be true.
70+
optional bool requires_reduced_classpath_fallback = 5;
71+
}
Lines changed: 69 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2018 The Bazel Authors. All rights reserved.
1+
// Copyright 2015 The Bazel Authors. All rights reserved.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -20,32 +20,81 @@ option java_package = "com.google.devtools.build.lib.worker";
2020

2121
// An input file.
2222
message Input {
23-
// The path in the file system where to read this input artifact from. This is
24-
// either a path relative to the execution root (the worker process is
25-
// launched with the working directory set to the execution root), or an
26-
// absolute path.
27-
string path = 1;
28-
29-
// A hash-value of the contents. The format of the contents is unspecified and
30-
// the digest should be treated as an opaque token.
31-
bytes digest = 2;
23+
// The path in the file system where to read this input artifact from. This is
24+
// either a path relative to the execution root (the worker process is
25+
// launched with the working directory set to the execution root), or an
26+
// absolute path.
27+
string path = 1;
28+
29+
// A hash-value of the contents. The format of the contents is unspecified and
30+
// the digest should be treated as an opaque token. This can be empty in some
31+
// cases.
32+
bytes digest = 2;
3233
}
3334

3435
// This represents a single work unit that Blaze sends to the worker.
3536
message WorkRequest {
36-
repeated string arguments = 1;
37+
repeated string arguments = 1;
38+
39+
// The inputs that the worker is allowed to read during execution of this
40+
// request.
41+
repeated Input inputs = 2;
42+
43+
// Each WorkRequest must have either a unique
44+
// request_id or request_id = 0. If request_id is 0, this WorkRequest must be
45+
// processed alone (singleplex), otherwise the worker may process multiple
46+
// WorkRequests in parallel (multiplexing). As an exception to the above, if
47+
// the cancel field is true, the request_id must be the same as a previously
48+
// sent WorkRequest. The request_id must be attached unchanged to the
49+
// corresponding WorkResponse. Only one singleplex request may be sent to a
50+
// worker at a time.
51+
int32 request_id = 3;
52+
53+
// EXPERIMENTAL: When true, this is a cancel request, indicating that a
54+
// previously sent WorkRequest with the same request_id should be cancelled.
55+
// The arguments and inputs fields must be empty and should be ignored.
56+
bool cancel = 4;
3757

38-
// The inputs that the worker is allowed to read during execution of this
39-
// request.
40-
repeated Input inputs = 2;
58+
// Values greater than 0 indicate that the worker may output extra debug
59+
// information to stderr (which will go into the worker log). Setting the
60+
// --worker_verbose flag for Bazel makes this flag default to 10.
61+
int32 verbosity = 5;
62+
63+
// The relative directory inside the workers working directory where the
64+
// inputs and outputs are placed, for sandboxing purposes. For singleplex
65+
// workers, this is unset, as they can use their working directory as sandbox.
66+
// For multiplex workers, this will be set when the
67+
// --experimental_worker_multiplex_sandbox flag is set _and_ the execution
68+
// requirements for the worker includes 'supports-multiplex-sandbox'.
69+
// The paths in `inputs` will not contain this prefix, but the actual files
70+
// will be placed/must be written relative to this directory. The worker
71+
// implementation is responsible for resolving the file paths.
72+
string sandbox_dir = 6;
4173
}
4274

43-
// The worker sends this message to Blaze when it finished its work on the WorkRequest message.
75+
// The worker sends this message to Blaze when it finished its work on the
76+
// WorkRequest message.
4477
message WorkResponse {
45-
int32 exit_code = 1;
78+
int32 exit_code = 1;
79+
80+
// Output message for this work unit.
81+
// This is akin to the combined stdout/stderr if the work unit were executed
82+
// as a standalone process. Output pertaining to a work unit should be
83+
// reported here instead of through the stdout/stderr of the worker process.
84+
// Assumed to be UTF-8 encoded.
85+
string output = 2;
86+
87+
// This field must be set to the same request_id as the WorkRequest it is a
88+
// response to. Since worker processes which support multiplex worker will
89+
// handle multiple WorkRequests in parallel, this ID will be used to
90+
// determined which WorkerProxy does this WorkResponse belong to.
91+
int32 request_id = 3;
4692

47-
// This is printed to the user after the WorkResponse has been received and is supposed to contain
48-
// compiler warnings / errors etc. - thus we'll use a string type here, which gives us UTF-8
49-
// encoding.
50-
string output = 2;
93+
// EXPERIMENTAL When true, indicates that this response was sent due to
94+
// receiving a cancel request. The exit_code and output fields should be empty
95+
// and will be ignored. Exactly one WorkResponse must be sent for each
96+
// non-cancelling WorkRequest received by the worker, but if the worker
97+
// received a cancel request, it doesn't matter if it replies with a regular
98+
// WorkResponse or with one where was_cancelled = true.
99+
bool was_cancelled = 4;
51100
}

0 commit comments

Comments
 (0)