This is an automated email from the ASF dual-hosted git repository.

hepin pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-pekko.git


The following commit(s) were added to refs/heads/main by this push:
     new 8a759bad21 feat: Using dependency walking to verify JDK9 Plugin works 
(#1065)
8a759bad21 is described below

commit 8a759bad21b681f88e75cf2f82ec65a1ff3cad87
Author: AndyChen <[email protected]>
AuthorDate: Tue Jan 30 14:33:30 2024 +0800

    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 <[email protected]>
    
    ---------
    
    Signed-off-by: Andy.Chen <[email protected]>
---
 .github/workflows/binary-compatibility-checks.yml |  3 +++
 .github/workflows/nightly-builds.yml              |  3 +++
 build.sbt                                         | 12 ++++++---
 project/PekkoDependWalker.scala                   | 33 +++++++++++++++++++++++
 project/plugins.sbt                               |  1 +
 5 files changed, 48 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/binary-compatibility-checks.yml 
b/.github/workflows/binary-compatibility-checks.yml
index 0dcfe4c26c..3fb91a1c2e 100644
--- a/.github/workflows/binary-compatibility-checks.yml
+++ b/.github/workflows/binary-compatibility-checks.yml
@@ -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
diff --git a/.github/workflows/nightly-builds.yml 
b/.github/workflows/nightly-builds.yml
index 38f2d82027..f46edc92c3 100644
--- a/.github/workflows/nightly-builds.yml
+++ b/.github/workflows/nightly-builds.yml
@@ -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: |-
diff --git a/build.sbt b/build.sbt
index a5450d5e71..e2d172f220 100644
--- a/build.sbt
+++ b/build.sbt
@@ -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(
@@ -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(
@@ -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")
@@ -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(
diff --git a/project/PekkoDependWalker.scala b/project/PekkoDependWalker.scala
new file mode 100644
index 0000000000..036900388f
--- /dev/null
+++ b/project/PekkoDependWalker.scala
@@ -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))))
+
+}
diff --git a/project/plugins.sbt b/project/plugins.sbt
index 918787f5ee..c3a4838f2f 100644
--- a/project/plugins.sbt
+++ b/project/plugins.sbt
@@ -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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to