@@ -254,44 +254,28 @@ def _compile_or_empty(
254254        )
255255
256256def  _build_nosrc_jar (ctx ):
257-     resources  =  _add_resources_cmd (ctx )
258-     ijar_cmd  =  "" 
259- 
260-     # this ensures the file is not empty 
261-     resources  +=  "META-INF/MANIFEST.MF=%s\n "  %  ctx .outputs .manifest .path 
262- 
263-     zipper_arg_path  =  ctx .actions .declare_file ("%s_zipper_args"  %  ctx .label .name )
264-     ctx .actions .write (zipper_arg_path , resources )
265-     cmd  =  """ 
266- set -o errexit 
267- set -o nounset 
268- set -o pipefail 
269- rm -f {jar_output} 
270- {zipper} c {jar_output} @{path} 
271- # ensures that empty src targets still emit a statsfile and a diagnosticsfile 
272- touch {statsfile} 
273- touch {diagnosticsfile} 
274- """  +  ijar_cmd 
275- 
276-     cmd  =  cmd .format (
277-         path  =  zipper_arg_path .path ,
278-         jar_output  =  ctx .outputs .jar .path ,
279-         zipper  =  ctx .executable ._zipper .path ,
280-         statsfile  =  ctx .outputs .statsfile .path ,
281-         diagnosticsfile  =  ctx .outputs .diagnosticsfile .path ,
257+     resources  =  [s  +  ":"  +  t  for  t , s  in  _resource_paths (ctx .files .resources , ctx .attr .resource_strip_prefix )]
258+ 
259+     args  =  ctx .actions .args ()
260+     args .set_param_file_format ("multiline" )
261+     args .use_param_file ("@%s" )
262+     args .add ("--compression" )
263+     args .add ("--normalize" )
264+     args .add ("--exclude_build_data" )
265+     args .add ("--warn_duplicate_resources" )
266+     args .add ("--output" , ctx .outputs .jar )
267+     args .add_all ("--resources" , resources )
268+ 
269+     ctx .actions .run (
270+         inputs  =  ctx .files .resources ,
271+         outputs  =  [ctx .outputs .jar ],
272+         executable  =  ctx .executable ._singlejar ,
273+         progress_message  =  "scalac %s"  %  ctx .label ,
274+         arguments  =  [args ],
282275    )
283276
284-     outs  =  [ctx .outputs .jar , ctx .outputs .statsfile , ctx .outputs .diagnosticsfile ]
285-     inputs  =  ctx .files .resources  +  [ctx .outputs .manifest ]
286- 
287-     ctx .actions .run_shell (
288-         inputs  =  inputs ,
289-         tools  =  [ctx .executable ._zipper , zipper_arg_path ],
290-         outputs  =  outs ,
291-         command  =  cmd ,
292-         progress_message  =  "scala %s"  %  ctx .label ,
293-         arguments  =  [],
294-     )
277+     ctx .actions .write (ctx .outputs .statsfile , "" )
278+     ctx .actions .write (ctx .outputs .diagnosticsfile , "" )
295279
296280def  _create_scala_compilation_provider (ctx , ijar , source_jar , deps_providers ):
297281    exports  =  []
@@ -378,11 +362,6 @@ def _try_to_compile_java_jar(
378362        java_compilation_provider  =  provider ,
379363    )
380364
381- def  _add_resources_cmd (ctx ):
382-     paths  =  _resource_paths (ctx .files .resources , ctx .attr .resource_strip_prefix )
383-     lines  =  ["{target}={source}\n " .format (target  =  p [0 ], source  =  p [1 ]) for  p  in  paths ]
384-     return  "" .join (lines )
385- 
386365def  _collect_java_providers_of (deps ):
387366    providers  =  []
388367    for  dep  in  deps :
0 commit comments