throws TransformException, InterruptedException, IOException { if (transformInvocation.getOutputProvider() == null) { throw new IllegalArgumentException("Transform invocation needs a valid output provider."); .getOutputProvider() .getContentLocation(TRANSFORM_OUTPUT, getOutputTypes(), getScopes(), Format.DIRECTORY); for (TransformInput input : transformInvocation.getInputs()) { .getOutputProvider() .getContentLocation(inputJar.getName(), getOutputTypes(), getScopes(), Format.JAR); outputJar.getParentFile().mkdirs(); if (!transformInvocation.isIncremental() || inputJar.getStatus() != Status.REMOVED) { FileUtils.copyFile(inputJar.getFile(), outputJar); if (transformInvocation.isIncremental()) {
@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); }
for (TransformInput input : invocation.getInputs()) { input.getJarInputs().parallelStream().forEach(jarInput -> { File src = jarInput.getFile(); File dst = invocation.getOutputProvider().getContentLocation( jarInput.getName(), jarInput.getContentTypes(), jarInput.getScopes(), Format.JAR); input.getDirectoryInputs().parallelStream().forEach(directoryInput -> { File src = directoryInput.getFile(); File dst = invocation.getOutputProvider().getContentLocation( directoryInput.getName(), directoryInput.getContentTypes(), directoryInput.getScopes(), Format.DIRECTORY); File dest = invocation.getOutputProvider().getContentLocation( "WMRouter", TransformManager.CONTENT_CLASS, ImmutableSet.of(QualifiedContent.Scope.PROJECT), Format.DIRECTORY);
@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); } }
for (TransformInput transformInput : transformInvocation.getInputs()) { for (JarInput jarInput : transformInput.getJarInputs()) { logger.error("InstantRunDependenciesApkBuilder received a jar file " if (transformInvocation.isIncremental() && !anyChangeOfInterest) { return;
@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); } }
private File classRootFor(String id) { return invocation.getOutputProvider().getContentLocation("capt-generated-by:" + id, Collections.singleton(QualifiedContent.DefaultContentType.CLASSES), Collections.singleton(QualifiedContent.Scope.EXTERNAL_LIBRARIES), Format.DIRECTORY); }
URLClassLoader captDependencies = new URLClassLoader(runnerUrls, Plugin.class.getClassLoader()); URL[] runtimeUrls = invocation.getInputs().stream() .flatMap(s -> Stream.concat(s.getDirectoryInputs().stream(), s.getJarInputs().stream())) .map(QualifiedContent::getFile) Streams.concat(invocation.getInputs().stream(), invocation.getReferencedInputs().stream()) .flatMap(s -> Stream.concat(s.getDirectoryInputs().stream(), s.getJarInputs().stream())) .map(QualifiedContent::getFile),
@Override public void transform(TransformInvocation invocation) throws TransformException, InterruptedException, IOException { long startMs = System.currentTimeMillis(); LOGGER.lifecycle("Start capt transform for '{}', incremental: {}", invocation.getContext().getVariantName(), invocation.isIncremental()); variantManager.getVariantScope(invocation.getContext().getVariantName()) .doTransform(invocation); LOGGER.lifecycle("End capt transform, cost: {}ms", (System.currentTimeMillis() - startMs)); }
Map<String, QualifiedContent> inputs = invocation.getInputs().stream() .flatMap(i -> Stream.concat(i.getDirectoryInputs().stream(), i.getJarInputs().stream())) .collect(Collectors.toMap(QualifiedContent::getName, Function.identity()));
@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); } }
boolean incremental = invocation.isIncremental() && prePlugins.keySet().containsAll(plugins.keySet()); if (incremental != invocation.isIncremental()) { LOGGER.lifecycle("Found new plugin applied, turn into full mode");
private File tempRootFor(String id) { return new File(invocation.getContext().getTemporaryDir(), id); }
List<QualifiedContent> locaJlJarScope = Lists.newArrayList(); for (TransformInput input : invocation.getReferencedInputs()) { for (QualifiedContent qualifiedContent : Iterables.concat( input.getJarInputs(), input.getDirectoryInputs())) {
transform(transformInvocation.getContext(), transformInvocation.getInputs(), transformInvocation.getReferencedInputs(), transformInvocation.getOutputProvider(), transformInvocation.isIncremental());
@Override public void transform(TransformInvocation transformInvocation) throws TransformException, InterruptedException, IOException { super.transform(transformInvocation); Collection<TransformInput> inputs = transformInvocation.getInputs(); TransformOutputProvider outputProvider = transformInvocation.getOutputProvider(); if (outputProvider != null) outputProvider.deleteAll(); System.out.println("/////////////////////////begin inputs///////////////////////////////////");
if (transformInvocation.isIncremental()) { for (TransformInput transformInput : transformInvocation.getInputs()) { for (JarInput jarInput : transformInput.getJarInputs()) { logger.error("InstantRunDependenciesApkBuilder received a jar file " for (TransformInput transformInput : transformInvocation.getInputs()) { for (JarInput jarInput : transformInput.getJarInputs()) { logger.error("InstantRunDependenciesApkBuilder received a jar file "
@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); } }
public void clearForFullMode() throws IOException { invocation.getOutputProvider().deleteAll(); FileUtils.deleteDirectory(variantRoot); } }
throws IOException, InterruptedException, TransformException { WaitableTasks io = WaitableTasks.get(resource.io()); invocation.getInputs() .forEach(i -> { i.getDirectoryInputs()