Skip to content

Commit

Permalink
feat: Using dependency walking to verify JDK9 Plugin works (#1065)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>

---------

Signed-off-by: Andy.Chen <[email protected]>
  • Loading branch information
Roiocam authored Jan 30, 2024
1 parent abad72d commit 8a759ba
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/binary-compatibility-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ jobs:
- name: Compile code
run: sbt +compile

- name: Check if the dependency task in the built correctly
run: sbt dependWalkerCheck

- name: Report MiMa Binary Issues
run: |-
sbt +mimaReportBinaryIssues
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/nightly-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ jobs:
- name: Enable jvm-opts
run: cp .jvmopts-ci .jvmopts

- name: Check if the dependency task in the built correctly
run: sbt dependWalkerCheck

- name: Compile and Test
# note that this is not running any multi-jvm tests because multi-in-test=false
run: |-
Expand Down
12 changes: 8 additions & 4 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ lazy val clusterSharding = pekkoModule("cluster-sharding")
.settings(AutomaticModuleName.settings("pekko.cluster.sharding"))
.settings(OSGi.clusterSharding)
.settings(Protobuf.settings)
.enablePlugins(MultiNode, ScaladocNoVerificationOfDiagrams, Jdk9, SbtOsgi)
.settings(PekkoDependWalker.jdk9CompileCheckSetting)
.enablePlugins(MultiNode, ScaladocNoVerificationOfDiagrams, Jdk9, DependWalkerPlugin, SbtOsgi)

lazy val clusterTools = pekkoModule("cluster-tools")
.dependsOn(
Expand Down Expand Up @@ -399,7 +400,8 @@ lazy val remote =
.settings(Protobuf.settings)
.settings(Test / parallelExecution := false)
.settings(serialversionRemoverPluginSettings)
.enablePlugins(Jdk9, SbtOsgi)
.settings(PekkoDependWalker.jdk9CompileCheckSetting)
.enablePlugins(Jdk9, DependWalkerPlugin, SbtOsgi)

lazy val remoteTests = pekkoModule("remote-tests")
.dependsOn(
Expand Down Expand Up @@ -428,7 +430,8 @@ lazy val stream = pekkoModule("stream")
.settings(OSGi.stream)
.settings(Protobuf.settings)
.settings(VerifyJDK9Classes.settings)
.enablePlugins(BoilerplatePlugin, Jdk9, SbtOsgi)
.settings(PekkoDependWalker.jdk9CompileCheckSetting)
.enablePlugins(BoilerplatePlugin, Jdk9, DependWalkerPlugin, SbtOsgi)

lazy val streamTestkit = pekkoModule("stream-testkit")
.dependsOn(stream, testkit % "compile->compile;test->test")
Expand Down Expand Up @@ -483,7 +486,8 @@ lazy val actorTyped = pekkoModule("actor-typed")
implicit val timeout = Timeout(5 seconds)
""")
.enablePlugins(Jdk9, SbtOsgi)
.settings(PekkoDependWalker.jdk9CompileCheckSetting)
.enablePlugins(Jdk9, DependWalkerPlugin, SbtOsgi)

lazy val persistenceTyped = pekkoModule("persistence-typed")
.dependsOn(
Expand Down
33 changes: 33 additions & 0 deletions project/PekkoDependWalker.scala
Original file line number Diff line number Diff line change
@@ -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))))

}
1 change: 1 addition & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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.reibitto" % "sbt-welcome" % "0.4.0")
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
// only loads on JDK 1.8 so we need to bring in older versions of parboiled which support JDK 1.8
Expand Down

0 comments on commit 8a759ba

Please sign in to comment.