180 lines
7.4 KiB
Groovy
180 lines
7.4 KiB
Groovy
plugins {
|
|
id 'java'
|
|
id 'application'
|
|
id 'edu.sc.seis.launch4j' version '2.5.4'
|
|
id 'org.openjfx.javafxplugin' version '0.1.0'
|
|
id 'org.springframework.boot' version '3.2.0'
|
|
id 'io.spring.dependency-management' version '1.1.4'
|
|
id 'com.github.johnrengelman.shadow' version '8.1.1' apply false // 关闭 shadow
|
|
}
|
|
|
|
configurations {
|
|
all*.exclude group: 'org.openjfx', module: 'javafx'
|
|
proguardLib
|
|
}
|
|
|
|
// JDK 版本检查
|
|
def requiredJavaVersion = 20
|
|
def currentJavaVersion = JavaVersion.current().majorVersion.toInteger()
|
|
if (currentJavaVersion != requiredJavaVersion) {
|
|
throw new GradleException("构建需要 JDK ${requiredJavaVersion},但当前是 JDK ${currentJavaVersion}。请更换 JDK 环境。")
|
|
}
|
|
|
|
group = 'com.axis.innovators.box'
|
|
version = '0.0.1'
|
|
|
|
repositories {
|
|
maven { url 'https://maven.aliyun.com/repository/public' }
|
|
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
|
|
maven { url 'https://jitpack.io' }
|
|
mavenCentral()
|
|
}
|
|
|
|
//tasks.named("bootJar") {
|
|
// enabled = false
|
|
//}
|
|
|
|
dependencies {
|
|
proguardLib files('libs/proguard.jar')
|
|
|
|
testImplementation platform('org.junit:junit-bom:5.10.0')
|
|
testImplementation 'org.junit.jupiter:junit-jupiter'
|
|
implementation 'org.commonmark:commonmark:0.24.0'
|
|
implementation 'org.commonjava.googlecode.markdown4j:markdown4j:2.2-cj-1.1'
|
|
implementation 'com.google.code.gson:gson:2.8.9'
|
|
implementation 'org.apache.logging.log4j:log4j-api:2.20.0'
|
|
implementation 'org.apache.logging.log4j:log4j-core:2.20.0'
|
|
implementation 'org.apache.logging.log4j:log4j-slf4j-impl:2.20.0'
|
|
implementation 'org.ow2.asm:asm:9.7.1'
|
|
implementation 'org.ow2.asm:asm-commons:9.7.1'
|
|
implementation 'org.ow2.asm:asm-analysis:9.7.1'
|
|
implementation 'org.ow2.asm:asm-util:9.7.1'
|
|
implementation 'org.ow2.asm:asm-tree:9.7.1'
|
|
implementation 'net.bytebuddy:byte-buddy:1.17.6'
|
|
implementation 'org.jsoup:jsoup:1.17.2'
|
|
implementation 'commons-io:commons-io:2.14.0'
|
|
implementation 'com.formdev:flatlaf:3.2.1'
|
|
implementation 'com.formdev:flatlaf-extras:3.2.1'
|
|
implementation 'com.formdev:flatlaf-intellij-themes:3.2.1'
|
|
implementation 'io.github.vincenzopalazzo:material-ui-swing:1.1.2'
|
|
implementation 'org.python:jython-standalone:2.7.3'
|
|
implementation 'org.graalvm.python:python-embedding:24.2.1'
|
|
implementation files('libs/JNC-1.0-jnc.jar')
|
|
implementation files('libs/dog api 1.3.jar')
|
|
implementation files('libs/DesktopWallpaperSdk-1.0-SNAPSHOT.jar')
|
|
implementation 'org.fxmisc.richtext:richtextfx:0.11.0'
|
|
implementation 'org.bitbucket.mstrobel:procyon-core:0.5.36'
|
|
implementation 'org.bitbucket.mstrobel:procyon-compilertools:0.5.36'
|
|
implementation 'com.fifesoft:rsyntaxtextarea:3.5.4'
|
|
implementation 'com.fifesoft:rstaui:3.3.1'
|
|
implementation 'com.fifesoft:languagesupport:3.3.0'
|
|
implementation 'com.fifesoft:autocomplete:3.3.2'
|
|
implementation 'org.apache.commons:commons-compress:1.23.0'
|
|
implementation 'com.fasterxml.jackson.core:jackson-databind:2.15.2'
|
|
implementation 'org.controlsfx:controlsfx:11.1.2'
|
|
implementation 'com.dlsc.formsfx:formsfx-core:11.6.0'
|
|
implementation 'net.sourceforge.plantuml:plantuml:8059'
|
|
implementation 'com.google.code.gson:gson:2.10.1'
|
|
implementation 'org.openjfx:javafx-controls:21'
|
|
implementation 'org.benf:cfr:0.152'
|
|
implementation 'com.github.javaparser:javaparser-core:3.25.1'
|
|
implementation 'com.1stleg:jnativehook:2.1.0'
|
|
implementation 'org.json:json:20230618'
|
|
implementation 'org.lwjgl:lwjgl:3.3.1'
|
|
implementation 'org.lwjgl:lwjgl-glfw:3.3.1'
|
|
implementation 'org.lwjgl:lwjgl-opengl:3.3.1'
|
|
implementation 'org.lwjgl:lwjgl:3.3.1:natives-windows'
|
|
implementation 'org.lwjgl:lwjgl-glfw:3.3.1:natives-windows'
|
|
implementation 'org.lwjgl:lwjgl-opengl:3.3.1:natives-windows'
|
|
implementation 'org.bytedeco:javacv-platform:1.5.7'
|
|
implementation 'org.bytedeco:javacpp-platform:1.5.7'
|
|
implementation 'com.madgag:animated-gif-lib:1.4'
|
|
implementation 'org.openjfx:javafx-web:17'
|
|
runtimeOnly 'com.mysql:mysql-connector-j'
|
|
developmentOnly 'org.springframework.boot:spring-boot-devtools'
|
|
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
|
testImplementation 'org.springframework.security:spring-security-test'
|
|
implementation 'com.kitfox.svg:svg-salamander:1.0'
|
|
implementation 'com.vladsch.flexmark:flexmark:0.64.8'
|
|
implementation 'com.github.kwhat:jnativehook:2.2.2'
|
|
implementation 'com.dustinredmond.fxtrayicon:FXTrayIcon:4.0.1'
|
|
implementation 'org.openjfx:javafx-graphics:21'
|
|
implementation 'me.friwi:jcefmaven:122.1.10'
|
|
implementation 'com.alphacephei:vosk:0.3.45'
|
|
implementation 'net.java.dev.jna:jna:5.13.0'
|
|
implementation 'net.java.dev.jna:jna-platform:5.13.0'
|
|
implementation 'org.apache.commons:commons-math3:3.6.1'
|
|
implementation 'com.google.guava:guava:31.1-jre'
|
|
implementation 'com.github.javaparser:javaparser-symbol-solver-core:3.25.9'
|
|
implementation 'org.bitbucket.mstrobel:procyon-core:0.6.0'
|
|
implementation 'org.bitbucket.mstrobel:procyon-compilertools:0.6.0'
|
|
implementation 'com.belerweb:pinyin4j:2.5.1'
|
|
implementation 'commons-io:commons-io:2.18.0'
|
|
implementation 'jflac:jflac:1.3'
|
|
implementation 'com.github.axet:TarsosDSP:2.4'
|
|
implementation 'org.json:json:20231013'
|
|
}
|
|
|
|
configurations.all {
|
|
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
|
|
}
|
|
|
|
// 复制依赖到 libs 目录
|
|
task copyDependencies(type: Copy) {
|
|
from configurations.runtimeClasspath
|
|
into "$buildDir/libs/libs"
|
|
}
|
|
|
|
// 原始 jar 打包(不含依赖)
|
|
tasks.jar {
|
|
dependsOn copyDependencies
|
|
archiveBaseName.set("${rootProject.name}")
|
|
archiveVersion.set("${version}")
|
|
}
|
|
|
|
// ProGuard 混淆任务
|
|
task obfuscateJar(type: JavaExec) {
|
|
dependsOn jar
|
|
group = "build"
|
|
description = "使用 ProGuard 混淆并生成映射表"
|
|
|
|
mainClass = 'proguard.ProGuard'
|
|
classpath = configurations.proguardLib
|
|
|
|
args = [
|
|
'-injars', "$buildDir/libs/${rootProject.name}-${version}.jar",
|
|
'-outjars', "$buildDir/libs/${rootProject.name}-${version}-obf.jar",
|
|
'-libraryjars', "${System.getProperty('java.home')}/jmods/java.base.jmod",
|
|
'-printmapping', "$buildDir/libs/output.srg",
|
|
'-keep class com.axis.innovators.box.plugins.**',
|
|
'-keep class com.axis.innovators.box.plugins.BoxClassLoader{*;}',
|
|
'-keeppackagenames', 'com.axis.innovators.box',
|
|
'-keeppackagenames', 'com.axis.innovators.box.plugins',
|
|
'-keepnames', 'class com.axis.innovators.box.**',
|
|
'-keepnames', 'class com.axis.innovators.box.plugins.**',
|
|
'-dontwarn',
|
|
'-dontoptimize',
|
|
'-dontshrink',
|
|
'-keepattributes', 'Signature,InnerClasses,EnclosingMethod,RuntimeVisibleAnnotations,RuntimeInvisibleAnnotations,RuntimeVisibleParameterAnnotations,RuntimeInvisibleParameterAnnotations,Deprecated,SourceFile,LineNumberTable,LocalVariableTable,LocalVariableTypeTable'
|
|
]
|
|
}
|
|
|
|
build {
|
|
dependsOn obfuscateJar
|
|
}
|
|
|
|
application {
|
|
mainClass = 'com.axis.innovators.box.Main'
|
|
}
|
|
|
|
task runClient(type: JavaExec) {
|
|
group = "application"
|
|
description = "运行 com.axis.innovators.box.Main"
|
|
classpath = sourceSets.main.runtimeClasspath
|
|
mainClass = "com.axis.innovators.box.Main"
|
|
jvmArgs = [
|
|
"-Dfile.encoding=UTF-8",
|
|
"-Djava.system.class.loader=com.axis.innovators.box.plugins.BoxClassLoader"
|
|
]
|
|
}
|