1313# limitations under the License.
1414"""Starlark rules for building Java projects."""
1515
16+ _MIGRATION_TAG = "__JAVA_RULES_MIGRATION_DO_NOT_USE_WILL_BREAK__"
17+
18+ def _add_tags (attrs ):
19+ if "tags" in attrs and attrs ["tags" ] != None :
20+ attrs ["tags" ] = attrs ["tags" ] + [_MIGRATION_TAG ]
21+ else :
22+ attrs ["tags" ] = [_MIGRATION_TAG ]
23+ return attrs
24+
1625def java_binary (** attrs ):
1726 """Bazel java_binary rule.
1827
@@ -21,7 +30,7 @@ def java_binary(**attrs):
2130 Args:
2231 **attrs: Rule attributes
2332 """
24- native .java_binary (** attrs )
33+ native .java_binary (** _add_tags ( attrs ) )
2534
2635def java_import (** attrs ):
2736 """Bazel java_import rule.
@@ -31,7 +40,7 @@ def java_import(**attrs):
3140 Args:
3241 **attrs: Rule attributes
3342 """
34- native .java_import (** attrs )
43+ native .java_import (** _add_tags ( attrs ) )
3544
3645def java_library (** attrs ):
3746 """Bazel java_library rule.
@@ -41,7 +50,7 @@ def java_library(**attrs):
4150 Args:
4251 **attrs: Rule attributes
4352 """
44- native .java_library (** attrs )
53+ native .java_library (** _add_tags ( attrs ) )
4554
4655def java_lite_proto_library (** attrs ):
4756 """Bazel java_lite_proto_library rule.
@@ -51,7 +60,7 @@ def java_lite_proto_library(**attrs):
5160 Args:
5261 **attrs: Rule attributes
5362 """
54- native .java_lite_proto_library (** attrs )
63+ native .java_lite_proto_library (** _add_tags ( attrs ) )
5564
5665def java_proto_library (** attrs ):
5766 """Bazel java_proto_library rule.
@@ -61,7 +70,7 @@ def java_proto_library(**attrs):
6170 Args:
6271 **attrs: Rule attributes
6372 """
64- native .java_proto_library (** attrs )
73+ native .java_proto_library (** _add_tags ( attrs ) )
6574
6675def java_test (** attrs ):
6776 """Bazel java_test rule.
@@ -71,7 +80,7 @@ def java_test(**attrs):
7180 Args:
7281 **attrs: Rule attributes
7382 """
74- native .java_test (** attrs )
83+ native .java_test (** _add_tags ( attrs ) )
7584
7685def java_package_configuration (** attrs ):
7786 """Bazel java_package_configuration rule.
@@ -81,7 +90,7 @@ def java_package_configuration(**attrs):
8190 Args:
8291 **attrs: Rule attributes
8392 """
84- native .java_package_configuration (** attrs )
93+ native .java_package_configuration (** _add_tags ( attrs ) )
8594
8695def java_plugin (** attrs ):
8796 """Bazel java_plugin rule.
@@ -91,7 +100,7 @@ def java_plugin(**attrs):
91100 Args:
92101 **attrs: Rule attributes
93102 """
94- native .java_plugin (** attrs )
103+ native .java_plugin (** _add_tags ( attrs ) )
95104
96105def java_runtime (** attrs ):
97106 """Bazel java_runtime rule.
@@ -101,7 +110,7 @@ def java_runtime(**attrs):
101110 Args:
102111 **attrs: Rule attributes
103112 """
104- native .java_runtime (** attrs )
113+ native .java_runtime (** _add_tags ( attrs ) )
105114
106115def java_toolchain (** attrs ):
107116 """Bazel java_toolchain rule.
@@ -111,4 +120,4 @@ def java_toolchain(**attrs):
111120 Args:
112121 **attrs: Rule attributes
113122 """
114- native .java_toolchain (** attrs )
123+ native .java_toolchain (** _add_tags ( attrs ) )
0 commit comments