From 8246b6fd7b6164971c4f7ed296fc7d1942b4fc40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=99=8E=E9=B8=A3?= Date: Tue, 16 Jun 2026 01:43:58 +0800 Subject: [PATCH] build: remove legacy Java 9+ sbt plugin references MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Motivation: Following apache/pekko#3075 which renamed Jdk9 → Jdk21 (since Java 17 is now the project baseline and JDK 9 features are part of the standard build), the AutomaticModuleName sbt plugin and `--add-opens` JVM options inherited from the Java 9 module-system era are stale references in the satellite Pekko projects. They add noise to the build and mislead developers about the actual Java baseline. Modification: - Delete project/AutomaticModuleName.scala (JPMS Automatic-Module-Name manifest helper) where it exists. - Remove `AutomaticModuleName.settings(...)` calls and inline `"Automatic-Module-Name" -> "..."` manifest entries from build.sbt. - Remove `--add-opens=java.base/...=ALL-UNNAMED` JVM options (both the single `+=` form and the `Seq(...)` form) from build.sbt. - Update stale `// JDK 11: ...` comments to `// project baseline is Java 17: ...` (aligned with apache/pekko#3075). Result: Build definitions no longer reference legacy Java 9+ module-system helpers or JVM options. Project baseline remains Java 17; no runtime behavior change for end users. --- build.sbt | 13 ------------- project/AutomaticModuleName.scala | 30 ------------------------------ 2 files changed, 43 deletions(-) delete mode 100644 project/AutomaticModuleName.scala diff --git a/build.sbt b/build.sbt index bed8bb90c9..edf41f84c8 100644 --- a/build.sbt +++ b/build.sbt @@ -105,7 +105,6 @@ val scalaMacroSupport = Seq( }) lazy val parsing = project("parsing") - .settings(AutomaticModuleName.settings("pekko.http.parsing")) .addPekkoModuleDependency("pekko-actor", "provided", PekkoCoreDependency.default) .settings(Dependencies.parsing) .settings(scalacOptions += "-language:_") @@ -115,7 +114,6 @@ lazy val parsing = project("parsing") .disablePlugins(MimaPlugin) lazy val httpCore = project("http-core") - .settings(AutomaticModuleName.settings("pekko.http.core")) .settings(AddMetaInfLicenseFiles.httpCoreSettings) .dependsOn(parsing /*, httpScalafixRules % ScalafixConfig*/ ) .addPekkoModuleDependency("pekko-stream", "provided", PekkoCoreDependency.default) @@ -131,7 +129,6 @@ lazy val httpCore = project("http-core") .disablePlugins(ScalafixPlugin) lazy val http = project("http") - .settings(AutomaticModuleName.settings("pekko.http")) .dependsOn(httpCore) .addPekkoModuleDependency("pekko-stream", "provided", PekkoCoreDependency.default) .settings(Dependencies.http) @@ -142,7 +139,6 @@ lazy val http = project("http") .enablePlugins(ReproducibleBuildsPlugin) lazy val http2Tests = project("http2-tests") - .settings(AutomaticModuleName.settings("pekko.http.http2")) .dependsOn(httpCore, httpTestkit % "test", httpCore % "test->test") .addPekkoModuleDependency("pekko-stream", "provided", PekkoCoreDependency.default) .addPekkoModuleDependency("pekko-stream-testkit", "test", PekkoCoreDependency.default) @@ -183,7 +179,6 @@ lazy val http2Tests = project("http2-tests") .disablePlugins(MimaPlugin) // experimental module still lazy val httpTestkit = project("http-testkit") - .settings(AutomaticModuleName.settings("pekko.http.testkit")) .dependsOn(http) .addPekkoModuleDependency("pekko-stream-testkit", "provided", PekkoCoreDependency.default) .addPekkoModuleDependency("pekko-testkit", "provided", PekkoCoreDependency.default) @@ -198,7 +193,6 @@ lazy val httpTestkit = project("http-testkit") .disablePlugins(MimaPlugin) // testkit, no bin compat guaranteed lazy val httpTestkitMunit = project("http-testkit-munit") - .settings(AutomaticModuleName.settings("pekko.http.testkit.munit")) .dependsOn(http, httpTestkit) .addPekkoModuleDependency("pekko-stream-testkit", "provided", PekkoCoreDependency.default) .addPekkoModuleDependency("pekko-testkit", "provided", PekkoCoreDependency.default) @@ -219,7 +213,6 @@ lazy val httpTests = project("http-tests") .settings( // following is needed by Agrona lib (PekkoHttpServerLatencyMultiNodeSpec) // https://github.com/aeron-io/agrona/wiki/Change-Log#200-2024-12-17 - MultiJvm / jvmOptions += "--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED", // Fix to reenable scala-steward, see https://gitter.im/scala-steward-org/scala-steward?at=6183bb66d78911028a1b7cd8 // Putting that jar file with the complicated name into the git tree directly breaks if something in the environment // has unicode path names configured wrongly. So, we wrap it into an extra zip file which is extracted before @@ -248,13 +241,11 @@ lazy val httpMarshallersScala = project("http-marshallers-scala") lazy val httpXml = httpMarshallersScalaSubproject("xml") - .settings(AutomaticModuleName.settings("pekko.http.marshallers.scalaxml")) .addPekkoModuleDependency("pekko-stream", "provided", PekkoCoreDependency.default) .settings(Dependencies.httpXml) lazy val httpSprayJson = httpMarshallersScalaSubproject("spray-json") - .settings(AutomaticModuleName.settings("pekko.http.marshallers.sprayjson")) .addPekkoModuleDependency("pekko-stream", "provided", PekkoCoreDependency.default) .settings(Dependencies.httpSprayJson) @@ -266,7 +257,6 @@ lazy val httpMarshallersJava = project("http-marshallers-java") lazy val httpJackson = httpMarshallersJavaSubproject("jackson") - .settings(AutomaticModuleName.settings("pekko.http.marshallers.jackson")) .addPekkoModuleDependency("pekko-stream", "provided", PekkoCoreDependency.default) .addPekkoModuleDependency("pekko-stream-testkit", "test", PekkoCoreDependency.default) .dependsOn(httpTestkit % "test") @@ -275,7 +265,6 @@ lazy val httpJackson = lazy val httpJackson3 = httpMarshallersJavaSubproject("jackson3") - .settings(AutomaticModuleName.settings("pekko.http.marshallers.jackson3")) .addPekkoModuleDependency("pekko-stream", "provided", PekkoCoreDependency.default) .addPekkoModuleDependency("pekko-stream-testkit", "test", PekkoCoreDependency.default) .dependsOn(httpTestkit % "test") @@ -286,7 +275,6 @@ lazy val httpJackson3 = lazy val httpCaching = project("http-caching") .settings( name := "pekko-http-caching") - .settings(AutomaticModuleName.settings("pekko.http.caching")) .addPekkoModuleDependency("pekko-stream", "provided", PekkoCoreDependency.default) .addPekkoModuleDependency("pekko-stream-testkit", "provided", PekkoCoreDependency.default) .settings(Dependencies.httpCaching) @@ -296,7 +284,6 @@ lazy val httpCaching = project("http-caching") lazy val httpCors = project("http-cors") .settings( name := "pekko-http-cors") - .settings(AutomaticModuleName.settings("pekko.http.cors")) .settings(AddMetaInfLicenseFiles.httpCorsSettings) .addPekkoModuleDependency("pekko-stream", "provided", PekkoCoreDependency.default) .addPekkoModuleDependency("pekko-stream-testkit", "provided", PekkoCoreDependency.default) diff --git a/project/AutomaticModuleName.scala b/project/AutomaticModuleName.scala deleted file mode 100644 index 1b1f36c153..0000000000 --- a/project/AutomaticModuleName.scala +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * license agreements; and to You under the Apache License, version 2.0: - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * This file is part of the Apache Pekko project, which was derived from Akka. - */ - -/** - * Copyright (C) 2016-2020 Lightbend Inc. - */ - -import sbt.{ Def, _ } -import sbt.Keys._ - -/** - * Helper to set Automatic-Module-Name in projects. - * - * !! DO NOT BE TEMPTED INTO AUTOMATICALLY DERIVING THE NAMES FROM PROJECT NAMES !! - * - * The names carry a lot of implications and DO NOT have to always align 1:1 with the group ids or package names, - * though there should be of course a strong relationship between them. - */ -object AutomaticModuleName { - private val AutomaticModuleName = "Automatic-Module-Name" - - def settings(name: String): Seq[Def.Setting[Task[Seq[PackageOption]]]] = Seq( - Compile / packageBin / packageOptions += Package.ManifestAttributes(AutomaticModuleName -> name)) -}