feat: init build release
This commit is contained in:
106
bin/build.sh
Normal file
106
bin/build.sh
Normal file
@@ -0,0 +1,106 @@
|
||||
#!/bin/bash
|
||||
ProjectL=wfc
|
||||
ProjectU=WFC
|
||||
RelVersion=1.0.2
|
||||
RelDate=`date +%Y%m%d`
|
||||
GitRootDir=${HOME}/wfc.git
|
||||
BERootDir=${GitRootDir}/be.wfc
|
||||
FERootDir=${GitRootDir}/fe.wfc
|
||||
FEUserRootDir=${GitRootDir}/fe.wfc.user
|
||||
BuildRootDir=${GitRootDir}/build.wfc
|
||||
|
||||
WFCWorkDir=/opt/wfc
|
||||
BuildDockerDir=${BuildRootDir}/build/docker
|
||||
ReleseDir=${BuildRootDir}/release
|
||||
TarFileName=${ProjectL}-${RelVersion}-${RelDate}.tar.gz
|
||||
|
||||
usage() {
|
||||
echo "Usage: sh build.sh [extras|jar|dist|copy|tar|deb|all]"
|
||||
exit 1
|
||||
}
|
||||
|
||||
build-extras(){
|
||||
echo -n "Begin build extras file ... "
|
||||
cd ${BuildRootDir}
|
||||
git pull
|
||||
cd bin
|
||||
javac printJarVer.java
|
||||
echo "done"
|
||||
}
|
||||
|
||||
build-jar(){
|
||||
cd ${BERootDir}
|
||||
git pull
|
||||
mvn clean package -Dmaven.test.skip=true -P prod
|
||||
}
|
||||
|
||||
build-dist(){
|
||||
cd ${FERootDir}
|
||||
git pull
|
||||
pnpm i
|
||||
pnpm build
|
||||
|
||||
cd ${FEUserRootDir}
|
||||
git pull
|
||||
pnpm i
|
||||
pnpm build
|
||||
}
|
||||
|
||||
copy-file(){
|
||||
${BuildRootDir}/bin/copy.sh
|
||||
cp -f ${BuildRootDir}/bin/printJarVer.class ${BuildRootDir}/build/bin/
|
||||
}
|
||||
|
||||
# build tar package
|
||||
build-tar(){
|
||||
echo -n "Begin build tar package ... "
|
||||
cd ${BuildRootDir}/build
|
||||
tar cvfz ${ReleseDir}/tars/${TarFileName} bin docker systemd 1>/dev/null
|
||||
echo "done"
|
||||
}
|
||||
|
||||
# build deb package
|
||||
build-deb(){
|
||||
echo -n "Begin build deb package ... "
|
||||
echo "done"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
"extras")
|
||||
build-extras
|
||||
;;
|
||||
"jar")
|
||||
build-jar
|
||||
;;
|
||||
"dist")
|
||||
build-dist
|
||||
;;
|
||||
"copy")
|
||||
copy-file
|
||||
;;
|
||||
"tar")
|
||||
build-extras
|
||||
build-jar
|
||||
build-dist
|
||||
copy-file
|
||||
build-tar
|
||||
;;
|
||||
"deb")
|
||||
build-extras
|
||||
build-jar
|
||||
build-dist
|
||||
copy-file
|
||||
build-deb
|
||||
;;
|
||||
"all")
|
||||
build-extras
|
||||
build-jar
|
||||
build-dist
|
||||
copy-file
|
||||
build-tar
|
||||
build-deb
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
74
bin/copy.sh
Normal file
74
bin/copy.sh
Normal file
@@ -0,0 +1,74 @@
|
||||
#!/bin/bash
|
||||
|
||||
GitRootDir=${HOME}/wfc.git
|
||||
BERootDir=${GitRootDir}/be.wfc
|
||||
FERootDir=${GitRootDir}/fe.wfc
|
||||
FEUserRootDir=${GitRootDir}/fe.wfc.user
|
||||
BuildRootDir=${GitRootDir}/build.wfc
|
||||
|
||||
WFCWorkDir=/opt/wfc
|
||||
BuildDockerDir=${BuildRootDir}/build/docker
|
||||
|
||||
# 复制项目的文件到对应docker路径,便于一键生成镜像。
|
||||
usage() {
|
||||
echo "Usage: sh copy.sh"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# copy sql
|
||||
echo -n "Begin copy sql ... "
|
||||
cp ${BERootDir}/sql/wfc_config_db/wfc_config_db.sql ${BuildDockerDir}/mysql/db
|
||||
cp ${BERootDir}/sql/wfc_system_db/wfc_system_db.sql ${BuildDockerDir}/mysql/db
|
||||
cp ${BERootDir}/sql/wfc_user_db/wfc_user_db.sql ${BuildDockerDir}/mysql/db
|
||||
#ln -sf /tmp ${BuildDockerDir}/mysql/
|
||||
echo "done"
|
||||
|
||||
# copy html
|
||||
echo -n "Begin copy system html ... "
|
||||
mkdir -p ${BuildDockerDir}/nginx/html/dist/sys
|
||||
rm -rf ${BuildDockerDir}/nginx/html/dist/sys/*
|
||||
cp -rf ${FERootDir}/dist/* ${BuildDockerDir}/nginx/html/dist/sys/
|
||||
echo "done"
|
||||
|
||||
echo -n "Begin copy user html ... "
|
||||
mkdir -p ${BuildDockerDir}/nginx/html/dist/u
|
||||
rm -rf ${BuildDockerDir}/nginx/html/dist/u/*
|
||||
cp -rf ${FEUserRootDir}/dist/* ${BuildDockerDir}/nginx/html/dist/u/
|
||||
echo "done"
|
||||
|
||||
# copy jar
|
||||
echo -n "Begin copy wfc-gateway ... "
|
||||
cp ${BERootDir}/wfc-gateway/target/wfc-gateway.jar ${BuildDockerDir}/wfc/gateway/jar
|
||||
echo "done"
|
||||
|
||||
echo -n "Begin copy wfc-auth ... "
|
||||
cp ${BERootDir}/wfc-auth/target/wfc-auth.jar ${BuildDockerDir}/wfc/auth/jar
|
||||
echo "done"
|
||||
|
||||
echo -n "Begin copy wfc-visual ... "
|
||||
cp ${BERootDir}/wfc-visual/wfc-visual-monitor/target/wfc-visual-monitor.jar ${BuildDockerDir}/wfc/visual/monitor/jar
|
||||
echo "done"
|
||||
|
||||
echo -n "Begin copy wfc-modules-system ... "
|
||||
cp ${BERootDir}/wfc-modules/wfc-system/target/wfc-modules-system.jar ${BuildDockerDir}/wfc/modules/system/jar
|
||||
echo "done"
|
||||
|
||||
echo -n "Begin copy wfc-modules-user ... "
|
||||
cp ${BERootDir}/wfc-modules/wfc-modules-user/target/wfc-modules-user.jar ${BuildDockerDir}/wfc/modules/user/jar
|
||||
echo "done"
|
||||
|
||||
echo -n "Begin copy wfc-modules-file ... "
|
||||
cp ${BERootDir}/wfc-modules/wfc-file/target/wfc-modules-file.jar ${BuildDockerDir}/wfc/modules/file/jar
|
||||
echo "done"
|
||||
|
||||
echo -n "Begin copy wfc-modules-job ... "
|
||||
cp ${BERootDir}/wfc-modules/wfc-job/target/wfc-modules-job.jar ${BuildDockerDir}/wfc/modules/job/jar
|
||||
echo "done"
|
||||
|
||||
echo -n "Begin copy wfc-modules-gen ... "
|
||||
cp ${BERootDir}/wfc-modules/wfc-gen/target/wfc-modules-gen.jar ${BuildDockerDir}/wfc/modules/gen/jar
|
||||
echo "done"
|
||||
|
||||
echo -n "Begin copy wfc-modules-payment ... "
|
||||
cp -rf ${BERootDir}/wfc-modules/wfc-payment/target/wfc-modules-payment.jar ${BuildDockerDir}/wfc/modules/payment/jar
|
||||
echo "done"
|
||||
28
bin/printJarVer.java
Normal file
28
bin/printJarVer.java
Normal file
@@ -0,0 +1,28 @@
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.jar.Attributes;
|
||||
import java.util.jar.JarFile;
|
||||
import java.util.jar.Manifest;
|
||||
|
||||
public class printJarVer {
|
||||
public static void main(String[] args) {
|
||||
if (args.length == 0) {
|
||||
System.out.println("Please input jars path and file name.");
|
||||
return;
|
||||
}
|
||||
|
||||
for (String jarPath : args) {
|
||||
File jarFile = new File(jarPath);
|
||||
String jarName = jarFile.getName();
|
||||
try (JarFile jar = new JarFile(jarFile)) {
|
||||
Manifest manifest = jar.getManifest();
|
||||
Attributes attributes = manifest.getMainAttributes();
|
||||
String version = attributes.getValue("Implementation-Version");
|
||||
System.out.println(jarName + " version: " + (version != null ? version : "not found version info"));
|
||||
} catch (IOException e) {
|
||||
System.out.println("Can't read " + jarName + " version.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user