multi-file compiling now working

This commit is contained in:
benfry
2004-06-22 18:30:28 +00:00
parent 3e283e1d74
commit b235e23b0d
3 changed files with 37 additions and 4 deletions

View File

@@ -105,6 +105,24 @@ public class PdeCompiler implements PdeMessageConsumer {
//buildPath + File.separator + className + ".java" // file to compile
};
// make list of code files that need to be compiled
// (some files are skipped if they contain no class)
String preprocNames[] = new String[sketch.codeCount];
int preprocCount = 0;
for (int i = 0; i < sketch.codeCount; i++) {
if (sketch.code[i].preprocName != null) {
preprocNames[preprocCount++] = sketch.code[i].preprocName;
}
}
String command[] = new String[baseCommand.length + preprocCount];
System.arraycopy(baseCommand, 0, command, 0, baseCommand.length);
// append each of the files to the command string
for (int i = 0; i < preprocCount; i++) {
command[baseCommand.length + i] =
buildPath + File.separator + preprocNames[i];
}
/*
String command[] = new String[baseCommand.length + sketch.codeCount];
System.arraycopy(baseCommand, 0, command, 0, baseCommand.length);
// append each of the files to the command string
@@ -112,6 +130,11 @@ public class PdeCompiler implements PdeMessageConsumer {
command[baseCommand.length + i] =
buildPath + File.separator + sketch.code[i].preprocName;
}
*/
//for (int i = 0; i < command.length; i++) {
//System.out.println("cmd " + i + " " + command[i]);
//}
firstErrorFound = false; // haven't found any errors yet
secondErrorFound = false;
@@ -132,6 +155,7 @@ public class PdeCompiler implements PdeMessageConsumer {
while (compiling) {
try {
result = process.waitFor();
//System.out.println("result is " + result);
compiling = false;
} catch (InterruptedException ignored) { }
}
@@ -169,6 +193,7 @@ public class PdeCompiler implements PdeMessageConsumer {
throw new PdeException(SUPER_BADNESS);
}
// success would mean that 'result' is set to zero
return (result == 0); // ? true : false;
}

View File

@@ -1017,10 +1017,13 @@ public class PdeSketch {
importPackageList);
if (className == null) {
// TODO this is temporary for debugging
System.err.println("no class found in " + code[i].name);
/*
System.err.println("class could not be determined for " +
code[i].name + " hopefully an error has " +
"already been reported.");
return null;
*/
} else {
code[i].preprocName = className + ".java";
}
@@ -1028,6 +1031,7 @@ public class PdeSketch {
if (i == 0) {
// store this for the compiler and the runtime
primaryClassName = className;
System.out.println("primary class " + primaryClassName);
// check if the 'main' file is in java mode
if (PdePreprocessor.programType == PdePreprocessor.JAVA) {
@@ -1091,6 +1095,7 @@ public class PdeSketch {
//
PdeCompiler compiler = new PdeCompiler();
boolean success = compiler.compile(this, buildPath);
System.out.println("success = " + success + " ... " + primaryClassName);
return success ? primaryClassName : null;
}

View File

@@ -127,17 +127,20 @@ X i.e. when double-clicking on them.. downloaded off web..
X but need to deal with simply, not providing a new exception case
X begin writing 'new text file'
040623 tuesday morning
040623 tuesday morning / early afternoon
X write 'new text file' (ctrl-t)
X hitting return/enter on the status.edit() not always working
X it had been disabled, now re-enabled
X also update status after "add file" of a .pde or .java
X implement delete
X implement hide/unhide
X see if multiple files are actually compiling
X nope, they aren't properly.. need to figure this out
X empty files = no class name found.. that's a problem
040623 tuesday afternoon
_ continue work on multi-file compile
_ see if multiple files are actually compiling
_ nope, they aren't properly.. need to figure this out
_ empty files = no class name found.. that's a problem
_ see if sonia project can compile
_ write export-to-application
_ write export-to-library