]> source.dussan.org Git - sonarqube.git/blob
793c9deca1bb5505f421a5e574be279005ef7d54
[sonarqube.git] /
1 /*
2  * SonarQube
3  * Copyright (C) 2009-2020 SonarSource SA
4  * mailto:info AT sonarsource DOT com
5  *
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.
10  *
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.
15  *
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.
19  */
20 import * as React from 'react';
21 import { FormattedMessage } from 'react-intl';
22 import { translate } from 'sonar-ui-common/helpers/l10n';
23 import CodeSnippet from '../../../../../components/common/CodeSnippet';
24 import {
25   getSonarcloudAddonYml,
26   getSonarcloudAddonYmlRender,
27   RequirementJavaBuild
28 } from '../AnalysisCommandTravis';
29 import { Props } from '../JavaGradle';
30
31 export function JavaGradleTravisSonarCloud(props: Props) {
32   const config = `plugins {
33   id "org.sonarqube" version "2.7"
34 }
35
36 sonarqube {
37   properties {
38     sonar.projectKey: ${props.projectKey}
39   }
40 }`;
41
42   const command = `${getSonarcloudAddonYml(props.organization)}
43
44 script:
45   - ./gradlew sonarqube`;
46
47   const renderCommand = () => (
48     <>
49       {getSonarcloudAddonYmlRender(props.organization)}
50       <br />
51       {`script:
52   - ./gradlew sonarqube`}
53     </>
54   );
55
56   return (
57     <div>
58       <h2 className="spacer-bottom spacer-top">
59         {translate('onboarding.analysis.with.travis.setup.title.a')}
60       </h2>
61
62       <RequirementJavaBuild />
63
64       <hr className="no-horizontal-margins" />
65
66       <h2 className="spacer-bottom spacer-top">
67         {translate('onboarding.analysis.with.travis.setup.title.b')}
68       </h2>
69
70       <FormattedMessage
71         defaultMessage={translate('onboarding.analysis.java.gradle.text.1.sonarcloud')}
72         id="onboarding.analysis.java.gradle.text.1.sonarcloud"
73         values={{
74           file: <code>build.gradle</code>,
75           plugin: <code>org.sonarqube</code>
76         }}
77       />
78
79       <CodeSnippet snippet={config} />
80
81       <FormattedMessage
82         defaultMessage={translate('onboarding.analysis.java.gradle.text.2.sonarcloud')}
83         id="onboarding.analysis.java.gradle.text.2.sonarcloud"
84         values={{
85           file: <code>.travis.yml</code>
86         }}
87       />
88
89       <CodeSnippet render={renderCommand} snippet={command} />
90
91       <FormattedMessage
92         defaultMessage={translate('onboarding.analysis.sq_scanner.docs_use_case')}
93         id="onboarding.analysis.sq_scanner.docs_use_case"
94         values={{
95           link: (
96             <a
97               href="http://redirect.sonarsource.com/doc/gradle.html"
98               rel="noopener noreferrer"
99               target="_blank">
100               {translate('onboarding.analysis.sqscanner.docs.gradle.title')}
101             </a>
102           ),
103           useCaseLink: (
104             <a
105               href="https://github.com/SonarSource/sq-com_example_java-gradle-travis"
106               rel="noopener noreferrer"
107               target="_blank">
108               {translate('onboarding.analysis.sqscanner.docs.gradle.example_project.title')}
109             </a>
110           )
111         }}
112       />
113     </div>
114   );
115 }