Skip to content

Commit f2f1cc3

Browse files
committed
prepare for 0.1.1 release
Bump the packaged app to 0.1.1 and make release scripts consistently pick the latest built jar and app version metadata.
1 parent 67e0179 commit f2f1cc3

File tree

5 files changed

+67
-13
lines changed

5 files changed

+67
-13
lines changed

java-frontend/PACKAGING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,6 @@ chmod +x appimagetool-x86_64.AppImage
4545
bash java-frontend/package-linux-appimage.sh \
4646
java-frontend/target/xrayview \
4747
java-frontend/target/release/XRayView.AppImage \
48-
0.1.0 \
48+
0.1.1 \
4949
./appimagetool-x86_64.AppImage
5050
```

java-frontend/package-app-image.sh

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,31 @@ APP_NAME="XRayView"
88
APP_IMAGE_DIR="$TARGET_DIR/app-image"
99
APP_INPUT_DIR="$TARGET_DIR/jpackage-input"
1010
BACKEND_BINARY="${1:-}"
11+
APP_VERSION="${2:-}"
1112
BACKEND_NAME=""
13+
PROJECT_JAR=""
14+
15+
resolve_project_jar() {
16+
local candidates=()
17+
local latest=""
18+
19+
shopt -s nullglob
20+
candidates=("$TARGET_DIR"/xrayview-java-frontend-*.jar)
21+
shopt -u nullglob
22+
23+
if [ "${#candidates[@]}" -eq 0 ]; then
24+
return 1
25+
fi
26+
27+
latest="${candidates[0]}"
28+
for candidate in "${candidates[@]:1}"; do
29+
if [ "$candidate" -nt "$latest" ]; then
30+
latest="$candidate"
31+
fi
32+
done
33+
34+
basename "$latest"
35+
}
1236

1337
if ! command -v jpackage >/dev/null 2>&1; then
1438
printf 'jpackage is required but was not found on PATH.\n' >&2
@@ -40,20 +64,27 @@ BACKEND_NAME="$(basename "$BACKEND_BINARY")"
4064
rm -rf "$APP_IMAGE_DIR" "$APP_INPUT_DIR"
4165
mkdir -p "$APP_INPUT_DIR/lib" "$APP_INPUT_DIR/backend"
4266

43-
PROJECT_JAR="$(basename "$TARGET_DIR"/xrayview-java-frontend-*.jar)"
67+
PROJECT_JAR="$(resolve_project_jar)"
4468
cp "$TARGET_DIR/$PROJECT_JAR" "$APP_INPUT_DIR/"
4569
cp "$TARGET_DIR"/lib/*.jar "$APP_INPUT_DIR/lib/"
4670
cp "$BACKEND_BINARY" "$APP_INPUT_DIR/backend/$BACKEND_NAME"
4771
chmod +x "$APP_INPUT_DIR/backend/$BACKEND_NAME"
4872

49-
jpackage \
50-
--type app-image \
51-
--dest "$APP_IMAGE_DIR" \
52-
--input "$APP_INPUT_DIR" \
53-
--name "$APP_NAME" \
54-
--main-jar "$PROJECT_JAR" \
55-
--main-class "com.xrayview.frontend.XRayViewLauncher" \
73+
jpackage_args=(
74+
--type app-image
75+
--dest "$APP_IMAGE_DIR"
76+
--input "$APP_INPUT_DIR"
77+
--name "$APP_NAME"
78+
--main-jar "$PROJECT_JAR"
79+
--main-class "com.xrayview.frontend.XRayViewLauncher"
5680
--java-options "--enable-native-access=ALL-UNNAMED"
81+
)
82+
83+
if [ -n "$APP_VERSION" ]; then
84+
jpackage_args+=(--app-version "$APP_VERSION")
85+
fi
86+
87+
jpackage "${jpackage_args[@]}"
5788

5889
printf 'Created app image at %s/%s\n' "$APP_IMAGE_DIR" "$APP_NAME"
5990
printf 'Bundled backend copied to lib/app/backend/%s inside the app image.\n' "$BACKEND_NAME"

java-frontend/package-linux-appimage.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ fi
3535
OUTPUT_DIR="$(dirname "$OUTPUT_APPIMAGE")"
3636
mkdir -p "$OUTPUT_DIR"
3737

38-
bash "$PROJECT_DIR/package-app-image.sh" "$BACKEND_BINARY"
38+
bash "$PROJECT_DIR/package-app-image.sh" "$BACKEND_BINARY" "$APP_VERSION"
3939

4040
if [ ! -d "$APP_BUNDLE_DIR" ]; then
4141
printf 'Expected jpackage app-image at %s\n' "$APP_BUNDLE_DIR" >&2

java-frontend/package-windows-msi.sh

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,29 @@ ICON_FILE="$TARGET_DIR/xrayview-placeholder.ico"
1313
BACKEND_BINARY="${1:-}"
1414
APP_VERSION="${2:-}"
1515
BACKEND_NAME=""
16+
PROJECT_JAR=""
17+
18+
resolve_project_jar() {
19+
local candidates=()
20+
local latest=""
21+
22+
shopt -s nullglob
23+
candidates=("$TARGET_DIR"/xrayview-java-frontend-*.jar)
24+
shopt -u nullglob
25+
26+
if [ "${#candidates[@]}" -eq 0 ]; then
27+
return 1
28+
fi
29+
30+
latest="${candidates[0]}"
31+
for candidate in "${candidates[@]:1}"; do
32+
if [ "$candidate" -nt "$latest" ]; then
33+
latest="$candidate"
34+
fi
35+
done
36+
37+
basename "$latest"
38+
}
1639

1740
if ! command -v jpackage >/dev/null 2>&1; then
1841
printf 'jpackage is required but was not found on PATH.\n' >&2
@@ -47,14 +70,14 @@ fi
4770
BACKEND_NAME="$(basename "$BACKEND_BINARY")"
4871

4972
if [ -z "$APP_VERSION" ]; then
50-
printf 'Pass the numeric app version as the second argument, for example 0.1.0.\n' >&2
73+
printf 'Pass the numeric app version as the second argument, for example 0.1.1.\n' >&2
5174
exit 1
5275
fi
5376

5477
rm -rf "$INSTALLER_DIR" "$APP_INPUT_DIR"
5578
mkdir -p "$INSTALLER_DIR" "$APP_INPUT_DIR/lib" "$APP_INPUT_DIR/backend"
5679

57-
PROJECT_JAR="$(basename "$TARGET_DIR"/xrayview-java-frontend-*.jar)"
80+
PROJECT_JAR="$(resolve_project_jar)"
5881
cp "$TARGET_DIR/$PROJECT_JAR" "$APP_INPUT_DIR/"
5982
cp "$TARGET_DIR"/lib/*.jar "$APP_INPUT_DIR/lib/"
6083
cp "$BACKEND_BINARY" "$APP_INPUT_DIR/backend/$BACKEND_NAME"

java-frontend/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>com.xrayview</groupId>
66
<artifactId>xrayview-java-frontend</artifactId>
7-
<version>0.1.0-SNAPSHOT</version>
7+
<version>0.1.1</version>
88
<name>XRayView Java Frontend</name>
99

1010
<properties>

0 commit comments

Comments
 (0)