Class SmartDexingStep

  • All Implemented Interfaces:
    Step

    public class SmartDexingStep
    extends Object
    implements Step
    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.

    • Constructor Detail

      • SmartDexingStep

        public SmartDexingStep​(AndroidPlatformTarget androidPlatformTarget,
                               BuildContext buildContext,
                               ProjectFilesystem filesystem,
                               Optional<Path> primaryOutputPath,
                               Optional<java.util.function.Supplier<Set<Path>>> primaryInputsToDex,
                               Optional<java.util.function.Supplier<List<String>>> primaryDexWeightsSupplier,
                               Optional<Path> secondaryOutputDir,
                               Optional<java.util.function.Supplier<com.google.common.collect.Multimap<Path,​Path>>> secondaryInputsToDex,
                               SmartDexingStep.DexInputHashesProvider dexInputHashesProvider,
                               Path successDir,
                               EnumSet<DxStep.Option> dxOptions,
                               com.google.common.util.concurrent.ListeningExecutorService executorService,
                               int xzCompressionLevel,
                               Optional<String> dxMaxHeapSize,
                               String dexTool,
                               boolean desugarInterfaceMethods,
                               boolean useDexBuckedId,
                               Optional<Set<Path>> additonalDesugarDeps,
                               BuildTarget buildTarget,
                               Optional<Integer> minSdkVersion)
        Parameters:
        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.
        minSdkVersion -