From 0397bdced17f457c45f55bc5bffbf9edf12b3880 Mon Sep 17 00:00:00 2001 From: Alexey Andreev Date: Wed, 7 Jun 2017 14:34:05 +0300 Subject: [PATCH] Report copied source files to JPS as changed files --- tools/core/src/main/java/org/teavm/tooling/TeaVMTool.java | 2 +- .../java/org/teavm/tooling/sources/SourceFilesCopier.java | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/core/src/main/java/org/teavm/tooling/TeaVMTool.java b/tools/core/src/main/java/org/teavm/tooling/TeaVMTool.java index ed1dde646..334a8c80a 100644 --- a/tools/core/src/main/java/org/teavm/tooling/TeaVMTool.java +++ b/tools/core/src/main/java/org/teavm/tooling/TeaVMTool.java @@ -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")); diff --git a/tools/core/src/main/java/org/teavm/tooling/sources/SourceFilesCopier.java b/tools/core/src/main/java/org/teavm/tooling/sources/SourceFilesCopier.java index e5a85d222..290363640 100644 --- a/tools/core/src/main/java/org/teavm/tooling/sources/SourceFilesCopier.java +++ b/tools/core/src/main/java/org/teavm/tooling/sources/SourceFilesCopier.java @@ -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 sourceFileProviders; private Set sourceFiles = new HashSet<>(); + private Consumer copiesConsumer; - public SourceFilesCopier(List sourceFileProviders) { + public SourceFilesCopier(List sourceFileProviders, Consumer 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); }