aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/AnalysisCommand.tsx40
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/__snapshots__/BitbucketPipelinesTutorial-it.tsx.snap8
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/commands/CFamily.ts13
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/components/CreateYmlFile.tsx14
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/other/BuildToolForm.tsx5
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/other/ProjectAnalysisStep.tsx1
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/other/__tests__/OtherTutorial-it.tsx11
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/other/__tests__/__snapshots__/OtherTutorial-it.tsx.snap35
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/other/commands/AnalysisCommand.tsx18
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/other/commands/ClangGCCCommand.tsx4
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/other/commands/DownloadScanner.tsx41
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/other/commands/Other.tsx9
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/utils.ts31
-rw-r--r--server/sonar-web/src/main/js/helpers/doc-links.ts1
-rw-r--r--sonar-core/src/main/resources/org/sonar/l10n/core.properties2
15 files changed, 192 insertions, 41 deletions
diff --git a/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/AnalysisCommand.tsx b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/AnalysisCommand.tsx
index fa956930e0b..b5f49ab41f0 100644
--- a/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/AnalysisCommand.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/AnalysisCommand.tsx
@@ -17,16 +17,21 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+import { Link } from '@sonarsource/echoes-react';
import { Dictionary } from 'lodash';
import * as React from 'react';
+import { FormattedMessage } from 'react-intl';
import withAvailableFeatures, {
WithAvailableFeaturesProps,
} from '../../../app/components/available-features/withAvailableFeatures';
+import { DocLink } from '../../../helpers/doc-links';
+import { useDocUrl } from '../../../helpers/docs';
+import { translate } from '../../../helpers/l10n';
import { Feature } from '../../../types/features';
import { Component } from '../../../types/types';
import { CompilationInfo } from '../components/CompilationInfo';
import CreateYmlFile from '../components/CreateYmlFile';
-import { Arch, BuildTools, TutorialConfig } from '../types';
+import { Arch, AutoConfig, BuildTools, TutorialConfig } from '../types';
import { isCFamily } from '../utils';
import { PreambuleYaml } from './PreambuleYaml';
import cFamilyExample from './commands/CFamily';
@@ -60,9 +65,20 @@ const YamlTemplate: Dictionary<BuildToolExampleBuilder> = {
[BuildTools.Other]: othersExample,
};
+const showJreWarning = (config: TutorialConfig, arch: Arch) => {
+ if (!isCFamily(config.buildTool)) {
+ return false;
+ }
+ if (config.autoConfig === AutoConfig.Automatic) {
+ return false;
+ }
+ return arch === Arch.Arm64;
+};
+
export function AnalysisCommand(props: Readonly<AnalysisCommandProps>) {
const { config, arch, mainBranchName, component } = props;
const branchesEnabled = props.hasFeature(Feature.BranchSupport);
+ const scannerRequirementsUrl = useDocUrl(DocLink.SonarScannerRequirements);
if (!config.buildTool) {
return null;
@@ -77,10 +93,30 @@ export function AnalysisCommand(props: Readonly<AnalysisCommandProps>) {
projectName: component.name,
});
+ const warning = showJreWarning(config, arch) && (
+ <p className="sw-mb-2">
+ <FormattedMessage
+ defaultMessage={translate('onboarding.analysis.sq_scanner.jre_required_warning')}
+ id="onboarding.analysis.sq_scanner.jre_required_warning"
+ values={{
+ link: (
+ <Link to={scannerRequirementsUrl}>
+ {translate('onboarding.analysis.sq_scanner.jre_required_warning.link')}
+ </Link>
+ ),
+ }}
+ />
+ </p>
+ );
+
return (
<>
<PreambuleYaml buildTool={config.buildTool} component={component} />
- <CreateYmlFile yamlFileName="bitbucket-pipelines.yml" yamlTemplate={yamlTemplate} />
+ <CreateYmlFile
+ yamlFileName="bitbucket-pipelines.yml"
+ yamlTemplate={yamlTemplate}
+ warning={warning}
+ />
{isCFamily(config.buildTool) && <CompilationInfo />}
</>
);
diff --git a/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/__snapshots__/BitbucketPipelinesTutorial-it.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/__snapshots__/BitbucketPipelinesTutorial-it.tsx.snap
index af497235e2f..af14ac13ac1 100644
--- a/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/__snapshots__/BitbucketPipelinesTutorial-it.tsx.snap
+++ b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/__snapshots__/BitbucketPipelinesTutorial-it.tsx.snap
@@ -105,9 +105,9 @@ definitions:
- mkdir $HOME/.sonar
- curl -sSLo $HOME/.sonar/build-wrapper-linux-aarch64.zip \${SONAR_HOST_URL}/static/cpp/build-wrapper-linux-aarch64.zip
- unzip -o $HOME/.sonar/build-wrapper-linux-aarch64.zip -d $HOME/.sonar/
- - curl -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-\${SONAR_SCANNER_VERSION}-linux.zip
+ - curl -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-\${SONAR_SCANNER_VERSION}.zip
- unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
- - export PATH="$PATH:$HOME/.sonar/sonar-scanner-\${SONAR_SCANNER_VERSION}-linux/bin"
+ - export PATH="$PATH:$HOME/.sonar/sonar-scanner-\${SONAR_SCANNER_VERSION}/bin"
- <any step required before running your build, like ./configure>
- $HOME/.sonar/build-wrapper-linux-aarch64/build-wrapper-linux-aarch64 --out-dir bw-output <your clean build command>
- sonar-scanner -Dsonar.cfamily.compile-commands=bw-output/compile_commands.json
@@ -143,9 +143,9 @@ definitions:
- mkdir $HOME/.sonar
- curl -sSLo $HOME/.sonar/build-wrapper-linux-aarch64.zip \${SONAR_HOST_URL}/static/cpp/build-wrapper-linux-aarch64.zip
- unzip -o $HOME/.sonar/build-wrapper-linux-aarch64.zip -d $HOME/.sonar/
- - curl -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-\${SONAR_SCANNER_VERSION}-linux.zip
+ - curl -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-\${SONAR_SCANNER_VERSION}.zip
- unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
- - export PATH="$PATH:$HOME/.sonar/sonar-scanner-\${SONAR_SCANNER_VERSION}-linux/bin"
+ - export PATH="$PATH:$HOME/.sonar/sonar-scanner-\${SONAR_SCANNER_VERSION}/bin"
- <any step required before running your build, like ./configure>
- $HOME/.sonar/build-wrapper-linux-aarch64/build-wrapper-linux-aarch64 --out-dir bw-output <your clean build command>
- sonar-scanner -Dsonar.cfamily.compile-commands=bw-output/compile_commands.json
diff --git a/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/commands/CFamily.ts b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/commands/CFamily.ts
index 70df56f6ce9..cf77fbf478a 100644
--- a/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/commands/CFamily.ts
+++ b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/commands/CFamily.ts
@@ -17,8 +17,12 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-import { AutoConfig, BuildTools } from '../../types';
-import { getBuildWrapperExecutableLinux, getBuildWrapperFolderLinux } from '../../utils';
+import { AutoConfig, BuildTools, OSs } from '../../types';
+import {
+ getBuildWrapperExecutableLinux,
+ getBuildWrapperFolderLinux,
+ getScannerUrlSuffix,
+} from '../../utils';
import { BuildToolExampleBuilder } from '../AnalysisCommand';
import othersExample from './Others';
@@ -33,6 +37,7 @@ const cFamilyExample: BuildToolExampleBuilder = ({
}
const buildWrapperExecutable = getBuildWrapperExecutableLinux(arch);
const buildWrapperFolder = getBuildWrapperFolderLinux(arch);
+ const scannerSuffix = getScannerUrlSuffix(OSs.Linux, arch);
return `image: <image ready for your build toolchain>
definitions:
@@ -44,9 +49,9 @@ definitions:
- mkdir $HOME/.sonar
- curl -sSLo $HOME/.sonar/${buildWrapperFolder}.zip \${SONAR_HOST_URL}/static/cpp/${buildWrapperFolder}.zip
- unzip -o $HOME/.sonar/${buildWrapperFolder}.zip -d $HOME/.sonar/
- - curl -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-\${SONAR_SCANNER_VERSION}-linux.zip
+ - curl -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-\${SONAR_SCANNER_VERSION}${scannerSuffix}.zip
- unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
- - export PATH="$PATH:$HOME/.sonar/sonar-scanner-\${SONAR_SCANNER_VERSION}-linux/bin"
+ - export PATH="$PATH:$HOME/.sonar/sonar-scanner-\${SONAR_SCANNER_VERSION}${scannerSuffix}/bin"
- <any step required before running your build, like ./configure>
- $HOME/.sonar/${buildWrapperFolder}/${buildWrapperExecutable} --out-dir bw-output <your clean build command>
- sonar-scanner -Dsonar.cfamily.compile-commands=bw-output/compile_commands.json
diff --git a/server/sonar-web/src/main/js/components/tutorials/components/CreateYmlFile.tsx b/server/sonar-web/src/main/js/components/tutorials/components/CreateYmlFile.tsx
index a2658bb5b80..8be1e9d92e2 100644
--- a/server/sonar-web/src/main/js/components/tutorials/components/CreateYmlFile.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/components/CreateYmlFile.tsx
@@ -17,19 +17,20 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-import { ClipboardIconButton, CodeSnippet, NumberedListItem } from 'design-system';
+import { ClipboardIconButton, CodeSnippet, FlagMessage, NumberedListItem } from 'design-system';
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
import { translate } from '../../../helpers/l10n';
import { InlineSnippet } from './InlineSnippet';
export interface CreateYmlFileProps {
+ warning?: React.ReactNode;
yamlFileName: string;
yamlTemplate: string;
}
-export default function CreateYmlFile(props: CreateYmlFileProps) {
- const { yamlTemplate, yamlFileName } = props;
+export default function CreateYmlFile(props: Readonly<CreateYmlFileProps>) {
+ const { yamlTemplate, yamlFileName, warning } = props;
return (
<NumberedListItem>
<FormattedMessage
@@ -44,6 +45,13 @@ export default function CreateYmlFile(props: CreateYmlFileProps) {
),
}}
/>
+ {warning && (
+ <div>
+ <FlagMessage className="sw-mt-2 sw-w-abs-600" variant="warning">
+ {warning}
+ </FlagMessage>
+ </div>
+ )}
<CodeSnippet className="sw-p-6 sw-overflow-auto" snippet={yamlTemplate} language="yml" />
</NumberedListItem>
);
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 e5a51052430..78d5bbf5531 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
@@ -30,6 +30,7 @@ interface Props {
arch?: Arch;
config: TutorialConfig;
hasCLanguageFeature: boolean;
+ isLocal: boolean;
os?: OSs;
setArch: (arch: Arch) => void;
setConfig: (config: TutorialConfig) => void;
@@ -37,7 +38,7 @@ interface Props {
}
export function BuildToolForm(props: Readonly<Props>) {
- const { config, setConfig, os, setOs, arch, setArch, hasCLanguageFeature } = props;
+ const { config, setConfig, os, setOs, arch, setArch, isLocal, hasCLanguageFeature } = props;
function handleConfigChange(newConfig: TutorialConfig) {
const selectOsByDefault = (newConfig.buildTool === BuildTools.Cpp ||
@@ -75,7 +76,7 @@ export function BuildToolForm(props: Readonly<Props>) {
titleLabelKey="onboarding.build.other.os"
/>
)}
- {shouldShowArchSelector(os, config) && (
+ {shouldShowArchSelector(os, config, !isLocal) && (
<RenderOptions
label={translate('onboarding.build.other.architecture')}
checked={arch}
diff --git a/server/sonar-web/src/main/js/components/tutorials/other/ProjectAnalysisStep.tsx b/server/sonar-web/src/main/js/components/tutorials/other/ProjectAnalysisStep.tsx
index e40181969a7..ed8fb265cd1 100644
--- a/server/sonar-web/src/main/js/components/tutorials/other/ProjectAnalysisStep.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/other/ProjectAnalysisStep.tsx
@@ -47,6 +47,7 @@ export default function ProjectAnalysisStep(props: Readonly<Props>) {
<div className="sw-pb-4">
<BuildToolForm
config={config}
+ isLocal={isLocal}
setConfig={setConfig}
os={os}
setOs={setOs}
diff --git a/server/sonar-web/src/main/js/components/tutorials/other/__tests__/OtherTutorial-it.tsx b/server/sonar-web/src/main/js/components/tutorials/other/__tests__/OtherTutorial-it.tsx
index 00616b9b63d..dbc445d6326 100644
--- a/server/sonar-web/src/main/js/components/tutorials/other/__tests__/OtherTutorial-it.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/other/__tests__/OtherTutorial-it.tsx
@@ -124,9 +124,19 @@ it('can choose build tools and copy provided settings', async () => {
// C++ - Automatic
await user.click(ui.cppBuildButton.get());
await user.click(ui.linuxButton.get());
+ expect(getCopyToClipboardValue(0, 'Copy')).toMatchSnapshot(
+ 'c++ (automatic) and other linux: download scanner',
+ );
expect(getCopyToClipboardValue(1, 'Copy')).toMatchSnapshot(
'c++ (automatic) and other linux: execute scanner',
);
+ await user.click(ui.arm64Button.get());
+ expect(getCopyToClipboardValue(0, 'Copy')).toMatchSnapshot(
+ 'c++ (automatic) and other linux arm64: download scanner',
+ );
+ expect(getCopyToClipboardValue(1, 'Copy')).toMatchSnapshot(
+ 'c++ (automatic) and other linux arm64: execute scanner',
+ );
await user.click(ui.windowsButton.get());
expect(getCopyToClipboardValue(1, 'Copy')).toMatchSnapshot(
'c++ (automatic) and other windows: execute scanner',
@@ -139,6 +149,7 @@ it('can choose build tools and copy provided settings', async () => {
// C++ - Linux (x86_64)
await user.click(ui.autoConfigManual.get());
await user.click(ui.linuxButton.get());
+ await user.click(ui.x86_64Button.get());
expect(getCopyToClipboardValue(0, 'Copy')).toMatchSnapshot(
'c++ (manual) linux: download build wrapper',
);
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 b38254c0548..9bbba92c695 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
@@ -1,5 +1,32 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
+exports[`can choose build tools and copy provided settings: c++ (automatic) and other linux arm64: download scanner 1`] = `
+"export SONAR_SCANNER_VERSION=5.0.1.3006
+export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION
+curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION.zip
+unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
+export PATH=$SONAR_SCANNER_HOME/bin:$PATH
+export SONAR_SCANNER_OPTS="-server"
+"
+`;
+
+exports[`can choose build tools and copy provided settings: c++ (automatic) and other linux arm64: execute scanner 1`] = `
+"sonar-scanner \\
+ -Dsonar.projectKey=my-project \\
+ -Dsonar.sources=. \\
+ -Dsonar.host.url=http://localhost:9000"
+`;
+
+exports[`can choose build tools and copy provided settings: c++ (automatic) and other linux: download scanner 1`] = `
+"export SONAR_SCANNER_VERSION=5.0.1.3006
+export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux
+curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux.zip
+unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
+export PATH=$SONAR_SCANNER_HOME/bin:$PATH
+export SONAR_SCANNER_OPTS="-server"
+"
+`;
+
exports[`can choose build tools and copy provided settings: c++ (automatic) and other linux: execute scanner 1`] = `
"sonar-scanner \\
-Dsonar.projectKey=my-project \\
@@ -60,8 +87,8 @@ export PATH=$HOME/.sonar/build-wrapper-linux-aarch64:$PATH
exports[`can choose build tools and copy provided settings: c++ (manual) linux arm64: download scanner 1`] = `
"export SONAR_SCANNER_VERSION=5.0.1.3006
-export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux
-curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux.zip
+export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION
+curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION.zip
unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
export PATH=$SONAR_SCANNER_HOME/bin:$PATH
export SONAR_SCANNER_OPTS="-server"
@@ -207,8 +234,8 @@ export PATH=$HOME/.sonar/build-wrapper-linux-aarch64:$PATH
exports[`can choose build tools and copy provided settings: objective-c linux arm64: download scanner 1`] = `
"export SONAR_SCANNER_VERSION=5.0.1.3006
-export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux
-curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux.zip
+export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION
+curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION.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 7105aeafa15..846fdb0f14c 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
@@ -55,14 +55,28 @@ export default function AnalysisCommand(props: Readonly<AnalysisCommandProps>) {
case BuildTools.Other:
return (
- <Other baseUrl={baseUrl} os={os} component={component} isLocal={isLocal} token={token} />
+ <Other
+ arch={Arch.X86_64}
+ baseUrl={baseUrl}
+ os={os}
+ component={component}
+ isLocal={isLocal}
+ token={token}
+ />
);
case BuildTools.Cpp:
case BuildTools.ObjectiveC:
if (config.buildTool === BuildTools.Cpp && config.autoConfig === AutoConfig.Automatic) {
return (
- <Other os={os} baseUrl={baseUrl} component={component} isLocal={isLocal} token={token} />
+ <Other
+ arch={arch}
+ os={os}
+ baseUrl={baseUrl}
+ component={component}
+ isLocal={isLocal}
+ token={token}
+ />
);
}
return (
diff --git a/server/sonar-web/src/main/js/components/tutorials/other/commands/ClangGCCCommand.tsx b/server/sonar-web/src/main/js/components/tutorials/other/commands/ClangGCCCommand.tsx
index 90dfda610b3..0498b2c2c46 100644
--- a/server/sonar-web/src/main/js/components/tutorials/other/commands/ClangGCCCommand.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/other/commands/ClangGCCCommand.tsx
@@ -35,13 +35,13 @@ export interface ClangGCCCustomProps {
token: string;
}
-export default function ClangGCCCustom(props: ClangGCCCustomProps) {
+export default function ClangGCCCustom(props: Readonly<ClangGCCCustomProps>) {
const { os, arch, baseUrl, component, isLocal, token } = props;
return (
<div>
<DownloadBuildWrapper isLocal={isLocal} baseUrl={baseUrl} os={os} arch={arch} />
- <DownloadScanner isLocal={isLocal} os={os} token={token} />
+ <DownloadScanner arch={arch} isLocal={isLocal} os={os} token={token} />
<ExecBuildWrapper os={os} arch={arch} />
<CompilationInfo />
<ExecScanner
diff --git a/server/sonar-web/src/main/js/components/tutorials/other/commands/DownloadScanner.tsx b/server/sonar-web/src/main/js/components/tutorials/other/commands/DownloadScanner.tsx
index b914eaa4960..872f355e206 100644
--- a/server/sonar-web/src/main/js/components/tutorials/other/commands/DownloadScanner.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/other/commands/DownloadScanner.tsx
@@ -18,10 +18,11 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+import { Link } from '@sonarsource/echoes-react';
import {
ClipboardIconButton,
CodeSnippet,
- Link,
+ FlagMessage,
NumberedList,
NumberedListItem,
SubHeading,
@@ -32,18 +33,21 @@ import { DocLink } from '../../../../helpers/doc-links';
import { useDocUrl } from '../../../../helpers/docs';
import { translate } from '../../../../helpers/l10n';
import { InlineSnippet } from '../../components/InlineSnippet';
-import { OSs } from '../../types';
+import { Arch, OSs } from '../../types';
+import { getScannerUrlSuffix } from '../../utils';
export interface DownloadScannerProps {
+ arch: Arch;
isLocal: boolean;
os: OSs;
token: string;
}
-export default function DownloadScanner(props: DownloadScannerProps) {
- const { os, isLocal, token } = props;
+export default function DownloadScanner(props: Readonly<DownloadScannerProps>) {
+ const { arch, os, isLocal, token } = props;
const docUrl = useDocUrl(DocLink.SonarScanner);
+ const scannerRequirementsUrl = useDocUrl(DocLink.SonarScannerRequirements);
return (
<div className="sw-mb-4">
@@ -66,12 +70,29 @@ export default function DownloadScanner(props: DownloadScannerProps) {
</p>
) : (
<>
+ {os === OSs.Linux && arch === Arch.Arm64 && (
+ <FlagMessage className="sw-mt-2 sw-w-abs-600" variant="warning">
+ <p className="sw-mb-2">
+ <FormattedMessage
+ defaultMessage={translate('onboarding.analysis.sq_scanner.jre_required_warning')}
+ id="onboarding.analysis.sq_scanner.jre_required_warning"
+ values={{
+ link: (
+ <Link to={scannerRequirementsUrl}>
+ {translate('onboarding.analysis.sq_scanner.jre_required_warning.link')}
+ </Link>
+ ),
+ }}
+ />
+ </p>
+ </FlagMessage>
+ )}
<CodeSnippet
className="sw-p-4"
wrap
language={os === OSs.Windows ? 'powershell' : 'bash'}
- snippet={getRemoteDownloadSnippet(os)}
- render={`<code>${getRemoteDownloadSnippet(os)}</code>`}
+ snippet={getRemoteDownloadSnippet(os, arch)}
+ render={`<code>${getRemoteDownloadSnippet(os, arch)}</code>`}
/>
<SubHeading className="sw-mb-2 sw-mt-4">
{translate('onboarding.analysis.sq_scanner.sonar_token_env.header')}
@@ -98,7 +119,7 @@ export default function DownloadScanner(props: DownloadScannerProps) {
);
}
-function getRemoteDownloadSnippet(os: OSs) {
+function getRemoteDownloadSnippet(os: OSs, arch: Arch) {
if (os === OSs.Windows) {
return `$env:SONAR_SCANNER_VERSION = "5.0.1.3006"
$env:SONAR_DIRECTORY = [System.IO.Path]::Combine($(get-location).Path,".sonar")
@@ -113,10 +134,10 @@ $env:Path += ";$env:SONAR_SCANNER_HOME/bin"
$env:SONAR_SCANNER_OPTS="-server"
`;
}
- const suffix = os === OSs.MacOS ? 'macosx' : 'linux';
+ const suffix = getScannerUrlSuffix(os, arch);
return `export SONAR_SCANNER_VERSION=5.0.1.3006
-export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-${suffix}
-curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-${suffix}.zip
+export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION${suffix}
+curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION${suffix}.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/Other.tsx b/server/sonar-web/src/main/js/components/tutorials/other/commands/Other.tsx
index 81b72ded5e9..82500b1e060 100644
--- a/server/sonar-web/src/main/js/components/tutorials/other/commands/Other.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/other/commands/Other.tsx
@@ -19,11 +19,12 @@
*/
import * as React from 'react';
import { Component } from '../../../../types/types';
-import { OSs } from '../../types';
+import { Arch, OSs } from '../../types';
import DownloadScanner from './DownloadScanner';
import ExecScanner from './ExecScanner';
export interface OtherProps {
+ arch: Arch;
baseUrl: string;
component: Component;
isLocal: boolean;
@@ -31,12 +32,12 @@ export interface OtherProps {
token: string;
}
-export default function Other(props: OtherProps) {
- const { baseUrl, os, component, isLocal, token } = props;
+export default function Other(props: Readonly<OtherProps>) {
+ const { arch, baseUrl, os, component, isLocal, token } = props;
return (
<div>
- <DownloadScanner isLocal={isLocal} os={os} token={token} />
+ <DownloadScanner arch={arch} isLocal={isLocal} os={os} token={token} />
<ExecScanner
baseUrl={baseUrl}
isLocal={isLocal}
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 f5b1aa95345..fc1a041aaae 100644
--- a/server/sonar-web/src/main/js/components/tutorials/utils.ts
+++ b/server/sonar-web/src/main/js/components/tutorials/utils.ts
@@ -120,13 +120,20 @@ export function shouldShowGithubCFamilyExampleRepositories(config: TutorialConfi
return false;
}
-export function shouldShowArchSelector(os: OSs | undefined, config: TutorialConfig) {
+export function shouldShowArchSelector(
+ os: OSs | undefined,
+ config: TutorialConfig,
+ scannerDownloadExplicit = false,
+) {
if (os !== OSs.Linux) {
return false;
}
if (!isCFamily(config.buildTool)) {
return false;
}
+ if (scannerDownloadExplicit) {
+ return true;
+ }
if (config.buildTool === BuildTools.Cpp && config.autoConfig === AutoConfig.Automatic) {
return false;
}
@@ -159,6 +166,22 @@ export function getBuildWrapperExecutable(os: OSs, arch?: Arch) {
throw new Error(`Unsupported OS: ${os}`);
}
-export const getBuildWrapperFolderLinux = (arch?: Arch) => getBuildWrapperFolder(OSs.Linux, arch);
-export const getBuildWrapperExecutableLinux = (arch?: Arch) =>
- getBuildWrapperExecutable(OSs.Linux, arch);
+export function getBuildWrapperFolderLinux(arch?: Arch) {
+ return getBuildWrapperFolder(OSs.Linux, arch);
+}
+export function getBuildWrapperExecutableLinux(arch?: Arch) {
+ return getBuildWrapperExecutable(OSs.Linux, arch);
+}
+
+export function getScannerUrlSuffix(os: OSs, arch?: Arch) {
+ if (os === OSs.Windows) {
+ return '-windows';
+ }
+ if (os === OSs.MacOS) {
+ return '-macosx';
+ }
+ if (os === OSs.Linux && arch === Arch.X86_64) {
+ return '-linux';
+ }
+ return '';
+}
diff --git a/server/sonar-web/src/main/js/helpers/doc-links.ts b/server/sonar-web/src/main/js/helpers/doc-links.ts
index 148dc4b7702..219e701fdcf 100644
--- a/server/sonar-web/src/main/js/helpers/doc-links.ts
+++ b/server/sonar-web/src/main/js/helpers/doc-links.ts
@@ -77,6 +77,7 @@ export enum DocLink {
ServerUpgradeRoadmap = '/setup-and-upgrade/upgrade-the-server/roadmap/',
SonarLintConnectedMode = '/user-guide/sonarlint-connected-mode/',
SonarScanner = '/analyzing-source-code/scanners/sonarscanner/',
+ SonarScannerRequirements = '/analyzing-source-code/scanners/general-requirements/',
SonarScannerDotNet = '/analyzing-source-code/scanners/sonarscanner-for-dotnet/',
SonarScannerGradle = '/analyzing-source-code/scanners/sonarscanner-for-gradle/',
SonarScannerMaven = '/analyzing-source-code/scanners/sonarscanner-for-maven/',
diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties
index 61513daa6dd..80dc1c28a1e 100644
--- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties
+++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties
@@ -4637,6 +4637,8 @@ onboarding.analysis.sq_scanner.docs_link=official documentation of the Scanner
onboarding.analysis.sq_scanner.sonar_token_env.header=Configure a SONAR_TOKEN environment variable in your CI settings
onboarding.analysis.sq_scanner.sonar_token_env.var_name=Add an environment variable called
onboarding.analysis.sq_scanner.sonar_token_env.var_value=Give it the following value
+onboarding.analysis.sq_scanner.jre_required_warning=A compatible Java Runtime Environment is required to run the Scanner on this platform, please refer to {link} for more details.
+onboarding.analysis.sq_scanner.jre_required_warning.link=the documentation
onboarding.analysis.sqscanner.docs.gradle.title=official documentation of the Scanner for Gradle
onboarding.analysis.sqscanner.docs.gradle.example_project.title=live Gradle-based example project