Skip to content

Commit

Permalink
Improve the launcher command line interface and improve setup command. (
Browse files Browse the repository at this point in the history
#1682)

* More in-depth `--setup`. Add defaults and way to update release channels.

* Bundle apache commons CLI. Port CLI parsing. Add simple test for parsing.

* Fix argument for `--javaOptions`

* Remove `stopAtNonOption`. Remove `--updateAlpha` and `--nolauncher`

* Add apache commons CLI to tools and libraries. Make help dialog better. Centralize copyright lines and CLI utilities.

* Remove release channel selection from interactive setup.

* Add update site to cli setup. Rename reload release channels to launcher metadata. Make update printout nicer.

* Add Apache Commons CLI to the readme.
  • Loading branch information
ThatRedox authored Oct 19, 2024
1 parent 92a5cfd commit eb88139
Show file tree
Hide file tree
Showing 8 changed files with 503 additions and 112 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,9 @@ Chunky uses the following 3rd party libraries:
- **Apache Maven Artifact by the Apache Software Foundation**
The library is covered by the Apache License, version 2.0.
See the file `licenses/Apache-2.0.txt` for the full license text.
- **Apache Commons CLI by the Apache Software Foundation**
The library is covered by the Apache License, version 2.0.
See the file `licenses/Apache-2.0.txt` for the full license text.
- **FastUtil by Sebastiano Vigna**
FastUtil is covered by Apache License, version 2.0.
See the file `licenses/Apache-2.0.txt` for the full license text.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import javafx.scene.layout.VBox;
import javafx.scene.text.Font;
import javafx.stage.Stage;
import se.llbit.chunky.HelpCopyright;
import se.llbit.chunky.main.Chunky;
import se.llbit.chunky.plugin.PluginApi;
import se.llbit.chunky.ui.ChunkyFx;
Expand All @@ -49,10 +50,11 @@
import se.llbit.util.Pair;

public class CreditsController implements Initializable {

@FXML
private Label version;
@FXML
public Label copyrightLine;
@FXML
private Hyperlink gplv3;
@FXML
private Hyperlink markdown;
Expand Down Expand Up @@ -83,6 +85,10 @@ public class CreditsController implements Initializable {
@FXML
private Hyperlink lz4JavaLicense;
@FXML
private Hyperlink apacheCli;
@FXML
private Hyperlink apacheCliLicense;
@FXML
private VBox pluginBox;
@FXML
private ImageView logoImage;
Expand Down Expand Up @@ -140,6 +146,8 @@ public void initialize(URL location, ResourceBundle resources) {

version.setText(Chunky.getMainWindowTitle());

copyrightLine.setText(HelpCopyright.COPYRIGHT_LINE);

gplv3.setOnAction(
e -> launchAndReset(gplv3, "https://github.com/chunky-dev/chunky/blob/master/LICENSE")
);
Expand Down Expand Up @@ -189,6 +197,11 @@ public void initialize(URL location, ResourceBundle resources) {
lz4JavaLicense.setBorder(Border.EMPTY);
lz4JavaLicense.setOnAction(e -> launchAndReset(lz4JavaLicense, "https://github.com/lz4/lz4-java/blob/master/LICENSE.txt"));

apacheCli.setBorder(Border.EMPTY);
apacheCli.setOnAction(e -> launchAndReset(apacheCli, "https://commons.apache.org/proper/commons-cli/"));
apacheCliLicense.setBorder(Border.EMPTY);
apacheCliLicense.setOnAction(e -> launchAndReset(apacheCliLicense, "http://www.apache.org/licenses/LICENSE-2.0"));

if (!plugins.isEmpty()) {
plugins.forEach((key, item) -> pluginBox.getChildren().addAll(buildBox(item)));
} else {
Expand Down
16 changes: 15 additions & 1 deletion chunky/src/res/se/llbit/chunky/ui/dialogs/Credits.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<Font name="System Bold" size="14.0"/>
</font>
</Label>
<Label text="Copyright (c) 2010-2024, Jesper Öqvist and Chunky contributors." wrapText="true">
<Label fx:id="copyrightLine" text="Copyright (c) 2010-2024, Jesper Öqvist and Chunky contributors" wrapText="true">
<padding>
<Insets top="10.0"/>
</padding>
Expand Down Expand Up @@ -249,6 +249,20 @@
<Insets left="20.0" />
</padding>
</Hyperlink>

<Hyperlink fx:id="apacheCli" text="Apache Commons CLI">
<padding>
<Insets/>
</padding>
</Hyperlink>
<Hyperlink fx:id="apacheCliLicense" text="Apache License 2.0">
<font>
<Font size="10.0"/>
</font>
<padding>
<Insets left="20.0"/>
</padding>
</Hyperlink>
</children>
</VBox>
</children>
Expand Down
27 changes: 20 additions & 7 deletions launcher/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@ configurations {
}

dependencies {
bundled 'org.apache.maven:maven-artifact:3.9.9'
bundled 'org.apache.maven:maven-artifact:3.9.9'
bundled 'commons-cli:commons-cli:1.6.0'

implementation project(':lib')
implementation project(':lib')

testImplementation 'com.google.truth:truth:1.1.3'
testImplementation 'junit:junit:4.13.2'
}

java {
Expand All @@ -21,13 +25,22 @@ java {
}
}

sourceSets.main {
java.srcDir 'src'
sourceSets {
main {
java {
srcDir 'src'
}
resources {
srcDir 'src'
include '**/*.png'
include '**/*.fxml'
srcDir 'src'
include '**/*.png'
include '**/*.fxml'
}
}
test {
java {
srcDir 'test'
}
}
}

jar {
Expand Down
Loading

0 comments on commit eb88139

Please sign in to comment.