Skip to content

Comments

Update main.yml and sonar-project.properties#1630

Merged
olabusayoT merged 1 commit intoapache:mainfrom
olabusayoT:daf-3071-update-sonar-properties
Feb 19, 2026
Merged

Update main.yml and sonar-project.properties#1630
olabusayoT merged 1 commit intoapache:mainfrom
olabusayoT:daf-3071-update-sonar-properties

Conversation

@olabusayoT
Copy link
Contributor

  • 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 SCALA_VERSION in case of scala version updates
  • Modified .sonar-project.properties to reference new environment variables for library paths.

DAFFODIL-3071, DAFFODIL-3068

Copy link
Member

@stevedlawrence stevedlawrence left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, looks good, just minor tweaks/suggestions

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" | sed 's/.*dependencyClasspath[[:space:]]*//' | sed '/^[[:space:]]*$/d' | tr ';' '\n' | tr ':' '\n' | sort -ui | tr '\n' ',' | sed 's/,$//')
SONAR_TEST_JAVA_JARS=$(echo "$TEST_JAVA_JARS" | sed 's/.*dependencyClasspath[[:space:]]*//' | sed '/^[[:space:]]*$/d' | tr ';' '\n'| tr ':' '\n' | sort -ui | tr '\n' ',' | sed 's/,$//')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these can be simplified a bit, e.g.

SONAR_JAVA_JARS=$(echo "$JAVA_JARS" | grep -v dependencyClasspath | tr ':;' '\n'| sort -u | paste -sd ',' -)

Uses grep -v to remove the 'dependencyClasspath' lines, combines the colon/semicolon tr into a single tr, and uses paste to avoid having to strip the trailing comma

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 "SCALA_VERSION=$SCALA_VERSION" >> $GITHUB_ENV
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we make this SONAR_SCALA_VERSION just to make it distinct and make it clear it's for the sonar stuff? SCALA_VERSION is kindof generic--if someone ever wanted to run this locally I could imagine that possibly affecting something other than the sonar scans.

Copy link
Contributor

@jadams-tresys jadams-tresys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

…oud 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
@olabusayoT olabusayoT force-pushed the daf-3071-update-sonar-properties branch from 73fd8a7 to fd21de2 Compare February 19, 2026 13:54
@olabusayoT olabusayoT merged commit fadf1f1 into apache:main Feb 19, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants