Commit 59eeaf91 authored by David Trott's avatar David Trott

Adding support for thrift 0.7

Re-Added: Update to utilize the new -out parameter added to thrift compiler patch (THRIFT-1069)
Also added caution to README.
parent be3ab5aa
CAUTION: Plugin version 0.1.11 requires thrift compiler version 0.7.0 or newer.
You must use plugin version 0.1.10 for older thrift versions.
***************************
*** Maven Thrift Plugin ***
***************************
......
......@@ -79,8 +79,6 @@ final class Thrift {
}
// result will always be 0 here.
moveGeneratedFiles();
return 0;
}
......@@ -99,7 +97,7 @@ final class Thrift {
command.add("-I");
command.add(thriftPathElement.toString());
}
command.add("-o");
command.add("-out");
command.add(javaOutputDirectory.toString());
command.add("--gen");
command.add(generator);
......@@ -107,27 +105,6 @@ final class Thrift {
return ImmutableList.copyOf(command);
}
private void moveGeneratedFiles() {
File genDir = new File(javaOutputDirectory, GENERATED_JAVA);
final File[] generatedFiles = genDir.listFiles();
for (File generatedFile : generatedFiles) {
final String filename = generatedFile.getName();
final File targetLocation = new File(javaOutputDirectory, filename);
if (targetLocation.exists()) {
if (!targetLocation.delete()) {
throw new RuntimeException("File Overwrite Failed: " + targetLocation.getPath());
}
}
if (!generatedFile.renameTo(targetLocation)) {
throw new RuntimeException("Rename Failed: " + targetLocation.getPath());
}
}
if (!genDir.delete()) {
throw new RuntimeException("Failed to delete directory: " + genDir.getPath());
}
}
/**
* @return the output
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment