diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2024-09-24 16:38:35 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2024-09-26 20:03:15 +0000 |
commit | 97e7655468e5569daf3019aa5f6eaf2dde34b5d1 (patch) | |
tree | aef2b59630baa3939e07de4c4dcfe3bfec6917de | |
parent | 929368eb01081cd9d0d3414a5e915153711a5802 (diff) | |
download | sonarqube-97e7655468e5569daf3019aa5f6eaf2dde34b5d1.tar.gz sonarqube-97e7655468e5569daf3019aa5f6eaf2dde34b5d1.zip |
SONAR-23139 Add the aarch64 download option for the Scanner for CLI on MacOSX
4 files changed, 31 insertions, 26 deletions
diff --git a/server/sonar-web/src/main/js/components/tutorials/other/BuildToolForm.tsx b/server/sonar-web/src/main/js/components/tutorials/other/BuildToolForm.tsx index 3cc9278e818..67445debac4 100644 --- a/server/sonar-web/src/main/js/components/tutorials/other/BuildToolForm.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/other/BuildToolForm.tsx @@ -23,8 +23,12 @@ import { withCLanguageFeature } from '../../hoc/withCLanguageFeature'; import BuildConfigSelection from '../components/BuildConfigSelection'; import GithubCFamilyExampleRepositories from '../components/GithubCFamilyExampleRepositories'; import RenderOptions from '../components/RenderOptions'; -import { Arch, BuildTools, OSs, TutorialConfig, TutorialModes } from '../types'; -import { shouldShowArchSelector, shouldShowGithubCFamilyExampleRepositories } from '../utils'; +import { Arch, OSs, TutorialConfig, TutorialModes } from '../types'; +import { + shouldShowArchSelector, + shouldShowGithubCFamilyExampleRepositories, + shouldShowOsSelector, +} from '../utils'; interface Props { arch?: Arch; @@ -41,17 +45,9 @@ export function BuildToolForm(props: Readonly<Props>) { const { config, setConfig, os, setOs, arch, setArch, isLocal, hasCLanguageFeature } = props; function handleConfigChange(newConfig: TutorialConfig) { - const selectOsByDefault = (newConfig.buildTool === BuildTools.Cpp || - newConfig.buildTool === BuildTools.ObjectiveC || - newConfig.buildTool === BuildTools.Dart || - newConfig.buildTool === BuildTools.Other) && { - os: OSs.Linux, - }; - setConfig({ ...config, ...newConfig, - ...selectOsByDefault, }); } @@ -65,10 +61,7 @@ export function BuildToolForm(props: Readonly<Props>) { onSetConfig={handleConfigChange} /> )} - {(config.buildTool === BuildTools.Other || - config.buildTool === BuildTools.Dart || - config.buildTool === BuildTools.Cpp || - config.buildTool === BuildTools.ObjectiveC) && ( + {shouldShowOsSelector(config) && ( <RenderOptions label={translate('onboarding.build.other.os')} checked={os} diff --git a/server/sonar-web/src/main/js/components/tutorials/other/__tests__/__snapshots__/OtherTutorial-it.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/other/__tests__/__snapshots__/OtherTutorial-it.tsx.snap index d1616af96b7..51dc422f44c 100644 --- a/server/sonar-web/src/main/js/components/tutorials/other/__tests__/__snapshots__/OtherTutorial-it.tsx.snap +++ b/server/sonar-web/src/main/js/components/tutorials/other/__tests__/__snapshots__/OtherTutorial-it.tsx.snap @@ -87,8 +87,8 @@ exports[`can choose build tools and copy provided settings: c++ (automatic) and exports[`can choose build tools and copy provided settings: c++ (automatic) and other linux: execute scanner 2`] = ` "export SONAR_SCANNER_VERSION=6.2.0.4584 -export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux-x64 -curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux-x64.zip +export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux-aarch64 +curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux-aarch64.zip unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/ export PATH=$SONAR_SCANNER_HOME/bin:$PATH export SONAR_SCANNER_OPTS="-server" @@ -104,8 +104,8 @@ exports[`can choose build tools and copy provided settings: c++ (automatic) and exports[`can choose build tools and copy provided settings: c++ (automatic) and other macos: execute scanner 2`] = ` "export SONAR_SCANNER_VERSION=6.2.0.4584 -export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-macosx-x64 -curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-macosx-x64.zip +export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-macosx-aarch64 +curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-macosx-aarch64.zip unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/ export PATH=$SONAR_SCANNER_HOME/bin:$PATH export SONAR_SCANNER_OPTS="-server" @@ -192,8 +192,8 @@ export PATH=$HOME/.sonar/build-wrapper-macosx-x86:$PATH exports[`can choose build tools and copy provided settings: c++ (manual) macos: download scanner 1`] = ` "export SONAR_SCANNER_VERSION=6.2.0.4584 -export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-macosx-x64 -curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-macosx-x64.zip +export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-macosx-aarch64 +curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-macosx-aarch64.zip unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/ export PATH=$SONAR_SCANNER_HOME/bin:$PATH export SONAR_SCANNER_OPTS="-server" @@ -339,8 +339,8 @@ export PATH=$HOME/.sonar/build-wrapper-macosx-x86:$PATH exports[`can choose build tools and copy provided settings: objective-c macos: download scanner 1`] = ` "export SONAR_SCANNER_VERSION=6.2.0.4584 -export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-macosx-x64 -curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-macosx-x64.zip +export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-macosx-aarch64 +curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-macosx-aarch64.zip unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/ export PATH=$SONAR_SCANNER_HOME/bin:$PATH export SONAR_SCANNER_OPTS="-server" diff --git a/server/sonar-web/src/main/js/components/tutorials/other/commands/AnalysisCommand.tsx b/server/sonar-web/src/main/js/components/tutorials/other/commands/AnalysisCommand.tsx index 2ad95448d8f..59437d570f4 100644 --- a/server/sonar-web/src/main/js/components/tutorials/other/commands/AnalysisCommand.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/other/commands/AnalysisCommand.tsx @@ -57,7 +57,7 @@ export default function AnalysisCommand(props: Readonly<AnalysisCommandProps>) { case BuildTools.Other: return ( <Other - arch={Arch.X86_64} + arch={arch} baseUrl={baseUrl} os={os} component={component} diff --git a/server/sonar-web/src/main/js/components/tutorials/utils.ts b/server/sonar-web/src/main/js/components/tutorials/utils.ts index e66b36734d6..14746271ee8 100644 --- a/server/sonar-web/src/main/js/components/tutorials/utils.ts +++ b/server/sonar-web/src/main/js/components/tutorials/utils.ts @@ -124,20 +124,32 @@ export function shouldShowGithubCFamilyExampleRepositories(config: TutorialConfi return false; } +export function shouldShowOsSelector(config: TutorialConfig) { + return ( + config.buildTool === BuildTools.Cpp || + config.buildTool === BuildTools.ObjectiveC || + config.buildTool === BuildTools.Dart || + config.buildTool === BuildTools.Other + ); +} + export function shouldShowArchSelector( os: OSs | undefined, config: TutorialConfig, scannerDownloadExplicit = false, ) { - if (os !== OSs.Linux) { + if (!shouldShowOsSelector(config)) { return false; } - if (!isCFamily(config.buildTool)) { + if (os !== OSs.Linux && os !== OSs.MacOS) { return false; } if (scannerDownloadExplicit) { return true; } + if (!isCFamily(config.buildTool)) { + return false; + } if (config.buildTool === BuildTools.Cpp && config.autoConfig === AutoConfig.Automatic) { return false; } @@ -182,7 +194,7 @@ export function getScannerUrlSuffix(os: OSs, arch?: Arch) { return '-windows-x64'; } if (os === OSs.MacOS) { - return '-macosx-x64'; + return '-macosx-' + (arch === Arch.Arm64 ? 'aarch64' : 'x64'); } if (os === OSs.Linux) { return '-linux-' + (arch === Arch.Arm64 ? 'aarch64' : 'x64'); |