diff options
author | Reinier Zwitserloot <reinier@tipit.to> | 2009-11-27 14:08:50 +0100 |
---|---|---|
committer | Reinier Zwitserloot <reinier@tipit.to> | 2009-11-27 14:08:50 +0100 |
commit | 3919e192f17dab936167215c9a163e8830a2b346 (patch) | |
tree | 795d07107750eed0d8dfd931036c53082670c3a8 /src | |
parent | 4eaf936df5e6666afdd76d154bafea7e59fdba14 (diff) | |
download | lombok-3919e192f17dab936167215c9a163e8830a2b346.tar.gz lombok-3919e192f17dab936167215c9a163e8830a2b346.tar.bz2 lombok-3919e192f17dab936167215c9a163e8830a2b346.zip |
The delombok task now works!
Diffstat (limited to 'src')
-rw-r--r-- | src/delombok/lombok/delombok/Delombok.java | 24 | ||||
-rw-r--r-- | src/delombok/lombok/delombok/ant/DelombokTask.java | 28 |
2 files changed, 38 insertions, 14 deletions
diff --git a/src/delombok/lombok/delombok/Delombok.java b/src/delombok/lombok/delombok/Delombok.java index 990267a2..2daa9af7 100644 --- a/src/delombok/lombok/delombok/Delombok.java +++ b/src/delombok/lombok/delombok/Delombok.java @@ -203,9 +203,22 @@ public class Delombok { delombok0(base, "", 0); } + public void process(File base, String name) throws IOException { + File f = new File(base, name); + if (f.isFile()) { + String extension = getExtension(f); + if (extension.equals("java")) delombok(base, name); + else if (extension.equals("class")) skipClass(name); + else copy(base, name); + } else if (!f.exists()) { + feedback.printf("Skipping %s because it does not exist.\n", canonical(f)); + } else if (!f.isDirectory()) { + feedback.printf("Skipping %s because it is a special file type.\n", canonical(f)); + } + } + private void delombok0(File base, String suffix, int loop) throws IOException { File dir = suffix.isEmpty() ? base : new File(base, suffix); - String name = suffix; if (dir.isDirectory()) { if (loop >= 100) { @@ -215,15 +228,8 @@ public class Delombok { delombok0(base, suffix + (suffix.isEmpty() ? "" : File.separator) + f.getName(), loop + 1); } } - } else if (dir.isFile()) { - String extension = getExtension(dir); - if (extension.equals("java")) delombok(base, name); - else if (extension.equals("class")) skipClass(name); - else copy(base, name); - } else if (!dir.exists()) { - feedback.printf("Skipping %s because it does not exist.\n", canonical(dir)); } else { - feedback.printf("Skipping %s because it is a special file type.\n", canonical(dir)); + process(base, suffix); } } diff --git a/src/delombok/lombok/delombok/ant/DelombokTask.java b/src/delombok/lombok/delombok/ant/DelombokTask.java index 89ea7c4d..7a674910 100644 --- a/src/delombok/lombok/delombok/ant/DelombokTask.java +++ b/src/delombok/lombok/delombok/ant/DelombokTask.java @@ -1,3 +1,24 @@ +/* + * Copyright © 2009 Reinier Zwitserloot and Roel Spilker. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ package lombok.delombok.ant; import java.io.File; @@ -64,12 +85,9 @@ public class DelombokTask extends Task { File baseDir = fileResource.getBaseDir(); if (baseDir == null) { File file = fileResource.getFile(); - System.out.printf("Processing raw file: %s\n", file); - delombok.delombok(file.getParentFile(), file.getName()); + delombok.process(file.getParentFile(), file.getName()); } else { - System.out.printf("Processing based file: %s -- %s\n", baseDir, fileResource.getName()); - delombok.delombok(baseDir, fileResource.getName()); - + delombok.process(baseDir, fileResource.getName()); } } } |