@Test public void addInput_shouldAddAnInput() throws Exception { TransformInvocation invocation = builder.addInput(transformInput).setOutputProvider(outputProvider).build(); assertThat(invocation.getInputs()).containsExactly(transformInput); assertThat(invocation.getReferencedInputs()).isEmpty(); assertThat(invocation.getOutputProvider()).isEqualTo(outputProvider); }
@Test public void addReferencedInput_shouldAddReferencedInput() throws Exception { TransformInvocation invocation = builder.addReferencedInput(transformInput).setOutputProvider(outputProvider).build(); assertThat(invocation.getInputs()).isEmpty(); assertThat(invocation.getReferencedInputs()).containsExactly(transformInput); assertThat(invocation.getOutputProvider()).isEqualTo(outputProvider); }
invocation.getReferencedInputs().stream()) .flatMap(s -> Stream.concat(s.getDirectoryInputs().stream(), s.getJarInputs().stream())) .map(QualifiedContent::getFile),
@Override public void transform(@NonNull TransformInvocation transformInvocation) throws TransformException, InterruptedException, IOException { Collection<TransformInput> inputs = transformInvocation.getReferencedInputs(); //noinspection ResultOfMethodCallIgnored outFolder.mkdirs(); if (transformInvocation.isIncremental()) { incrementalUpdate(inputs); } else { fullCopy(inputs); } }
@Override public void transform(@NonNull TransformInvocation invocation) throws IOException, TransformException, InterruptedException { if (invocation.getReferencedInputs().isEmpty()) { throw new RuntimeException("Empty list of referenced inputs"); } try { variantScope.getInstantRunBuildContext().startRecording( InstantRunBuildContext.TaskType.VERIFIER); doTransform(invocation.getReferencedInputs(), invocation.isIncremental()); } finally { variantScope.getInstantRunBuildContext().stopRecording( InstantRunBuildContext.TaskType.VERIFIER); } }
@Override public void transform(@NonNull TransformInvocation transformInvocation) throws TransformException, InterruptedException, IOException { // This task will not be invoked on the initial assemble build. For subsequent instant run // build, we want to fail the verifier if anything changed. (Native libraries are // treated as Java resources in the plugin) if (!transformInvocation.isIncremental() || hasChangedInputs(transformInvocation.getReferencedInputs())) { buildContext.setVerifierStatus(failureStatus); } }
List<QualifiedContent> locaJlJarScope = Lists.newArrayList(); for (TransformInput input : invocation.getReferencedInputs()) { for (QualifiedContent qualifiedContent : Iterables.concat( input.getJarInputs(), input.getDirectoryInputs())) {
TransformInput input = Iterables.getOnlyElement(invocation.getReferencedInputs()); File minifiedOutJar = Iterables.getOnlyElement(input.getJarInputs()).getFile();
@Override public void transform(@NonNull TransformInvocation invocation) throws IOException, TransformException, InterruptedException { TransformOutputProvider output = invocation.getOutputProvider(); Collection<TransformInput> referencedInputs = invocation.getReferencedInputs(); checkNotNull(output, "Missing output object for transform " + getName()); if (isIncrementalRun(invocation.isIncremental(), referencedInputs)) { incrementalRun(invocation.getInputs(), referencedInputs, output); } else { fullRun(invocation.getInputs(), referencedInputs, output); } }
invocation.getInputs(), invocation.getReferencedInputs());
@Override public void transform(@NonNull TransformInvocation invocation) throws IOException, TransformException, InterruptedException { FileUtils.cleanOutputDir(jniLibsFolder); for (TransformInput input : invocation.getReferencedInputs()) { for (JarInput jarInput : input.getJarInputs()) { copyFromJar(jarInput.getFile()); } for (DirectoryInput directoryInput : input.getDirectoryInputs()) { copyFromFolder(directoryInput.getFile()); } } }
Collection<TransformInput> referencedInputs = transformInvocation.getReferencedInputs(); TransformOutputProvider outputProvider = transformInvocation.getOutputProvider();
@Override public void transform(@NonNull TransformInvocation invocation) throws IOException, TransformException, InterruptedException { // Re-direct the output to appropriate log levels, just like the official ProGuard task. LoggingManager loggingManager = invocation.getContext().getLogging(); loggingManager.captureStandardOutput(LogLevel.INFO); loggingManager.captureStandardError(LogLevel.WARN); try { File input = verifyInputs(invocation.getReferencedInputs()); shrinkWithProguard(input); computeList(input); } catch (ParseException | ProcessException e) { throw new TransformException(e); } }
for (TransformInput input : invocation.getReferencedInputs()) { for (DirectoryInput directoryInput : input.getDirectoryInputs()) { if (!directoryInput.getContentTypes()
transformInvocation.getReferencedInputs(), transformInvocation.getOutputProvider(), transformInvocation.isIncremental());
private void runJack(@NonNull TransformInvocation transformInvocation) throws ProcessException, IOException, JackToolchain.ToolchainException, ClassNotFoundException { TransformOutputProvider outputProvider = transformInvocation.getOutputProvider(); checkNotNull(outputProvider); final File outDirectory = outputProvider.getContentLocation( "main", getOutputTypes(), getScopes(), Format.DIRECTORY); options.setDexOutputDirectory(outDirectory); options.setClasspaths( TransformInputUtil.getAllFiles(transformInvocation.getReferencedInputs())); options.setImportFiles(TransformInputUtil.getAllFiles(transformInvocation.getInputs())); options.setInputFiles(getSourceFiles()); JackToolchain toolchain = new JackToolchain( androidBuilder.getTargetInfo().getBuildTools(), androidBuilder.getLogger(), androidBuilder.getErrorReporter()); toolchain.convert(options, androidBuilder.getJavaProcessExecutor(), jackInProcess); }