Skip to content

Commit ddaf864

Browse files
hvadehracopybara-github
authored andcommitted
Automated rollback of commit befbd4f.
*** Reason for rollback *** postsubmit breakage: [] *** Original change description *** Restructure rules_java BEGIN_PUBLIC Restructure rules_java Design doc: https://docs.google.com/document/d/1L1JFgjpZ7SrBinb24DC_5nTIELeYDacikcme-YcA7xs/edit END_PUBLIC *** PiperOrigin-RevId: 605288071 Change-Id: Iab7970bff70443afd2ba41c50650800a2a37c037
1 parent befbd4f commit ddaf864

20 files changed

Lines changed: 131 additions & 450 deletions

java/BUILD

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,15 @@ licenses(["notice"])
77
filegroup(
88
name = "srcs",
99
srcs = glob(["**"]) + [
10-
"//java/modules:srcs",
1110
"//java/private:srcs",
1211
"//java/proto:srcs",
13-
"//java/toolchains:srcs",
1412
],
1513
visibility = ["//:__pkg__"],
1614
)
1715

1816
bzl_library(
1917
name = "rules",
20-
srcs = [
21-
"defs.bzl",
22-
"java_binary.bzl",
23-
"java_import.bzl",
24-
"java_library.bzl",
25-
"java_plugin.bzl",
26-
"java_single_jar.bzl",
27-
"java_test.bzl",
28-
],
18+
srcs = ["defs.bzl"],
2919
visibility = ["//visibility:public"],
3020
deps = ["//java/private"],
3121
)

java/defs.bzl

Lines changed: 129 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -13,43 +13,142 @@
1313
# limitations under the License.
1414
"""Starlark rules for building Java projects."""
1515

16-
load("//java:java_binary.bzl", _java_binary = "java_binary")
17-
load("//java:java_import.bzl", _java_import = "java_import")
18-
load("//java:java_library.bzl", _java_library = "java_library")
19-
load("//java:java_plugin.bzl", _java_plugin = "java_plugin")
20-
load("//java:java_test.bzl", _java_test = "java_test")
21-
load("//java/modules:java_common.bzl", _java_common = "java_common")
22-
load("//java/modules:java_info.bzl", _JavaInfo = "JavaInfo")
23-
load("//java/modules:java_plugin_info.bzl", _JavaPluginInfo = "JavaPluginInfo")
24-
load("//java/proto:java_lite_proto_library.bzl", _java_lite_proto_library = "java_lite_proto_library")
25-
load("//java/proto:java_proto_library.bzl", _java_proto_library = "java_proto_library")
26-
load("//java/toolchains:java_package_configuration.bzl", _java_package_configuration = "java_package_configuration")
27-
load("//java/toolchains:java_runtime.bzl", _java_runtime = "java_runtime")
28-
load("//java/toolchains:java_toolchain.bzl", _java_toolchain = "java_toolchain")
16+
load("//java/private:native.bzl", "NativeJavaInfo", "NativeJavaPluginInfo", "native_java_common")
2917

18+
# Do not touch: This line marks the end of loads; needed for PR importing.
19+
20+
_MIGRATION_TAG = "__JAVA_RULES_MIGRATION_DO_NOT_USE_WILL_BREAK__"
3021
version = "7.4.0"
3122

