暂时废弃GraalVM Native Image

这东西太折磨人了,而且我本地设备还编译不了
用Github Codespace编译 -> 测试 -> 发现反射爆炸又要加规则 -> 重新编译
这一套流程跑一次半个小时没了,跑之前还无法预知到底要弄几次
This commit is contained in:
TheWhiteDog9487
2026-07-30 16:54:16 +08:00
parent 8420843068
commit 737e2a5def
3 changed files with 47 additions and 45 deletions
+34 -33
View File
@@ -2,6 +2,7 @@ name: 构建
on: on:
workflow_dispatch: workflow_dispatch:
push: push:
pull_request:
jobs: jobs:
build-jar: build-jar:
@@ -24,36 +25,36 @@ jobs:
with: with:
name: WebAPI Jar name: WebAPI Jar
path: build/libs/*boot*.jar path: build/libs/*boot*.jar
build-native: # build-native:
runs-on: ${{ matrix.os }} # runs-on: ${{ matrix.os }}
strategy: # strategy:
matrix: # matrix:
os: [macos-latest, windows-latest, ubuntu-latest] # os: [macos-latest, windows-latest, ubuntu-latest]
steps: # steps:
- name: 签出仓库 # - name: 签出仓库
uses: actions/checkout@v7 # uses: actions/checkout@v7
- name: 安装GraalVM # - name: 安装GraalVM
uses: graalvm/setup-graalvm@v1 # uses: graalvm/setup-graalvm@v1
with: # with:
java-version: '25' # java-version: '25'
distribution: 'liberica' # distribution: 'liberica'
- name: 让gradlew可执行 # - name: 让gradlew可执行
if: runner.os != 'Windows' # if: runner.os != 'Windows'
run: chmod +x ./gradlew # run: chmod +x ./gradlew
- name: 构建原生镜像 # - name: 构建原生镜像
if: runner.os == 'Windows' # if: runner.os == 'Windows'
env: # env:
# Needed for Windows; to resolve issue with temp folder during native image build, due to relativization # # Needed for Windows; to resolve issue with temp folder during native image build, due to relativization
# problem when different drives are used, such as in GHA runners. # # problem when different drives are used, such as in GHA runners.
# https://github.com/graalvm/native-build-tools/issues/754 # # https://github.com/graalvm/native-build-tools/issues/754
# https://github.com/bric3/jufmt/commit/feb040f159b9a5168d677455218b787d9b644ee2 # # https://github.com/bric3/jufmt/commit/feb040f159b9a5168d677455218b787d9b644ee2
GRADLE_OPTS: -Djava.io.tmpdir=${{ runner.temp }} # GRADLE_OPTS: -Djava.io.tmpdir=${{ runner.temp }}
run: ./gradlew nativeCompile # run: ./gradlew nativeCompile
- name: 构建原生镜像 # - name: 构建原生镜像
if: runner.os != 'Windows' # if: runner.os != 'Windows'
run: ./gradlew nativeCompile # run: ./gradlew nativeCompile
- name: 上传构建产物 # - name: 上传构建产物
uses: actions/upload-artifact@v7 # uses: actions/upload-artifact@v7
with: # with:
name: WebAPI Native Image ${{ runner.os }} ${{ runner.arch }} # name: WebAPI Native Image ${{ runner.os }} ${{ runner.arch }}
path: build/native/nativeCompile/* # path: build/native/nativeCompile/*
+12 -11
View File
@@ -9,11 +9,11 @@ plugins {
id("org.springframework.boot") version "4.1.0" id("org.springframework.boot") version "4.1.0"
id("io.spring.dependency-management") version "1.1.7" id("io.spring.dependency-management") version "1.1.7"
id("org.hibernate.orm") version "7.4.1.Final" id("org.hibernate.orm") version "7.4.1.Final"
id("org.graalvm.buildtools.native") version "1.1.1" // id("org.graalvm.buildtools.native") version "1.1.1"
} }
group = "xyz.thewhitedog9487" group = "xyz.thewhitedog9487"
version = "0.8.0" version = "0.8.1"
java { java {
toolchain { toolchain {
@@ -48,22 +48,22 @@ dependencies {
annotationProcessor("org.projectlombok:lombok") annotationProcessor("org.projectlombok:lombok")
annotationProcessor("org.springframework.boot:spring-boot-configuration-processor") annotationProcessor("org.springframework.boot:spring-boot-configuration-processor")
kapt("org.springframework.boot:spring-boot-configuration-processor") kapt("org.springframework.boot:spring-boot-configuration-processor")
testImplementation("org.springframework.boot:spring-boot-starter-actuator-test") // testImplementation("org.springframework.boot:spring-boot-starter-actuator-test")
testImplementation("org.springframework.boot:spring-boot-starter-data-jpa-test") // testImplementation("org.springframework.boot:spring-boot-starter-data-jpa-test")
// testImplementation("org.springframework.boot:spring-boot-starter-data-redis-test") // testImplementation("org.springframework.boot:spring-boot-starter-data-redis-test")
// testImplementation("org.springframework.boot:spring-boot-starter-jdbc-test") // testImplementation("org.springframework.boot:spring-boot-starter-jdbc-test")
// testImplementation("org.springframework.boot:spring-boot-starter-restclient-test") // testImplementation("org.springframework.boot:spring-boot-starter-restclient-test")
// testImplementation("org.springframework.boot:spring-boot-starter-security-oauth2-authorization-server-test") // testImplementation("org.springframework.boot:spring-boot-starter-security-oauth2-authorization-server-test")
// testImplementation("org.springframework.boot:spring-boot-starter-security-oauth2-client-test") // testImplementation("org.springframework.boot:spring-boot-starter-security-oauth2-client-test")
// testImplementation("org.springframework.boot:spring-boot-starter-security-oauth2-resource-server-test") // testImplementation("org.springframework.boot:spring-boot-starter-security-oauth2-resource-server-test")
testImplementation("org.springframework.boot:spring-boot-starter-security-test") // testImplementation("org.springframework.boot:spring-boot-starter-security-test")
testImplementation("org.springframework.boot:spring-boot-starter-webmvc-test") // testImplementation("org.springframework.boot:spring-boot-starter-webmvc-test")
// testImplementation("org.springframework.boot:spring-boot-starter-websocket-test") // testImplementation("org.springframework.boot:spring-boot-starter-websocket-test")
testImplementation("org.jetbrains.kotlin:kotlin-test-junit5") // testImplementation("org.jetbrains.kotlin:kotlin-test-junit5")
testCompileOnly("org.projectlombok:lombok") // testCompileOnly("org.projectlombok:lombok")
testRuntimeOnly("org.junit.platform:junit-platform-launcher") // testRuntimeOnly("org.junit.platform:junit-platform-launcher")
testAnnotationProcessor("org.projectlombok:lombok") // testAnnotationProcessor("org.projectlombok:lombok")
testImplementation(kotlin("test")) // testImplementation(kotlin("test"))
implementation("io.github.oshai:kotlin-logging-jvm:7.0.3") implementation("io.github.oshai:kotlin-logging-jvm:7.0.3")
implementation("org.hibernate.orm:hibernate-community-dialects") implementation("org.hibernate.orm:hibernate-community-dialects")
@@ -107,6 +107,7 @@ tasks.withType<KotlinCompile>().configureEach {
freeCompilerArgs.add("-Xannotation-default-target=param-property") freeCompilerArgs.add("-Xannotation-default-target=param-property")
} }
} }
kapt { kapt {
keepJavacAnnotationProcessors = true keepJavacAnnotationProcessors = true
} }
@@ -21,7 +21,7 @@ class OpenApiConfiguration {
.contact(Contact() .contact(Contact()
.name("TheWhiteDog9487") .name("TheWhiteDog9487")
.url("https://www.github.com/TheWhiteDog9487/WebAPI")) .url("https://www.github.com/TheWhiteDog9487/WebAPI"))
.version("0.8.0") .version("0.8.1")
.license(License() .license(License()
.name("WTFPL") .name("WTFPL")
.url("https://spdx.org/licenses/WTFPL")) ) .url("https://spdx.org/licenses/WTFPL")) )