@@ -25,6 +25,7 @@ import (
2525 "os"
2626 "os/exec"
2727 "path/filepath"
28+ "strconv"
2829 "strings"
2930 "sync"
3031
4849 "dexbuilder" ,
4950 "in" ,
5051 "out" ,
52+ "min_sdk_version" ,
5153 },
5254 }
5355
5961 desugar , androidJar , dexbuilder , in string
6062 classpaths , outs , outputDir flags.StringList
6163 desugarCoreLibs bool
64+ minSdkVersion int
6265
6366 initOnce sync.Once
6467)
@@ -73,6 +76,7 @@ func Init() {
7376 flag .StringVar (& dexbuilder , "dexbuilder" , "" , "Path to dexbuilder" )
7477 flag .StringVar (& in , "in" , "" , "Path to input" )
7578 flag .Var (& outs , "out" , "Path to output, if more than one specified, output is sharded across files." )
79+ flag .IntVar (& minSdkVersion , "min_sdk_version" , 0 , "Passthrough to d8 for desugaring and dexing." )
7680 })
7781}
7882
@@ -176,6 +180,9 @@ func desugarJar(in, out string) error {
176180 "--output" ,
177181 out ,
178182 }
183+ if minSdkVersion > 0 {
184+ args = append (args , "--min_sdk_version" , strconv .Itoa (minSdkVersion ))
185+ }
179186 if desugarCoreLibs {
180187 args = append (args , "--desugar_supported_core_libs" )
181188 }
@@ -192,7 +199,9 @@ func dexBuilder(in, out string) error {
192199 "--output_zip" ,
193200 out ,
194201 }
195-
202+ if minSdkVersion > 0 {
203+ args = append (args , "--min_sdk_version" , strconv .Itoa (minSdkVersion ))
204+ }
196205 return runCmd (dexbuilder , args )
197206}
198207
0 commit comments