chore: Remove serialversion-remover-plugin (#2204)

This commit is contained in:
He-Pin(kerr) 2025-09-19 22:17:45 +08:00 committed by GitHub
parent 8c48393cd3
commit 3969ae8276
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 2 additions and 71 deletions

View file

@ -107,8 +107,7 @@ lazy val root = Project(id = "pekko", base = file("."))
benchJmh,
protobufV3,
pekkoScalaNightly,
docs,
serialversionRemoverPlugin))
docs))
.settings(
Compile / headerCreate / unmanagedSources := (baseDirectory.value / "project").**("*.scala").get)
.settings(PekkoBuild.welcomeSettings)
@ -120,7 +119,6 @@ lazy val actor = pekkoModule("actor")
.settings(AutomaticModuleName.settings("pekko.actor"))
.settings(AddMetaInfLicenseFiles.actorSettings)
.settings(VersionGenerator.settings)
.settings(serialversionRemoverPluginSettings)
.enablePlugins(BoilerplatePlugin, SbtOsgi)
lazy val actorTests = pekkoModule("actor-tests")
@ -406,7 +404,6 @@ lazy val remote =
.settings(OSGi.remote)
.settings(Protobuf.settings)
.settings(Test / parallelExecution := false)
.settings(serialversionRemoverPluginSettings)
.enablePlugins(DependWalkerPlugin, SbtOsgi)
lazy val remoteTests = pekkoModule("remote-tests")
@ -602,20 +599,6 @@ lazy val billOfMaterials = Project("bill-of-materials", file("bill-of-materials"
bomIncludeProjects := userProjects,
description := s"${description.value} (depending on Scala ${CrossVersion.binaryScalaVersion(scalaVersion.value)})")
lazy val serialversionRemoverPlugin =
Project(id = "serialVersionRemoverPlugin", base = file("plugins/serialversion-remover-plugin")).settings(
scalaVersion := Dependencies.scala3Version,
libraryDependencies += ("org.scala-lang" %% "scala3-compiler" % Dependencies.scala3Version),
Compile / doc / sources := Nil,
Compile / publishArtifact := false)
lazy val serialversionRemoverPluginSettings = Seq(
Compile / scalacOptions ++= (
if (scalaVersion.value.startsWith("3."))
Seq("-Xplugin:" + (serialversionRemoverPlugin / Compile / Keys.`package`).value.getAbsolutePath.toString)
else Nil
))
def pekkoModule(moduleName: String): Project =
Project(id = moduleName, base = file(moduleName))
.enablePlugins(ReproducibleBuildsPlugin)

View file

@ -1 +0,0 @@
pluginClass=org.apache.pekko.SerialVersionRemoverPlugin

View file

@ -1,51 +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) 2021-2022 Lightbend Inc. <https://www.lightbend.com>
*/
package org.apache.pekko
import dotty.tools.dotc.ast.Trees._
import dotty.tools.dotc.ast.tpd
import dotty.tools.dotc.core.Contexts.Context
import dotty.tools.dotc.core.Symbols._
import dotty.tools.dotc.plugins.{ PluginPhase, StandardPlugin }
import dotty.tools.backend.jvm.GenBCode
import dotty.tools.dotc.core.Flags._
import dotty.tools.dotc.typer.FrontEnd
class SerialVersionRemoverPlugin extends StandardPlugin {
val name = "serialversion-remover-plugin"
val description = "Remove SerialVersionUid annotation from traits"
override def init(options: List[String]): List[PluginPhase] = {
(new SerialVersionRemoverPhase()) :: Nil
}
}
class SerialVersionRemoverPhase extends PluginPhase {
import tpd._
val phaseName = "serialversion-remover"
override val runsBefore = Set(GenBCode.name)
override def transformTypeDef(tree: TypeDef)(implicit ctx: Context): Tree = {
val symbol = tree.symbol
if (tree.symbol.getAnnotation(defn.SerialVersionUIDAnnot).isDefined && tree.symbol.is(Trait)) {
tree.symbol.removeAnnotation(defn.SerialVersionUIDAnnot)
}
tree
}
}

View file

@ -119,7 +119,7 @@ object PekkoDisciplinePlugin extends AutoPlugin {
lazy val disciplineSettings =
if (enabled) {
nowarnSettings ++ Seq(
Compile / scalacOptions ++= Seq("-Xfatal-warnings"),
Compile / scalacOptions ++= (if (scalaVersion.value.startsWith("3.")) Nil else Seq("-Xfatal-warnings")),
Test / scalacOptions --= testUndiscipline,
Compile / javacOptions ++= (
if (jvmIgnoreWarnings || scalaVersion.value.startsWith("3.") || nonFatalJavaWarningsFor(name.value)) {