@@ -208,7 +208,7 @@ accepting arbitrary Python versions.
208208 ),
209209 "_build_data_writer" : lambda : attrb .Label (
210210 default = "//python/private:build_data_writer" ,
211- executable = True ,
211+ allow_files = True ,
212212 cfg = "exec" ,
213213 ),
214214 "_debugger_flag" : lambda : attrb .Label (
@@ -1336,14 +1336,15 @@ def _get_base_runfiles_for_binary(
13361336 )
13371337
13381338def _write_build_data (ctx ):
1339+ inputs = builders .DepsetBuilder ()
13391340 if is_stamping_enabled (ctx ):
13401341 # NOTE: ctx.info_file is undocumented; see
13411342 # https://github.com/bazelbuild/bazel/issues/9363
13421343 info_file = ctx .info_file
13431344 version_file = ctx .files ._uncachable_version_file [0 ]
1344- inputs = [info_file , version_file ]
1345+ inputs .add (info_file )
1346+ inputs .add (version_file )
13451347 else :
1346- inputs = []
13471348 info_file = None
13481349 version_file = None
13491350
@@ -1377,8 +1378,19 @@ def _write_build_data(ctx):
13771378 root = ctx .bin_dir ,
13781379 )
13791380
1381+ action_args = ctx .actions .args ()
1382+ writer_file = ctx .files ._build_data_writer [0 ]
1383+ if writer_file .path .endswith (".ps1" ):
1384+ action_exe = "pwsh.exe"
1385+ action_args .add ("-File" )
1386+ action_args .add (writer_file )
1387+ inputs .add (writer_file )
1388+ else :
1389+ action_exe = ctx .attr ._build_data_writer [DefaultInfo ].files_to_run
1390+
13801391 ctx .actions .run (
1381- executable = ctx .executable ._build_data_writer ,
1392+ executable = action_exe ,
1393+ arguments = [action_args ],
13821394 env = {
13831395 # Include config mode so that binaries can detect if they're
13841396 # being used as a build tool or not, allowing for runtime optimizations.
@@ -1391,10 +1403,11 @@ def _write_build_data(ctx):
13911403 "TARGET" : str (ctx .label ),
13921404 "VERSION_FILE" : version_file .path if version_file else "" ,
13931405 },
1394- inputs = depset ( direct = inputs ),
1406+ inputs = inputs . build ( ),
13951407 outputs = [build_data ],
13961408 mnemonic = "PyWriteBuildData" ,
13971409 progress_message = "Reticulating %{label} build data" ,
1410+ toolchain = None ,
13981411 )
13991412 return build_data
14001413
0 commit comments