3 * Copyright (C) 2009-2023 SonarSource SA
4 * mailto:info AT sonarsource DOT com
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 3 of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 import * as React from 'react';
21 import { FormattedMessage } from 'react-intl';
22 import { ClipboardIconButton } from '../../../../components/controls/clipboard';
23 import { translate } from '../../../../helpers/l10n';
24 import CodeSnippet from '../../../common/CodeSnippet';
25 import SentenceWithHighlights from '../../components/SentenceWithHighlights';
26 import { BuildTools } from '../../types';
28 export enum PrepareType {
34 export interface PrepareAnalysisCommandProps {
35 buildTool: BuildTools;
40 export default function PrepareAnalysisCommand(props: PrepareAnalysisCommandProps) {
41 const { buildTool, kind, projectKey } = props;
43 const ADDITIONAL_PROPERTY = 'sonar.cfamily.build-wrapper-output=bw-output';
45 const MAVEN_GRADLE_PROPS_SNIPPET = `# Additional properties that will be passed to the scanner,
46 # Put one key=value per line, example:
47 # sonar.exclusions=**/*.bin
48 sonar.projectKey=${projectKey}`;
51 <ul className="list-styled list-alpha spacer-top">
53 <SentenceWithHighlights
54 translationKey="onboarding.tutorial.with.azure_pipelines.BranchAnalysis.prepare.endpoint"
55 highlightKeys={['endpoint']}
60 id="onboarding.tutorial.with.azure_pipelines.BranchAnalysis.prepare.run_analysis"
61 defaultMessage={translate(
62 'onboarding.tutorial.with.azure_pipelines.BranchAnalysis.prepare.run_analysis'
68 'onboarding.tutorial.with.azure_pipelines.BranchAnalysis.prepare.run_analysis.section'
75 'onboarding.tutorial.with.azure_pipelines.BranchAnalysis.prepare.run_analysis.values',
84 {kind === PrepareType.StandAlone && (
87 <SentenceWithHighlights
88 translationKey="onboarding.tutorial.with.azure_pipelines.BranchAnalysis.manual"
89 highlightKeys={['mode']}
95 id="onboarding.tutorial.with.azure_pipelines.BranchAnalysis.run.key.sentence"
96 defaultMessage={translate(
97 'onboarding.tutorial.with.azure_pipelines.BranchAnalysis.run.key.sentence'
103 'onboarding.tutorial.with.azure_pipelines.BranchAnalysis.run.key.sentence.project_key'
107 key: <code className="rule">{projectKey}</code>,
108 button: <ClipboardIconButton copyValue={projectKey} />,
112 {buildTool === BuildTools.CFamily && (
115 id="onboarding.tutorial.with.azure_pipelines.BranchAnalysis.prepare_additional.ccpp"
116 defaultMessage={translate(
117 'onboarding.tutorial.with.azure_pipelines.BranchAnalysis.prepare_additional.ccpp'
123 'onboarding.tutorial.with.azure_pipelines.BranchAnalysis.prepare_additional.ccpp.advanced'
130 'onboarding.tutorial.with.azure_pipelines.BranchAnalysis.prepare_additional.ccpp.additional'
134 property: <code className="rule">{ADDITIONAL_PROPERTY}</code>,
135 button: <ClipboardIconButton copyValue={ADDITIONAL_PROPERTY} />,
143 {kind === PrepareType.JavaMavenGradle && (
145 <SentenceWithHighlights
146 translationKey="onboarding.tutorial.with.azure_pipelines.BranchAnalysis.advanced_properties"
147 highlightKeys={['section', 'properties']}
150 <CodeSnippet snippet={MAVEN_GRADLE_PROPS_SNIPPET} />
153 {kind === PrepareType.MSBuild && (
156 id="onboarding.tutorial.with.azure_pipelines.BranchAnalysis.run.key.sentence"
157 defaultMessage={translate(
158 'onboarding.tutorial.with.azure_pipelines.BranchAnalysis.run.key.sentence'
164 'onboarding.tutorial.with.azure_pipelines.BranchAnalysis.run.key.sentence.project_key'
168 key: <code className="rule">{projectKey}</code>,
169 button: <ClipboardIconButton copyValue={projectKey} />,