diff options
-rw-r--r-- | .cirrus.yml | 7 | ||||
-rw-r--r-- | .claude/update-jres.md | 46 | ||||
-rw-r--r-- | .github/workflows/PullRequestClosed.yml | 2 | ||||
-rw-r--r-- | .github/workflows/PullRequestCreated.yml | 2 | ||||
-rw-r--r-- | .github/workflows/RequestReview.yml | 2 | ||||
-rw-r--r-- | .github/workflows/SubmitReview.yml | 2 | ||||
-rw-r--r-- | .github/workflows/releasability.yml | 4 | ||||
-rw-r--r-- | CLAUDE.md | 20 | ||||
-rw-r--r-- | it/pom.xml | 6 | ||||
-rw-r--r-- | it/src/test/java/com/sonarsource/scanner/it/ScannerTestCase.java | 6 | ||||
-rw-r--r-- | pom.xml | 173 | ||||
-rw-r--r-- | src/main/assembly/dist-linux-aarch64.xml | 6 | ||||
-rw-r--r-- | src/main/assembly/dist-linux-x64.xml | 6 | ||||
-rw-r--r-- | src/main/assembly/dist-macosx-aarch64.xml | 6 | ||||
-rw-r--r-- | src/main/assembly/dist-macosx-x64.xml | 6 | ||||
-rw-r--r-- | src/main/java/org/sonarsource/scanner/cli/SystemInfo.java | 4 | ||||
-rw-r--r-- | src/test/java/org/sonarsource/scanner/cli/SystemInfoTest.java | 23 | ||||
-rw-r--r-- | src/test/java/testutils/LogTester.java | 6 |
18 files changed, 273 insertions, 54 deletions
diff --git a/.cirrus.yml b/.cirrus.yml index a489c04..69418f2 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -92,7 +92,7 @@ mend_scan_task: ws_artifacts: path: "whitesource/**/*" -linux_x64_qa_java17_task: +linux_x64_qa_java11_task: depends_on: - build <<: *ONLY_SONARSOURCE_QA @@ -113,6 +113,9 @@ linux_x64_qa_java17_task: - export PATH=$PATH:/tmp/${nodeName}/bin - source cirrus-env QA - source set_maven_build_version $BUILD_NUMBER + - wget -O OpenJDK11U-jre_x64_linux_hotspot_11.0.27_6.tar.gz https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.27%2B6/OpenJDK11U-jre_x64_linux_hotspot_11.0.27_6.tar.gz + - tar xzf OpenJDK11U-jre_x64_linux_hotspot_11.0.27_6.tar.gz -C /tmp + - export JAVA_11_HOME=/tmp/jdk-11.0.27+6-jre - cd it - mvn -B -e -Dsonar.runtimeVersion="$SQ_VERSION" -Dmaven.test.redirectTestOutputToFile=false verify cleanup_before_cache_script: @@ -142,7 +145,7 @@ win_x64_qa_java17_task: promote_task: depends_on: - - linux_x64_qa_java17 + - linux_x64_qa_java11 - win_x64_qa_java17 <<: *ONLY_SONARSOURCE_QA_EXCEPT_ON_NIGHTLY_CRON eks_container: diff --git a/.claude/update-jres.md b/.claude/update-jres.md new file mode 100644 index 0000000..a07e520 --- /dev/null +++ b/.claude/update-jres.md @@ -0,0 +1,46 @@ +# Update JREs Command + +Updates all bundled JREs in the sonar-scanner-cli project to the latest available JRE 17 version for each architecture by automatically querying the Adoptium API. + +## Arguments +- `latest` (default) - automatically finds the latest JRE 17 version for each architecture +- `<version>` - specify exact version like `17.0.15+6` + +## Steps performed: +1. **Fetch release metadata**: Query Adoptium/Temurin API to find the releases details +2. **Update version properties**: Update JRE root directory name in the pom.xml `<properties>` section for each architecture +3. **Update download URLs**: Update download URLs and SHA256 hashes for all platform profiles +4. **Validate changes**: Ensure all Maven profiles are properly updated, then run `mvn clean verify -P<list of all architecture-specific profile ids>` to be sure there are no errors + +## Platforms supported: +- Linux x64: `OpenJDK17U-jre_x64_linux_hotspot_{version}.tar.gz` +- Linux aarch64: `OpenJDK17U-jre_aarch64_linux_hotspot_{version}.tar.gz` +- macOS x64: `OpenJDK17U-jre_x64_mac_hotspot_{version}.tar.gz` +- macOS aarch64: `OpenJDK17U-jre_aarch64_mac_hotspot_{version}.tar.gz` +- Windows x64: `OpenJDK17U-jre_x64_windows_hotspot_{version}.zip` + +## Usage: +``` +/update-jres # Uses latest version (default) +/update-jres latest # Same as above +/update-jres 17.0.15+6 # Uses specific version +``` + +## Implementation Details: + +Don't use the GitHub API, as there is an Adoptium API: + +When using "latest" (default behavior), the command will: + +1. **Query the latest release metadata**: Use the Adoptium API: `curl -X 'GET' 'https://api.adoptium.net/v3/assets/latest/17/hotspot?image_type=jre&vendor=eclipse' -H 'accept: application/json'` +2. **Handle missing architectures**: If an architecture isn't found in the latest release, it might be that the release process is in progress. In this case suggest staying on the previous version. +3. **Read metadata from the JSON**: For each architecture/version combination: + - Read download URL from the JSON metadata (`binary.package.link`) + - Read SHA256 hash from from the JSON metadata (`binary.package.checksum`) + +When using a specific version, the command will: + +1. **Query the release metadata**: Use the Adoptium API: `curl -X 'GET' 'https://api.adoptium.net/v3/assets/version/<version URL encoded>?image_type=jre&page=0&page_size=10&project=jdk&release_type=ga&semver=false&sort_method=DEFAULT&sort_order=DESC&vendor=eclipse' -H 'accept: application/json'` +2. **Read metadata from the JSON**: For each architecture/version combination: + - Read download URL from the JSON metadata (`binaries.package.link`) + - Read SHA256 hash from from the JSON metadata (`binaries.package.checksum`) diff --git a/.github/workflows/PullRequestClosed.yml b/.github/workflows/PullRequestClosed.yml index 77bf0e1..dd54f81 100644 --- a/.github/workflows/PullRequestClosed.yml +++ b/.github/workflows/PullRequestClosed.yml @@ -7,7 +7,7 @@ on: jobs: PullRequestClosed_job: name: Pull Request Closed - runs-on: ubuntu-latest + runs-on: ubuntu-latest-large permissions: id-token: write pull-requests: read diff --git a/.github/workflows/PullRequestCreated.yml b/.github/workflows/PullRequestCreated.yml index cde6e4c..6ea51bf 100644 --- a/.github/workflows/PullRequestCreated.yml +++ b/.github/workflows/PullRequestCreated.yml @@ -7,7 +7,7 @@ on: jobs: PullRequestCreated_job: name: Pull Request Created - runs-on: ubuntu-latest + runs-on: ubuntu-latest-large permissions: id-token: write # For external PR, ticket should be created manually diff --git a/.github/workflows/RequestReview.yml b/.github/workflows/RequestReview.yml index 5eac0d5..5e74c2b 100644 --- a/.github/workflows/RequestReview.yml +++ b/.github/workflows/RequestReview.yml @@ -7,7 +7,7 @@ on: jobs: RequestReview_job: name: Request review - runs-on: ubuntu-latest + runs-on: ubuntu-latest-large permissions: id-token: write # For external PR, ticket should be moved manually diff --git a/.github/workflows/SubmitReview.yml b/.github/workflows/SubmitReview.yml index d5f22e6..763ca30 100644 --- a/.github/workflows/SubmitReview.yml +++ b/.github/workflows/SubmitReview.yml @@ -7,7 +7,7 @@ on: jobs: SubmitReview_job: name: Submit Review - runs-on: ubuntu-latest + runs-on: ubuntu-latest-large permissions: id-token: write pull-requests: read diff --git a/.github/workflows/releasability.yml b/.github/workflows/releasability.yml index bac8e4b..a2b5b48 100644 --- a/.github/workflows/releasability.yml +++ b/.github/workflows/releasability.yml @@ -7,7 +7,7 @@ name: Releasability status - completed jobs: update_releasability_status: - runs-on: ubuntu-latest + runs-on: ubuntu-latest-large name: Releasability status permissions: id-token: write @@ -18,7 +18,7 @@ jobs: && github.event.check_suite.conclusion == 'success' && github.event.check_suite.app.slug == 'cirrus-ci' steps: - - uses: SonarSource/gh-action_releasability/releasability-status@2.1.2 + - uses: SonarSource/gh-action_releasability/releasability-status@2.2.0 with: optional_checks: "Jira" env: diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..667f03a --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,20 @@ +# Claude Commands for SonarScanner CLI + +## Update JREs + +Help updating all bundled JREs to the latest available JRE 17 version, or to a specific version, by automatically querying the Adoptium API. + +**Command:** `/update-jres` + +**Usage:** +``` +/update-jres # Uses latest version (default) +/update-jres latest # Same as above +/update-jres 17.0.15+6 # Uses specific version +``` + +**What it does:** +1. **Get JREs metadata**: Queries Adoptium API to get JREs metadata +2. **Updates version properties**: Updates architecture-specific dirname properties in pom.xml +3. **Updates download URLs**: Updates platform-specific download URLs +4. **Updates SHA256 hashes**: Updates SHA256 hashes for each platform @@ -23,11 +23,11 @@ <properties> <license.name>GNU LGPL v3</license.name> - <sonar.buildVersion>7.9.1</sonar.buildVersion> + <sonar.buildVersion>25.5.0.107428</sonar.buildVersion> <!-- following properties must be set in command-line : sonar.runtimeVersion and sonarRunner.version --> <maven.compiler.release>17</maven.compiler.release> - <orchestrator.version>5.3.0.2465</orchestrator.version> + <orchestrator.version>5.6.2.2695</orchestrator.version> </properties> <dependencies> @@ -63,7 +63,7 @@ <dependency> <groupId>org.assertj</groupId> <artifactId>assertj-core</artifactId> - <version>3.26.3</version> + <version>3.27.3</version> </dependency> </dependencies> diff --git a/it/src/test/java/com/sonarsource/scanner/it/ScannerTestCase.java b/it/src/test/java/com/sonarsource/scanner/it/ScannerTestCase.java index 6b12552..4601cad 100644 --- a/it/src/test/java/com/sonarsource/scanner/it/ScannerTestCase.java +++ b/it/src/test/java/com/sonarsource/scanner/it/ScannerTestCase.java @@ -103,6 +103,9 @@ public abstract class ScannerTestCase { SonarScanner newScannerWithToken(File baseDir, String token, String... keyValueProperties) { SonarScanner scannerCli = SonarScanner.create(baseDir, keyValueProperties); + if (System.getenv().containsKey("JAVA_11_HOME")) { + scannerCli.getEnvironmentVariables().put("JAVA_HOME", System.getenv("JAVA_11_HOME")); + } scannerCli.setScannerVersion(artifactVersion().toString()); if (orchestrator.getServer().version().isGreaterThanOrEquals(10, 0)) { scannerCli.setProperty("sonar.token", token); @@ -115,6 +118,9 @@ public abstract class ScannerTestCase { SonarScanner newScannerWithAdminCredentials(File baseDir, String... keyValueProperties) { SonarScanner scannerCli = SonarScanner.create(baseDir, keyValueProperties); + if (System.getenv().containsKey("JAVA_11_HOME")) { + scannerCli.getEnvironmentVariables().put("JAVA_HOME", System.getenv("JAVA_11_HOME")); + } scannerCli.setScannerVersion(artifactVersion().toString()); if (orchestrator.getServer().version().isGreaterThanOrEquals(25, 1)) { scannerCli.setProperty("sonar.token", orchestrator.getDefaultAdminToken()); @@ -10,7 +10,7 @@ <groupId>org.sonarsource.scanner.cli</groupId> <artifactId>sonar-scanner-cli</artifactId> - <version>7.2-SNAPSHOT</version> + <version>7.3-SNAPSHOT</version> <packaging>jar</packaging> <name>SonarScanner CLI</name> <url>https://docs.sonarsource.com/sonarqube/latest/analyzing-source-code/scanners/sonarscanner/</url> @@ -55,14 +55,16 @@ <!-- configuration for assembly of distributions --> <unpack.dir>${project.build.directory}/unpack</unpack.dir> <scanner.jar>${project.build.finalName}.jar</scanner.jar> - <jre.dirname.linux>jdk-17.0.13+11-jre</jre.dirname.linux> - <jre.dirname.windows>jdk-17.0.13+11-jre</jre.dirname.windows> - <jre.dirname.macosx>jdk-17.0.13+11-jre/Contents/Home</jre.dirname.macosx> + <jre.dirname.linux.aarch64>jdk-17.0.15+6-jre</jre.dirname.linux.aarch64> + <jre.dirname.linux.x64>jdk-17.0.15+6-jre</jre.dirname.linux.x64> + <jre.dirname.macosx.aarch64>jdk-17.0.15+6-jre/Contents/Home</jre.dirname.macosx.aarch64> + <jre.dirname.macosx.x64>jdk-17.0.15+6-jre/Contents/Home</jre.dirname.macosx.x64> + <jre.dirname.windows>jdk-17.0.15+6-jre</jre.dirname.windows> <!-- Release: enable publication to Bintray --> <artifactsToPublish>${project.groupId}:${project.artifactId}:zip,${project.groupId}:${project.artifactId}:zip:linux-x64,${project.groupId}:${project.artifactId}:zip:linux-aarch64,${project.groupId}:${project.artifactId}:zip:windows-x64,${project.groupId}:${project.artifactId}:zip:macosx-x64,${project.groupId}:${project.artifactId}:zip:macosx-aarch64,${project.groupId}:${project.artifactId}:json:cyclonedx</artifactsToPublish> - <maven.compiler.release>17</maven.compiler.release> + <maven.compiler.release>11</maven.compiler.release> </properties> <dependencyManagement> @@ -70,7 +72,7 @@ <dependency> <groupId>org.junit</groupId> <artifactId>junit-bom</artifactId> - <version>5.11.4</version> + <version>5.13.3</version> <type>pom</type> <scope>import</scope> </dependency> @@ -81,17 +83,17 @@ <dependency> <groupId>org.sonarsource.scanner.lib</groupId> <artifactId>sonar-scanner-java-library</artifactId> - <version>3.3.1.450</version> + <version>3.4.0.514</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> - <version>2.0.16</version> + <version>2.0.17</version> </dependency> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> - <version>1.5.13</version> + <version>1.5.18</version> </dependency> <dependency> <groupId>com.google.code.findbugs</groupId> @@ -109,13 +111,13 @@ <dependency> <groupId>org.assertj</groupId> <artifactId>assertj-core</artifactId> - <version>3.26.3</version> + <version>3.27.3</version> <scope>test</scope> </dependency> <dependency> <groupId>org.mockito</groupId> <artifactId>mockito-core</artifactId> - <version>5.14.2</version> + <version>5.18.0</version> <scope>test</scope> </dependency> </dependencies> @@ -240,8 +242,8 @@ <configuration> <rules> <requireFilesSize> - <minsize>11200000</minsize> - <maxsize>11300000</maxsize> + <minsize>11600000</minsize> + <maxsize>11700000</maxsize> <files> <file>${project.build.directory}/sonar-scanner-${project.version}.zip</file> </files> @@ -289,10 +291,10 @@ <goal>wget</goal> </goals> <configuration> - <url>https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.13%2B11/OpenJDK17U-jre_x64_linux_hotspot_17.0.13_11.tar.gz</url> + <url>https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.15%2B6/OpenJDK17U-jre_x64_linux_hotspot_17.0.15_6.tar.gz</url> <unpack>true</unpack> <outputDirectory>${unpack.dir}/linux-x64</outputDirectory> - <sha256>4086cc7cb2d9e7810141f255063caad10a8a018db5e6b47fa5394c506ab65bff</sha256> + <sha256>aaed740c38ff1e87a4b920f9deb165d419d9fdf23f423740d2ecb280eeab9647</sha256> </configuration> </execution> </executions> @@ -319,6 +321,31 @@ </execution> </executions> </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-enforcer-plugin</artifactId> + <executions> + <execution> + <id>enforce-linux-x64-distribution-size</id> + <goals> + <goal>enforce</goal> + </goals> + <phase>verify</phase> + <configuration> + <rules> + <requireFilesSize> + <!-- Should be big enough to confirm the JRE was bundled --> + <minsize>50000000</minsize> + <maxsize>60000000</maxsize> + <files> + <file>${project.build.directory}/sonar-scanner-${project.version}-linux-x64.zip</file> + </files> + </requireFilesSize> + </rules> + </configuration> + </execution> + </executions> + </plugin> </plugins> </build> </profile> @@ -337,10 +364,10 @@ <goal>wget</goal> </goals> <configuration> - <url>https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.13%2B11/OpenJDK17U-jre_aarch64_linux_hotspot_17.0.13_11.tar.gz</url> + <url>https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.15%2B6/OpenJDK17U-jre_aarch64_linux_hotspot_17.0.15_6.tar.gz</url> <unpack>true</unpack> <outputDirectory>${unpack.dir}/linux-aarch64</outputDirectory> - <sha256>97c4fb748eaa1292fb2f28fec90a3eba23e35974ef67f8b3aa304ad4db2ba162</sha256> + <sha256>c89467f543bd434b71f3b748adeeeb1b2692f90242824b78205be1ae72ba385f</sha256> </configuration> </execution> </executions> @@ -367,6 +394,31 @@ </execution> </executions> </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-enforcer-plugin</artifactId> + <executions> + <execution> + <id>enforce-linux-aarch64-distribution-size</id> + <goals> + <goal>enforce</goal> + </goals> + <phase>verify</phase> + <configuration> + <rules> + <requireFilesSize> + <!-- Should be big enough to confirm the JRE was bundled --> + <minsize>50000000</minsize> + <maxsize>60000000</maxsize> + <files> + <file>${project.build.directory}/sonar-scanner-${project.version}-linux-aarch64.zip</file> + </files> + </requireFilesSize> + </rules> + </configuration> + </execution> + </executions> + </plugin> </plugins> </build> </profile> @@ -385,10 +437,10 @@ <goal>wget</goal> </goals> <configuration> - <url>https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.13%2B11/OpenJDK17U-jre_x64_windows_hotspot_17.0.13_11.zip</url> + <url>https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.15%2B6/OpenJDK17U-jre_x64_windows_hotspot_17.0.15_6.zip</url> <unpack>true</unpack> <outputDirectory>${unpack.dir}/windows-x64</outputDirectory> - <sha256>11a61a94d383e755b08b4e5890a13d148bc9f95b7149cbbeec62efb8c75a4a67</sha256> + <sha256>4380136495b1aebf10593a94c98babd632155e5ace3fa5b1a1a3b79d6fbe2e99</sha256> </configuration> </execution> </executions> @@ -415,6 +467,31 @@ </execution> </executions> </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-enforcer-plugin</artifactId> + <executions> + <execution> + <id>enforce-windows-x64-distribution-size</id> + <goals> + <goal>enforce</goal> + </goals> + <phase>verify</phase> + <configuration> + <rules> + <requireFilesSize> + <!-- Should be big enough to confirm the JRE was bundled --> + <minsize>50000000</minsize> + <maxsize>60000000</maxsize> + <files> + <file>${project.build.directory}/sonar-scanner-${project.version}-windows-x64.zip</file> + </files> + </requireFilesSize> + </rules> + </configuration> + </execution> + </executions> + </plugin> </plugins> </build> </profile> @@ -433,10 +510,10 @@ <goal>wget</goal> </goals> <configuration> - <url>https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.13%2B11/OpenJDK17U-jre_x64_mac_hotspot_17.0.13_11.tar.gz</url> + <url>https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.15%2B6/OpenJDK17U-jre_x64_mac_hotspot_17.0.15_6.tar.gz</url> <unpack>true</unpack> <outputDirectory>${unpack.dir}/macosx-x64</outputDirectory> - <sha256>bf9faf4540001a251e6bfb52b99c7ec5b1f36d3ebe94e104f61a30f173ba8c78</sha256> + <sha256>38f7bb3faaa3aec90290e6dd912a050cc895ee2aa8fb9d8ea6aac86822bb108b</sha256> </configuration> </execution> </executions> @@ -463,6 +540,31 @@ </execution> </executions> </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-enforcer-plugin</artifactId> + <executions> + <execution> + <id>enforce-macosx-x64-distribution-size</id> + <goals> + <goal>enforce</goal> + </goals> + <phase>verify</phase> + <configuration> + <rules> + <requireFilesSize> + <!-- Should be big enough to confirm the JRE was bundled --> + <minsize>49000000</minsize> + <maxsize>60000000</maxsize> + <files> + <file>${project.build.directory}/sonar-scanner-${project.version}-macosx-x64.zip</file> + </files> + </requireFilesSize> + </rules> + </configuration> + </execution> + </executions> + </plugin> </plugins> </build> </profile> @@ -481,10 +583,10 @@ <goal>wget</goal> </goals> <configuration> - <url>https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.13%2B11/OpenJDK17U-jre_aarch64_mac_hotspot_17.0.13_11.tar.gz</url> + <url>https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.15%2B6/OpenJDK17U-jre_aarch64_mac_hotspot_17.0.15_6.tar.gz</url> <unpack>true</unpack> <outputDirectory>${unpack.dir}/macosx-aarch64</outputDirectory> - <sha256>a886b8f2a50eca2e59b45ea59f5a2e8e9d27ff5b5b3b069443a70cda7f27c907</sha256> + <sha256>2eb9548fbed1031355ca11a35b5a297e9872edd1dafacb40294f0c1a6677bbfb</sha256> </configuration> </execution> </executions> @@ -511,6 +613,31 @@ </execution> </executions> </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-enforcer-plugin</artifactId> + <executions> + <execution> + <id>enforce-macosx-aarch64-distribution-size</id> + <goals> + <goal>enforce</goal> + </goals> + <phase>verify</phase> + <configuration> + <rules> + <requireFilesSize> + <!-- Should be big enough to confirm the JRE was bundled --> + <minsize>49000000</minsize> + <maxsize>60000000</maxsize> + <files> + <file>${project.build.directory}/sonar-scanner-${project.version}-macosx-aarch64.zip</file> + </files> + </requireFilesSize> + </rules> + </configuration> + </execution> + </executions> + </plugin> </plugins> </build> </profile> diff --git a/src/main/assembly/dist-linux-aarch64.xml b/src/main/assembly/dist-linux-aarch64.xml index 3e92aa7..4109d88 100644 --- a/src/main/assembly/dist-linux-aarch64.xml +++ b/src/main/assembly/dist-linux-aarch64.xml @@ -9,7 +9,7 @@ <!-- jre basic, except bin/ --> <fileSet> - <directory>${unpack.dir}/linux-aarch64/${jre.dirname.linux}</directory> + <directory>${unpack.dir}/linux-aarch64/${jre.dirname.linux.aarch64}</directory> <outputDirectory>jre</outputDirectory> <excludes> <exclude>bin/**</exclude> @@ -22,7 +22,7 @@ <!-- jre bin/java --> <fileSet> - <directory>${unpack.dir}/linux-aarch64/${jre.dirname.linux}/bin</directory> + <directory>${unpack.dir}/linux-aarch64/${jre.dirname.linux.aarch64}/bin</directory> <outputDirectory>jre/bin</outputDirectory> <includes> <include>java</include> @@ -32,7 +32,7 @@ <!-- jre lib executable files --> <fileSet> - <directory>${unpack.dir}/linux-aarch64/${jre.dirname.linux}/lib</directory> + <directory>${unpack.dir}/linux-aarch64/${jre.dirname.linux.aarch64}/lib</directory> <outputDirectory>jre/lib</outputDirectory> <includes> <include>jspawnhelper</include> diff --git a/src/main/assembly/dist-linux-x64.xml b/src/main/assembly/dist-linux-x64.xml index f13e733..34c465c 100644 --- a/src/main/assembly/dist-linux-x64.xml +++ b/src/main/assembly/dist-linux-x64.xml @@ -9,7 +9,7 @@ <!-- jre basic, except bin/ --> <fileSet> - <directory>${unpack.dir}/linux-x64/${jre.dirname.linux}</directory> + <directory>${unpack.dir}/linux-x64/${jre.dirname.linux.x64}</directory> <outputDirectory>jre</outputDirectory> <excludes> <exclude>bin/**</exclude> @@ -22,7 +22,7 @@ <!-- jre bin/java --> <fileSet> - <directory>${unpack.dir}/linux-x64/${jre.dirname.linux}/bin</directory> + <directory>${unpack.dir}/linux-x64/${jre.dirname.linux.x64}/bin</directory> <outputDirectory>jre/bin</outputDirectory> <includes> <include>java</include> @@ -32,7 +32,7 @@ <!-- jre lib executable files --> <fileSet> - <directory>${unpack.dir}/linux-x64/${jre.dirname.linux}/lib</directory> + <directory>${unpack.dir}/linux-x64/${jre.dirname.linux.x64}/lib</directory> <outputDirectory>jre/lib</outputDirectory> <includes> <include>jspawnhelper</include> diff --git a/src/main/assembly/dist-macosx-aarch64.xml b/src/main/assembly/dist-macosx-aarch64.xml index 2329b9b..ecddba0 100644 --- a/src/main/assembly/dist-macosx-aarch64.xml +++ b/src/main/assembly/dist-macosx-aarch64.xml @@ -9,7 +9,7 @@ <!-- jre basic, except bin/ and misc --> <fileSet> - <directory>${unpack.dir}/macosx-aarch64/${jre.dirname.macosx}</directory> + <directory>${unpack.dir}/macosx-aarch64/${jre.dirname.macosx.aarch64}</directory> <outputDirectory>jre</outputDirectory> <excludes> <exclude>bin/**</exclude> @@ -20,7 +20,7 @@ <!-- jre bin/java --> <fileSet> - <directory>${unpack.dir}/macosx-aarch64/${jre.dirname.macosx}/bin</directory> + <directory>${unpack.dir}/macosx-aarch64/${jre.dirname.macosx.aarch64}/bin</directory> <outputDirectory>jre/bin</outputDirectory> <includes> <include>java</include> @@ -30,7 +30,7 @@ <!-- jre lib executable files --> <fileSet> - <directory>${unpack.dir}/macosx-aarch64/${jre.dirname.macosx}/lib</directory> + <directory>${unpack.dir}/macosx-aarch64/${jre.dirname.macosx.aarch64}/lib</directory> <outputDirectory>jre/lib</outputDirectory> <includes> <include>jspawnhelper</include> diff --git a/src/main/assembly/dist-macosx-x64.xml b/src/main/assembly/dist-macosx-x64.xml index 9429ff6..3967d1b 100644 --- a/src/main/assembly/dist-macosx-x64.xml +++ b/src/main/assembly/dist-macosx-x64.xml @@ -9,7 +9,7 @@ <!-- jre basic, except bin/ and misc --> <fileSet> - <directory>${unpack.dir}/macosx-x64/${jre.dirname.macosx}</directory> + <directory>${unpack.dir}/macosx-x64/${jre.dirname.macosx.x64}</directory> <outputDirectory>jre</outputDirectory> <excludes> <exclude>bin/**</exclude> @@ -20,7 +20,7 @@ <!-- jre bin/java --> <fileSet> - <directory>${unpack.dir}/macosx-x64/${jre.dirname.macosx}/bin</directory> + <directory>${unpack.dir}/macosx-x64/${jre.dirname.macosx.x64}/bin</directory> <outputDirectory>jre/bin</outputDirectory> <includes> <include>java</include> @@ -30,7 +30,7 @@ <!-- jre lib executable files --> <fileSet> - <directory>${unpack.dir}/macosx-x64/${jre.dirname.macosx}/lib</directory> + <directory>${unpack.dir}/macosx-x64/${jre.dirname.macosx.x64}/lib</directory> <outputDirectory>jre/lib</outputDirectory> <includes> <include>jspawnhelper</include> diff --git a/src/main/java/org/sonarsource/scanner/cli/SystemInfo.java b/src/main/java/org/sonarsource/scanner/cli/SystemInfo.java index 4e39a4f..762e9e2 100644 --- a/src/main/java/org/sonarsource/scanner/cli/SystemInfo.java +++ b/src/main/java/org/sonarsource/scanner/cli/SystemInfo.java @@ -44,11 +44,11 @@ class SystemInfo { static void print() { LOG.info("SonarScanner CLI {}", ScannerVersion.version()); - LOG.atInfo().log(SystemInfo::java); + LOG.atDebug().log(SystemInfo::java); LOG.atInfo().log(SystemInfo::os); String scannerOpts = system.getenv("SONAR_SCANNER_OPTS"); if (scannerOpts != null) { - LOG.atInfo().addArgument(() -> redactSensitiveArguments(scannerOpts)).log("SONAR_SCANNER_OPTS={}"); + LOG.atDebug().addArgument(() -> redactSensitiveArguments(scannerOpts)).log("SONAR_SCANNER_OPTS={}"); } } diff --git a/src/test/java/org/sonarsource/scanner/cli/SystemInfoTest.java b/src/test/java/org/sonarsource/scanner/cli/SystemInfoTest.java index da00b00..6e8698c 100644 --- a/src/test/java/org/sonarsource/scanner/cli/SystemInfoTest.java +++ b/src/test/java/org/sonarsource/scanner/cli/SystemInfoTest.java @@ -74,7 +74,21 @@ class SystemInfoTest { } @Test - void should_print() { + void should_print_scanner_version_and_os_at_info() { + mockOs(); + mockJava(); + + SystemInfo.print(); + + verify(mockSystem).getProperty("os.version"); + + assertThat(logTester.logs(Level.INFO)) + .containsOnly("SonarScanner CLI " + ScannerVersion.version(), "linux 2.5 x64"); + } + + @Test + void should_print_jvm_version_and_opts_at_debug() { + logTester.setLevel(Level.DEBUG); mockOs(); mockJava(); when(mockSystem.getenv("SONAR_SCANNER_OPTS")).thenReturn("arg"); @@ -85,12 +99,13 @@ class SystemInfoTest { verify(mockSystem).getProperty("os.version"); verify(mockSystem).getenv("SONAR_SCANNER_OPTS"); - assertThat(logTester.logs(Level.INFO)) - .containsOnly("SonarScanner CLI " + ScannerVersion.version(), "Java 1.9 oracle (64-bit)", "linux 2.5 x64", "SONAR_SCANNER_OPTS=arg"); + assertThat(logTester.logs(Level.DEBUG)) + .containsOnly("Java 1.9 oracle (64-bit)", "SONAR_SCANNER_OPTS=arg"); } @Test void should_not_print_sensitive_data() { + logTester.setLevel(Level.DEBUG); mockOs(); mockJava(); when(mockSystem.getenv("SONAR_SCANNER_OPTS")) @@ -98,6 +113,6 @@ class SystemInfoTest { SystemInfo.print(); - assertThat(logTester.logs(Level.INFO)).contains("SONAR_SCANNER_OPTS=-Dsonar.login=* -Dsonar.whatever=whatever -Dsonar.password=* -Dsonar.whatever2=whatever2 -Dsonar.token=*"); + assertThat(logTester.logs(Level.DEBUG)).contains("SONAR_SCANNER_OPTS=-Dsonar.login=* -Dsonar.whatever=whatever -Dsonar.password=* -Dsonar.whatever2=whatever2 -Dsonar.token=*"); } } diff --git a/src/test/java/testutils/LogTester.java b/src/test/java/testutils/LogTester.java index 4b87c52..8a9d0f0 100644 --- a/src/test/java/testutils/LogTester.java +++ b/src/test/java/testutils/LogTester.java @@ -28,6 +28,8 @@ import org.junit.jupiter.api.extension.ExtensionContext; import org.slf4j.LoggerFactory; import org.slf4j.event.Level; +import static java.util.stream.Collectors.*; + public class LogTester implements BeforeEachCallback, AfterEachCallback { private final ConcurrentListAppender<ILoggingEvent> listAppender = new ConcurrentListAppender<>(); @@ -55,7 +57,7 @@ public class LogTester implements BeforeEachCallback, AfterEachCallback { public List<String> logs() { return listAppender.list.stream().map(e -> (LoggingEvent) e) .map(LoggingEvent::getFormattedMessage) - .toList(); + .collect(toList()); } /** @@ -66,7 +68,7 @@ public class LogTester implements BeforeEachCallback, AfterEachCallback { return listAppender.list.stream().map(e -> (LoggingEvent) e) .filter(e -> e.getLevel().equals(ch.qos.logback.classic.Level.fromLocationAwareLoggerInteger(level.toInt()))) .map(LoggingEvent::getFormattedMessage) - .toList(); + .collect(toList()); } public LogTester clear() { |