@@ -26,6 +26,7 @@ def _desugar(
2626 min_sdk_version = 0 ,
2727 library_desugaring = True ,
2828 desugar_exec = None ,
29+ desugared_lib_config = None ,
2930 toolchain_type = None ):
3031 """Desugars a JAR.
3132
@@ -38,6 +39,8 @@ def _desugar(
3839 min_sdk_version: Integer. The minimum targeted sdk version.
3940 library_desugaring: Boolean. Whether to enable core library desugaring.
4041 desugar_exec: File. The executable desugar file.
42+ desugared_lib_config: File. The json file containing desugarer options.
43+ toolchain_type: Label or String. The toolchain to use for running the desugar action.
4144 """
4245
4346 args = ctx .actions .args ()
@@ -50,18 +53,24 @@ def _desugar(
5053 args .add_all (classpath , before_each = "--classpath_entry" )
5154 args .add_all (bootclasspath , before_each = "--bootclasspath_entry" )
5255
56+ input_file_deps = [input ]
5357 if library_desugaring :
5458 if ctx .fragments .android .check_desugar_deps :
5559 args .add ("--emit_dependency_metadata_as_needed" )
5660
57- if ctx .fragments .android .desugar_java8_libs and library_desugaring :
61+ if ctx .fragments .android .desugar_java8_libs :
5862 args .add ("--desugar_supported_core_libs" )
63+ args .add ("--desugared_lib_config" , desugared_lib_config )
64+ if desugared_lib_config :
65+ input_file_deps .append (desugared_lib_config )
66+ else :
67+ fail ("Got NoneType for desugared_lib_config" )
5968
6069 if min_sdk_version > 0 :
6170 args .add ("--min_sdk_version" , str (min_sdk_version ))
6271
6372 ctx .actions .run (
64- inputs = depset ([ input ] + bootclasspath , transitive = [classpath ]),
73+ inputs = depset (input_file_deps + bootclasspath , transitive = [classpath ]),
6574 outputs = [output ],
6675 executable = desugar_exec ,
6776 arguments = [args ],
0 commit comments