Skip to content

Commit d1a9a9e

Browse files
LeFroschmai93
authored andcommitted
Remove no-op python2->python3 flags (#7901)
PiperOrigin-RevId: 807310643 Co-authored-by: Mai Hussien <[email protected]> (cherry picked from commit 9643309)
1 parent 3880ed3 commit d1a9a9e

File tree

5 files changed

+5
-60
lines changed

5 files changed

+5
-60
lines changed

aspect/BUILD

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
load("@bazel_skylib//rules:copy_file.bzl", "copy_file")
66
load(":build_defs.bzl", "aspect_files", "aspect_library")
7-
load(":flag_hack.bzl", "define_flag_hack")
87

98
licenses(["notice"])
109

@@ -42,7 +41,6 @@ aspect_files(
4241
files = [
4342
"artifacts.bzl",
4443
"fast_build_info_bundled.bzl",
45-
"flag_hack.bzl",
4644
"intellij_info_impl_bundled.bzl",
4745
"java_classpath.bzl",
4846
"make_variables.bzl",
@@ -89,15 +87,13 @@ _dev_aspect_path = package_name()
8987
# This genrule is required for the aspect to be valid in all three repositories in which it's used.
9088
# Changes:
9189
# //.../aspect/tools:tool_name -> //:tool_name_bin
92-
# //.../aspect:flag_hack -> //:flag_hack
9390
# :intellij_info_impl.bzl -> :intellij_info_impl_bundled.bzl
9491
genrule(
9592
name = "modify_tools_path",
9693
srcs = ["intellij_info.bzl"],
9794
outs = ["intellij_info_bundled.bzl"],
9895
cmd = "cat $(SRCS) >$@ && " +
9996
"sed -i -e 's,//%s/tools:\" + tool_name,tools/\" + tool_name,g' $@ && " % _dev_aspect_path +
100-
"sed -i -e 's,//%s:flag_hack,:flag_hack,g' $@ && " % _dev_aspect_path +
10197
"sed -i -e 's,:intellij_info_impl.bzl,:intellij_info_impl_bundled.bzl,g' $@",
10298
)
10399

@@ -123,11 +119,11 @@ genrule(
123119
"sed -i -e 's,:intellij_info_impl.bzl,:intellij_info_impl_bundled.bzl,g' $@",
124120
)
125121

126-
define_flag_hack()
127-
128122
aspect_library(
129123
name = "aspect_template_lib",
130124
files = [
125+
"cc_info.bzl",
126+
"cc_info.template.bzl",
131127
"code_generator_info.bzl",
132128
"code_generator_info.template.bzl",
133129
"intellij_info.template.bzl",
@@ -136,8 +132,6 @@ aspect_library(
136132
"java_info.template.bzl",
137133
"python_info.bzl",
138134
"python_info.template.bzl",
139-
"cc_info.bzl",
140-
"cc_info.template.bzl",
141135
],
142136
namespace = "aspect/template",
143137
visibility = ["//visibility:public"],

aspect/BUILD.aspect

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,8 @@
55

66
licenses(["notice"]) # Apache 2.0
77

8-
load(":flag_hack.bzl", "define_flag_hack")
9-
108
exports_files([
119
"tools/PackageParser_deploy.jar",
1210
"tools/CreateAar_deploy.jar",
1311
"tools/JarFilter_deploy.jar",
1412
])
15-
16-
define_flag_hack()

aspect/flag_hack.bzl

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

aspect/intellij_info.bzl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ semantics = struct(
8585
py = struct(
8686
get_launcher = get_py_launcher,
8787
),
88-
flag_hack_label = "//aspect:flag_hack",
8988
)
9089

9190
def _aspect_impl(target, ctx):

aspect/intellij_info_impl.bzl

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,14 @@ load(
1313
"struct_omit_none",
1414
"to_artifact_location",
1515
)
16+
load(":cc_info.bzl", "CC_USE_GET_TOOL_FOR_ACTION")
1617
load(":code_generator_info.bzl", "CODE_GENERATOR_RULE_NAMES")
17-
load(":flag_hack.bzl", "FlagHackInfo")
18-
load(":java_info.bzl", "get_java_info", "java_info_in_target", "java_info_reference", "get_provider_from_target")
18+
load(":java_info.bzl", "get_java_info", "get_provider_from_target", "java_info_in_target", "java_info_reference")
1919
load(
2020
":make_variables.bzl",
2121
"expand_make_variables",
2222
)
2323
load(":python_info.bzl", "get_py_info", "py_info_in_target")
24-
load(":cc_info.bzl", "CC_USE_GET_TOOL_FOR_ACTION")
2524

2625
IntelliJInfo = provider(
2726
doc = "Collected information about the targets visited by the aspect.",
@@ -320,14 +319,7 @@ def _get_output_mnemonic(ctx):
320319
return ctx.bin_dir.path.split("/")[1]
321320

322321
def _get_python_version(ctx):
323-
if ctx.attr._flag_hack[FlagHackInfo].incompatible_py2_outputs_are_suffixed:
324-
if _get_output_mnemonic(ctx).find("-py2-") != -1:
325-
return PY2
326-
return PY3
327-
else:
328-
if _get_output_mnemonic(ctx).find("-py3-") != -1:
329-
return PY3
330-
return PY2
322+
return PY3
331323

332324
_SRCS_VERSION_MAPPING = {
333325
"PY2": SRC_PY2,
@@ -1335,7 +1327,6 @@ def semantics_extra_deps(base, semantics, name):
13351327
def make_intellij_info_aspect(aspect_impl, semantics, **kwargs):
13361328
"""Creates the aspect given the semantics."""
13371329
tool_label = semantics.tool_label
1338-
flag_hack_label = semantics.flag_hack_label
13391330
deps = semantics_extra_deps(DEPS, semantics, "extra_deps")
13401331
runtime_deps = RUNTIME_DEPS
13411332
prerequisite_deps = semantics_extra_deps(PREREQUISITE_DEPS, semantics, "extra_prerequisites")
@@ -1351,9 +1342,6 @@ def make_intellij_info_aspect(aspect_impl, semantics, **kwargs):
13511342
default = tool_label("JarFilter_deploy.jar"),
13521343
allow_single_file = True,
13531344
),
1354-
"_flag_hack": attr.label(
1355-
default = flag_hack_label,
1356-
),
13571345
"_create_aar": attr.label(
13581346
default = tool_label("CreateAar_deploy.jar"),
13591347
allow_single_file = True,

0 commit comments

Comments
 (0)