public class SmartDexingStep
Optimized dx command runner which can invoke multiple dx commands in parallel and also avoid
doing unnecessary dx invocations in the first place.
This is most appropriately represented as a build rule itself (which depends on individual dex
rules) however this would require significant refactoring of AndroidBinaryRule that would be
disruptive to other initiatives in flight (namely, ApkBuilder). It is also debatable that it is
even the right course of action given that it would require dynamically modifying the DAG.
primaryOutputPath - Path for the primary dex artifact.
primaryInputsToDex - Set of paths to include as inputs for the primary dex artifact.
secondaryOutputDir - Directory path for the secondary dex artifacts, if there are any.
Note that this directory will be pruned such that only those secondary outputs generated by
this command will remain in the directory!
secondaryInputsToDex - List of paths to input jar files, to use as dx input, keyed by the
corresponding output dex file. Note that for each output file (key), a separate dx
invocation will be started with the corresponding jar files (value) as the input.
successDir - Directory where success artifacts are written.
executorService - The thread pool to execute the dx command on.
public static int determineOptimalThreadCount()
Optimal (in terms of both memory and performance) number of parallel threads to run
dexer. The implementation uses running machine hardware characteristics to determine this.