-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
75 lines (73 loc) · 1.68 KB
/
build.sh
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/bash
CUR_DIR=`pwd`
PATH=$PATH:/c/Program\ Files/Java/jdk-21/bin
FX_PATH=/d/software/openjfx/javafx-sdk-21.0.2
TARGET_NAME=hello.jar
PKG_NAME=demo
MAIN_CLASS=fx.Main
BASE=/d/project/fx-hello
OUTPUT_BASE=$BASE/out
DIST_DIR=$OUTPUT_BASE/dist_bash
COMPILED_DIR=$OUTPUT_BASE/production/fx-hello
PKGED_JAR_DIR=$OUTPUT_BASE/artifacts/hello
INPUT_HOME=$PKGED_JAR_DIR
function copyFxDynamicLib() {
local FX_DYNAMIC_LIB_PATH=$FX_PATH/bin
local DIST_DIR_BIN=$DIST_DIR/$PKG_NAME/runtime/bin
cp -n $FX_DYNAMIC_LIB_PATH/* $DIST_DIR_BIN
}
function copyFxJar() {
if [[ ! -x $PKGED_JAR_DIR ]] then
mkdir -p $PKGED_JAR_DIR
fi
local FX_LIBS_PATH=$FX_PATH/lib
for cj in `ls $FX_LIBS_PATH`
do
if [[ $cj == *".jar" ]] then
cp -n $FX_LIBS_PATH/$cj $PKGED_JAR_DIR
fi
done
}
function pkgCompiledJar() {
if [[ -f $PKGED_JAR_DIR/$TARGET_NAME ]] then
local cmd
echo 'jar exists ,y to re-pkg jar '
read cmd
if [[ $cmd != 'y' ]] then
echo 'no repackage jar'
return
fi
fi
cd $PKGED_JAR_DIR
rm -f ./$TARGET_NAME
jar -cvf $TARGET_NAME -C $COMPILED_DIR .
}
function buildImage(){
if [[ -d $DIST_DIR/$PKG_NAME ]] then
local cmd
echo 'image exists,y to rebuild image'
read cmd
if [[ $cmd != 'y' ]] then
echo 'no build img'
return
fi
fi
if [[ ! -d $DIST_DIR ]] then
mkdir -p $DIST_DIR
fi
cd $DIST_DIR
rm -rf ./$PKG_NAME
jpackage --type app-image \
--name $PKG_NAME \
--input $INPUT_HOME \
--main-jar $TARGET_NAME \
--main-class $MAIN_CLASS \
--java-options -Xmx1G \
--icon $BASE/useless/icon.ico \
--win-console
copyFxDynamicLib
}
copyFxJar
pkgCompiledJar
buildImage
cd $CUR_DIR