Skip to content

Commit

Permalink
add more debugging/error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
parrt committed Jun 3, 2015
1 parent fbf3ee8 commit 8c2657b
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion tool/test/org/antlr/v4/test/runtime/csharp/BaseTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -415,8 +415,20 @@ private boolean buildProject() throws Exception {
"/p:Configuration=Release",
getTestProjectFile().getAbsolutePath()
};
Process process = Runtime.getRuntime().exec(args, null, new File(tmpdir));
System.err.println("Starting build "+Utils.join(args, " "));
Process process =
Runtime.getRuntime().exec(args, null, new File(tmpdir));
StreamVacuum stdoutVacuum = new StreamVacuum(process.getInputStream());
StreamVacuum stderrVacuum = new StreamVacuum(process.getErrorStream());
stdoutVacuum.start();
stderrVacuum.start();
process.waitFor();
stdoutVacuum.join();
stderrVacuum.join();
if ( stderrVacuum.toString().length()>0 ) {
this.stderrDuringParse = stderrVacuum.toString();
System.err.println("buildProject stderrVacuum: "+ stderrVacuum);
}
return process.exitValue()==0;
}

Expand Down Expand Up @@ -447,8 +459,13 @@ private String locateTool(String tool) {
public boolean createProject() {
try {
String pack = this.getClass().getPackage().getName().replace(".", "/") + "/";
System.out.println("create project "+pack);
// save AssemblyInfo
InputStream input = Thread.currentThread().getContextClassLoader().getResourceAsStream(pack + "AssemblyInfo.cs");
if ( input==null ) {
System.err.println("Can't find " + pack + "AssemblyInfo.cs as resource");
return false;
}
OutputStream output = new FileOutputStream(new File(tmpdir, "AssemblyInfo.cs").getAbsolutePath());
while(input.available()>0) {
output.write(input.read());
Expand Down Expand Up @@ -494,6 +511,7 @@ public boolean createProject() {
transformer.transform(new DOMSource(prjXml), new StreamResult(prjFile));
return true;
} catch(Exception e) {
e.printStackTrace(System.err);
return false;
}
}
Expand Down

0 comments on commit 8c2657b

Please sign in to comment.