Skip to content

Commit

Permalink
Replace semver4j with maven-artifact and remove library jars from the…
Browse files Browse the repository at this point in the history
… git repo. (#1775)

* Replace semver4j with maven-artifact.

* Exclude manifest files of dependencies from the launcher fat jar.

* Add a gradle task that extracts all dependency jars so that we don't have to keep the jars in git.
  • Loading branch information
leMaik authored Sep 29, 2024
1 parent 0bc1302 commit ed28030
Show file tree
Hide file tree
Showing 13 changed files with 24 additions and 33 deletions.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,6 @@ Chunky uses the following 3rd party libraries:
See the file `licenses/Apache-2.0.txt` for the full license text.
See the file `licenses/lz4-java.txt` for the copyright notice.
lz4-java uses LZ4, by Yann Collet, which is covered by the BSD 2-Clause license. See the file `licenses/lz4.txt` for the copyright notice and full license.
- **Semver4j by Vincent Durmont**
The library is covered by the MIT License.
See the file `licenses/semver4j.txt` for the copyright notice.

## Special Thanks

Expand Down
12 changes: 12 additions & 0 deletions chunky/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ configurations {
implementation.extendsFrom configurations.nbtlib
implementation.extendsFrom configurations.cplib
implementation.extendsFrom configurations.toolpanelib

// dependencies that are not bundled with chunky-core but downloaded separately by the launcher
externalDependencies {
extendsFrom configurations.implementation
exclude group: "se.llbit" // bundled in chunky-core
exclude group: "org.openjfx" // provided at runtime
}
}

dependencies {
Expand Down Expand Up @@ -104,6 +111,11 @@ task sourcesJar(type: Jar) {
archiveClassifier.set('sources')
}

task copyExternalDependencies(type: Copy) {
into "${buildDir}/${libsDirName}"
from configurations.externalDependencies
}

artifacts {
archives javadocJar, sourcesJar
}
Expand Down
Binary file removed chunky/lib/commons-math3-3.2.jar
Binary file not shown.
Binary file removed chunky/lib/fastutil-8.4.4.jar
Binary file not shown.
Binary file removed chunky/lib/gson-2.9.0.jar
Binary file not shown.
Binary file removed chunky/lib/lz4-java-1.8.0.jar
Binary file not shown.
Binary file removed chunky/lib/maven-artifact-3.9.9.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,6 @@ public class CreditsController implements Initializable {
@FXML
private Hyperlink simplexnoiseLicense;
@FXML
private Hyperlink semver4j;
@FXML
private Hyperlink semver4jLicense;
@FXML
private Hyperlink lz4Java;
@FXML
private Hyperlink lz4JavaLicense;
Expand Down Expand Up @@ -188,11 +184,6 @@ public void initialize(URL location, ResourceBundle resources) {
simplexnoiseLicense.setBorder(Border.EMPTY);
simplexnoiseLicense.setOnAction(e -> launchAndReset(simplexnoiseLicense, "https://unlicense.org/"));

semver4j.setBorder(Border.EMPTY);
semver4j.setOnAction(e -> launchAndReset(semver4j, "https://github.com/vdurmont/semver4j"));
semver4jLicense.setBorder(Border.EMPTY);
semver4jLicense.setOnAction(e -> launchAndReset(semver4jLicense, "https://github.com/vdurmont/semver4j/blob/master/LICENSE.md"));

lz4Java.setBorder(Border.EMPTY);
lz4Java.setOnAction(e -> launchAndReset(lz4Java, "https://github.com/lz4/lz4-java"));
lz4JavaLicense.setBorder(Border.EMPTY);
Expand Down
14 changes: 0 additions & 14 deletions chunky/src/res/se/llbit/chunky/ui/dialogs/Credits.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -236,20 +236,6 @@
</padding>
</Hyperlink>

<Hyperlink fx:id="semver4j" text="semver4j">
<padding>
<Insets/>
</padding>
</Hyperlink>
<Hyperlink fx:id="semver4jLicense" text="MIT License">
<font>
<Font size="10.0" />
</font>
<padding>
<Insets left="20.0" />
</padding>
</Hyperlink>

<Hyperlink fx:id="lz4Java" text="lz4-java">
<padding>
<Insets/>
Expand Down
4 changes: 3 additions & 1 deletion launcher/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ configurations {
}

dependencies {
bundled 'com.vdurmont:semver4j:3.1.0'
bundled 'org.apache.maven:maven-artifact:3.9.9'

implementation project(':lib')
}
Expand Down Expand Up @@ -44,5 +44,7 @@ jar {
// Include other dependencies
from {
configurations.bundled.collect { it.isDirectory() ? it : zipTree(it) }
} {
exclude "META-INF/*"
}
}
6 changes: 4 additions & 2 deletions launcher/src/se/llbit/chunky/launcher/ChunkyLauncher.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
*/
package se.llbit.chunky.launcher;

import com.vdurmont.semver4j.Semver;
import javafx.stage.Stage;
import org.apache.maven.artifact.versioning.ArtifactVersion;
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
import se.llbit.chunky.PersistentSettings;
import se.llbit.chunky.launcher.ui.ChunkyLauncherFx;
import se.llbit.chunky.launcher.ui.DebugConsole;
Expand Down Expand Up @@ -46,7 +47,8 @@
*/
public class ChunkyLauncher {

public static final Semver LAUNCHER_VERSION = new Semver("1.14.0");
public static final ArtifactVersion LAUNCHER_VERSION = new DefaultArtifactVersion("1.14.0");

public static final int LAUNCHER_SETTINGS_REVISION = 1;

/**
Expand Down
7 changes: 4 additions & 3 deletions launcher/src/se/llbit/chunky/launcher/LauncherInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
*/
package se.llbit.chunky.launcher;

import com.vdurmont.semver4j.Semver;
import org.apache.maven.artifact.versioning.ArtifactVersion;
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
import se.llbit.json.JsonArray;
import se.llbit.json.JsonObject;
import se.llbit.json.JsonValue;
Expand All @@ -32,7 +33,7 @@ public class LauncherInfo {
public final String path;

public final Date date;
public final Semver version;
public final ArtifactVersion version;

public final Map<String, ReleaseChannel> channels = new LinkedHashMap<>();

Expand All @@ -46,7 +47,7 @@ public LauncherInfo() {
}

public LauncherInfo(JsonObject obj) {
version = new Semver(obj.get("name").stringValue(""));
version = new DefaultArtifactVersion(obj.get("name").stringValue(""));
notes = obj.get("notes").stringValue("");
path = obj.get("path").stringValue("ChunkyLauncher.jar");
date = Util.dateFromISO8601(obj.get("timestamp").stringValue(""));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ public void updateLauncher(Consumer<String> errorCallback, Consumer<LauncherInfo
errorCallback,
info -> {
if (info != null) {
if (info.version.isGreaterThan(ChunkyLauncher.LAUNCHER_VERSION)) {
if (info.version.compareTo(ChunkyLauncher.LAUNCHER_VERSION) > 0) {
Platform.runLater(() -> {
try {
LauncherUpdateDialog updateDialog = new LauncherUpdateDialog(settings, info);
Expand Down

0 comments on commit ed28030

Please sign in to comment.