From b385d43a605ab10eee767c868eb14ca32cb215a2 Mon Sep 17 00:00:00 2001 From: Mathieu Suen Date: Wed, 24 Feb 2021 17:38:02 +0100 Subject: [PATCH] SONAR-14493 Add tutorial for .NET Core in Jenkins. --- .../tutorials/jenkins/JenkinsfileStep.tsx | 2 +- .../JenkinsfileStep-test.tsx.snap | 6 - .../jenkins/buildtool-steps/DotNet.tsx | 93 ++++++---------- .../jenkins/buildtool-steps/DotNetCore.tsx | 60 ++++++++++ .../buildtool-steps/DotNetFramework.tsx | 57 ++++++++++ .../buildtool-steps/DotNetPrereqsMSBuild.tsx | 60 ++++++++++ .../buildtool-steps/DotNetPrereqsScanner.tsx | 66 +++++++++++ .../__tests__/DotNetCore-test.tsx | 36 ++++++ .../__tests__/DotNetFramework-test.tsx | 35 ++++++ .../__tests__/DotNetPrereqsMSBuild-test.tsx | 30 +++++ .../__tests__/DotNetPrereqsScanner-test.tsx | 30 +++++ .../__snapshots__/DotNet-test.tsx.snap | 104 +++--------------- .../__snapshots__/DotNetCore-test.tsx.snap | 61 ++++++++++ .../DotNetFramework-test.tsx.snap | 33 ++++++ .../DotNetPrereqsMSBuild-test.tsx.snap | 67 +++++++++++ .../DotNetPrereqsScanner-test.tsx.snap | 75 +++++++++++++ .../manual/commands/__tests__/Other-test.tsx | 4 +- .../__snapshots__/Other-test.tsx.snap | 30 +---- .../resources/org/sonar/l10n/core.properties | 47 ++++++-- 19 files changed, 699 insertions(+), 197 deletions(-) create mode 100644 server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/DotNetCore.tsx create mode 100644 server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/DotNetFramework.tsx create mode 100644 server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/DotNetPrereqsMSBuild.tsx create mode 100644 server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/DotNetPrereqsScanner.tsx create mode 100644 server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/DotNetCore-test.tsx create mode 100644 server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/DotNetFramework-test.tsx create mode 100644 server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/DotNetPrereqsMSBuild-test.tsx create mode 100644 server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/DotNetPrereqsScanner-test.tsx create mode 100644 server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/__snapshots__/DotNetCore-test.tsx.snap create mode 100644 server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/__snapshots__/DotNetFramework-test.tsx.snap create mode 100644 server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/__snapshots__/DotNetPrereqsMSBuild-test.tsx.snap create mode 100644 server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/__snapshots__/DotNetPrereqsScanner-test.tsx.snap diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/JenkinsfileStep.tsx b/server/sonar-web/src/main/js/components/tutorials/jenkins/JenkinsfileStep.tsx index f80804519e8..576463cf716 100644 --- a/server/sonar-web/src/main/js/components/tutorials/jenkins/JenkinsfileStep.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/JenkinsfileStep.tsx @@ -69,7 +69,7 @@ export function JenkinsfileStep(props: JenkinsfileStepProps) { name="buildtool" onCheck={value => setBuildTool(value as BuildToolsWithoutCFamily)} optionLabelKey="onboarding.build" - options={Object.values(BuildTools)} + options={Object.keys(BUILDTOOL_COMPONENT_MAP)} /> {buildTool !== undefined && diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/__snapshots__/JenkinsfileStep-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/__snapshots__/JenkinsfileStep-test.tsx.snap index 7f2f1394a90..a4610804993 100644 --- a/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/__snapshots__/JenkinsfileStep-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/__snapshots__/JenkinsfileStep-test.tsx.snap @@ -18,7 +18,6 @@ exports[`should render correctly for .NET 1`] = ` Array [ "maven", "gradle", - "cfamily", "dotnet", "other", ] @@ -140,7 +139,6 @@ exports[`should render correctly for Gradle 1`] = ` Array [ "maven", "gradle", - "cfamily", "dotnet", "other", ] @@ -262,7 +260,6 @@ exports[`should render correctly for Maven 1`] = ` Array [ "maven", "gradle", - "cfamily", "dotnet", "other", ] @@ -384,7 +381,6 @@ exports[`should render correctly for Other 1`] = ` Array [ "maven", "gradle", - "cfamily", "dotnet", "other", ] @@ -506,7 +502,6 @@ exports[`should render correctly with no branches 1`] = ` Array [ "maven", "gradle", - "cfamily", "dotnet", "other", ] @@ -637,7 +632,6 @@ exports[`should render correctly: initial content 1`] = ` Array [ "maven", "gradle", - "cfamily", "dotnet", "other", ] diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/DotNet.tsx b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/DotNet.tsx index 37bf69b928a..413536eda21 100644 --- a/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/DotNet.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/DotNet.tsx @@ -18,73 +18,48 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import HelpTooltip from 'sonar-ui-common/components/controls/HelpTooltip'; -import { Alert } from 'sonar-ui-common/components/ui/Alert'; -import CodeSnippet from '../../../common/CodeSnippet'; -import SentenceWithFilename from '../../components/SentenceWithFilename'; -import SentenceWithHighlights from '../../components/SentenceWithHighlights'; +import { translate } from 'sonar-ui-common/helpers/l10n'; +import RenderOptions from '../../components/RenderOptions'; +import { OSs } from '../../types'; +import DotNetCore from './DotNetCore'; +import DotNetFramework from './DotNetFramework'; export interface DotNetProps { component: T.Component; } -const jenkinsfileSnippet = (key: string) => `node { - stage('SCM') { - checkout scm - } - stage('SonarQube Analysis') { - def msbuildHome = tool 'Default MSBuild' - def scannerHome = tool 'SonarScanner for MSBuild' - withSonarQubeEnv() { - bat "\\"\${scannerHome}\\\\SonarScanner.MSBuild.exe\\" begin /k:\\"${key}\\"" - bat "\\"\${msbuildHome}\\\\MSBuild.exe\\" /t:Rebuild" - bat "\\"\${scannerHome}\\\\SonarScanner.MSBuild.exe\\" end" - } - } +export interface DotNetCoreFrameworkProps { + component: T.Component; + os: OSDotNet; } -`; + +export type OSDotNet = OSs.Linux | OSs.Windows; + +const DotNetFlavor = { win_core: DotNetCore, win_msbuild: DotNetFramework, linux_core: DotNetCore }; +const DotOS: { [key in keyof typeof DotNetFlavor]: OSDotNet } = { + win_core: OSs.Windows, + win_msbuild: OSs.Windows, + linux_core: OSs.Linux +}; export default function DotNet({ component }: DotNetProps) { + const [flavorComponent, setFlavorComponet] = React.useState(); + const DotNetTutorial = flavorComponent && DotNetFlavor[flavorComponent]; return ( -
  • - - -

    - - -

    - -

    -

    - -

    -

    - -

    - - } - /> -

    -
    - -
  • + <> +
  • + {translate('onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.build_agent')} + setFlavorComponet(value as keyof typeof DotNetFlavor)} + options={Object.keys(DotNetFlavor)} + /> +
  • + {DotNetTutorial && flavorComponent && ( + + )} + ); } diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/DotNetCore.tsx b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/DotNetCore.tsx new file mode 100644 index 00000000000..f12da8349f4 --- /dev/null +++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/DotNetCore.tsx @@ -0,0 +1,60 @@ +/* + * 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 CodeSnippet from '../../../common/CodeSnippet'; +import SentenceWithFilename from '../../components/SentenceWithFilename'; +import { OSs } from '../../types'; +import { DotNetCoreFrameworkProps, OSDotNet } from './DotNet'; +import DotNetPrereqsScanner from './DotNetPrereqsScanner'; + +const OSS_DEP: { [key in OSDotNet]: { shell: string; pathSeparator: string } } = { + [OSs.Linux]: { shell: 'sh', pathSeparator: '/' }, + [OSs.Windows]: { shell: 'bat', pathSeparator: '\\\\' } +}; + +const jenkinsfileSnippet = (key: string, shell: OSDotNet) => `node { + stage('SCM') { + checkout scm + } + stage('SonarQube Analysis') { + def scannerHome = tool 'SonarScanner for MSBuild' + withSonarQubeEnv() { + ${OSS_DEP[shell].shell} "dotnet \${scannerHome}${OSS_DEP[shell].pathSeparator}SonarScanner.MSBuild.dll begin /k:\\"${key}\\"" + ${OSS_DEP[shell].shell} "dotnet build" + ${OSS_DEP[shell].shell} "dotnet \${scannerHome}${OSS_DEP[shell].pathSeparator}SonarScanner.MSBuild.dll end" + } + } +} +`; + +export default function DotNetCore({ component, os }: DotNetCoreFrameworkProps) { + return ( + <> + +
  • + + +
  • + + ); +} diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/DotNetFramework.tsx b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/DotNetFramework.tsx new file mode 100644 index 00000000000..657476367f5 --- /dev/null +++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/DotNetFramework.tsx @@ -0,0 +1,57 @@ +/* + * 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 CodeSnippet from '../../../common/CodeSnippet'; +import SentenceWithFilename from '../../components/SentenceWithFilename'; +import { DotNetCoreFrameworkProps } from './DotNet'; +import DotNetPrereqsMSBuild from './DotNetPrereqsMSBuild'; +import DotNetPrereqsScanner from './DotNetPrereqsScanner'; + +const jenkinsfileSnippet = (key: string) => `node { + stage('SCM') { + checkout scm + } + stage('SonarQube Analysis') { + def msbuildHome = tool 'Default MSBuild' + def scannerHome = tool 'SonarScanner for MSBuild' + withSonarQubeEnv() { + bat "\\"\${scannerHome}\\\\SonarScanner.MSBuild.exe\\" begin /k:\\"${key}\\"" + bat "\\"\${msbuildHome}\\\\MSBuild.exe\\" /t:Rebuild" + bat "\\"\${scannerHome}\\\\SonarScanner.MSBuild.exe\\" end" + } + } +} +`; + +export default function DotNetFramework({ component }: DotNetCoreFrameworkProps) { + return ( + <> + + +
  • + + +
  • + + ); +} diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/DotNetPrereqsMSBuild.tsx b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/DotNetPrereqsMSBuild.tsx new file mode 100644 index 00000000000..9a64daa0414 --- /dev/null +++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/DotNetPrereqsMSBuild.tsx @@ -0,0 +1,60 @@ +/* + * 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 { ClipboardIconButton } from 'sonar-ui-common/components/controls/clipboard'; +import { Alert } from 'sonar-ui-common/components/ui/Alert'; +import { translate } from 'sonar-ui-common/helpers/l10n'; +import SentenceWithHighlights from '../../components/SentenceWithHighlights'; + +export default function DotNetPrereqsMSBuild() { + return ( +
  • + + + {translate('onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.info')} + +
      +
    • + +
    • +
    • + +
    • +
    • + + Default MSBuild + +
    • +
    +
  • + ); +} diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/DotNetPrereqsScanner.tsx b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/DotNetPrereqsScanner.tsx new file mode 100644 index 00000000000..a68e7b1055b --- /dev/null +++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/DotNetPrereqsScanner.tsx @@ -0,0 +1,66 @@ +/* + * 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 { ClipboardIconButton } from 'sonar-ui-common/components/controls/clipboard'; +import { Alert } from 'sonar-ui-common/components/ui/Alert'; +import { translate } from 'sonar-ui-common/helpers/l10n'; +import SentenceWithHighlights from '../../components/SentenceWithHighlights'; + +export default function DotNetPrereqsScanner() { + return ( +
  • + + + {translate('onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.info')} + +
      +
    • + +
    • +
    • + +
    • +
    • + + SonarScanner for MSBuild + +
    • +
    • + +
    • +
    +
  • + ); +} diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/DotNetCore-test.tsx b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/DotNetCore-test.tsx new file mode 100644 index 00000000000..7656b8e39b4 --- /dev/null +++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/DotNetCore-test.tsx @@ -0,0 +1,36 @@ +/* + * 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 { mockComponent } from '../../../../../helpers/testMocks'; +import { OSs } from '../../../types'; +import { DotNetCoreFrameworkProps } from '../DotNet'; +import DotNetCore from '../DotNetCore'; + +it('should render correctly', () => { + expect(shallowRender()).toMatchSnapshot('win'); + expect(shallowRender({ os: OSs.Linux })).toMatchSnapshot('linux'); +}); + +function shallowRender(props: Partial = {}) { + return shallow( + + ); +} diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/DotNetFramework-test.tsx b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/DotNetFramework-test.tsx new file mode 100644 index 00000000000..44837fe60cf --- /dev/null +++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/DotNetFramework-test.tsx @@ -0,0 +1,35 @@ +/* + * 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 { mockComponent } from '../../../../../helpers/testMocks'; +import { OSs } from '../../../types'; +import { DotNetCoreFrameworkProps } from '../DotNet'; +import DotNetFramework from '../DotNetFramework'; + +it('should render correctly', () => { + expect(shallowRender()).toMatchSnapshot(); +}); + +function shallowRender(props: Partial = {}) { + return shallow( + + ); +} diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/DotNetPrereqsMSBuild-test.tsx b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/DotNetPrereqsMSBuild-test.tsx new file mode 100644 index 00000000000..b559ae08a8a --- /dev/null +++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/DotNetPrereqsMSBuild-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 DotNetPrereqsMSBuild from '../DotNetPrereqsMSBuild'; + +it('should render correctly', () => { + expect(shallowRender()).toMatchSnapshot(); +}); + +function shallowRender() { + return shallow(); +} diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/DotNetPrereqsScanner-test.tsx b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/DotNetPrereqsScanner-test.tsx new file mode 100644 index 00000000000..93c95b2ba81 --- /dev/null +++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/DotNetPrereqsScanner-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 DotNetPrereqsScanner from '../DotNetPrereqsScanner'; + +it('should render correctly', () => { + expect(shallowRender()).toMatchSnapshot(); +}); + +function shallowRender() { + return shallow(); +} diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/__snapshots__/DotNet-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/__snapshots__/DotNet-test.tsx.snap index 60f35c80bab..60d9bf011b9 100644 --- a/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/__snapshots__/DotNet-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/__snapshots__/DotNet-test.tsx.snap @@ -1,91 +1,21 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`should render correctly 1`] = ` -
  • - - -

    - - -

    - -

    -

    - -

    -

    - -

    - - } - /> -

    -
    - -
  • + +
  • + onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.build_agent + +
  • +
    `; diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/__snapshots__/DotNetCore-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/__snapshots__/DotNetCore-test.tsx.snap new file mode 100644 index 00000000000..d3e6b656151 --- /dev/null +++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/__snapshots__/DotNetCore-test.tsx.snap @@ -0,0 +1,61 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`should render correctly: linux 1`] = ` + + +
  • + + +
  • +
    +`; + +exports[`should render correctly: win 1`] = ` + + +
  • + + +
  • +
    +`; diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/__snapshots__/DotNetFramework-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/__snapshots__/DotNetFramework-test.tsx.snap new file mode 100644 index 00000000000..c5d2c7107de --- /dev/null +++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/__snapshots__/DotNetFramework-test.tsx.snap @@ -0,0 +1,33 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`should render correctly 1`] = ` + + + +
  • + + +
  • +
    +`; diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/__snapshots__/DotNetPrereqsMSBuild-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/__snapshots__/DotNetPrereqsMSBuild-test.tsx.snap new file mode 100644 index 00000000000..5352256cc55 --- /dev/null +++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/__snapshots__/DotNetPrereqsMSBuild-test.tsx.snap @@ -0,0 +1,67 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`should render correctly 1`] = ` +
  • + + + onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.info + +
      +
    • + +
    • +
    • + +
    • +
    • + + + Default MSBuild + + +
    • +
    +
  • +`; diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/__snapshots__/DotNetPrereqsScanner-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/__snapshots__/DotNetPrereqsScanner-test.tsx.snap new file mode 100644 index 00000000000..86e44d5182a --- /dev/null +++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/__snapshots__/DotNetPrereqsScanner-test.tsx.snap @@ -0,0 +1,75 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`should render correctly 1`] = ` +
  • + + + onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.info + +
      +
    • + +
    • +
    • + +
    • +
    • + + + SonarScanner for MSBuild + + +
    • +
    • + +
    • +
    +
  • +`; diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/Other-test.tsx b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/Other-test.tsx index 70e9c3ef615..751a95f8cd5 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/Other-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/Other-test.tsx @@ -23,9 +23,7 @@ import { OSs } from '../../../types'; import Other, { OtherProps } from '../Other'; it('renders correctly', () => { - expect(shallowRender()).toMatchSnapshot('linux'); - expect(shallowRender({ os: OSs.Windows })).toMatchSnapshot('windows'); - expect(shallowRender({ os: OSs.MacOS })).toMatchSnapshot('macos'); + expect(shallowRender()).toMatchSnapshot(); }); function shallowRender(props: Partial = {}) { diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/Other-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/Other-test.tsx.snap index 15cc7f98669..f031c8c142c 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/Other-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/Other-test.tsx.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`renders correctly: linux 1`] = ` +exports[`renders correctly 1`] = `
    `; - -exports[`renders correctly: macos 1`] = ` -
    - - -
    -`; - -exports[`renders correctly: windows 1`] = ` -
    - - -
    -`; 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 04d2de164c0..fd7b55aecb6 100644 --- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties +++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties @@ -3304,6 +3304,9 @@ onboarding.build.maven=Maven onboarding.build.gradle=Gradle onboarding.build.make=Make onboarding.build.dotnet=.NET +onboarding.build.dotnet.win_core=Windows + .NET Core +onboarding.build.dotnet.win_msbuild=Windows + .NET Framework +onboarding.build.dotnet.linux_core=Linux + .NET Core onboarding.build.cfamily=C,C++ or ObjC onboarding.build.other=Other (for JS, TS, Go, Python, PHP, ...) @@ -3575,18 +3578,38 @@ onboarding.tutorial.with.jenkins.jenkinsfile.maven.step3.help2.sentence=The name onboarding.tutorial.with.jenkins.jenkinsfile.maven.step3.help2.sentence.path=Maven > Maven installations onboarding.tutorial.with.jenkins.jenkinsfile.maven.step3.help2.sentence.name=Name onboarding.tutorial.with.jenkins.jenkinsfile.gradle.step2.sentence=Add the following to your {file} file: -onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.replace.sentence=Make sure to replace {default_msbuild} and {default_scanner} with the names you gave to your MSBuild and SonarScanner for MSBuild tools {in_jenkins}. -onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.replace.sentence.default_msbuild=Default MSBuild -onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.replace.sentence.default_scanner=SonarScanner for MSBuild -onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.replace.sentence.in_jenkins=in Jenkins -onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.help1.sentence=To get the name of these tools in Jenkins, navigate to {path}. -onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.help1.sentence.path=Manage Jenkins > Global Tool Configuration -onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.help2.sentence=For your MSBuild tool, the name is located under the {path} section, in the {name} field. -onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.help2.sentence.path=MSBuild > MSBuild installations -onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.help2.sentence.name=Name -onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.help3.sentence=For your SonarScanner for MSBuild tool, the name is located under the {path} section, in the {name} field. -onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.help3.sentence.path=SonarScanner for MSBuild > SonarScanner for MSBuild installations -onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.help3.sentence.name=Name +onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.build_agent=Choose your build agent. + +onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.title.sentence=Prerequisite: Add a {default_msbuild} tool +onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.title.sentence.default_msbuild=MSBuild +onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.info=This step need to be done only once per jenkins instance. +onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.step1.sentence=In Jenkins, make sure to have the {msbuild} installed. +onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.step1.sentence.msbuild=MSBuild Plugin +onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.step2.sentence=Navigate to {path}. +onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.step2.sentence.path=Manage Jenkins > Global Tool Configuration +onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.step3.sentence=Under {msbuild} click on {add_msbuild} and give a {name} that will be used in the last step. Refer to the {msbuild_plugin} documentation on how to install the tool: +onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.step3.sentence.msbuild=MSBuild +onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.step3.sentence.msbuild_plugin=MSBuild Plugin +onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.step3.sentence.add_msbuild=Add MSBuild +onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.step3.sentence.name=Name + + +onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.title.sentence=Prerequisite: Add a {default_scanner} tool +onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.title.sentence.default_scanner=SonarScanner for MSBuild +onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.info=This step needs to be done only once per jenkins instance or if you need different scanner versions. +onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.step1.sentence=In Jenkins, navigate to {path}. +onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.step1.sentence.path=Manage Jenkins > Global Tool Configuration +onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.step2.sentence=Under {default_scanner} click on {add_scanner_for_msbuild} +onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.step2.sentence.default_scanner=SonarScanner for MSBuild +onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.step2.sentence.add_scanner_for_msbuild=Add SonarScanner for MSBuild +onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.step3.sentence=Choose a {name} that will be used in the last step: +onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.step3.sentence.name=Name +onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.step4.sentence=Check {install_auto} +onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.step4.sentence.install_auto=Install automatically +onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.step5.sentence=Under {install_from} select the corresponding .NET Core scanner required for you project. +onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.step5.sentence.install_from=Install from GitHub +onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.step5.sentence.install_auto=Install automatically + onboarding.tutorial.with.jenkins.jenkinsfile.other.step2.sentence=Create a {file} file in your repository and paste the following code: onboarding.tutorial.with.jenkins.jenkinsfile.other.step3.replace.sentence=Make sure to replace {default} with the name you gave to your SonarQube Scanner tool {in_jenkins}. onboarding.tutorial.with.jenkins.jenkinsfile.other.step3.replace.sentence.default=SonarScanner -- 2.39.5