feat: Using dependency walking to verify JDK9 Plugin works (#1065)

* using dependency walking to check JDK9 works

* rollback constant extract

* code format and header format

* improve code

* fix code

* add CI action

* apply for all JDK9 package module

* update ci

* Using plugin rather than code

Signed-off-by: Andy.Chen <iRoiocam@gmail.com>

---------

Signed-off-by: Andy.Chen <iRoiocam@gmail.com>
This commit is contained in:
AndyChen 2024-01-30 14:33:30 +08:00 committed by GitHub
parent abad72d869
commit 8a759bad21
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 48 additions and 4 deletions

View file

@ -38,6 +38,9 @@ jobs:
- name: Compile code - name: Compile code
run: sbt +compile run: sbt +compile
- name: Check if the dependency task in the built correctly
run: sbt dependWalkerCheck
- name: Report MiMa Binary Issues - name: Report MiMa Binary Issues
run: |- run: |-
sbt +mimaReportBinaryIssues sbt +mimaReportBinaryIssues

View file

@ -133,6 +133,9 @@ jobs:
- name: Enable jvm-opts - name: Enable jvm-opts
run: cp .jvmopts-ci .jvmopts run: cp .jvmopts-ci .jvmopts
- name: Check if the dependency task in the built correctly
run: sbt dependWalkerCheck
- name: Compile and Test - name: Compile and Test
# note that this is not running any multi-jvm tests because multi-in-test=false # note that this is not running any multi-jvm tests because multi-in-test=false
run: |- run: |-

View file

@ -188,7 +188,8 @@ lazy val clusterSharding = pekkoModule("cluster-sharding")
.settings(AutomaticModuleName.settings("pekko.cluster.sharding")) .settings(AutomaticModuleName.settings("pekko.cluster.sharding"))
.settings(OSGi.clusterSharding) .settings(OSGi.clusterSharding)
.settings(Protobuf.settings) .settings(Protobuf.settings)
.enablePlugins(MultiNode, ScaladocNoVerificationOfDiagrams, Jdk9, SbtOsgi) .settings(PekkoDependWalker.jdk9CompileCheckSetting)
.enablePlugins(MultiNode, ScaladocNoVerificationOfDiagrams, Jdk9, DependWalkerPlugin, SbtOsgi)
lazy val clusterTools = pekkoModule("cluster-tools") lazy val clusterTools = pekkoModule("cluster-tools")
.dependsOn( .dependsOn(
@ -399,7 +400,8 @@ lazy val remote =
.settings(Protobuf.settings) .settings(Protobuf.settings)
.settings(Test / parallelExecution := false) .settings(Test / parallelExecution := false)
.settings(serialversionRemoverPluginSettings) .settings(serialversionRemoverPluginSettings)
.enablePlugins(Jdk9, SbtOsgi) .settings(PekkoDependWalker.jdk9CompileCheckSetting)
.enablePlugins(Jdk9, DependWalkerPlugin, SbtOsgi)
lazy val remoteTests = pekkoModule("remote-tests") lazy val remoteTests = pekkoModule("remote-tests")
.dependsOn( .dependsOn(
@ -428,7 +430,8 @@ lazy val stream = pekkoModule("stream")
.settings(OSGi.stream) .settings(OSGi.stream)
.settings(Protobuf.settings) .settings(Protobuf.settings)
.settings(VerifyJDK9Classes.settings) .settings(VerifyJDK9Classes.settings)
.enablePlugins(BoilerplatePlugin, Jdk9, SbtOsgi) .settings(PekkoDependWalker.jdk9CompileCheckSetting)
.enablePlugins(BoilerplatePlugin, Jdk9, DependWalkerPlugin, SbtOsgi)
lazy val streamTestkit = pekkoModule("stream-testkit") lazy val streamTestkit = pekkoModule("stream-testkit")
.dependsOn(stream, testkit % "compile->compile;test->test") .dependsOn(stream, testkit % "compile->compile;test->test")
@ -483,7 +486,8 @@ lazy val actorTyped = pekkoModule("actor-typed")
implicit val timeout = Timeout(5 seconds) implicit val timeout = Timeout(5 seconds)
""") """)
.enablePlugins(Jdk9, SbtOsgi) .settings(PekkoDependWalker.jdk9CompileCheckSetting)
.enablePlugins(Jdk9, DependWalkerPlugin, SbtOsgi)
lazy val persistenceTyped = pekkoModule("persistence-typed") lazy val persistenceTyped = pekkoModule("persistence-typed")
.dependsOn( .dependsOn(

View file

@ -0,0 +1,33 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Jdk9.CompileJdk9
import io.github.roiocam.DependWalkerPlugin.autoImport.walkTasks
import io.github.roiocam.TaskDefine._
import io.github.roiocam._
import sbt.Keys._
import sbt._
object PekkoDependWalker {
lazy val jdk9CompileCheckSetting = Seq(
walkTasks := Seq(
WalkTask(
ScopeKeyMatcher((Compile / packageBin).scopedKey, CheckBoth),
ScopeKeyMatcher((CompileJdk9 / compile).scopedKey, CheckConfig))))
}

View file

@ -29,6 +29,7 @@ addSbtPlugin("com.github.pjfanning" % "sbt-source-dist" % "0.1.11")
addSbtPlugin("com.github.pjfanning" % "sbt-pekko-build" % "0.3.2") addSbtPlugin("com.github.pjfanning" % "sbt-pekko-build" % "0.3.2")
addSbtPlugin("com.github.reibitto" % "sbt-welcome" % "0.4.0") addSbtPlugin("com.github.reibitto" % "sbt-welcome" % "0.4.0")
addSbtPlugin("com.github.sbt" % "sbt-license-report" % "1.6.1") addSbtPlugin("com.github.sbt" % "sbt-license-report" % "1.6.1")
addSbtPlugin("io.github.roiocam" % "sbt-depend-walker" % "0.1.1")
// We have to deliberately use older versions of sbt-paradox because current Pekko sbt build // We have to deliberately use older versions of sbt-paradox because current Pekko sbt build
// only loads on JDK 1.8 so we need to bring in older versions of parboiled which support JDK 1.8 // only loads on JDK 1.8 so we need to bring in older versions of parboiled which support JDK 1.8