Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions app/src/cc/arduino/view/preferences/Preferences.form
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,13 @@
</Property>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="loadSketchLibrariesBox">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="tr(&quot;Use libraries in sketch folder&quot;)" type="code"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JLabel" name="jLabel1">
Expand Down
9 changes: 9 additions & 0 deletions app/src/cc/arduino/view/preferences/Preferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ private void initComponents() {
checkUpdatesBox = new javax.swing.JCheckBox();
saveVerifyUploadBox = new javax.swing.JCheckBox();
accessibleIDEBox = new javax.swing.JCheckBox();
loadSketchLibrariesBox = new javax.swing.JCheckBox();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
scaleSpinner = new javax.swing.JSpinner();
Expand Down Expand Up @@ -285,6 +286,9 @@ public void mouseEntered(java.awt.event.MouseEvent evt) {
accessibleIDEBox.setText(tr("Use accessibility features"));
checkboxesContainer.add(accessibleIDEBox);

loadSketchLibrariesBox.setText(tr("Use libraries in sketch folder"));
checkboxesContainer.add(loadSketchLibrariesBox);

jLabel1.setText(tr("Interface scale:"));

jLabel2.setText(tr(" (requires restart of Arduino)"));
Expand Down Expand Up @@ -718,6 +722,7 @@ private void autoScaleCheckBoxItemStateChanged(java.awt.event.ItemEvent evt) {//
private javax.swing.JButton browseButton;
private javax.swing.JCheckBox checkUpdatesBox;
private javax.swing.JCheckBox accessibleIDEBox;
private javax.swing.JCheckBox loadSketchLibrariesBox;
private javax.swing.JPanel checkboxesContainer;
private javax.swing.JComboBox comboLanguage;
private javax.swing.JLabel comboLanguageLabel;
Expand Down Expand Up @@ -833,6 +838,8 @@ private void savePreferencesData() {

PreferencesData.setBoolean("ide.accessible", accessibleIDEBox.isSelected());

PreferencesData.setBoolean("build.load_sketch_libraries",loadSketchLibrariesBox.isSelected());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be use_sketch_libraries instead? These libraries are not loaded by default, they are made available and used when required. "Use" is also the term used in the checkbox text?


PreferencesData.set("boardsmanager.additional.urls", additionalBoardsManagerField.getText().replace("\r\n", "\n").replace("\r", "\n").replace("\n", ","));

PreferencesData.set(Constants.PREF_PROXY_TYPE, proxyTypeButtonGroup.getSelection().getActionCommand());
Expand Down Expand Up @@ -913,6 +920,8 @@ private void showPreferencesData() {

accessibleIDEBox.setSelected(PreferencesData.getBoolean("ide.accessible"));

loadSketchLibrariesBox.setSelected(PreferencesData.getBoolean("build.load_sketch_libraries"));

saveVerifyUploadBox.setSelected(PreferencesData.getBoolean("editor.save_on_verify"));

additionalBoardsManagerField.setText(PreferencesData.get("boardsmanager.additional.urls"));
Expand Down
6 changes: 6 additions & 0 deletions arduino-core/src/cc/arduino/Compiler.java
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,13 @@ private void callArduinoBuilder(TargetBoard board, TargetPlatform platform, Targ
addPathFlagIfPathExists(cmd, "-tools", Paths.get(BaseNoGui.getHardwarePath(), "tools", "avr").toFile());
addPathFlagIfPathExists(cmd, "-tools", installedPackagesFolder);

if(PreferencesData.getBoolean("build.load_sketch_libraries") == true) {
addPathFlagIfPathExists(cmd, "-libraries",Paths.get(sketch.getFolder().getAbsolutePath(),"libraries").toFile());
}

addPathFlagIfPathExists(cmd, "-built-in-libraries", BaseNoGui.getContentFile("libraries"));


addPathFlagIfPathExists(cmd, "-libraries", BaseNoGui.getSketchbookLibrariesFolder().folder);

String fqbn = Stream.of(aPackage.getId(), platform.getId(), board.getId(), boardOptions(board)).filter(s -> !s.isEmpty()).collect(Collectors.joining(":"));
Expand Down
4 changes: 4 additions & 0 deletions build/shared/lib/preferences.txt
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,10 @@ programmer = arduino:avrispmkii
upload.using = bootloader
upload.verify = true

# This is true if the arduino IDE will try to load libraries from <Sketch>/libraries
# This is false by default to maintain backwards compatibility
build.load_sketch_libraries = false

# default port is not defined to prevent running AVRDUDE before Port selected (issue #7943)
#serial.port=
serial.databits=8
Expand Down