Skip to content

Commit ffc64d0

Browse files
committed
preprocess() method in JavaBuild returns PreprocessorResult object
1 parent 3849580 commit ffc64d0

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

java/src/processing/mode/java/JavaBuild.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ public String build(File srcFolder, File binFolder, boolean sizeWarning) throws
107107
this.binFolder = binFolder;
108108

109109
// run the preprocessor
110-
String classNameFound = preprocess(srcFolder, sizeWarning);
110+
PreprocessorResult result = preprocess(srcFolder, sizeWarning);
111+
String classNameFound = result.getClassName();
111112

112113
// compile the program. errors will happen as a RunnerException
113114
// that will bubble up to whomever called build().
@@ -139,7 +140,7 @@ public String getSketchClassName() {
139140
* @param srcFolder Location to copy all the .java files
140141
* @return null if compilation failed, main class name if not
141142
*/
142-
public String preprocess(File srcFolder, boolean sizeWarning) throws SketchException {
143+
public PreprocessorResult preprocess(File srcFolder, boolean sizeWarning) throws SketchException {
143144
PdePreprocessor preprocessor = PdePreprocessor.builderFor(sketch.getMainName()).build();
144145
return preprocess(srcFolder, null, preprocessor, sizeWarning);
145146
}
@@ -149,13 +150,13 @@ public String preprocess(File srcFolder, boolean sizeWarning) throws SketchExcep
149150
* @param srcFolder location where the .java source files will be placed
150151
* @param packageName null, or the package name that should be used as default
151152
* @param preprocessor the preprocessor object ready to do the work
152-
* @return main PApplet class name found during preprocess, or null if error
153+
* @return PreprocessorResult object containing the preprocessing results
153154
* @throws SketchException details of where the preprocessing failed
154155
*/
155-
public String preprocess(File srcFolder,
156-
String packageName,
157-
PdePreprocessor preprocessor,
158-
boolean sizeWarning) throws SketchException {
156+
public PreprocessorResult preprocess(File srcFolder,
157+
String packageName,
158+
PdePreprocessor preprocessor,
159+
boolean sizeWarning) throws SketchException {
159160
// make sure the user isn't playing "hide the sketch folder"
160161
sketch.ensureExistence();
161162

@@ -379,7 +380,7 @@ public String preprocess(File srcFolder,
379380
}
380381
}
381382
foundMain = preprocessor.hasMain();
382-
return result.getClassName();
383+
return result;
383384
}
384385

385386

0 commit comments

Comments
 (0)