Skip to content

Commit cb66d22

Browse files
authored
Merge pull request #1612 from Sloeber/support_for_tar_zst_#1611
Add code and needed packages to handle tar.zst files
2 parents b1b8e70 + f8dc841 commit cb66d22

28 files changed

+109
-105
lines changed

.github/workflows/maven.yml

+8-7
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33

44
name: Java CI with Maven
55

6-
7-
8-
96
on:
107
push:
118
branches: [ master ]
@@ -18,16 +15,17 @@ jobs:
1815
runs-on: ubuntu-latest
1916

2017
steps:
21-
- name: show Maven
22-
run: mvn -version
23-
2418
- uses: actions/checkout@v2
19+
- name: Set up Maven
20+
uses: stCarolas/[email protected]
21+
with:
22+
maven-version: 3.9.6
2523
- name: Set up JDK 17
2624
uses: actions/setup-java@v2
2725
with:
2826
java-version: '17'
2927
distribution: 'adopt'
30-
- name: Build with Maven
28+
- name: Build Sloeber with Maven
3129
run: mvn --no-transfer-progress verify -Pall,sloeber_release,NOSDK -Dtest=NightlyJenkins -DfailIfNoTests=false
3230

3331
- name: Archive production artifacts
@@ -55,3 +53,6 @@ jobs:
5553
with:
5654
name: macosx_arm
5755
path: io.sloeber.product/target/products/sloeber-ide-sloeber_release-macosx.cocoa.aarch64.zip
56+
- name: Build Sloeber SDK with Maven
57+
run: mvn clean verify -PSDK,win64,latest -DskipTests=true
58+

io.sloeber.core/META-INF/MANIFEST.MF

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ Require-Bundle: org.eclipse.cdt.managedbuilder.core,
2222
org.eclipse.debug.core,
2323
org.eclipse.core.variables,
2424
org.apache.commons.commons-io,
25-
org.apache.commons.commons-compress
25+
org.apache.commons.commons-compress,
26+
com.github.luben.zstd-jni;bundle-version="1.5.5"
2627
Export-Package: cc.arduino.packages;x-internal:=true,
2728
cc.arduino.packages.discoverers;x-internal:=true,
2829
cc.arduino.packages.ssh;x-internal:=true,

io.sloeber.core/src/io/sloeber/core/api/BoardsManager.java

