stevedlawrence commented on code in PR #1630:
URL: https://github.com/apache/daffodil/pull/1630#discussion_r2824109249
##########
.github/workflows/main.yml:
##########
@@ -215,10 +215,16 @@ jobs:
if: ${{ env.SONARSCAN == 'true' }}
run: |
SCALA_VERSION=${{ matrix.scala_version }}
- SCALA_BINARY_VERSION=$(echo "$SCALA_VERSION" | cut -d. -f1,2)
+ 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/,$//')
Review Comment:
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
##########
.github/workflows/main.yml:
##########
@@ -215,10 +215,16 @@ jobs:
if: ${{ env.SONARSCAN == 'true' }}
run: |
SCALA_VERSION=${{ matrix.scala_version }}
- SCALA_BINARY_VERSION=$(echo "$SCALA_VERSION" | cut -d. -f1,2)
+ 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/,$//')
# 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 "SCALA_VERSION=$SCALA_VERSION" >> $GITHUB_ENV
Review Comment:
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.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]