From ea7064762be12f5ccca3c3372d900f2e23784b27 Mon Sep 17 00:00:00 2001 From: Jeremy Davis Date: Thu, 1 Jul 2021 16:45:46 +0200 Subject: [PATCH] SONAR-15061 Explain how to set up Java 11 for Azure Pipelines --- .../azure-pipelines/JavaToolInstallation.tsx | 81 +++++++++++++++++++ .../__tests__/JavaToolInstallation-test.tsx | 30 +++++++ .../JavaToolInstallation-test.tsx.snap | 61 ++++++++++++++ .../azure-pipelines/commands/JavaGradle.tsx | 4 + .../azure-pipelines/commands/JavaMaven.tsx | 3 + .../__snapshots__/JavaGradle-test.tsx.snap | 1 + .../__snapshots__/JavaMaven-test.tsx.snap | 1 + .../resources/org/sonar/l10n/core.properties | 7 ++ 8 files changed, 188 insertions(+) create mode 100644 server/sonar-web/src/main/js/components/tutorials/azure-pipelines/JavaToolInstallation.tsx create mode 100644 server/sonar-web/src/main/js/components/tutorials/azure-pipelines/__tests__/JavaToolInstallation-test.tsx create mode 100644 server/sonar-web/src/main/js/components/tutorials/azure-pipelines/__tests__/__snapshots__/JavaToolInstallation-test.tsx.snap diff --git a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/JavaToolInstallation.tsx b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/JavaToolInstallation.tsx new file mode 100644 index 00000000000..c4619c8e4c5 --- /dev/null +++ b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/JavaToolInstallation.tsx @@ -0,0 +1,81 @@ +/* + * SonarQube + * Copyright (C) 2009-2021 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +import * as React from 'react'; +import { FormattedMessage } from 'react-intl'; +import { translate } from 'sonar-ui-common/helpers/l10n'; + +function renderSentenceWithFieldAndValue(props: { + field: React.ReactNode; + value: React.ReactNode; +}) { + const { field, value } = props; + return ( + {field}, + value: {value} + }} + /> + ); +} + +export default function JavaToolInstallation() { + return ( +
  • + {translate('onboarding.tutorial.with.azure_pipelines.BranchAnalysis.java_installer.title')} +
      +
    • + {renderSentenceWithFieldAndValue({ + field: translate( + 'onboarding.tutorial.with.azure_pipelines.BranchAnalysis.java_installer.java_version' + ), + value: '11' + })} + {' ' /* explicit space between the two strings */} + {translate( + 'onboarding.tutorial.with.azure_pipelines.BranchAnalysis.java_installer.or_higher' + )} +
    • +
    • + {renderSentenceWithFieldAndValue({ + field: translate( + 'onboarding.tutorial.with.azure_pipelines.BranchAnalysis.java_installer.java_architecture' + ), + value: 'x64' + })} +
    • +
    • + {renderSentenceWithFieldAndValue({ + field: translate( + 'onboarding.tutorial.with.azure_pipelines.BranchAnalysis.java_installer.java_source' + ), + value: translate( + 'onboarding.tutorial.with.azure_pipelines.BranchAnalysis.java_installer.pre-installed' + ) + })} +
    • +
    +
  • + ); +} diff --git a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/__tests__/JavaToolInstallation-test.tsx b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/__tests__/JavaToolInstallation-test.tsx new file mode 100644 index 00000000000..65cf657d6d7 --- /dev/null +++ b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/__tests__/JavaToolInstallation-test.tsx @@ -0,0 +1,30 @@ +/* + * SonarQube + * Copyright (C) 2009-2021 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +import { shallow } from 'enzyme'; +import * as React from 'react'; +import JavaToolInstallation from '../JavaToolInstallation'; + +it('should render correctly', () => { + expect(shallowRender()).toMatchSnapshot(); +}); + +function shallowRender() { + return shallow(); +} diff --git a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/__tests__/__snapshots__/JavaToolInstallation-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/__tests__/__snapshots__/JavaToolInstallation-test.tsx.snap new file mode 100644 index 00000000000..fc744643409 --- /dev/null +++ b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/__tests__/__snapshots__/JavaToolInstallation-test.tsx.snap @@ -0,0 +1,61 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`should render correctly 1`] = ` +
  • + onboarding.tutorial.with.azure_pipelines.BranchAnalysis.java_installer.title +
      +
    • + + onboarding.tutorial.with.azure_pipelines.BranchAnalysis.java_installer.java_version + , + "value": + 11 + , + } + } + /> + + onboarding.tutorial.with.azure_pipelines.BranchAnalysis.java_installer.or_higher +
    • +
    • + + onboarding.tutorial.with.azure_pipelines.BranchAnalysis.java_installer.java_architecture + , + "value": + x64 + , + } + } + /> +
    • +
    • + + onboarding.tutorial.with.azure_pipelines.BranchAnalysis.java_installer.java_source + , + "value": + onboarding.tutorial.with.azure_pipelines.BranchAnalysis.java_installer.pre-installed + , + } + } + /> +
    • +
    +
  • +`; diff --git a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/commands/JavaGradle.tsx b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/commands/JavaGradle.tsx index 3736f533bbb..372499561dd 100644 --- a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/commands/JavaGradle.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/commands/JavaGradle.tsx @@ -22,6 +22,7 @@ import * as React from 'react'; import { translate, translateWithParameters } from 'sonar-ui-common/helpers/l10n'; import SentenceWithHighlights from '../../components/SentenceWithHighlights'; import { BuildTools } from '../../types'; +import JavaToolInstallation from '../JavaToolInstallation'; import AlertClassicEditor from './AlertClassicEditor'; import PrepareAnalysisCommand, { PrepareType } from './PrepareAnalysisCommand'; import PublishSteps from './PublishSteps'; @@ -48,6 +49,9 @@ export default function JavaGradle(props: JavaGradleProps) { kind={PrepareType.JavaMavenGradle} projectKey={projectKey} /> + + +
  • {translateWithParameters( 'onboarding.tutorial.with.azure_pipelines.BranchAnalysis.java', diff --git a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/commands/JavaMaven.tsx b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/commands/JavaMaven.tsx index c73f380c11d..aee48bdc51d 100644 --- a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/commands/JavaMaven.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/commands/JavaMaven.tsx @@ -22,6 +22,7 @@ import * as React from 'react'; import { translate, translateWithParameters } from 'sonar-ui-common/helpers/l10n'; import SentenceWithHighlights from '../../components/SentenceWithHighlights'; import { BuildTools } from '../../types'; +import JavaToolInstallation from '../JavaToolInstallation'; import AlertClassicEditor from './AlertClassicEditor'; import PrepareAnalysisCommand, { PrepareType } from './PrepareAnalysisCommand'; import PublishSteps from './PublishSteps'; @@ -48,6 +49,8 @@ export default function JavaMaven(props: JavaMavenProps) { projectKey={projectKey} /> + +
  • {translateWithParameters( 'onboarding.tutorial.with.azure_pipelines.BranchAnalysis.java', diff --git a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/commands/__tests__/__snapshots__/JavaGradle-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/commands/__tests__/__snapshots__/JavaGradle-test.tsx.snap index 66f4880a6ec..d46bb3b80f4 100644 --- a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/commands/__tests__/__snapshots__/JavaGradle-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/commands/__tests__/__snapshots__/JavaGradle-test.tsx.snap @@ -23,6 +23,7 @@ exports[`should render correctly 1`] = ` kind={0} projectKey="projectKey" /> +
  • onboarding.tutorial.with.azure_pipelines.BranchAnalysis.java.onboarding.build.gradle
  • diff --git a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/commands/__tests__/__snapshots__/JavaMaven-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/commands/__tests__/__snapshots__/JavaMaven-test.tsx.snap index 5c22db0b22e..06c9d9ce809 100644 --- a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/commands/__tests__/__snapshots__/JavaMaven-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/commands/__tests__/__snapshots__/JavaMaven-test.tsx.snap @@ -23,6 +23,7 @@ exports[`should render correctly 1`] = ` kind={0} projectKey="projectKey" /> +
  • onboarding.tutorial.with.azure_pipelines.BranchAnalysis.java.onboarding.build.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 c1a66679835..112ecffea95 100644 --- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties +++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties @@ -3830,6 +3830,13 @@ onboarding.tutorial.with.azure_pipelines.BranchAnalysis.run.key.sentence.project onboarding.tutorial.with.azure_pipelines.BranchAnalysis.advanced_properties.sentence=Expand the {section} and replace the {properties} with the following snippet onboarding.tutorial.with.azure_pipelines.BranchAnalysis.advanced_properties.sentence.section=Advanced section onboarding.tutorial.with.azure_pipelines.BranchAnalysis.advanced_properties.sentence.properties=Additional Properties +onboarding.tutorial.with.azure_pipelines.BranchAnalysis.java_installer.title=Add a new Java tool installer task +onboarding.tutorial.with.azure_pipelines.BranchAnalysis.java_installer.sentence=Under {field}, select {value} +onboarding.tutorial.with.azure_pipelines.BranchAnalysis.java_installer.java_version=JDK version +onboarding.tutorial.with.azure_pipelines.BranchAnalysis.java_installer.or_higher=(or higher) +onboarding.tutorial.with.azure_pipelines.BranchAnalysis.java_installer.java_architecture=JDK architecture +onboarding.tutorial.with.azure_pipelines.BranchAnalysis.java_installer.java_source=JDK source +onboarding.tutorial.with.azure_pipelines.BranchAnalysis.java_installer.pre-installed=Pre-installed onboarding.tutorial.with.azure_pipelines.BranchAnalysis.java=Edit or add a new {0} task onboarding.tutorial.with.azure_pipelines.BranchAnalysis.java.settings.sentence=Under {section}, check {option} onboarding.tutorial.with.azure_pipelines.BranchAnalysis.java.settings.sentence.section=Code Analysis -- 2.39.5