+1
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ public class BoardsManager {
7373
+ "https://raw.githubusercontent.com/jantje/hardware/master/package_jantje_index.json\n" //$NON-NLS-1$
7474
+ "https://raw.githubusercontent.com/jantje/ArduinoLibraries/master/library_jantje_index.json\n" //$NON-NLS-1$
7575
+ "https://arduino.esp8266.com/stable/package_esp8266com_index.json\n" //$NON-NLS-1$
76+
+ "https://www.pjrc.com/teensy/package_teensy_index.json\n" //$NON-NLS-1$
7677
+ KEY_MANAGER_ARDUINO_LIBRARY_JSON_URL;
7778

7879
protected static List<ArduinoPlatformPackageIndex> packageIndices;

io.sloeber.core/src/io/sloeber/core/tools/FileModifiers.java

+9-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import java.io.File;
44
import java.io.IOException;
55
import java.nio.charset.Charset;
6+
import java.nio.charset.StandardCharsets;
67
import java.nio.file.FileVisitResult;
78
import java.nio.file.Files;
89
import java.nio.file.Path;
@@ -33,8 +34,15 @@ public class FileModifiers {
3334
*/
3435
public static void appendString(File input, String addString) throws IOException {
3536
Path pathFile = Path.of(input.toString());
36-
String fileString = Files.readString(pathFile, Charset.defaultCharset()) + addString;
37+
try {
38+
String fileString = Files.readString(pathFile,StandardCharsets.UTF_8) + addString;
3739
Files.write(pathFile, fileString.getBytes(), StandardOpenOption.TRUNCATE_EXISTING, StandardOpenOption.CREATE);
40+
}catch(IOException e) {
41+
String fileString = Files.readString(pathFile,Charset.forName("Cp1252")) + addString;
42+
Files.write(pathFile, fileString.getBytes(), StandardOpenOption.TRUNCATE_EXISTING, StandardOpenOption.CREATE);
43+
44+
}
45+
3846
}
3947

4048
/**

io.sloeber.core/src/io/sloeber/core/tools/PackageManager.java

+14-6
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import org.apache.commons.compress.archivers.zip.ZipArchiveInputStream;
2222
import org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream;
2323
import org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream;
24+
import org.apache.commons.compress.compressors.zstandard.ZstdCompressorInputStream;
2425
import org.apache.commons.io.FileUtils;
2526
import org.eclipse.core.runtime.IPath;
2627
import org.eclipse.core.runtime.IProgressMonitor;
@@ -67,7 +68,7 @@ public static IStatus downloadAndInstall(String pURL, String pArchiveFileName, I
6768
pMonitor.subTask("Downloading " + pArchiveFileName + " .."); //$NON-NLS-1$ //$NON-NLS-2$
6869
myCopy(dl, archivePath.toFile(), true);
6970
}
70-
} catch (IOException e) {
71+
} catch (Exception e) {
7172
return new Status(IStatus.ERROR, Activator.getId(), Messages.Manager_Failed_to_download.replace(FILE, pURL),
7273
e);
7374
}
@@ -79,27 +80,34 @@ private static IStatus processArchive(String pArchiveFileName, IPath pInstallPat
7980
// Create an ArchiveInputStream with the correct archiving algorithm
8081
String faileToExtractMessage = Messages.Manager_Failed_to_extract.replace(FILE, pArchiveFullFileName);
8182
if (pArchiveFileName.endsWith("tar.bz2")) { //$NON-NLS-1$
82-
try (ArchiveInputStream inStream = new TarArchiveInputStream(
83+
try (TarArchiveInputStream inStream = new TarArchiveInputStream(
8384
new BZip2CompressorInputStream(new FileInputStream(pArchiveFullFileName)))) {
8485
return extract(inStream, pInstallPath.toFile(), 1, pForceDownload, pMonitor);
8586
} catch (IOException | InterruptedException e) {
8687
return new Status(IStatus.ERROR, Activator.getId(), faileToExtractMessage, e);
8788
}
8889
} else if (pArchiveFileName.endsWith("zip")) { //$NON-NLS-1$
89-
try (ArchiveInputStream in = new ZipArchiveInputStream(new FileInputStream(pArchiveFullFileName))) {
90+
try (ZipArchiveInputStream in = new ZipArchiveInputStream(new FileInputStream(pArchiveFullFileName))) {
9091
return extract(in, pInstallPath.toFile(), 1, pForceDownload, pMonitor);
9192
} catch (IOException | InterruptedException e) {
9293
return new Status(IStatus.ERROR, Activator.getId(), faileToExtractMessage, e);
9394
}
9495
} else if (pArchiveFileName.endsWith("tar.gz")) { //$NON-NLS-1$
95-
try (ArchiveInputStream in = new TarArchiveInputStream(
96+
try (TarArchiveInputStream in = new TarArchiveInputStream(
9697
new GzipCompressorInputStream(new FileInputStream(pArchiveFullFileName)))) {
9798
return extract(in, pInstallPath.toFile(), 1, pForceDownload, pMonitor);
9899
} catch (IOException | InterruptedException e) {
99100
return new Status(IStatus.ERROR, Activator.getId(), faileToExtractMessage, e);
100101
}
102+
} else if (pArchiveFileName.endsWith("tar.zst")) { //$NON-NLS-1$
103+
try (TarArchiveInputStream in = new TarArchiveInputStream(
104+
new ZstdCompressorInputStream(new FileInputStream(pArchiveFullFileName)))) {
105+
return extract(in, pInstallPath.toFile(), 1, pForceDownload, pMonitor);
106+
} catch (IOException | InterruptedException e) {
107+
return new Status(IStatus.ERROR, Activator.getId(), faileToExtractMessage, e);
108+
}
101109
} else if (pArchiveFileName.endsWith("tar")) { //$NON-NLS-1$
102-
try (ArchiveInputStream in = new TarArchiveInputStream(new FileInputStream(pArchiveFullFileName))) {
110+
try (TarArchiveInputStream in = new TarArchiveInputStream(new FileInputStream(pArchiveFullFileName))) {
103111
return extract(in, pInstallPath.toFile(), 1, pForceDownload, pMonitor);
104112
} catch (IOException | InterruptedException e) {
105113
return new Status(IStatus.ERROR, Activator.getId(), faileToExtractMessage, e);
@@ -109,7 +117,7 @@ private static IStatus processArchive(String pArchiveFileName, IPath pInstallPat
109117
}
110118
}
111119

112-
private static IStatus extract(ArchiveInputStream in, File destFolder, int stripPath, boolean overwrite,
120+
private static IStatus extract(ArchiveInputStream<?> in, File destFolder, int stripPath, boolean overwrite,
113121
IProgressMonitor pMonitor) throws IOException, InterruptedException {
114122

115123
// Folders timestamps must be set at the end of archive extraction

io.sloeber.parent/pom.xml

-2
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@
8080
<!--
8181
<source>11</source>
8282
<target>11</target> -->
83-
<executionEnvironment>org.eclipse.justj.openjdk.hotspot.jre.full-17</executionEnvironment>
8483

8584
</configuration>
8685
</plugin>
@@ -96,7 +95,6 @@
9695
<plugin>
9796
<groupId>org.apache.maven.plugins</groupId>
9897
<artifactId>maven-release-plugin</artifactId>
99-
<version>2.5.3</version>
10098
<configuration>
10199
<arguments>-Dgpg.passphrase=${gpg.passphrase}</arguments>
102100
</configuration>

io.sloeber.product.sdk/arduino.product

+16-17
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<?pde version="3.5"?>
33

4-
<product name="Sloeber" uid="io.sloeber.product" id="io.sloeber.application.product" application="org.eclipse.ui.ide.workbench" version="4.4.2.qualifier" type="features" includeLaunchers="true" autoIncludeRequirements="true">
4+
<product name="Sloeber" uid="io.sloeber.product" id="io.sloeber.application.product" application="org.eclipse.ui.ide.workbench" version="4.4.2.qualifier" type="features" includeLaunchers="true" autoIncludeRequirements="false">
55

66
<aboutInfo>
7-
<image path="/io.sloeber.application/icons/eclipse_lg.png"/>
7+
<image path="/io.sloeber.product.sdk/icons/eclipse_lg.png"/>
88
<text>
99
Sloeber, the Eclipse IDE for Arduino Developers
1010

@@ -36,10 +36,10 @@ https://github.com/sloeber/arduino-eclipse-plugin/graphs/contributors
3636
</vmArgsMac>
3737
</launcherArgs>
3838

39-
<windowImages i16="/io.sloeber.application/icons/logo_16.png" i32="/io.sloeber.application/icons/logo_32.png" i48="/io.sloeber.application/icons/logo_48.png" i256="/io.sloeber.application/icons/logo_256.png"/>
39+
<windowImages i16="/io.sloeber.product.sdk/icons/logo_16.png" i32="/io.sloeber.product.sdk/icons/logo_32.png" i48="/io.sloeber.product.sdk/icons/logo_48.png" i256="/io.sloeber.product.sdk/icons/logo_256.png"/>
4040

4141
<splash
42-
location="io.sloeber.application"
42+
location="io.sloeber.product"
4343
startupProgressRect="97,370,100,4"
4444
startupMessageRect="400,370,441,20"
4545
startupForegroundColor="C8D5EA" />
@@ -207,7 +207,6 @@ United States, other countries, or both.
207207
</plugins>
208208

209209
<features>
210-
<feature id="ilg.gnumcueclipse.debug.gdbjtag.openocd.feature" installMode="root"/>
211210
<feature id="org.eclipse.cdt.autotools" installMode="root"/>
212211
<feature id="org.eclipse.cdt.gdb" installMode="root"/>
213212
<feature id="org.eclipse.cdt.gnu.build" installMode="root"/>
@@ -224,7 +223,6 @@ United States, other countries, or both.
224223
<feature id="org.eclipse.ecf.filetransfer.feature" installMode="root"/>
225224
<feature id="org.eclipse.ecf.filetransfer.httpclient5.feature" installMode="root"/>
226225
<feature id="org.eclipse.ecf.filetransfer.ssl.feature" installMode="root"/>
227-
<feature id="org.eclipse.egit" installMode="root"/>
228226
<feature id="org.eclipse.emf.common" installMode="root"/>
229227
<feature id="org.eclipse.emf.ecore" installMode="root"/>
230228
<feature id="org.eclipse.epp.mpc" installMode="root"/>
@@ -240,18 +238,13 @@ United States, other countries, or both.
240238
<feature id="org.eclipse.jgit" installMode="root"/>
241239
<feature id="org.eclipse.justj.openjdk.hotspot.jre.full" installMode="root"/>
242240
<feature id="org.eclipse.mylyn_feature" installMode="root"/>
243-
<feature id="org.eclipse.mylyn.bugzilla_feature" installMode="root"/>
244241
<feature id="org.eclipse.mylyn.commons.identity" installMode="root"/>
245242
<feature id="org.eclipse.mylyn.commons.notifications" installMode="root"/>
246243
<feature id="org.eclipse.mylyn.commons.repositories" installMode="root"/>
247244
<feature id="org.eclipse.mylyn.commons" installMode="root"/>
248245
<feature id="org.eclipse.mylyn.context_feature" installMode="root"/>
249246
<feature id="org.eclipse.mylyn.discovery" installMode="root"/>
250-
<feature id="org.eclipse.mylyn.ide_feature" installMode="root"/>
251247
<feature id="org.eclipse.mylyn.monitor" installMode="root"/>
252-
<feature id="org.eclipse.mylyn.tasks.ide" installMode="root"/>
253-
<feature id="org.eclipse.mylyn.team_feature" installMode="root"/>
254-
<feature id="org.eclipse.mylyn.wikitext_feature" installMode="root"/>
255248
<feature id="org.eclipse.nebula.widgets.oscilloscope.feature" installMode="root"/>
256249
<feature id="org.eclipse.pde.source" installMode="root"/>
257250
<feature id="org.eclipse.pde" installMode="root"/>
@@ -266,6 +259,13 @@ United States, other countries, or both.
266259
<feature id="org.eclipse.rse.ssh" installMode="root"/>
267260
<feature id="org.eclipse.rse.telnet" installMode="root"/>
268261
<feature id="org.eclipse.rse" installMode="root"/>
262+
<feature id="org.eclipse.equinox.p2.core.feature.source" installMode="root"/>
263+
<feature id="org.eclipse.help.source" installMode="root"/>
264+
<feature id="org.eclipse.equinox.p2.user.ui.source" installMode="root"/>
265+
<feature id="org.eclipse.equinox.p2.extras.feature.source" installMode="root"/>
266+
<feature id="org.eclipse.ecf.filetransfer.httpclientjava.feature" installMode="root"/>
267+
<feature id="org.eclipse.equinox.p2.rcp.feature.source" installMode="root"/>
268+
<feature id="org.eclipse.egit" installMode="root"/>
269269
</features>
270270

271271
<configurations>
@@ -280,12 +280,11 @@ United States, other countries, or both.
280280
</configurations>
281281

282282
<repositories>
283-
<repository location="https://eclipse.baeyens.it/update/V4/stable/" enabled="true" />
284-
<repository location="https://download.eclipse.org/technology/babel/update-site/latest/" enabled="false" />
285-
<repository location="https://download.eclipse.org/justj/jres/17/updates/release/latest/" enabled="true" />
286-
<repository location="https://download.eclipse.org/releases/latest/" enabled="true" />
287-
<repository location="https://download.eclipse.org/eclipse/updates/latest" enabled="true" />
288-
<repository location="https://download.eclipse.org/nebula/releases/latest/" enabled="true" />
283+
<repository location="https://download.eclipse.org/technology/babel/update-site/latest/" name="" enabled="false" />
284+
<repository location="https://download.eclipse.org/justj/jres/17/updates/release/latest/" name="" enabled="true" />
285+
<repository location="https://download.eclipse.org/releases/latest/" name="" enabled="true" />
286+
<repository location="https://download.eclipse.org/eclipse/updates/latest" name="" enabled="true" />
287+
<repository location="https://download.eclipse.org/nebula/releases/latest/" name="" enabled="true" />
289288
</repositories>
290289

291290
<preferencesInfo>
36.5 KB
Loading
10.4 KB
Loading
901 Bytes
Loading
21.7 KB
Loading
2.08 KB
Loading
3.54 KB
Loading
4.89 KB
Loading
332 Bytes
Loading
526 Bytes
Loading

io.sloeber.product/sloeber.target

+30-5
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22
<?pde version="3.8"?>
33
<target includeMode="feature" name="Sloeber">
44
<locations>
5-
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
6-
<repository location="https://download.eclipse.org/nebula/releases/latest/"/>
7-
<unit id="org.eclipse.nebula.widgets.oscilloscope.css.feature.feature.group" version="0.0.0"/>
8-
<unit id="org.eclipse.nebula.widgets.oscilloscope.feature.feature.group" version="0.0.0"/>
9-
</location>
105
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
116
<repository location="https://download.eclipse.org/releases/latest"/>
127
<unit id="org.eclipse.cdt.autotools.feature.group" version="0.0.0"/>
@@ -30,8 +25,38 @@
3025
<unit id="org.eclipse.ecf.core.feature.group" version="0.0.0"/>
3126
<unit id="org.eclipse.wildwebdeveloper.feature.feature.group" version="0.0.0"/>
3227
</location>
28+
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
29+
<repository location="https://download.eclipse.org/nebula/releases/latest/"/>
30+
<unit id="org.eclipse.nebula.widgets.oscilloscope.css.feature.feature.group" version="0.0.0"/>
31+
<unit id="org.eclipse.nebula.widgets.oscilloscope.feature.feature.group" version="0.0.0"/>
32+
</location>
33+
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
34+
<repository location="http://download.eclipse.org/mylyn/releases/latest"/>
35+
<unit id="org.eclipse.mylyn.context_feature.feature.group" version="3.26.0.v20221229-1738"/>
36+
<unit id="org.eclipse.mylyn_feature.feature.group" version="3.26.0.v20230416-1636"/>
37+
</location>
38+
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
39+
<repository location="https://download.eclipse.org/egit/updates"/>
40+
<unit id="org.eclipse.egit.feature.group" version="6.8.0.202311291450-r"/>
41+
<unit id="org.eclipse.egit.source.feature.group" version="6.8.0.202311291450-r"/>
42+
<unit id="org.eclipse.jgit.feature.group" version="6.8.0.202311291450-r"/>
43+
<unit id="org.eclipse.egit.gitflow.feature.feature.group" version="6.8.0.202311291450-r"/>
44+
<unit id="org.eclipse.jgit.gpg.bc.feature.group" version="6.8.0.202311291450-r"/>
45+
<unit id="org.eclipse.jgit.http.apache.feature.group" version="6.8.0.202311291450-r"/>
46+
<unit id="org.eclipse.jgit.lfs.feature.group" version="6.8.0.202311291450-r"/>
47+
<unit id="org.eclipse.jgit.pgm.feature.group" version="6.8.0.202311291450-r"/>
48+
<unit id="org.eclipse.jgit.source.feature.group" version="6.8.0.202311291450-r"/>
49+
<unit id="org.eclipse.jgit.ssh.apache.feature.group" version="6.8.0.202311291450-r"/>
50+
<unit id="org.eclipse.jgit.ssh.jsch.feature.group" version="6.8.0.202311291450-r"/>
51+
</location>
3352
<location includeDependencyDepth="none" includeDependencyScopes="compile" includeSource="true" label="DirectFromMaven" missingManifest="error" type="Maven">
3453
<dependencies>
54+
<dependency>
55+
<groupId>com.github.luben</groupId>
56+
<artifactId>zstd-jni</artifactId>
57+
<version>1.5.5-11</version>
58+
<type>jar</type>
59+
</dependency>
3560
<dependency>
3661
<groupId>com.google.code.gson</groupId>
3762
<artifactId>gson</artifactId>

io.sloeber.tests/src/io/sloeber/core/CompileAndUpload.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import io.sloeber.providers.ESP32;
4141
import io.sloeber.providers.ESP8266;
4242
import io.sloeber.providers.MCUBoard;
43+
import io.sloeber.providers.Teensy;
4344
import io.sloeber.ui.monitor.SerialConnection;
4445

4546
@SuppressWarnings({"nls","unused"})
@@ -134,8 +135,7 @@ public static void installAdditionalBoards() {
134135
Arduino.installLatestSamDBoards();
135136
Arduino.installLatestIntellCurieBoards();
136137
Arduino.installLatestSamBoards();
137-
138-
BoardsManager.addPrivateHardwarePath(MySystem.getTeensyPlatform());
138+
Teensy.installLatest();
139139

140140
}
141141

io.sloeber.tests/src/io/sloeber/core/CreateAndCompileArduinoIDEExamplesOnTeensyTest.java

+1-6
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,7 @@ private static boolean skipExample(Example example) {
101101
}
102102

103103
public static void installAdditionalBoards() {
104-
if (MySystem.getTeensyPlatform().isEmpty()) {
105-
System.err.println("ERROR: Teensy not installed/configured skipping tests!!!");
106-
} else {
107-
BoardsManager.addPrivateHardwarePath(MySystem.getTeensyPlatform());
108-
}
109-
104+
Teensy.installLatest();
110105
}
111106

112107
@Test

io.sloeber.tests/src/io/sloeber/core/CreateAndCompileDefaultInoOnAllBoardsTest.java

-5
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ public class CreateAndCompileDefaultInoOnAllBoardsTest {
3131
private static final boolean removeAllinstallationInfoAtStartup = false;
3232
private static final boolean skipPlatformInstallation = false;
3333
private static final boolean apply_known_work_Arounds = true;
34-
private static final boolean testPrivateHardware = true;
3534
private static final boolean closeFailedProjects = false;
3635
private static int myBuildCounter = 0;
3736
private static int myTotalFails = 0;
@@ -323,10 +322,6 @@ public static void installAdditionalBoards() {
323322
}
324323
BoardsManager.setPackageURLs(toAddList, true);
325324

326-
if (testPrivateHardware) {
327-
BoardsManager.addPrivateHardwarePath(MySystem.getTeensyPlatform());
328-
}
329-
330325
if (!skipPlatformInstallation) {
331326
BoardsManager.installAllLatestPlatforms();
332327
// PackageManager.installsubsetOfLatestPlatforms(0,5);

io.sloeber.tests/src/io/sloeber/core/CreateAndCompileLibraryExamplesTest.java

-5
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,6 @@ public static void installAdditionalBoards() {
106106
LibraryManager.installAllLatestLibraries();
107107
// LibraryManager.onlyKeepLatestPlatforms();
108108
}
109-
if (MySystem.getTeensyPlatform().isEmpty()) {
110-
System.err.println("ERROR: Teensy not installed/configured skipping tests!!!");
111-
} else {
112-
BoardsManager.addPrivateHardwarePath(MySystem.getTeensyPlatform());
113-
}
114109
BoardsManager.installAllLatestPlatforms();
115110

116111
}

0 commit comments

Comments
 (0)