class InstantRunDependenciesApkBuilder extends InstantRunSplitApkBuilder {

    @Override
    public void transform(@NonNull TransformInvocation transformInvocation)
            throws TransformException, InterruptedException, IOException {
        // we are not really an incremental transform. All we need to know is that at least
        // one of our file has changed in any way and trigger a full rebuild of the
        // dependencies split apk.
        boolean anyChangeOfInterest =
                transformInvocation
                        .getInputs()
                        .stream()
                        .flatMap(t -> t.getDirectoryInputs().stream())
                        .anyMatch(directoryInput -> !directoryInput.getChangedFiles().isEmpty());
        // if we are in incremental mode, and not change interest us, just return.
        if (transformInvocation.isIncremental() && !anyChangeOfInterest) {
            return;
        }

        ImmutableSet.Builder<File> dexFiles = ImmutableSet.builder();
        for (TransformInput transformInput : transformInvocation.getInputs()) {
            for (JarInput jarInput : transformInput.getJarInputs()) {
                logger.error("InstantRunDependenciesApkBuilder received a jar file "
                        + jarInput.getFile().getAbsolutePath());
            }

            for (DirectoryInput directoryInput : transformInput.getDirectoryInputs()) {
                File[] files = directoryInput.getFile().listFiles();
                if (files != null) {
                    dexFiles.add(files);
                }
            }
        }
        ImmutableSet<File> listOfDexes = dexFiles.build();
        if (listOfDexes.isEmpty()) {
            return;
        }

        try {
            generateSplitApk(mainApk, new DexFiles(listOfDexes, APK_FILE_NAME));
        } catch (Exception e) {
            logger.error("Error while generating dependencies split APK", e);
            throw new TransformException(e);
        }
    }

    public  InstantRunDependenciesApkBuilder(
            @NonNull Logger logger,
            @NonNull Project project,
            @NonNull InstantRunBuildContext buildContext,
            @NonNull AndroidBuilder androidBuilder,
            @Nullable FileCollection aapt2FromMaven,
            @NonNull Supplier<String> applicationIdSupplier,
            @Nullable FileCollection signingConf,
            @NonNull AaptOptions aaptOptions,
            @NonNull File outputDirectory,
            @NonNull File supportDirectory,
            @NonNull BuildableArtifact resources,
            @NonNull BuildableArtifact resourcesWithMainManifest,
            @NonNull BuildableArtifact apkList,
            @NonNull ApkData mainApk);

}