Skip to content

Commit

Permalink
Merge pull request #1612 from Sloeber/support_for_tar_zst_#1611
Browse files Browse the repository at this point in the history
Add code and needed packages to handle tar.zst files
  • Loading branch information
jantje authored Jan 26, 2024
2 parents b1b8e70 + f8dc841 commit cb66d22
Show file tree
Hide file tree
Showing 28 changed files with 109 additions and 105 deletions.
15 changes: 8 additions & 7 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@

name: Java CI with Maven




on:
push:
branches: [ master ]
Expand All @@ -18,16 +15,17 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: show Maven
run: mvn -version

- uses: actions/checkout@v2
- name: Set up Maven
uses: stCarolas/[email protected]
with:
maven-version: 3.9.6
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'adopt'
- name: Build with Maven
- name: Build Sloeber with Maven
run: mvn --no-transfer-progress verify -Pall,sloeber_release,NOSDK -Dtest=NightlyJenkins -DfailIfNoTests=false

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

3 changes: 2 additions & 1 deletion io.sloeber.core/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ Require-Bundle: org.eclipse.cdt.managedbuilder.core,
org.eclipse.debug.core,
org.eclipse.core.variables,
org.apache.commons.commons-io,
org.apache.commons.commons-compress
org.apache.commons.commons-compress,
com.github.luben.zstd-jni;bundle-version="1.5.5"
Export-Package: cc.arduino.packages;x-internal:=true,
cc.arduino.packages.discoverers;x-internal:=true,
cc.arduino.packages.ssh;x-internal:=true,
Expand Down
1 change: 1 addition & 0 deletions io.sloeber.core/src/io/sloeber/core/api/BoardsManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public class BoardsManager {
+ "https://raw.githubusercontent.com/jantje/hardware/master/package_jantje_index.json\n" //$NON-NLS-1$
+ "https://raw.githubusercontent.com/jantje/ArduinoLibraries/master/library_jantje_index.json\n" //$NON-NLS-1$
+ "https://arduino.esp8266.com/stable/package_esp8266com_index.json\n" //$NON-NLS-1$
+ "https://www.pjrc.com/teensy/package_teensy_index.json\n" //$NON-NLS-1$
+ KEY_MANAGER_ARDUINO_LIBRARY_JSON_URL;

protected static List<ArduinoPlatformPackageIndex> packageIndices;
Expand Down
10 changes: 9 additions & 1 deletion io.sloeber.core/src/io/sloeber/core/tools/FileModifiers.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.Path;
Expand Down Expand Up @@ -33,8 +34,15 @@ public class FileModifiers {
*/
public static void appendString(File input, String addString) throws IOException {
Path pathFile = Path.of(input.toString());
String fileString = Files.readString(pathFile, Charset.defaultCharset()) + addString;
try {
String fileString = Files.readString(pathFile,StandardCharsets.UTF_8) + addString;
Files.write(pathFile, fileString.getBytes(), StandardOpenOption.TRUNCATE_EXISTING, StandardOpenOption.CREATE);
}catch(IOException e) {
String fileString = Files.readString(pathFile,Charset.forName("Cp1252")) + addString;
Files.write(pathFile, fileString.getBytes(), StandardOpenOption.TRUNCATE_EXISTING, StandardOpenOption.CREATE);

}

}

/**
Expand Down
20 changes: 14 additions & 6 deletions io.sloeber.core/src/io/sloeber/core/tools/PackageManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.apache.commons.compress.archivers.zip.ZipArchiveInputStream;
import org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream;
import org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream;
import org.apache.commons.compress.compressors.zstandard.ZstdCompressorInputStream;
import org.apache.commons.io.FileUtils;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
Expand Down Expand Up @@ -67,7 +68,7 @@ public static IStatus downloadAndInstall(String pURL, String pArchiveFileName, I
pMonitor.subTask("Downloading " + pArchiveFileName + " .."); //$NON-NLS-1$ //$NON-NLS-2$
myCopy(dl, archivePath.toFile(), true);
}
} catch (IOException e) {
} catch (Exception e) {
return new Status(IStatus.ERROR, Activator.getId(), Messages.Manager_Failed_to_download.replace(FILE, pURL),
e);
}
Expand All @@ -79,27 +80,34 @@ private static IStatus processArchive(String pArchiveFileName, IPath pInstallPat
// Create an ArchiveInputStream with the correct archiving algorithm
String faileToExtractMessage = Messages.Manager_Failed_to_extract.replace(FILE, pArchiveFullFileName);
if (pArchiveFileName.endsWith("tar.bz2")) { //$NON-NLS-1$
try (ArchiveInputStream inStream = new TarArchiveInputStream(
try (TarArchiveInputStream inStream = new TarArchiveInputStream(
new BZip2CompressorInputStream(new FileInputStream(pArchiveFullFileName)))) {
return extract(inStream, pInstallPath.toFile(), 1, pForceDownload, pMonitor);
} catch (IOException | InterruptedException e) {
return new Status(IStatus.ERROR, Activator.getId(), faileToExtractMessage, e);
}
} else if (pArchiveFileName.endsWith("zip")) { //$NON-NLS-1$
try (ArchiveInputStream in = new ZipArchiveInputStream(new FileInputStream(pArchiveFullFileName))) {
try (ZipArchiveInputStream in = new ZipArchiveInputStream(new FileInputStream(pArchiveFullFileName))) {
return extract(in, pInstallPath.toFile(), 1, pForceDownload, pMonitor);
} catch (IOException | InterruptedException e) {
return new Status(IStatus.ERROR, Activator.getId(), faileToExtractMessage, e);
}
} else if (pArchiveFileName.endsWith("tar.gz")) { //$NON-NLS-1$
try (ArchiveInputStream in = new TarArchiveInputStream(
try (TarArchiveInputStream in = new TarArchiveInputStream(
new GzipCompressorInputStream(new FileInputStream(pArchiveFullFileName)))) {
return extract(in, pInstallPath.toFile(), 1, pForceDownload, pMonitor);
} catch (IOException | InterruptedException e) {
return new Status(IStatus.ERROR, Activator.getId(), faileToExtractMessage, e);
}
} else if (pArchiveFileName.endsWith("tar.zst")) { //$NON-NLS-1$
try (TarArchiveInputStream in = new TarArchiveInputStream(
new ZstdCompressorInputStream(new FileInputStream(pArchiveFullFileName)))) {
return extract(in, pInstallPath.toFile(), 1, pForceDownload, pMonitor);
} catch (IOException | InterruptedException e) {
return new Status(IStatus.ERROR, Activator.getId(), faileToExtractMessage, e);
}
} else if (pArchiveFileName.endsWith("tar")) { //$NON-NLS-1$
try (ArchiveInputStream in = new TarArchiveInputStream(new FileInputStream(pArchiveFullFileName))) {
try (TarArchiveInputStream in = new TarArchiveInputStream(new FileInputStream(pArchiveFullFileName))) {
return extract(in, pInstallPath.toFile(), 1, pForceDownload, pMonitor);
} catch (IOException | InterruptedException e) {
return new Status(IStatus.ERROR, Activator.getId(), faileToExtractMessage, e);
Expand All @@ -109,7 +117,7 @@ private static IStatus processArchive(String pArchiveFileName, IPath pInstallPat
}
}

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

// Folders timestamps must be set at the end of archive extraction
Expand Down
2 changes: 0 additions & 2 deletions io.sloeber.parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@
<!--
<source>11</source>
<target>11</target> -->
<executionEnvironment>org.eclipse.justj.openjdk.hotspot.jre.full-17</executionEnvironment>

</configuration>
</plugin>
Expand All @@ -96,7 +95,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
<configuration>
<arguments>-Dgpg.passphrase=${gpg.passphrase}</arguments>
</configuration>
Expand Down
33 changes: 16 additions & 17 deletions io.sloeber.product.sdk/arduino.product
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<?pde version="3.5"?>

<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">
<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">

<aboutInfo>
<image path="/io.sloeber.application/icons/eclipse_lg.png"/>
<image path="/io.sloeber.product.sdk/icons/eclipse_lg.png"/>
<text>
Sloeber, the Eclipse IDE for Arduino Developers

Expand Down Expand Up @@ -36,10 +36,10 @@ https://github.com/sloeber/arduino-eclipse-plugin/graphs/contributors
</vmArgsMac>
</launcherArgs>

<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"/>
<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"/>

<splash
location="io.sloeber.application"
location="io.sloeber.product"
startupProgressRect="97,370,100,4"
startupMessageRect="400,370,441,20"
startupForegroundColor="C8D5EA" />
Expand Down Expand Up @@ -207,7 +207,6 @@ United States, other countries, or both.
</plugins>

<features>
<feature id="ilg.gnumcueclipse.debug.gdbjtag.openocd.feature" installMode="root"/>
<feature id="org.eclipse.cdt.autotools" installMode="root"/>
<feature id="org.eclipse.cdt.gdb" installMode="root"/>
<feature id="org.eclipse.cdt.gnu.build" installMode="root"/>
Expand All @@ -224,7 +223,6 @@ United States, other countries, or both.
<feature id="org.eclipse.ecf.filetransfer.feature" installMode="root"/>
<feature id="org.eclipse.ecf.filetransfer.httpclient5.feature" installMode="root"/>
<feature id="org.eclipse.ecf.filetransfer.ssl.feature" installMode="root"/>
<feature id="org.eclipse.egit" installMode="root"/>
<feature id="org.eclipse.emf.common" installMode="root"/>
<feature id="org.eclipse.emf.ecore" installMode="root"/>
<feature id="org.eclipse.epp.mpc" installMode="root"/>
Expand All @@ -240,18 +238,13 @@ United States, other countries, or both.
<feature id="org.eclipse.jgit" installMode="root"/>
<feature id="org.eclipse.justj.openjdk.hotspot.jre.full" installMode="root"/>
<feature id="org.eclipse.mylyn_feature" installMode="root"/>
<feature id="org.eclipse.mylyn.bugzilla_feature" installMode="root"/>
<feature id="org.eclipse.mylyn.commons.identity" installMode="root"/>
<feature id="org.eclipse.mylyn.commons.notifications" installMode="root"/>
<feature id="org.eclipse.mylyn.commons.repositories" installMode="root"/>
<feature id="org.eclipse.mylyn.commons" installMode="root"/>
<feature id="org.eclipse.mylyn.context_feature" installMode="root"/>
<feature id="org.eclipse.mylyn.discovery" installMode="root"/>
<feature id="org.eclipse.mylyn.ide_feature" installMode="root"/>
<feature id="org.eclipse.mylyn.monitor" installMode="root"/>
<feature id="org.eclipse.mylyn.tasks.ide" installMode="root"/>
<feature id="org.eclipse.mylyn.team_feature" installMode="root"/>
<feature id="org.eclipse.mylyn.wikitext_feature" installMode="root"/>
<feature id="org.eclipse.nebula.widgets.oscilloscope.feature" installMode="root"/>
<feature id="org.eclipse.pde.source" installMode="root"/>
<feature id="org.eclipse.pde" installMode="root"/>
Expand All @@ -266,6 +259,13 @@ United States, other countries, or both.
<feature id="org.eclipse.rse.ssh" installMode="root"/>
<feature id="org.eclipse.rse.telnet" installMode="root"/>
<feature id="org.eclipse.rse" installMode="root"/>
<feature id="org.eclipse.equinox.p2.core.feature.source" installMode="root"/>
<feature id="org.eclipse.help.source" installMode="root"/>
<feature id="org.eclipse.equinox.p2.user.ui.source" installMode="root"/>
<feature id="org.eclipse.equinox.p2.extras.feature.source" installMode="root"/>
<feature id="org.eclipse.ecf.filetransfer.httpclientjava.feature" installMode="root"/>
<feature id="org.eclipse.equinox.p2.rcp.feature.source" installMode="root"/>
<feature id="org.eclipse.egit" installMode="root"/>
</features>

<configurations>
Expand All @@ -280,12 +280,11 @@ United States, other countries, or both.
</configurations>

<repositories>
<repository location="https://eclipse.baeyens.it/update/V4/stable/" enabled="true" />
<repository location="https://download.eclipse.org/technology/babel/update-site/latest/" enabled="false" />
<repository location="https://download.eclipse.org/justj/jres/17/updates/release/latest/" enabled="true" />
<repository location="https://download.eclipse.org/releases/latest/" enabled="true" />
<repository location="https://download.eclipse.org/eclipse/updates/latest" enabled="true" />
<repository location="https://download.eclipse.org/nebula/releases/latest/" enabled="true" />
<repository location="https://download.eclipse.org/technology/babel/update-site/latest/" name="" enabled="false" />
<repository location="https://download.eclipse.org/justj/jres/17/updates/release/latest/" name="" enabled="true" />
<repository location="https://download.eclipse.org/releases/latest/" name="" enabled="true" />
<repository location="https://download.eclipse.org/eclipse/updates/latest" name="" enabled="true" />
<repository location="https://download.eclipse.org/nebula/releases/latest/" name="" enabled="true" />
</repositories>

<preferencesInfo>
Expand Down
Binary file added io.sloeber.product.sdk/icons/eclipse_lg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added io.sloeber.product.sdk/icons/logo_128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added io.sloeber.product.sdk/icons/logo_16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added io.sloeber.product.sdk/icons/logo_256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added io.sloeber.product.sdk/icons/logo_32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added io.sloeber.product.sdk/icons/logo_48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added io.sloeber.product.sdk/icons/logo_64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added io.sloeber.product.sdk/icons/sample.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added io.sloeber.product.sdk/icons/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 30 additions & 5 deletions io.sloeber.product/sloeber.target
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@
<?pde version="3.8"?>
<target includeMode="feature" name="Sloeber">
<locations>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
<repository location="https://download.eclipse.org/nebula/releases/latest/"/>
<unit id="org.eclipse.nebula.widgets.oscilloscope.css.feature.feature.group" version="0.0.0"/>
<unit id="org.eclipse.nebula.widgets.oscilloscope.feature.feature.group" version="0.0.0"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
<repository location="https://download.eclipse.org/releases/latest"/>
<unit id="org.eclipse.cdt.autotools.feature.group" version="0.0.0"/>
Expand All @@ -30,8 +25,38 @@
<unit id="org.eclipse.ecf.core.feature.group" version="0.0.0"/>
<unit id="org.eclipse.wildwebdeveloper.feature.feature.group" version="0.0.0"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
<repository location="https://download.eclipse.org/nebula/releases/latest/"/>
<unit id="org.eclipse.nebula.widgets.oscilloscope.css.feature.feature.group" version="0.0.0"/>
<unit id="org.eclipse.nebula.widgets.oscilloscope.feature.feature.group" version="0.0.0"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
<repository location="http://download.eclipse.org/mylyn/releases/latest"/>
<unit id="org.eclipse.mylyn.context_feature.feature.group" version="3.26.0.v20221229-1738"/>
<unit id="org.eclipse.mylyn_feature.feature.group" version="3.26.0.v20230416-1636"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
<repository location="https://download.eclipse.org/egit/updates"/>
<unit id="org.eclipse.egit.feature.group" version="6.8.0.202311291450-r"/>
<unit id="org.eclipse.egit.source.feature.group" version="6.8.0.202311291450-r"/>
<unit id="org.eclipse.jgit.feature.group" version="6.8.0.202311291450-r"/>
<unit id="org.eclipse.egit.gitflow.feature.feature.group" version="6.8.0.202311291450-r"/>
<unit id="org.eclipse.jgit.gpg.bc.feature.group" version="6.8.0.202311291450-r"/>
<unit id="org.eclipse.jgit.http.apache.feature.group" version="6.8.0.202311291450-r"/>
<unit id="org.eclipse.jgit.lfs.feature.group" version="6.8.0.202311291450-r"/>
<unit id="org.eclipse.jgit.pgm.feature.group" version="6.8.0.202311291450-r"/>
<unit id="org.eclipse.jgit.source.feature.group" version="6.8.0.202311291450-r"/>
<unit id="org.eclipse.jgit.ssh.apache.feature.group" version="6.8.0.202311291450-r"/>
<unit id="org.eclipse.jgit.ssh.jsch.feature.group" version="6.8.0.202311291450-r"/>
</location>
<location includeDependencyDepth="none" includeDependencyScopes="compile" includeSource="true" label="DirectFromMaven" missingManifest="error" type="Maven">
<dependencies>
<dependency>
<groupId>com.github.luben</groupId>
<artifactId>zstd-jni</artifactId>
<version>1.5.5-11</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
Expand Down
4 changes: 2 additions & 2 deletions io.sloeber.tests/src/io/sloeber/core/CompileAndUpload.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import io.sloeber.providers.ESP32;
import io.sloeber.providers.ESP8266;
import io.sloeber.providers.MCUBoard;
import io.sloeber.providers.Teensy;
import io.sloeber.ui.monitor.SerialConnection;

@SuppressWarnings({"nls","unused"})
Expand Down Expand Up @@ -134,8 +135,7 @@ public static void installAdditionalBoards() {
Arduino.installLatestSamDBoards();
Arduino.installLatestIntellCurieBoards();
Arduino.installLatestSamBoards();

BoardsManager.addPrivateHardwarePath(MySystem.getTeensyPlatform());
Teensy.installLatest();

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,7 @@ private static boolean skipExample(Example example) {
}

public static void installAdditionalBoards() {
if (MySystem.getTeensyPlatform().isEmpty()) {
System.err.println("ERROR: Teensy not installed/configured skipping tests!!!");
} else {
BoardsManager.addPrivateHardwarePath(MySystem.getTeensyPlatform());
}

Teensy.installLatest();
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public class CreateAndCompileDefaultInoOnAllBoardsTest {
private static final boolean removeAllinstallationInfoAtStartup = false;
private static final boolean skipPlatformInstallation = false;
private static final boolean apply_known_work_Arounds = true;
private static final boolean testPrivateHardware = true;
private static final boolean closeFailedProjects = false;
private static int myBuildCounter = 0;
private static int myTotalFails = 0;
Expand Down Expand Up @@ -323,10 +322,6 @@ public static void installAdditionalBoards() {
}
BoardsManager.setPackageURLs(toAddList, true);

if (testPrivateHardware) {
BoardsManager.addPrivateHardwarePath(MySystem.getTeensyPlatform());
}

if (!skipPlatformInstallation) {
BoardsManager.installAllLatestPlatforms();
// PackageManager.installsubsetOfLatestPlatforms(0,5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,6 @@ public static void installAdditionalBoards() {
LibraryManager.installAllLatestLibraries();
// LibraryManager.onlyKeepLatestPlatforms();
}
if (MySystem.getTeensyPlatform().isEmpty()) {
System.err.println("ERROR: Teensy not installed/configured skipping tests!!!");
} else {
BoardsManager.addPrivateHardwarePath(MySystem.getTeensyPlatform());
}
BoardsManager.installAllLatestPlatforms();

}
Expand Down
Loading

0 comments on commit cb66d22

Please sign in to comment.