-
Notifications
You must be signed in to change notification settings - Fork 53
/
PackageWindows.ps1
46 lines (35 loc) · 1.71 KB
/
PackageWindows.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
$CURRENT_DIR = Split-Path -Parent $MyInvocation.MyCommand.Definition
$TARGET_DIR = "$CURRENT_DIR/target"
$RELEASE_JAR_FILE_Filter = 'ApkToolBoxGUI-*.jar'
$RELEASE_JAR_FILE = Get-ChildItem -Path "$TARGET_DIR" -Filter $RELEASE_JAR_FILE_Filter
$VERSION = $RELEASE_JAR_FILE.BaseName.Replace("ApkToolBoxGUI-", "").Replace(".jar", "")
$TMP_DIR = "$TARGET_DIR/release"
# Build $TARGET_DIR/ApkToolBoxGUI-$VERSION-without-JRE.zip
if (Test-Path $TMP_DIR) {
Remove-Item $TMP_DIR -Recurse -Force
}
If (!(Test-Path $TMP_DIR)) {
New-Item -ItemType Directory -Force -Path $TMP_DIR
}
Copy-Item $RELEASE_JAR_FILE.FullName "$TMP_DIR/ApkToolBoxGUI.jar"
Copy-Item "$CURRENT_DIR/ApkToolBoxGUI.bat" $TMP_DIR
Compress-Archive -Path "$TMP_DIR\*" -DestinationPath "$TARGET_DIR/ApkToolBoxGUI-$VERSION-without-JRE-Windows.zip" -Force
# Build $TARGET_DIR/ApkToolBoxGUI-$VERSION-with-JRE.zip
if (Test-Path $TMP_DIR) {
Remove-Item $TMP_DIR -Recurse -Force
}
If (!(Test-Path $TMP_DIR)) {
New-Item -ItemType Directory -Force -Path $TMP_DIR
}
if (Test-Path "$TARGET_DIR/ApkToolBoxGUI-$VERSION-with-JRE") {
Remove-Item "$TARGET_DIR/ApkToolBoxGUI-$VERSION-with-JRE" -recurse
}
Copy-Item $RELEASE_JAR_FILE.FullName "$TMP_DIR/ApkToolBoxGUI.jar"
jpackage --input $TMP_DIR --type app-image --name "ApkToolBoxGUI-$VERSION-with-JRE" --main-jar 'ApkToolBoxGUI.jar' --dest "$TARGET_DIR" --verbose
Compress-Archive -Path "$TARGET_DIR/ApkToolBoxGUI-$VERSION-with-JRE\*" -DestinationPath "$TARGET_DIR/ApkToolBoxGUI-$VERSION-with-JRE-Windows.zip" -Force
if (Test-Path $TMP_DIR) {
Remove-Item $TMP_DIR -Recurse -Force
}
if (Test-Path "$TARGET_DIR/ApkToolBoxGUI-$VERSION-with-JRE") {
Remove-Item "$TARGET_DIR/ApkToolBoxGUI-$VERSION-with-JRE" -Recurse -Force
}