Report copied source files to JPS as changed files

This commit is contained in:
Alexey Andreev 2017-06-07 14:34:05 +03:00
parent 27bb8fe9ed
commit 0397bdced1
2 changed files with 6 additions and 2 deletions

View File

@ -540,7 +540,7 @@ public class TeaVMTool implements BaseTeaVMTool {
if (vm.getWrittenClasses() == null) {
return;
}
SourceFilesCopier copier = new SourceFilesCopier(sourceFileProviders);
SourceFilesCopier copier = new SourceFilesCopier(sourceFileProviders, generatedFiles::add);
copier.addClasses(vm.getWrittenClasses());
copier.setLog(log);
copier.copy(new File(targetDirectory, "src"));

View File

@ -19,6 +19,7 @@ import java.io.*;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.function.Consumer;
import org.apache.commons.io.IOUtils;
import org.teavm.model.ClassReader;
import org.teavm.model.ListableClassReaderSource;
@ -30,9 +31,11 @@ public class SourceFilesCopier {
private TeaVMToolLog log = new EmptyTeaVMToolLog();
private List<SourceFileProvider> sourceFileProviders;
private Set<String> sourceFiles = new HashSet<>();
private Consumer<File> copiesConsumer;
public SourceFilesCopier(List<SourceFileProvider> sourceFileProviders) {
public SourceFilesCopier(List<SourceFileProvider> sourceFileProviders, Consumer<File> copiesConsumer) {
this.sourceFileProviders = sourceFileProviders;
this.copiesConsumer = copiesConsumer;
}
public void setLog(TeaVMToolLog log) {
@ -80,6 +83,7 @@ public class SourceFilesCopier {
IOUtils.copy(input, output);
}
}
copiesConsumer.accept(outputFile);
} catch (IOException e) {
log.warning("Could not copy source file " + fileName, e);
}