32-
# Language rules
23+
def _add_tags(attrs):
24+
if "tags" in attrs and attrs["tags"] != None:
25+
attrs["tags"] = attrs["tags"] + [_MIGRATION_TAG]
26+
else:
27+
attrs["tags"] = [_MIGRATION_TAG]
28+
return attrs
29+
30+
def java_binary(**attrs):
31+
"""Bazel java_binary rule.
32+
33+
https://docs.bazel.build/versions/master/be/java.html#java_binary
34+
35+
Args:
36+
**attrs: Rule attributes
37+
"""
38+
39+
# buildifier: disable=native-java
40+
native.java_binary(**_add_tags(attrs))
41+
42+
def java_import(**attrs):
43+
"""Bazel java_import rule.
44+
45+
https://docs.bazel.build/versions/master/be/java.html#java_import
46+
47+
Args:
48+
**attrs: Rule attributes
49+
"""
50+
51+
# buildifier: disable=native-java
52+
native.java_import(**_add_tags(attrs))
53+
54+
def java_library(**attrs):
55+
"""Bazel java_library rule.
56+
57+
https://docs.bazel.build/versions/master/be/java.html#java_library
58+
59+
Args:
60+
**attrs: Rule attributes
61+
"""
62+
63+
# buildifier: disable=native-java
64+
native.java_library(**_add_tags(attrs))
65+
66+
def java_lite_proto_library(**attrs):
67+
"""Bazel java_lite_proto_library rule.
68+
69+
https://docs.bazel.build/versions/master/be/java.html#java_lite_proto_library
70+
71+
Args:
72+
**attrs: Rule attributes
73+
"""
74+
75+
# buildifier: disable=native-java
76+
native.java_lite_proto_library(**_add_tags(attrs))
77+
78+
def java_proto_library(**attrs):
79+
"""Bazel java_proto_library rule.
80+
81+
https://docs.bazel.build/versions/master/be/java.html#java_proto_library
82+
83+
Args:
84+
**attrs: Rule attributes
85+
"""
86+
87+
# buildifier: disable=native-java
88+
native.java_proto_library(**_add_tags(attrs))
89+
90+
def java_test(**attrs):
91+
"""Bazel java_test rule.
92+
93+
https://docs.bazel.build/versions/master/be/java.html#java_test
94+
95+
Args:
96+
**attrs: Rule attributes
97+
"""
98+
99+
# buildifier: disable=native-java
100+
native.java_test(**_add_tags(attrs))
101+
102+
def java_package_configuration(**attrs):
103+
"""Bazel java_package_configuration rule.
104+
105+
https://docs.bazel.build/versions/master/be/java.html#java_package_configuration
106+
107+
Args:
108+
**attrs: Rule attributes
109+
"""
110+
111+
# buildifier: disable=native-java
112+
native.java_package_configuration(**_add_tags(attrs))
113+
114+
def java_plugin(**attrs):
115+
"""Bazel java_plugin rule.
116+
117+
https://docs.bazel.build/versions/master/be/java.html#java_plugin
118+
119+
Args:
120+
**attrs: Rule attributes
121+
"""
122+
123+
# buildifier: disable=native-java
124+
native.java_plugin(**_add_tags(attrs))
125+
126+
def java_runtime(**attrs):
127+
"""Bazel java_runtime rule.
128+
129+
https://docs.bazel.build/versions/master/be/java.html#java_runtime
130+
131+
Args:
132+
**attrs: Rule attributes
133+
"""
134+
135+
# buildifier: disable=native-java
136+
native.java_runtime(**_add_tags(attrs))
33137

34-
java_binary = _java_binary
35-
java_test = _java_test
36-
java_library = _java_library
37-
java_plugin = _java_plugin
38-
java_import = _java_import
138+
def java_toolchain(**attrs):
139+
"""Bazel java_toolchain rule.
39140
40-
# Toolchain rules
141+
https://docs.bazel.build/versions/master/be/java.html#java_toolchain
41142
42-
java_runtime = _java_runtime
43-
java_toolchain = _java_toolchain
44-
java_package_configuration = _java_package_configuration
143+
Args:
144+
**attrs: Rule attributes
145+
"""
45146

46-
# Proto rules
147+
# buildifier: disable=native-java
148+
native.java_toolchain(**_add_tags(attrs))
47149

48-
java_proto_library = _java_proto_library
49-
java_lite_proto_library = _java_lite_proto_library
150+
java_common = native_java_common
50151

51-
# Modules and providers
152+
JavaInfo = NativeJavaInfo
52153

53-
JavaInfo = _JavaInfo
54-
JavaPluginInfo = _JavaPluginInfo
55-
java_common = _java_common
154+
JavaPluginInfo = NativeJavaPluginInfo

java/java_binary.bzl

Lines changed: 0 additions & 30 deletions
This file was deleted.

java/java_import.bzl

Lines changed: 0 additions & 28 deletions
This file was deleted.

java/java_library.bzl

Lines changed: 0 additions & 30 deletions
This file was deleted.

java/java_plugin.bzl

Lines changed: 0 additions & 28 deletions
This file was deleted.

java/java_test.bzl

Lines changed: 0 additions & 30 deletions
This file was deleted.

java/modules/BUILD

Lines changed: 0 additions & 18 deletions
This file was deleted.

java/modules/java_common.bzl

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)