Commit Graph

690 Commits

Author SHA1 Message Date
Federico Fissore 4e262a566d Introducing "defaultTarget" board is the one selected in preferences is not available. Closes #1731 2013-12-19 13:14:44 +01:00
Federico Fissore 9b05911525 Merge branch 'ide-1.5.x-jssc2' into ide-1.5.x 2013-12-03 18:15:52 +01:00
Cristian Maglie cc347e4ea3 Removed unused variable 2013-12-03 17:51:37 +01:00
Cristian Maglie 1d8901d9bb Fixed indentation.
Updated revision log.
2013-12-03 17:46:55 +01:00
Matthijs Kooijman 0029e97b5a Return different exit codes with --verify or --upload
Previous commits made all failures return 1, even though originally an
unknown sketch file would return 2. This restores the previous behaviour
and adds return code 3 to mean invalid options specified.

The return codes are now:
0: Success
1: Build failed or upload failed
2: Sketch not found
3: Invalid commandline options
2013-11-29 00:33:43 +01:00
Matthijs Kooijman 9196a8d943 Don't show the GUI on --verify or --upload
These are intended to be ran from the commandline, so showing the GUI
doesn't make so much sense.

This is not quite the perfect solution yet, because an Editor object and
all kinds of GUI objects are still created. This commit only prevents
them from being visible, which is a nice first step, but not quite
pretty yet. However, to do it properly, some code should be moved out of
the Editor class, so that's a bit more work.

Additionally, any messages shown with Base::showError and friends still
create a popup, they probably shouldn't do this either.
2013-11-29 00:33:43 +01:00
Matthijs Kooijman c6795dde73 In EditorConsole::write(), use all arguments
When System.(out|err).print was used before there was a visible
EditorConsole, the message was written to the stderr/stdout by this
instead of the EditorConsole. However, the write(data, offset, length)
version would not pass on its offset and length parameters to the
stdout/stderr stream, causing (parts of) a message to be printed
multiple times.

This commit makes sure the parameters are all properly passed to the
real stream.

For some reason the write(int) and write(byte[], int, int) methods in
PrintStream do not throw an IOException like the write(byte[]) version,
so the try block has to go.
2013-11-28 23:08:36 +01:00
Matthijs Kooijman 4592acc213 Change the logic deciding when to do a full rebuild
Previously, a full cleanup of the work directory (and thus a full
rebuild) was done on the first build after:
 - startup, or
 - a change in the board or board suboption.

This did not cooperate nicely with commandline compilation using
--verify. Using the build.path option a persistent build path could be
used, but the actual files in that path would never be reused.

Now, each build saves the preferences used for building in a file
"buildprefs.txt" inside the build directory. Subsequent builds will read
this file to see if any build options changed and re-use the existing
files if the build options are identical.

Because the main .cpp file is not handled by Compiler::build, but by
Sketch::preprocess, it is still always regenerated, even if the Sketch
itself didn't change. This could be fixed later, though it is probably
not a problem.

When writing buildprefs.txt, only the build preferences starting with
"build.", "compiler." or "recipes." are used. These should be enough to
ensure files are always rebuilt when needed (probably also sometimes
when not needed, when change build.verbose for example). Using all build
preferences would cause the files to be rebuild too often, and because
of last.ide.xxx.daterun, they would still rebuild on _every_
invocation... This approach is perhaps not ideal, but improving it would
require putting more structure in the preferences instead of piling them
all together into the build preferences.

Because of this new mechanism, the old
buildSettingsChanged()/deleteFilesOnNextBuild could be removed.
2013-11-28 23:08:36 +01:00
Matthijs Kooijman 7b7f447a4a Move the definition of primaryClassName in Sketch
Instead of defining in the preprocess method and returning, just define
it in the build method. This makes sure the name is available before
preprocessing, which is important for the upcoming commits.

