fix(build): 修复 Maven 发布模型与 Java 8 门禁#719
Open
zhibeigg wants to merge 1 commit into
Open
Conversation
11 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
原有问题
现有 Gradle 发布配置和 Java 8 约束只保证“能够构建”,不能保证“发布后可被消费者正确使用”:
api/compileOnlyApi依赖,消费者拿到主 JAR 后无法自动解析所需模块或外部库。common-reflex和平台实现等实际运行所需制品又可能被错误排除。sourceCompatibility=1.8或 KotlinjvmTarget=1.8只限制字节码格式,使用新 JDK 编译时仍可能误调用 Java 9+ API。Unsafe和List.reversed()解析可能绑定到 Java 8 不存在的 API。典型触发场景与后果
NoClassDefFoundError。NoSuchMethodError/NoClassDefFoundError。本 PR 修改
api与compileOnlyApicompile 依赖的 Maven POM,并验证内部坐标版本一致。common-reflex、数据库模块和各平台实现制品。verifyPublishingModel,检查发布清单、禁止模块、POM 依赖和制品选择。--release 8;Kotlin/最终 class 增加 Java 8 API 签名及 class major 门禁。Unsafe改为反射访问,并修复两处在新 JDK 上会误绑定 Java 21List.reversed()的调用。修改目的
让 Maven 仓库中的坐标、POM 和实际 JAR 内容保持一致,并在构建阶段阻止任何只能在 Java 9+ 运行的 API 进入 Java 8 兼容制品。
兼容性与行为变化
验证
./gradlew verifyJava8Compatibility --no-parallel./gradlew verifyPublishingModel --rerun-tasks --no-parallel./gradlew :common:test :module:incision:test :module:minecraft:minecraft-kether:test --no-parallel./gradlew :common-legacy-api:build :module:database:build :module:database:database-ptc-object:build --no-parallelcommon-reflex、common-legacy-api、database、database-ptc-object、platform-bukkit-implRefs #703