Skip to content

Commit

Permalink
feat: Added native image config for osx, also split for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
jagodevreede committed Oct 12, 2024
1 parent a579239 commit b6faf72
Show file tree
Hide file tree
Showing 23 changed files with 1,458 additions and 24 deletions.
7 changes: 6 additions & 1 deletion DESIGN_DECISIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,9 @@
The JDK jars contain files with symlinks in them, this is not properly supported by for example commons-compress.
Also file permissions are not working, so files can't be executed.

Therefor the choice has been made to just use os tools like unzip and tar on osx and linux. And 7z on windows.
Therefor the choice has been made to just use os tools like unzip and tar on osx and linux. And 7z on windows.

## native-image folder
The files generated by the agent in native-image are very os dependent, so we need a set for every os, the best solution
would be to set the `agentDir` property in the gluon plugin, however does not work. So we copy the files manually. First
in the `validate` phase and then we need to put it back manually.
5 changes: 3 additions & 2 deletions buildAndRun.cmd
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@echo off
call mvnw install -Dmaven.test.skip=true
call mvnw javafx:run -f sdkman-ui
::call mvnw install -Dmaven.test.skip=true
::call mvnw javafx:run -f sdkman-ui
call mvnw gluonfx:runagent -f sdkman-ui
6 changes: 6 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,12 @@
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
Expand Down
2 changes: 2 additions & 0 deletions sdkman-ui/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Ignore generated native image resources as the correct ones are copied into this folder
src/main/resources/META-INF/native-image
30 changes: 27 additions & 3 deletions sdkman-ui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
<attach.version>4.0.19</attach.version>
<native.maven.plugin.version>0.10.1</native.maven.plugin.version>
<main.class>io.github.jagodevreede.sdkmanui.Main</main.class>
<maven-resources-plugin.version>3.3.1</maven-resources-plugin.version>
<maven-assembly-plugin.version>3.7.1</maven-assembly-plugin.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -77,6 +79,10 @@
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
Expand Down Expand Up @@ -107,8 +113,26 @@
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<artifactId>maven-resources-plugin</artifactId>
<version>${maven-resources-plugin.version}</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/src/main/resources/META-INF/native-image</outputDirectory>
<resources>
<resource>
<directory>src/main/resources/META-INF/native-image-${os.name}</directory>
<filtering>false</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
Expand All @@ -130,7 +154,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.7.1</version>
<version>${maven-assembly-plugin.version}</version>
<executions>
<execution>
<id>assemble-windows</id>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public void initialize(URL url, ResourceBundle resourceBundle) {
table.setPlaceholder(new Label("No versions found"));
table.getColumns().clear();

javaSelected();
switchCandidate("java");
showInstalledOnly.selectedProperty().addListener((observable, oldValue, newValue) -> {
sdkManUiPreferences.showInstalled = newValue;
sdkManUiPreferences.saveQuite();
Expand Down Expand Up @@ -216,14 +216,6 @@ private static TableColumn<VersionView, String> getTableColumn(String title, Str
return vendorCol;
}

public void javaSelected() {
switchCandidate("java");
}

public void mavenSelected() {
switchCandidate("maven");
}

public void openConfig() throws IOException {
URL configFxml = Main.class.getClassLoader().getResource("config.fxml");
Parent root = FXMLLoader.load(configFxml);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,11 @@ public void runUpdate() {

Optional<String> downloadUrl = getDownloadUrl(getLatestGitHubRelease().getLatestReleaseDownloads());
if (!downloadUrl.isPresent()) {
ServiceRegistry.INSTANCE.getPopupView()
.showError("Did not find the download url yet please visit the github page, and download the update manually");
ServiceRegistry.INSTANCE.getPopupView().showError("Did not find the download url yet please visit the github page, and download the update manually");
return;
}
DownloadTask downloadTask = new DownloadTask(downloadUrl.get(), tempFile, destFile, null);
PopupView.ProgressWindow progressWindow = ServiceRegistry.INSTANCE.getPopupView()
.showProgress("Download of update in progress", downloadTask);
PopupView.ProgressWindow progressWindow = ServiceRegistry.INSTANCE.getPopupView().showProgress("Download of update in progress", downloadTask);
ProgressInformation progressInformation = current -> {
if (current > 0) {
Platform.runLater(() -> progressWindow.progressBar().setProgress(current / 100.0));
Expand Down
Loading

0 comments on commit b6faf72

Please sign in to comment.