mirror of
https://github.com/arduino/Arduino.git
synced 2025-02-18 12:54:25 +01:00
Pass arguments to the Compiler constructor
Previously, these arguments would be passed to the compile method. However, passing them to the constructor makes sure that the build preferences are created sooner, so they can be used by Sketch before calling the compile method. This commit shouldn't change any behaviour, but prepares for the next commits.
This commit is contained in:
parent
57551b9e79
commit
beac88e039
@ -1542,8 +1542,8 @@ public class Sketch {
|
||||
|
||||
// compile the program. errors will happen as a RunnerException
|
||||
// that will bubble up to whomever called build().
|
||||
Compiler compiler = new Compiler();
|
||||
if (compiler.compile(this, buildPath, primaryClassName, verbose)) {
|
||||
Compiler compiler = new Compiler(this, buildPath, primaryClassName);
|
||||
if (compiler.compile(verbose)) {
|
||||
size(compiler.getBuildPreferences());
|
||||
return primaryClassName;
|
||||
}
|
||||
|
@ -62,26 +62,30 @@ public class Compiler implements MessageConsumer {
|
||||
private String targetArch;
|
||||
|
||||
private RunnerException exception;
|
||||
|
||||
|
||||
/**
|
||||
* Compile sketch.
|
||||
*
|
||||
* Create a new Compiler
|
||||
* @param _sketch Sketch object to be compiled.
|
||||
* @param _buildPath Where the temporary files live and will be built from.
|
||||
* @param _primaryClassName the name of the combined sketch file w/ extension
|
||||
*/
|
||||
public Compiler(Sketch _sketch, String _buildPath, String _primaryClassName)
|
||||
throws RunnerException {
|
||||
sketch = _sketch;
|
||||
prefs = createBuildPreferences(_buildPath, _primaryClassName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compile sketch.
|
||||
*
|
||||
* @return true if successful.
|
||||
* @throws RunnerException Only if there's a problem. Only then.
|
||||
*/
|
||||
public boolean compile(Sketch _sketch, String _buildPath,
|
||||
String _primaryClassName, boolean _verbose)
|
||||
throws RunnerException {
|
||||
sketch = _sketch;
|
||||
public boolean compile(boolean _verbose) throws RunnerException {
|
||||
verbose = _verbose || Preferences.getBoolean("build.verbose");
|
||||
sketchIsCompiled = false;
|
||||
objectFiles = new ArrayList<File>();
|
||||
|
||||
prefs = createBuildPreferences(_buildPath, _primaryClassName);
|
||||
|
||||
// 0. include paths for core + all libraries
|
||||
sketch.setCompilingProgress(20);
|
||||
List<String> includePaths = new ArrayList<String>();
|
||||
|
Loading…
x
Reference in New Issue
Block a user