This commit should not change behaviour, only prepare for the next
commits.
2013-11-28 23:08:36 +01:00
Matthijs Kooijman beac88e039 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.
2013-11-28 23:08:35 +01:00
Matthijs Kooijman 57551b9e79 Add --pref option
This allows setting preferences through the commandline.
2013-11-28 23:08:35 +01:00
Matthijs Kooijman f502c9b53c Error out when a required commandline argument is left out 2013-11-28 23:08:35 +01:00
Matthijs Kooijman 0a3b82af8f Improve error handling for files on the commandline
Previously, any files that were specified on the commandline but could
not be opened were silently ignored. Only if --verify and --upload was
specified and _all_ files failed to open, a generic error message was
shown. Additionally, if multiple files were specified with --verify or
--upload, only the first would be acted on (the others would be openened
and shown in the GUI, but not actually verified or uploaded).

Now, whenever a file fails to open, an error message is shown (fatal
with --verify or --upload, non-fatal otherwise).

Furthermore, with --verify or --upload an error is shown when there is
not exactly one file on the commandline.

Finally, instead of keeping an "opened" variable, the code now just
checks the size of "editors" to see if a blank sketch should be opened.
2013-11-28 23:08:35 +01:00
Matthijs Kooijman 400ae7fdfd Slightly delay opening of files specified on the commandline
Instead of opening up files during argument processing, the filenames
are now stored in a list and opened only after all commandline arguments
have been processed.

This commit in itself shouldn't change any behaviour, but it prepares
for improved error reporting in the next commits.
2013-11-28 23:08:35 +01:00
Matthijs Kooijman 4ba80e3715 Show an error on unknown options 2013-11-28 23:08:35 +01:00
Matthijs Kooijman e32eafe48f Handle sketch with only invalid code filenames
Previously, this would error out with an index out of bounds exception.
Now, an IOException is thrown, which is properly handled further up the
call chain.
2013-11-28 23:08:35 +01:00
Matthijs Kooijman 0ea5509fcf Handle errors in the --board parameter
Previously, it would just raise nullpointer or index out of bounds
exceptions when the --board paramater was wrong.
2013-11-28 23:08:31 +01:00
Matthijs Kooijman 46c930c841 Pass TargetBoard objects around instead of strings
Previously, strings containing the board id, or a joined version of the
package, platform and board id were passed around. Since comparing
objects is easier than strings and since parsing strings can be fragile,
it's better to just pass the TargetBoard objects.

There is one case where string parsing is still required: when parsing
the --board commandline option. However, the parsing is now done in the
right place, when handling the commandline, instead of in a generic
selectBoard method.
2013-11-28 22:25:53 +01:00
Matthijs Kooijman 89fa1c4bbd Don't re-set board preference when changing custom suboptions
Since the custom suboptions are only visible when their associated board
is the currently selected one, there is no point in re-setting the
current board when a suboption is selected.
2013-11-28 22:11:11 +01:00
Cristian Maglie 4a7cee4b3c Fixed upload on Arduino Leonardo (and derivatives) with JSSC on Mac.
See #1633
2013-11-28 17:27:13 +01:00
Federico Fissore 4b3717bc53 jssc: updated config files (eclipse, ant build.xml, windows launcher, mac template.app), removed rxtx binaries 2013-11-28 17:27:13 +01:00
Federico Fissore f334e673a5 removing RXTX, switching to JSSC 2013-11-28 17:27:13 +01:00
Federico Fissore d5cc92d8ab FileUtils.readFileToString opens files with UTF-8 encoding 2013-11-28 15:28:12 +01:00
Cristian Maglie ff970f10b1 Another language update 2013-11-28 14:19:39 +01:00
Cristian Maglie 2186790b2b Updated translations 2013-11-28 11:28:58 +01:00
Cristian Maglie 061d71e123 Update version to 1.5.5 (Base.java) 2013-11-22 14:44:00 +01:00
Cristian Maglie 3bec9121cd Reintroduced warning on development leftovers in 1.5 libraries.
See #1692
2013-11-20 12:12:05 +01:00
Matthijs Kooijman a4a660154e Don't forbid unknown files in a library
The current code forbids any files it does not know about, but this is
bad because:
 - It breaks forward compatibility if we later add more files or
   directories to the library format.
 - It breaks for people who want to have some extra stuff in their
   library (say, .gitignore or a README file). We can't keep a list of
   "allowed" stuff, since there will always be stuff missing.

