Commit be3ab5aa authored by David Trott's avatar David Trott

Reverting commit supporting thrift 1.7.x, the main line should be clean until...

Reverting commit supporting thrift 1.7.x, the main line should be clean until 1.7.x is offically released.

Revert "Updated to utilize the new -out parameter added to thrift compiler patch (THRIFT-1069)"
This reverts commit fe80dbd6.
parent 4acdc9ed
......@@ -79,6 +79,8 @@ final class Thrift {
}
// result will always be 0 here.
moveGeneratedFiles();
return 0;
}
......@@ -97,7 +99,7 @@ final class Thrift {
command.add("-I");
command.add(thriftPathElement.toString());
}
command.add("-out");
command.add("-o");
command.add(javaOutputDirectory.toString());
command.add("--gen");
command.add(generator);
......@@ -105,6 +107,27 @@ 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