mirror of
https://github.com/wushuo894/ani-rss.git
synced 2026-03-13 09:20:23 +00:00
build: 优化打包流程
This commit is contained in:
@@ -18,10 +18,32 @@
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ani.rss</groupId>
|
||||
<artifactId>ani-rss-commons</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<annotationProcessorPaths>
|
||||
<path>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</path>
|
||||
</annotationProcessorPaths>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
||||
27
ani-rss-application/generate-resources.sh
Normal file
27
ani-rss-application/generate-resources.sh
Normal file
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ -d ../ani-rss-ui/dist ]; then
|
||||
if [ -d ./src/main/resources/dist ]; then
|
||||
rm -rf ./src/main/resources/dist
|
||||
fi
|
||||
mv ../ani-rss-ui/dist ./src/main/resources/dist
|
||||
echo "move dist ..."
|
||||
fi
|
||||
|
||||
# build_info 位置
|
||||
build_info_path=./src/main/resources/build_info
|
||||
|
||||
rm -rf ${build_info_path}
|
||||
git rev-parse --short HEAD >> ${build_info_path}
|
||||
git branch --show-current >> ${build_info_path}
|
||||
|
||||
# 更新程序位置
|
||||
update_exe_path=./src/main/resources/ani-rss-update.exe
|
||||
|
||||
if [ ! -e ${update_exe_path} ]; then
|
||||
echo "下载 ani-rss-update.exe"
|
||||
wget https://github.com/wushuo894/ani-rss-update/releases/download/latest/ani-rss-update.exe
|
||||
mv ani-rss-update.exe ${update_exe_path}
|
||||
else
|
||||
echo -e "${YELLOW}已存在 ani-rss-update.exe${NC}"
|
||||
fi
|
||||
@@ -18,6 +18,10 @@
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>ani.rss</groupId>
|
||||
<artifactId>ani-rss-ui</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ani.rss</groupId>
|
||||
<artifactId>ani-rss-web</artifactId>
|
||||
@@ -30,6 +34,7 @@
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
@@ -39,7 +44,6 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>3.7.1</version>
|
||||
<configuration>
|
||||
<descriptorRefs>
|
||||
<descriptorRef>jar-with-dependencies</descriptorRef>
|
||||
@@ -64,7 +68,6 @@
|
||||
<plugin>
|
||||
<groupId>com.akathist.maven.plugins.launch4j</groupId>
|
||||
<artifactId>launch4j-maven-plugin</artifactId>
|
||||
<version>2.6.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>l4j</id>
|
||||
@@ -109,8 +112,53 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>generate-resources</id>
|
||||
<phase>generate-resources</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>bash</executable>
|
||||
<arguments>
|
||||
<argument>./generate-resources.sh</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>generate-md5sum</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>java</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<mainClass>ani.rss.build.Md5Sum</mainClass>
|
||||
<systemProperties>
|
||||
<systemProperty>
|
||||
<key>basedir</key>
|
||||
<value>${project.basedir}</value>
|
||||
</systemProperty>
|
||||
</systemProperties>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<annotationProcessorPaths>
|
||||
<path>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</path>
|
||||
</annotationProcessorPaths>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
</project>
|
||||
|
||||
@@ -89,6 +89,7 @@ public class FileAction implements BaseAction {
|
||||
BufferedInputStream inputStream = FileUtil.getInputStream(imgFile);
|
||||
@Cleanup
|
||||
OutputStream out = response.getOut();
|
||||
response.setContentLength((int) file.length());
|
||||
IoUtil.copy(inputStream, out);
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
@@ -102,6 +103,7 @@ public class FileAction implements BaseAction {
|
||||
BufferedInputStream inputStream = FileUtil.getInputStream(imgFile);
|
||||
@Cleanup
|
||||
OutputStream out = response.getOut();
|
||||
response.setContentLength((int) file.length());
|
||||
IoUtil.copy(inputStream, out);
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
@@ -183,11 +185,9 @@ public class FileAction implements BaseAction {
|
||||
InputStream inputStream = Channels.newInputStream(channel);
|
||||
IoUtil.copy(inputStream, out, 40960, end - start, null);
|
||||
} else {
|
||||
@Cleanup
|
||||
OutputStream out = response.getOut();
|
||||
@Cleanup
|
||||
InputStream inputStream = FileUtil.getInputStream(file);
|
||||
IoUtil.copy(inputStream, out, 40960);
|
||||
response.write(inputStream, (int) file.length());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
String message = ExceptionUtil.getMessage(e);
|
||||
|
||||
51
ani-rss-application/src/main/java/ani/rss/build/Md5Sum.java
Normal file
51
ani-rss-application/src/main/java/ani/rss/build/Md5Sum.java
Normal file
@@ -0,0 +1,51 @@
|
||||
package ani.rss.build;
|
||||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.crypto.SecureUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Objects;
|
||||
|
||||
@Slf4j
|
||||
public class Md5Sum implements Runnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
String basedir = System.getProperty("basedir");
|
||||
File target = new File(basedir + "/target");
|
||||
Assert.isTrue(target.exists(), "target not exists");
|
||||
|
||||
File[] files = target.listFiles();
|
||||
Assert.notEmpty(files, "files not found");
|
||||
Objects.requireNonNull(files, "files not found");
|
||||
|
||||
for (File file : files) {
|
||||
if (file.isDirectory()) {
|
||||
continue;
|
||||
}
|
||||
String extName = FileUtil.extName(file);
|
||||
if (StrUtil.isBlank(extName)) {
|
||||
continue;
|
||||
}
|
||||
if ("md5".equals(extName)) {
|
||||
continue;
|
||||
}
|
||||
generate(file);
|
||||
}
|
||||
}
|
||||
|
||||
private void generate(File file) {
|
||||
File md5File = new File(file + ".md5");
|
||||
if (md5File.exists()) {
|
||||
return;
|
||||
}
|
||||
|
||||
String md5 = SecureUtil.md5(file);
|
||||
FileUtil.writeUtf8String(md5, md5File);
|
||||
|
||||
log.info("md5 {} {}", file, md5);
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,7 @@
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
@@ -36,4 +37,21 @@
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<annotationProcessorPaths>
|
||||
<path>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</path>
|
||||
</annotationProcessorPaths>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -25,12 +25,10 @@
|
||||
<dependency>
|
||||
<groupId>org.eclipse</groupId>
|
||||
<artifactId>bittorrent</artifactId>
|
||||
<version>0.3.0-v20070627-1030</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.xerial</groupId>
|
||||
<artifactId>sqlite-jdbc</artifactId>
|
||||
<version>3.50.3.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sun.mail</groupId>
|
||||
@@ -48,6 +46,28 @@
|
||||
<groupId>org.jsoup</groupId>
|
||||
<artifactId>jsoup</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<annotationProcessorPaths>
|
||||
<path>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</path>
|
||||
</annotationProcessorPaths>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
"vue": "^3.5.25"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vitejs/plugin-vue": "^6.0.2",
|
||||
"shiki": "^3.19.0",
|
||||
"@vitejs/plugin-vue": "^6.0.3",
|
||||
"shiki": "^3.20.0",
|
||||
"terser": "^5.44.1",
|
||||
"unplugin-auto-import": "^20.3.0",
|
||||
"unplugin-vue-components": "^30.0.0",
|
||||
|
||||
@@ -78,6 +78,18 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<annotationProcessorPaths>
|
||||
<path>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</path>
|
||||
</annotationProcessorPaths>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
@@ -25,7 +25,25 @@
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<annotationProcessorPaths>
|
||||
<path>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</path>
|
||||
</annotationProcessorPaths>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
||||
60
package.sh
60
package.sh
@@ -1,61 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 起始位置
|
||||
base_path=$(pwd)
|
||||
|
||||
# ui 位置
|
||||
ui_path=${base_path}/ani-rss-ui
|
||||
# ani-rss-application 路径
|
||||
application_path=${base_path}/ani-rss-application
|
||||
# dist 位置
|
||||
dist_path=${application_path}/src/main/resources/dist
|
||||
# 更新程序位置
|
||||
update_exe_path=${application_path}/src/main/resources/ani-rss-update.exe
|
||||
# build_info 位置
|
||||
build_info_path=${application_path}/src/main/resources/build_info
|
||||
# target 位置
|
||||
target_path=${application_path}/target
|
||||
|
||||
rm -rf ${build_info_path}
|
||||
git rev-parse --short HEAD >> ${build_info_path}
|
||||
git branch --show-current >> ${build_info_path}
|
||||
|
||||
# 定义颜色代码
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[0;33m'
|
||||
NC='\033[0m'
|
||||
|
||||
cd ${ui_path}
|
||||
|
||||
mvn -B install -DskipTests --file pom.xml
|
||||
|
||||
if [ $? -eq 1 ]; then
|
||||
echo -e "${RED}web编译失败${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "${GREEN}web编译完成${NC}"
|
||||
|
||||
if [ -d ${dist_path} ]; then
|
||||
echo -e "${YELLOW}清理 ${dist_path}${NC}"
|
||||
rm -rf ${dist_path}/*
|
||||
else
|
||||
echo -e "${YELLOW}创建文件夹 ${dist_path}${NC}"
|
||||
mkdir -p ${dist_path}
|
||||
fi
|
||||
|
||||
cp -r dist/* ${dist_path}
|
||||
|
||||
if [ ! -e ${update_exe_path} ]; then
|
||||
echo "下载 ani-rss-update.exe"
|
||||
wget https://github.com/wushuo894/ani-rss-update/releases/download/latest/ani-rss-update.exe
|
||||
mv ani-rss-update.exe ${update_exe_path}
|
||||
else
|
||||
echo -e "${YELLOW}已存在 ani-rss-update.exe${NC}"
|
||||
fi
|
||||
|
||||
cd ..
|
||||
mvn -B package -DskipTests --file pom.xml
|
||||
|
||||
if [ $? -eq 1 ]; then
|
||||
@@ -64,12 +13,3 @@ if [ $? -eq 1 ]; then
|
||||
fi
|
||||
|
||||
echo -e "${GREEN}jar编译完成${NC}"
|
||||
|
||||
|
||||
|
||||
md5sum ${target_path}/ani-rss-jar-with-dependencies.jar | awk '{print $1}' > ${target_path}/ani-rss-jar-with-dependencies.jar.md5
|
||||
md5sum ${target_path}/ani-rss-launcher.exe | awk '{print $1}' > ${target_path}/ani-rss-launcher.exe.md5
|
||||
|
||||
echo "md5"
|
||||
echo "ani-rss-jar-with-dependencies.jar $(cat ${target_path}/ani-rss-jar-with-dependencies.jar.md5)"
|
||||
echo "ani-rss-launcher.exe $(cat ${target_path}/ani-rss-launcher.exe.md5)"
|
||||
|
||||
45
pom.xml
45
pom.xml
@@ -13,11 +13,11 @@
|
||||
</organization>
|
||||
<modules>
|
||||
<module>ani-rss-commons</module>
|
||||
<module>ani-rss-ui</module>
|
||||
<module>ani-rss-application</module>
|
||||
<module>ani-rss-web</module>
|
||||
<module>ani-rss-core</module>
|
||||
<module>ani-rss-api</module>
|
||||
<module>ani-rss-ui</module>
|
||||
</modules>
|
||||
<inceptionYear>2025</inceptionYear>
|
||||
<description>基于RSS自动追番、订阅、下载、刮削</description>
|
||||
@@ -35,6 +35,11 @@
|
||||
<artifactId>ani-rss-commons</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ani.rss</groupId>
|
||||
<artifactId>ani-rss-ui</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ani.rss</groupId>
|
||||
<artifactId>ani-rss-api</artifactId>
|
||||
@@ -54,6 +59,7 @@
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.42</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
@@ -85,6 +91,16 @@
|
||||
<artifactId>jsoup</artifactId>
|
||||
<version>1.21.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse</groupId>
|
||||
<artifactId>bittorrent</artifactId>
|
||||
<version>0.3.0-v20070627-1030</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.xerial</groupId>
|
||||
<artifactId>sqlite-jdbc</artifactId>
|
||||
<version>3.50.3.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
@@ -94,4 +110,31 @@
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<build>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>3.8.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.14.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>com.akathist.maven.plugins.launch4j</groupId>
|
||||
<artifactId>launch4j-maven-plugin</artifactId>
|
||||
<version>2.6.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>3.6.2</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
||||
Reference in New Issue
Block a user