This commit removes that code and just allows all files again.
2013-11-19 17:39:35 +01:00
Federico Fissore d0758af29a PreProcessor now replace every single char with a space, without collapsing multiline matches 2013-11-18 11:39:52 +01:00
Federico Fissore 84e9d70415 Preprocessor regexp: "." now matches even line terminators. Closes #1653 2013-11-17 22:12:07 +01:00
Federico Fissore e6698e4baa Enforcing string start/end check. See #1687 2013-11-16 14:41:54 +01:00
Federico Fissore 139dd6bf6a PdePreprocessor restored to version 316b871
Added an "insideString" flag in scrubComments to avoid failing with strings like "Hello */*"
Added a handful of tests taking code from various issues in order to better avoid future regressions
Closes #1687
2013-11-16 12:59:41 +01:00
Federico Fissore fdb98f1213 Using [code] instead of [quote] for Copy for forum. Fixes #1675 2013-11-14 17:45:23 +01:00
Cristian Maglie 9b1c9d4f16 Updated language file.
Changed "Copy error" message to "Copy error messages".
2013-11-12 14:31:50 +01:00
Federico Fissore e1579af565 PdePreprocessor: different patterns order leads to a slightly different result. Updating test 2013-11-11 12:24:59 +01:00
Federico Fissore 05bf2b0be9 PrePreprocess.scrubComments doesn't properly work: using RegExp from PrePreprocess.strip. Fixes #817 2013-11-11 12:18:42 +01:00
Federico Fissore 07f8c691b4 PdePreprocessor.scubComments result used before looking for libraries. Fixes #1293 2013-11-11 12:05:59 +01:00
Federico Fissore 22dfa98202 Merge branch 'ide-1.5.x' into ide-1.5.x-preproc 2013-11-11 11:18:32 +01:00
Kristian Lauszus 7706fcfdde Can now detect devices with serial number in the port number on OSX - see: https://github.com/arduino/Arduino/issues/223
It now also parses PID and VID values with text afterwards properly
2013-11-11 04:42:29 +01:00
Federico Fissore 0d8e12dbe0 OSX workaround for board autodetection #223 2013-11-08 20:34:05 +01:00
Federico Fissore 12446a25d9 Test preproc 2013-11-06 18:32:09 +01:00
Cristian Maglie c4823ccfc4 Merge branch 'master' into ide-1.5.x 2013-11-04 10:36:53 +01:00
Cristian Maglie 89d6841ac0 Merge branch 'cayci-master' 2013-11-04 10:33:38 +01:00
PaulStoffregen ae265a98b9 Help 3rd party installers find the hardware path 2013-11-04 10:22:24 +01:00
Cristian Maglie be30113f09 Reference libraries in hardware addons when they reference another core.
Fixes #1445
2013-11-03 20:32:34 +01:00
Cayci 66faf5d6c6 Render line numbers using TextAreaPainter
Fix the line number font rendering problem on the Mac.

Now, the TextAreaLineNumbers class extends the TextAreaPainter and just
overloads the paintLine method to make it render the line number instead
of rendering the whole line. Other than that, the superclass' drawing
code is used.

So: the same drawing code that renders the source code text in the
editor is now also being used to render the line numbers.
2013-11-02 21:49:09 -04:00
Cayci a2111fdcf6 add preference to enable/disable line numbers
add preference to enable/disable line numbers and make font change work
2013-10-28 21:01:35 -04:00
Federico Fissore 5284c3a3e6 IDE Command line: using "isAbsolute" instead of "exists" to avoid conflicting with files in IDE install location 2013-10-28 12:50:17 +01:00
Federico Fissore d133365cc1 IDE command line: sketches can now be specified with relative paths. Fixes #1493 2013-10-28 10:10:14 +01:00
Cayci 787f73dade Display line numbers for the file being edited 2013-10-28 00:19:30 -04:00