This is an automated email from the ASF dual-hosted git repository.
olabusayo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/daffodil.git
The following commit(s) were added to refs/heads/main by this push:
new fadf1f1a0 Update `main.yml` and `sonar-project.properties` for
improved SonarCloud integration
fadf1f1a0 is described below
commit fadf1f1a06843997c57e82dcb0744eb8abfa2cfe
Author: olabusayoT <[email protected]>
AuthorDate: Wed Feb 18 12:12:30 2026 -0500
Update `main.yml` and `sonar-project.properties` for improved SonarCloud
integration
- use environment vars `SONAR_JAVA_JARS` and `SONAR_TEST_JAVA_JARS` for
dependency resolution.
- Updated workflow to dynamically generate environment variables for jar
dependencies during scans, as well as scala version
- Update reportPaths to use env var SONAR_SCALA_VERSION in case of scala
version updates
- Modified `.sonar-project.properties` to reference new environment
variables for library paths.
DAFFODIL-3071, DAFFODIL-3068
---
.github/workflows/main.yml | 14 ++++++++++----
.sonar-project.properties | 11 +++++++----
2 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 08e03d770..bfab1ea11 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -214,11 +214,17 @@ jobs:
- name: Prepare for SonarCloud Scan
if: ${{ env.SONARSCAN == 'true' }}
run: |
- SCALA_VERSION=${{ matrix.scala_version }}
- SCALA_BINARY_VERSION=$(echo "$SCALA_VERSION" | cut -d. -f1,2)
+ SONAR_SCALA_VERSION=${{ matrix.scala_version }}
+ JAVA_JARS=$(sbt -batch -no-colors -error "export
Compile/dependencyClasspath" 2>/dev/null)
+ TEST_JAVA_JARS=$(sbt -batch -no-colors -error "export
Test/dependencyClasspath" 2>/dev/null)
+ SONAR_JAVA_JARS=$(echo "$JAVA_JARS" | grep -v dependencyClasspath |
tr ':;' '\n'| sort -u | paste -sd ',' -)
+ SONAR_TEST_JAVA_JARS=$(echo "$TEST_JAVA_JARS" | grep -v
dependencyClasspath | tr ':;' '\n'| sort -u | paste -sd ',' -)
# NOTE: This is needed by .sonar-project.properties so it can
- # have the right reportPath per version
- echo "SCALA_BINARY_VERSION=$SCALA_BINARY_VERSION" >> $GITHUB_ENV
+ # have the right reportPath per version, as well as the proper
+ # path to jar dependencies
+ echo "SONAR_SCALA_VERSION=$SONAR_SCALA_VERSION" >> $GITHUB_ENV
+ echo "SONAR_JAVA_JARS=$SONAR_JAVA_JARS" >> $GITHUB_ENV
+ echo "SONAR_TEST_JAVA_JARS=$SONAR_TEST_JAVA_JARS" >> $GITHUB_ENV
$SBT coverageReport
find . -name scoverage.xml -exec sed -i
's#/home/runner/work/daffodil/daffodil#/github/workspace#g' {} +
diff --git a/.sonar-project.properties b/.sonar-project.properties
index 1ece3a3d1..303bfea41 100644
--- a/.sonar-project.properties
+++ b/.sonar-project.properties
@@ -25,7 +25,10 @@ sonar.objc.file.suffixes=-
sonar.cpd.exclusions=daffodil-cli/src/main/scala/org/apache/daffodil/cli/Main.scala
sonar.java.binaries=target/**/classes
sonar.java.test.binaries=target/**/test-classes
-sonar.java.libraries=../lib_managed/jars/**/*.jar
-sonar.java.test.libraries=../lib_managed/jars/**/*.jar
-# SCALA_BINARY_VERSION (major.minor) must be provided externally
-sonar.scala.coverage.reportPaths=target/scala-${SCALA_BINARY_VERSION}/scoverage-report/scoverage.xml
+# SONAR_JAVA_JARS and SONAR_TEST_JAVA_JARS must be provided externally
+# You can get them by running the same commands in your shell as is run
+# in .github/workflows/main.yml for the Prepare for SonarCloud Scan step
+sonar.java.libraries=${env.SONAR_JAVA_JARS}
+sonar.java.test.libraries=${env.SONAR_JAVA_JARS}
+# SCALA_VERSION (major.minor.patch) must be provided externally
+sonar.scala.coverage.reportPaths=../target/scala-${env.SONAR_SCALA_VERSION}/scoverage-report/scoverage.xml