Skip to content

Commit 74a8ccd

Browse files
author
Federico Fissore
committed
Introducing bundled_library_index.json
1 parent a1d99b9 commit 74a8ccd

File tree

4 files changed

+284
-17
lines changed

4 files changed

+284
-17
lines changed

arduino-core/src/processing/app/BaseNoGui.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -609,13 +609,18 @@ static public void initPackages() throws Exception {
609609
librariesIndexer = new LibrariesIndexer(BaseNoGui.getSettingsFolder());
610610
File librariesIndexFile = librariesIndexer.getIndexFile();
611611
if (!librariesIndexFile.isFile()) {
612-
try {
613-
// Otherwise create an empty packages index
614-
FileOutputStream out = new FileOutputStream(librariesIndexFile);
615-
out.write("{ \"libraries\" : [ ] }".getBytes());
616-
out.close();
617-
} catch (IOException e) {
618-
e.printStackTrace();
612+
File defaultLibraryJsonFile = new File(getContentFile("dist"), "library_index.json");
613+
if (defaultLibraryJsonFile.isFile()) {
614+
FileUtils.copyFile(defaultLibraryJsonFile, librariesIndexFile);
615+
} else {
616+
try {
617+
// Otherwise create an empty packages index
618+
FileOutputStream out = new FileOutputStream(librariesIndexFile);
619+
out.write("{ \"libraries\" : [ ] }".getBytes());
620+
out.close();
621+
} catch (IOException e) {
622+
e.printStackTrace();
623+
}
619624
}
620625
}
621626
librariesIndexer.parseIndex();
@@ -626,16 +631,11 @@ private static File findDefaultPackageFile() {
626631
if (!distFolder.exists()) {
627632
return null;
628633
}
629-
File[] files = distFolder.listFiles();
634+
File[] files = distFolder.listFiles(new OnlyFilesWithExtension("tar.bz2", "zip", "tar.gz", "tar"));
630635
if (files.length > 1) {
631636
throw new IllegalStateException("More than one file in " + distFolder);
632637
}
633-
File file = files[0];
634-
if (!file.isFile() || !(file.getName().contains(".tar.") || file.getName().endsWith(".zip"))) {
635-
throw new IllegalStateException(file + " must be a valid .tar.* or .zip file");
636-
}
637-
638-
return file;
638+
return files[0];
639639
}
640640

641641
static protected void initPlatform() {

arduino-core/src/processing/app/helpers/filefilters/OnlyFilesWithExtension.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,15 @@ public class OnlyFilesWithExtension implements FilenameFilter {
2929
String extensions[];
3030

3131
public OnlyFilesWithExtension(String... ext) {
32-
extensions = ext;
32+
this.extensions = ext;
3333
}
3434

3535
public boolean accept(File dir, String name) {
36-
for (String ext : extensions)
37-
if (name.endsWith(ext))
36+
for (String ext : extensions) {
37+
if (name.endsWith(ext)) {
3838
return true;
39+
}
40+
}
3941
return false;
4042
}
4143

build/build.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,6 +1001,7 @@
10011001
<move file="${staging_folder}/work/dist/bundled_package/packages/arduino/tools/avrdude/avrdude-6.0.1" tofile="${staging_folder}/work/dist/bundled_package/packages/arduino/tools/avrdude/${avrdude_version}"/>
10021002

10031003
<copy file="shared/bundled_package_index.json" tofile="${staging_folder}/work/dist/bundled_package/package_index.json"/>
1004+
<copy file="shared/bundled_library_index.json" tofile="${staging_folder}/work/dist/library_index.json"/>
10041005
</target>
10051006

10061007
</project>
Lines changed: 264 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,264 @@
1+
{
2+
"libraries": [
3+
{
4+
"name": "WiFi",
5+
"version": "1.2",
6+
"author": "Arduino",
7+
"maintainer": "Arduino \u003c[email protected]\u003e",
8+
"sentence": "Enables network connection (local and Internet) using the Arduino WiFi shield. For all Arduino boards.",
9+
"paragraph": "With this library you can instantiate Servers, Clients and send/receive UDP packets through WiFi. The shield can connect either to open or encrypted networks (WEP, WPA). The IP address can be assigned statically or through a DHCP. The library can also manage DNS.",
10+
"website": "http://arduino.cc/en/Reference/WiFi",
11+
"category": "Communication",
12+
"architectures": [
13+
"*"
14+
],
15+
"types": [
16+
"Arduino"
17+
],
18+
"url": "http://arduino.cc/download.php?f=/libraries/WiFi-1.2.zip",
19+
"archiveFileName": "WiFi-1.2.zip",
20+
"size": 5318498,
21+
"checksum": "SHA-256:f9ca7dce918fed50b5adc04433c3a51789b99b50d8ca68607b1fdffbd67eb539"
22+
},
23+
{
24+
"name": "Bridge",
25+
"version": "1.2",
26+
"author": "Arduino",
27+
"maintainer": "Arduino \u003c[email protected]\u003e",
28+
"sentence": "Enables the communication between the Linux processor and the AVR. For Arduino Yún and TRE only.",
29+
"paragraph": "The Bridge library feature: access to the shared storage, run and manage linux processes, open a remote console, access to the linux file system, including the SD card, enstablish http clients or servers.",
30+
"website": "http://arduino.cc/en/Reference/YunBridgeLibrary",
31+
"category": "Communication",
32+
"architectures": [
33+
"*"
34+
],
35+
"types": [
36+
"Arduino"
37+
],
38+
"url": "http://arduino.cc/download.php?f=/libraries/Bridge-1.2.zip",
39+
"archiveFileName": "Bridge-1.2.zip",
40+
"size": 79698,
41+
"checksum": "SHA-256:a90ea655ba0a53f766364a235228255a208634bcf5e0797f66c82720669821b3"
42+
},
43+
{
44+
"name": "GSM",
45+
"version": "1.0",
46+
"author": "Arduino",
47+
"maintainer": "Arduino \u003c[email protected]\u003e",
48+
"sentence": "Enables GSM/GRPS network connection using the Arduino GSM Shield. For all Arduino boards BUT Arduino DUE.",
49+
"paragraph": "Use this library to make/receive voice calls, to send and receive SMS with the Quectel M10 GSM module.\u003c/br\u003eThis library also allows you to connect to internet through the GPRS networks. You can either use web Clients and Servers.\u003c/br\u003e",
50+
"website": "http://arduino.cc/en/Reference/GSM",
51+
"category": "Communication",
52+
"architectures": [
53+
"avr"
54+
],
55+
"types": [
56+
"Arduino"
57+
],
58+
"url": "http://arduino.cc/download.php?f=/libraries/GSM-1.0.zip",
59+
"archiveFileName": "GSM-1.0.zip",
60+
"size": 126171,
61+
"checksum": "SHA-256:4c4666f74254f26cf6bd4548b8b06c66205b556a18a58e3c6be7c6343958edfa"
62+
},
63+
{
64+
"name": "Robot IR Remote",
65+
"version": "1.0",
66+
"author": "Arduino",
67+
"maintainer": "Arduino \u003c[email protected]\u003e",
68+
"sentence": "Allows controlling the Arduino Robot via an IR remote control. For Arduino Robot only.",
69+
"website": "https://github.com/shirriff/Arduino-IRremote",
70+
"category": "Device Control",
71+
"architectures": [
72+
"avr"
73+
],
74+
"types": [
75+
"Arduino"
76+
],
77+
"url": "http://arduino.cc/download.php?f=/libraries/Robot_IR_Remote-1.0.zip",
78+
"archiveFileName": "Robot_IR_Remote-1.0.zip",
79+
"size": 22142,
80+
"checksum": "SHA-256:cfa3f87b3d6c280f57d96282069c27d10654782b4fc31c1ab47ccff29cae5413"
81+
},
82+
{
83+
"name": "Servo",
84+
"version": "1.0",
85+
"author": "Michael Margolis, Arduino",
86+
"maintainer": "Arduino \u003c[email protected]\u003e",
87+
"sentence": "Allows Arduino boards to control a variety of servo motors. For all Arduino boards.",
88+
"paragraph": "This library can control a great number of servos.\u003cbr /\u003eIt makes careful use of timers: the library can control 12 servos using only 1 timer.\u003cbr /\u003eOn the Arduino Due you can control up to 60 servos.\u003cbr /\u003e",
89+
"website": "http://arduino.cc/en/Reference/Servo",
90+
"category": "Device Control",
91+
"architectures": [
92+
"avr",
93+
"sam"
94+
],
95+
"types": [
96+
"Arduino"
97+
],
98+
"url": "http://arduino.cc/download.php?f=/libraries/Servo-1.0.zip",
99+
"archiveFileName": "Servo-1.0.zip",
100+
"size": 13868,
101+
"checksum": "SHA-256:fc254ddded0abc097186a7c3823d8c52b90f9a683a7dab64be89abfb743ed092"
102+
},
103+
{
104+
"name": "Stepper",
105+
"version": "1.0",
106+
"author": "Arduino",
107+
"maintainer": "Arduino \u003c[email protected]\u003e",
108+
"sentence": "Allows Arduino boards to control a variety of stepper motors. For all Arduino boards.",
109+
"paragraph": "This library allows you to control unipolar or bipolar stepper motors. To use it you will need a stepper motor, and the appropriate hardware to control it.",
110+
"website": "http://arduino.cc/en/Reference/Stepper",
111+
"category": "Device Control",
112+
"architectures": [
113+
"*"
114+
],
115+
"types": [
116+
"Arduino"
117+
],
118+
"url": "http://arduino.cc/download.php?f=/libraries/Stepper-1.0.zip",
119+
"archiveFileName": "Stepper-1.0.zip",
120+
"size": 7671,
121+
"checksum": "SHA-256:f703900afcb236631d3ab5ba904c9b1c3ef74b82528db93ffca855c27800bda0"
122+
},
123+
{
124+
"name": "LiquidCrystal",
125+
"version": "1.0",
126+
"author": "Arduino, Adafruit",
127+
"maintainer": "Arduino \u003c[email protected]\u003e",
128+
"sentence": "Allows communication with alphanumerical liquid crystal displays (LCDs). For all Arduino boards.",
129+
"paragraph": "This library allows an Arduino board to control LiquidCrystal displays (LCDs) based on the Hitachi HD44780 (or a compatible) chipset, which is found on most text-based LCDs. The library works with in either 4 or 8 bit mode (i.e. using 4 or 8 data lines in addition to the rs, enable, and, optionally, the rw control lines).",
130+
"website": "http://arduino.cc/en/Reference/LiquidCrystal",
131+
"category": "Display",
132+
"architectures": [
133+
"*"
134+
],
135+
"types": [
136+
"Arduino"
137+
],
138+
"url": "http://arduino.cc/download.php?f=/libraries/LiquidCrystal-1.0.zip",
139+
"archiveFileName": "LiquidCrystal-1.0.zip",
140+
"size": 15887,
141+
"checksum": "SHA-256:a1210e20887cee267bce0039bdeab393647334d6b4972abc029dfbd662497c00"
142+
},
143+
{
144+
"name": "Robot Control",
145+
"version": "1.0",
146+
"author": "Arduino",
147+
"maintainer": "Arduino \u003c[email protected]\u003e",
148+
"sentence": "Enables easy access to the controls of the Arduino Robot Control board. For Arduino Robot only.",
149+
"paragraph": "The Arduino robot is made by two independent boards. The Control Board is the top board of the Arduino Robot, with this library you can easily write sketches to control the robot.",
150+
"website": "http://arduino.cc/en/Reference/RobotLibrary",
151+
"category": "Device Control",
152+
"architectures": [
153+
"avr"
154+
],
155+
"types": [
156+
"Arduino"
157+
],
158+
"url": "http://arduino.cc/download.php?f=/libraries/Robot_Control-1.0.zip",
159+
"archiveFileName": "Robot_Control-1.0.zip",
160+
"size": 107911,
161+
"checksum": "SHA-256:0e44a693a72834de71add8a9d7a9de220bea5ab20582d6fc5aa4c2582809835a"
162+
},
163+
{
164+
"name": "TFT",
165+
"version": "1.0",
166+
"author": "Arduino, Adafruit",
167+
"maintainer": "Arduino \u003c[email protected]\u003e",
168+
"sentence": "Allows drawing text, images, and shapes on the Arduino TFT graphical display. For all Arduino boards.",
169+
"paragraph": "This library is compatible with most of the TFT display based on the ST7735 chipset",
170+
"website": "http://arduino.cc/en/Reference/TFTLibrary",
171+
"category": "Display",
172+
"architectures": [
173+
"*"
174+
],
175+
"types": [
176+
"Arduino"
177+
],
178+
"url": "http://arduino.cc/download.php?f=/libraries/TFT-1.0.zip",
179+
"archiveFileName": "TFT-1.0.zip",
180+
"size": 43501,
181+
"checksum": "SHA-256:e64bb1bb23455f6a03e01694993c7f5b41e2c41e39f5cfbd77b32d9273aef56e"
182+
},
183+
{
184+
"name": "Ethernet",
185+
"version": "1.0",
186+
"author": "Arduino",
187+
"maintainer": "Arduino \u003c[email protected]\u003e",
188+
"sentence": "Enables network connection (local and Internet) using the Arduino Ethernet board or shield. For all Arduino boards.",
189+
"paragraph": "With this library you can use the Arduino Ethernet (shield or board) to connect to Internet. The library provides both Client and server functionalities. The library permits you to connect to a local network also with DHCP and to resolve DNS.",
190+
"website": "http://arduino.cc/en/Reference/Ethernet",
191+
"category": "Communication",
192+
"architectures": [
193+
"*"
194+
],
195+
"types": [
196+
"Arduino"
197+
],
198+
"url": "http://arduino.cc/download.php?f=/libraries/Ethernet-1.0.zip",
199+
"archiveFileName": "Ethernet-1.0.zip",
200+
"size": 47389,
201+
"checksum": "SHA-256:ed1bda4683ffe2b2e90d083c430f8b253d8160545387bd89e0482201b619c19d"
202+
},
203+
{
204+
"name": "SD",
205+
"version": "1.0",
206+
"author": "Arduino, SparkFun",
207+
"maintainer": "Arduino \u003c[email protected]\u003e",
208+
"sentence": "Enables reading and writing on SD cards. For all Arduino boards.",
209+
"paragraph": "Once an SD memory card is connected to the SPI interfare of the Arduino board you are enabled to create files and read/write on them. You can also move through directories on the SD card.",
210+
"website": "http://arduino.cc/en/Reference/SD",
211+
"category": "Data Storage",
212+
"architectures": [
213+
"*"
214+
],
215+
"types": [
216+
"Arduino"
217+
],
218+
"url": "http://arduino.cc/download.php?f=/libraries/SD-1.0.zip",
219+
"archiveFileName": "SD-1.0.zip",
220+
"size": 59165,
221+
"checksum": "SHA-256:5804e4eb7a6ca47f3e074bda86fc504eaea1fcebc8c182344a4a768015241197"
222+
},
223+
{
224+
"name": "Esplora",
225+
"version": "1.0",
226+
"author": "Arduino",
227+
"maintainer": "Arduino \u003c[email protected]\u003e",
228+
"sentence": "Grants easy access to the various sensors and actuators of the Esplora. For Arduino Esplora only.",
229+
"paragraph": "The sensors available on the board are:2-Axis analog joystick with center push-button,4 push-buttons,microphone, light sensor, temperature sensor, 3-axis accelerometer, 2 TinkerKit input connectors.\u003c/br\u003eThe actuators available on the board are: bright RGB LED, piezo buzzer, 2 TinkerKit output connectors.",
230+
"website": "http://arduino.cc/en/Reference/EsploraLibrary",
231+
"category": "Device Control",
232+
"architectures": [
233+
"avr"
234+
],
235+
"types": [
236+
"Arduino"
237+
],
238+
"url": "http://arduino.cc/download.php?f=/libraries/Esplora-1.0.zip",
239+
"archiveFileName": "Esplora-1.0.zip",
240+
"size": 19718,
241+
"checksum": "SHA-256:93658339703db8166abfb41c4429cd85e06e86dcf3646eb079bc8413ffe9f392"
242+
},
243+
{
244+
"name": "Firmata",
245+
"version": "2.3.6",
246+
"author": "Firmata Developers",
247+
"maintainer": "Firmata Developers \u003c[email protected]\u003e",
248+
"sentence": "Enables the communication with computer apps using a standard serial protocol. For all Arduino boards.",
249+
"paragraph": "The Firmata library implements the Firmata protocol for communicating with software on the host computer. This allows you to write custom firmware without having to create your own protocol and objects for the programming environment that you are using.",
250+
"website": "http://firmata.org",
251+
"category": "Device Control",
252+
"architectures": [
253+
"*"
254+
],
255+
"types": [
256+
"Arduino"
257+
],
258+
"url": "http://arduino.cc/download.php?f=/libraries/Firmata-2.3.6.zip",
259+
"archiveFileName": "Firmata-2.3.6.zip",
260+
"size": 56651,
261+
"checksum": "SHA-256:bcfbaebbcc614114ac8a9ea569175c2ee5d0af3999a03b1b9418553e2e7ef0f3"
262+
}
263+
]
264+
}

0 commit comments

Comments
 (0)