diff options
author | Marc R. Hoffmann <hoffmann@mountainminds.com> | 2017-06-08 20:03:06 +0200 |
---|---|---|
committer | Evgeny Mandrikov <Godin@users.noreply.github.com> | 2017-06-08 20:03:06 +0200 |
commit | 2a2f161920d7608630ba1163d45a858803cfef2e (patch) | |
tree | c7ab3642fa6bad331376003cf75321a2d2fea794 /org.jacoco.cli/src | |
parent | 817d0ae185106486dac2ba6dd229c1af5c42d03f (diff) | |
download | jacoco-2a2f161920d7608630ba1163d45a858803cfef2e.tar.gz |
Use dest argument as folder in any case (#543)
The instrument goal accepts folders as well as files as input. In case
of files the instrumented copy should be written to the folder given as
the dest option.
Diffstat (limited to 'org.jacoco.cli/src')
-rw-r--r-- | org.jacoco.cli/src/org/jacoco/cli/internal/commands/Instrument.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/org.jacoco.cli/src/org/jacoco/cli/internal/commands/Instrument.java b/org.jacoco.cli/src/org/jacoco/cli/internal/commands/Instrument.java index c52c0722..bb3a8ff6 100644 --- a/org.jacoco.cli/src/org/jacoco/cli/internal/commands/Instrument.java +++ b/org.jacoco.cli/src/org/jacoco/cli/internal/commands/Instrument.java @@ -49,14 +49,19 @@ public class Instrument extends Command { @Override public int execute(final PrintWriter out, final PrintWriter err) throws IOException { + final File absoluteDest = dest.getAbsoluteFile(); instrumenter = new Instrumenter( new OfflineInstrumentationAccessGenerator()); int total = 0; for (final File s : source) { - total += instrumentRecursive(s, dest); + if (s.isFile()) { + total += instrument(s, new File(absoluteDest, s.getName())); + } else { + total += instrumentRecursive(s, absoluteDest); + } } out.printf("[INFO] %s classes instrumented to %s.%n", - Integer.valueOf(total), dest.getAbsolutePath()); + Integer.valueOf(total), absoluteDest); return 0; } |