@Test public void testStatusAlreadySet() throws TransformException, InterruptedException, IOException { when(instantRunBuildContext.getVerifierResult()).thenReturn( Optional.of(InstantRunVerifierStatus.DEPENDENCY_CHANGED)); final File inputDir = temporaryFolder.newFolder(); final File inputFile = new File(inputDir, "com/foo/bar/InputFile.class"); ImmutableList<TransformInput> transformInputs = ImmutableList.<TransformInput>of(new TransformInput() { @NonNull @Override public Collection<JarInput> getJarInputs() { return ImmutableList.of(); } @NonNull @Override public Collection<DirectoryInput> getDirectoryInputs() { return ImmutableList.<DirectoryInput>of(new DirectoryInputForTests() { @NonNull @Override public Map<File, Status> getChangedFiles() { return ImmutableMap.of(inputFile, Status.ADDED); } @NonNull @Override public File getFile() { return inputDir; } }); } }); getTransform().transform(new TransformInvocationBuilder(context) .addOutputProvider(transformOutputProvider) .addReferencedInputs(transformInputs) .setIncrementalMode(true) .build()); assertThat(instantRunBuildContext.getVerifierResult().isPresent()).isTrue(); assertThat(instantRunBuildContext.getVerifierResult().get()).isEqualTo( InstantRunVerifierStatus.DEPENDENCY_CHANGED); }
@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); } }
InstantRunVerifierTransform extends Transform { @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); } } }
InstantRunVerifierTransform extends Transform { @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); } } InstantRunVerifierTransform(InstantRunVariantScope variantScope); }
InstantRunVerifierTransform extends Transform { @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); } } InstantRunVerifierTransform(InstantRunVariantScope variantScope); @Override void transform(@NonNull TransformInvocation invocation); @NonNull @Override String getName(); @NonNull @Override Set<QualifiedContent.ContentType> getInputTypes(); @NonNull @Override Set<QualifiedContent.ContentType> getOutputTypes(); @NonNull @Override Set<QualifiedContent.Scope> getScopes(); @NonNull @Override Set<QualifiedContent.Scope> getReferencedScopes(); @NonNull @Override Collection<File> getSecondaryDirectoryOutputs(); @Override boolean isIncremental(); }
InstantRunVerifierTransform extends Transform { @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); } } InstantRunVerifierTransform(InstantRunVariantScope variantScope); @Override void transform(@NonNull TransformInvocation invocation); @NonNull @Override String getName(); @NonNull @Override Set<QualifiedContent.ContentType> getInputTypes(); @NonNull @Override Set<QualifiedContent.ContentType> getOutputTypes(); @NonNull @Override Set<QualifiedContent.Scope> getScopes(); @NonNull @Override Set<QualifiedContent.Scope> getReferencedScopes(); @NonNull @Override Collection<File> getSecondaryDirectoryOutputs(); @Override boolean isIncremental();  }