3 * Copyright (C) 2009-2021 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.
21 import * as React from 'react';
22 import { FormattedMessage } from 'react-intl';
23 import { ClipboardIconButton } from 'sonar-ui-common/components/controls/clipboard';
24 import { translate } from 'sonar-ui-common/helpers/l10n';
25 import CodeSnippet from '../../../common/CodeSnippet';
26 import SentenceWithHighlights from '../../components/SentenceWithHighlights';
27 import { BuildTools } from '../../types';
29 export enum PrepareType {
35 export interface PrepareAnalysisCommandProps {
36 buildTool: BuildTools;
41 export default function PrepareAnalysisCommand(props: PrepareAnalysisCommandProps) {
42 const { buildTool, kind, projectKey } = props;
44 const ADDITIONAL_PROPERTY = 'sonar.cfamily.build-wrapper-output=<output directory>';
46 const MAVEN_GRADLE_PROPS_SNIPPET = `# Additional properties that will be passed to the scanner,
47 # Put one key=value per line, example:
48 # sonar.exclusions=**/*.bin
49 sonar.projectKey=${projectKey}`;
52 <ul className="list-styled">
54 <SentenceWithHighlights
55 translationKey="onboarding.tutorial.with.azure_pipelines.BranchAnalysis.prepare.endpoint"
56 highlightKeys={['endpoint']}
61 id="onboarding.tutorial.with.azure_pipelines.BranchAnalysis.prepare.run_analysis"
62 defaultMessage={translate(
63 'onboarding.tutorial.with.azure_pipelines.BranchAnalysis.prepare.run_analysis'
69 'onboarding.tutorial.with.azure_pipelines.BranchAnalysis.prepare.run_analysis.section'
76 'onboarding.tutorial.with.azure_pipelines.BranchAnalysis.prepare.run_analysis.values',
85 {kind === PrepareType.StandAlone && (
88 <SentenceWithHighlights
89 translationKey="onboarding.tutorial.with.azure_pipelines.BranchAnalysis.manual"
90 highlightKeys={['mode']}
96 id="onboarding.tutorial.with.azure_pipelines.BranchAnalysis.run.key.sentence"
97 defaultMessage={translate(
98 'onboarding.tutorial.with.azure_pipelines.BranchAnalysis.run.key.sentence'
104 'onboarding.tutorial.with.azure_pipelines.BranchAnalysis.run.key.sentence.project_key'
108 key: <code className="rule">{projectKey}</code>,
109 button: <ClipboardIconButton copyValue={projectKey} />
113 {buildTool === BuildTools.CFamily && (
116 id="onboarding.tutorial.with.azure_pipelines.BranchAnalysis.prepare_additional.ccpp"
117 defaultMessage={translate(
118 'onboarding.tutorial.with.azure_pipelines.BranchAnalysis.prepare_additional.ccpp'
124 'onboarding.tutorial.with.azure_pipelines.BranchAnalysis.prepare_additional.ccpp.advanced'
131 'onboarding.tutorial.with.azure_pipelines.BranchAnalysis.prepare_additional.ccpp.additional'
135 property: <code className="rule">{ADDITIONAL_PROPERTY}</code>,
136 button: <ClipboardIconButton copyValue={ADDITIONAL_PROPERTY} />
144 {kind === PrepareType.JavaMavenGradle && (
146 <SentenceWithHighlights
147 translationKey="onboarding.tutorial.with.azure_pipelines.BranchAnalysis.advanced_properties"
148 highlightKeys={['section', 'properties']}
151 <CodeSnippet snippet={MAVEN_GRADLE_PROPS_SNIPPET} />
154 {kind === PrepareType.MSBuild && (
157 id="onboarding.tutorial.with.azure_pipelines.BranchAnalysis.run.key.sentence"
158 defaultMessage={translate(
159 'onboarding.tutorial.with.azure_pipelines.BranchAnalysis.run.key.sentence'
165 'onboarding.tutorial.with.azure_pipelines.BranchAnalysis.run.key.sentence.project_key'
169 key: <code className="rule">{projectKey}</code>,
170 button: <ClipboardIconButton copyValue={projectKey} />