await user.click(getTutorialBuildButtons().macosButton.get());
assertObjCStepIsCorrectlyRendered(OSs.MacOS);
+ // Analysis step: Dart
+ await user.click(getTutorialBuildButtons().dartBuildButton.get());
+ assertOtherStepIsCorrectlyRendered();
+
// Analysis step: Other
await user.click(getTutorialBuildButtons().otherBuildButton.get());
assertOtherStepIsCorrectlyRendered();
case BuildTools.ObjectiveC:
return <ClangGCC config={config} projectKey={projectKey} />;
+ case BuildTools.Dart:
case BuildTools.Other:
return <Other projectKey={projectKey} />;
import { isCFamily } from '../utils';
import { PreambuleYaml } from './PreambuleYaml';
import cFamilyExample from './commands/CFamily';
+import dartExample from './commands/Dart';
import dotNetExample from './commands/DotNet';
import gradleExample from './commands/Gradle';
import mavenExample from './commands/Maven';
[BuildTools.DotNet]: dotNetExample,
[BuildTools.Cpp]: cFamilyExample,
[BuildTools.ObjectiveC]: cFamilyExample,
+ [BuildTools.Dart]: dartExample,
[BuildTools.Other]: othersExample,
};
return <GradleBuild component={component} />;
case BuildTools.Cpp:
case BuildTools.ObjectiveC:
+ case BuildTools.Dart:
case BuildTools.Other:
return <DefaultProjectKey component={component} />;
default:
'C++ (manual arm64) and Objective-C: sonar-project.properties',
);
+ // Dart
+ await user.click(ui.dartBuildButton.get());
+ expect(getCopyToClipboardValue(0, 'Copy')).toMatchSnapshot('Dart: sonar-project.properties');
+ expect(getCopyToClipboardValue(1, 'Copy')).toMatchSnapshot('Dart: bitbucket-pipelines.yml');
+
// Other
await user.click(ui.otherBuildButton.get());
expect(getCopyToClipboardValue(0, 'Copy')).toMatchSnapshot(
// Jest Snapshot v1, https://goo.gl/fbAQLP
+exports[`should follow and complete all steps: Dart: sonar-project.properties 1`] = `"sonar.projectKey=my-project"`;
+
+exports[`should follow and complete all steps: Dart: bitbucket-pipelines.yml 1`] = `
+"image: ghcr.io/cirruslabs/flutter:stable
+
+definitions:
+ steps:
+ - step: &build-step
+ name: Build the project, and run the SonarQube analysis
+ script:
+ - <commands to build your project>
+ - export SONAR_SCANNER_VERSION=6.1.0.4477
+ - mkdir $HOME/.sonar
+ - curl -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-\${SONAR_SCANNER_VERSION}-linux-x64.zip
+ - unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
+ - export PATH="$PATH:$HOME/.sonar/sonar-scanner-\${SONAR_SCANNER_VERSION}-linux-x64/bin"
+ - sonar-scanner
+ caches:
+ sonar: ~/.sonar
+
+clone:
+ depth: full
+
+pipelines:
+ branches:
+ '{main}':
+ - step: *build-step
+
+ pull-requests:
+ '**':
+ - step: *build-step"
+`;
+
exports[`should follow and complete all steps: .NET: bitbucket-pipelines.yml 1`] = `
"image: mcr.microsoft.com/dotnet/sdk:7.0
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2024 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 { Arch, OSs } from '../../types';
+import { SONAR_SCANNER_CLI_LATEST_VERSION, getScannerUrlSuffix } from '../../utils';
+import { BuildToolExampleBuilder } from '../AnalysisCommand';
+
+const dartExample: BuildToolExampleBuilder = ({ branchesEnabled, mainBranchName }) => {
+ const scannerSuffix = getScannerUrlSuffix(OSs.Linux, Arch.X86_64);
+ return `image: ghcr.io/cirruslabs/flutter:stable
+
+definitions:
+ steps:
+ - step: &build-step
+ name: Build the project, and run the SonarQube analysis
+ script:
+ - <commands to build your project>
+ - export SONAR_SCANNER_VERSION=${SONAR_SCANNER_CLI_LATEST_VERSION}
+ - mkdir $HOME/.sonar
+ - curl -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-\${SONAR_SCANNER_VERSION}${scannerSuffix}.zip
+ - unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
+ - export PATH="$PATH:$HOME/.sonar/sonar-scanner-\${SONAR_SCANNER_VERSION}${scannerSuffix}/bin"
+ - sonar-scanner
+ caches:
+ sonar: ~/.sonar
+
+clone:
+ depth: full
+
+pipelines:
+ branches:
+ '{${mainBranchName}}':
+ - step: *build-step
+${
+ branchesEnabled
+ ? `
+ pull-requests:
+ '**':
+ - step: *build-step`
+ : ''
+}`;
+};
+
+export default dartExample;
import { Component } from '../../../types/types';
import { BuildTools, TutorialConfig } from '../types';
import CFamily from './commands/CFamily';
+import Dart from './commands/Dart';
import DotNet from './commands/DotNet';
import Gradle from './commands/Gradle';
import JavaMaven from './commands/JavaMaven';
component={component}
/>
);
+ case BuildTools.Dart:
+ return (
+ <Dart
+ branchesEnabled={branchSupportEnabled}
+ mainBranchName={mainBranchName}
+ monorepo={monorepo}
+ component={component}
+ />
+ );
case BuildTools.Other:
return (
<Others
'Objective-C MacOS: .github/workflows/build.yml',
);
+ // Dart
+ await user.click(ui.dartBuildButton.get());
+ expect(getCopyToClipboardValue(0, 'Copy')).toMatchSnapshot('Dart: .github/workflows/build.yml');
+
// Other
await user.click(ui.otherBuildButton.get());
expect(getCopyToClipboardValue(0, 'Copy')).toMatchSnapshot(
// Jest Snapshot v1, https://goo.gl/fbAQLP
+exports[`should follow and complete all steps: Dart: .github/workflows/build.yml 1`] = `
+"
+name: Build
+
+on:
+ push:
+ branches:
+ - main
+ pull_request:
+ types: [opened, synchronize, reopened]
+
+jobs:
+ build:
+ name: Build and analyze
+ runs-on: ubuntu-latest
+ steps:
+ - <commands to build your project>
+ - name: Download sonar-scanner
+ run: |
+ curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-6.1.0.4477-linux-x64.zip
+ unzip $HOME/.sonar/sonar-scanner.zip -o -d $HOME/.sonar/
+ - name: Run sonar-scanner
+ env:
+ SONAR_TOKEN: \${{ secrets.SONAR_TOKEN }}
+ SONAR_HOST_URL: \${{ secrets.SONAR_HOST_URL }}
+ run: |
+ sonar-scanner-6.1.0.4477-linux-x64/bin/sonar-scanner \\
+ -Dsonar.projectKey=my-project"
+`;
+
exports[`should follow and complete all steps: .NET: .github/workflows/build.yml 1`] = `
"name: Build
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2024 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 { CodeSnippet, Link, NumberedListItem } from 'design-system';
+import * as React from 'react';
+import { FormattedMessage } from 'react-intl';
+import { DocLink } from '../../../../helpers/doc-links';
+import { useDocUrl } from '../../../../helpers/docs';
+import { translate } from '../../../../helpers/l10n';
+import { Component } from '../../../../types/types';
+import MonorepoDocLinkFallback from './MonorepoDocLinkFallback';
+
+export interface DartProps {
+ branchesEnabled?: boolean;
+ component: Component;
+ mainBranchName: string;
+ monorepo?: boolean;
+}
+
+export default function Dart(props: Readonly<DartProps>) {
+ const { component, branchesEnabled, mainBranchName, monorepo } = props;
+ const docUrl = useDocUrl(DocLink.SonarScanner);
+
+ if (monorepo) {
+ return <MonorepoDocLinkFallback />;
+ }
+
+ return (
+ <NumberedListItem>
+ <FormattedMessage
+ defaultMessage={translate('onboarding.tutorial.with.github_action.dart')}
+ id="onboarding.tutorial.with.github_action.dart"
+ />
+ <CodeSnippet
+ className="sw-p-6 sw-overflow-auto"
+ snippet={`
+name: Build
+
+on:
+ push:
+ branches:
+ - ${mainBranchName}
+${branchesEnabled ? ' pull_request:\n types: [opened, synchronize, reopened]' : ''}
+
+jobs:
+ build:
+ name: Build and analyze
+ runs-on: ubuntu-latest
+ steps:
+ - <commands to build your project>
+ - name: Download sonar-scanner
+ run: |
+ curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-6.1.0.4477-linux-x64.zip
+ unzip $HOME/.sonar/sonar-scanner.zip -o -d $HOME/.sonar/
+ - name: Run sonar-scanner
+ env:
+ SONAR_TOKEN: \${{ secrets.SONAR_TOKEN }}
+ SONAR_HOST_URL: \${{ secrets.SONAR_HOST_URL }}
+ run: |
+ sonar-scanner-6.1.0.4477-linux-x64/bin/sonar-scanner \\
+ -Dsonar.projectKey=${component.key}`}
+ language="yml"
+ />
+
+ <p className="sw-mt-4">
+ <FormattedMessage
+ defaultMessage={translate('onboarding.analysis.sq_scanner.docs')}
+ id="onboarding.analysis.sq_scanner.docs"
+ values={{
+ link: <Link to={docUrl}>{translate('onboarding.analysis.sq_scanner.docs_link')}</Link>,
+ }}
+ />
+ </p>
+ </NumberedListItem>
+ );
+}
[BuildTools.ObjectiveC]: otherSnippet,
[BuildTools.Gradle]: gradleSnippet,
[BuildTools.Maven]: mavenSnippet,
+ [BuildTools.Dart]: otherSnippet,
[BuildTools.Other]: otherSnippet,
};
[BuildTools.ObjectiveC]: 'sonar-project.properties',
[BuildTools.Gradle]: GradleBuildDSL.Groovy,
[BuildTools.Maven]: 'pom.xml',
+ [BuildTools.Dart]: 'sonar-project.properties',
[BuildTools.Other]: 'sonar-project.properties',
};
[BuildTools.ObjectiveC]: undefined,
[BuildTools.Gradle]: undefined,
[BuildTools.Maven]: 'xml',
+ [BuildTools.Dart]: undefined,
[BuildTools.Other]: undefined,
};
await user.click(ui.autoConfigManual.get());
expect(getCopyToClipboardValue(1, 'Copy')).toMatchSnapshot('CPP - manual: gitlab-ci.yml');
+ // Dart
+ await user.click(ui.dartBuildButton.get());
+ expect(getCopyToClipboardValue(0, 'Copy')).toMatchSnapshot('Dart: sonar-project.properties');
+ expect(getCopyToClipboardValue(1, 'Copy')).toMatchSnapshot('Dart: gitlab-ci.yml');
+
// Other
await user.click(ui.otherBuildButton.get());
expect(getCopyToClipboardValue(0, 'Copy')).toMatchSnapshot('Other: sonar-project.properties');
"
`;
+exports[`should follow and complete all steps: Dart: gitlab-ci.yml 1`] = `
+"image: ghcr.io/cirruslabs/flutter:stable
+
+variables:
+ SONAR_USER_HOME: "\${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache
+ GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task
+
+stages:
+ - get-binaries
+ - sonarqube-check
+ - sonarqube-vulnerability-report
+
+get-binaries:
+ stage: get-binaries
+ cache:
+ policy: push
+ key: "\${CI_COMMIT_SHORT_SHA}"
+ paths:
+ - sonar-scanner/
+
+ script:
+ # Download sonar-scanner
+ - curl -sSLo ./sonar-scanner.zip 'https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-6.1.0.4477-linux-x64.zip'
+ - unzip -o sonar-scanner.zip
+ - mv sonar-scanner-6.1.0.4477-linux-x64 sonar-scanner
+
+ rules:
+ - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
+ - if: $CI_COMMIT_BRANCH == 'master'
+ - if: $CI_COMMIT_BRANCH == 'main'
+ - if: $CI_COMMIT_BRANCH == 'develop'
+
+sonarqube-check:
+ stage: sonarqube-check
+
+ script:
+ - <commands to build your project>
+ - sonar-scanner/bin/sonar-scanner --define sonar.host.url="\${SONAR_HOST_URL}"
+ allow_failure: true
+ rules:
+ - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
+ - if: $CI_COMMIT_BRANCH == 'master'
+ - if: $CI_COMMIT_BRANCH == 'main'
+ - if: $CI_COMMIT_BRANCH == 'develop'
+
+sonarqube-vulnerability-report:
+ stage: sonarqube-vulnerability-report
+ script:
+ - 'curl -u "\${SONAR_TOKEN}:" "\${SONAR_HOST_URL}/api/issues/gitlab_sast_export?projectKey=my-project&branch=\${CI_COMMIT_BRANCH}&pullRequest=\${CI_MERGE_REQUEST_IID}" -o gl-sast-sonar-report.json'
+ allow_failure: true
+ rules:
+ - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
+ - if: $CI_COMMIT_BRANCH == 'master'
+ - if: $CI_COMMIT_BRANCH == 'main'
+ - if: $CI_COMMIT_BRANCH == 'develop'
+ artifacts:
+ expire_in: 1 day
+ reports:
+ sast: gl-sast-sonar-report.json
+"
+`;
+
+exports[`should follow and complete all steps: Dart: sonar-project.properties 1`] = `
+"sonar.projectKey=my-project
+sonar.qualitygate.wait=true
+"
+`;
+
exports[`should follow and complete all steps: Gradle: gitlab-ci.yml 1`] = `
"image: gradle:8.2.0-jdk17-jammy
`sonar-scanner/bin/sonar-scanner --define sonar.host.url="\${SONAR_HOST_URL}" ` +
`--define sonar.cfamily.compile-commands="\${BUILD_WRAPPER_OUT_DIR}/compile_commands.json"`,
},
+ [BuildTools.Dart]: {
+ image: 'ghcr.io/cirruslabs/flutter:stable',
+ script: () => `
+ - <commands to build your project>
+ - sonar-scanner/bin/sonar-scanner --define sonar.host.url="\${SONAR_HOST_URL}"`,
+ },
[BuildTools.Other]: {
image: `
name: sonarsource/sonar-scanner-cli:latest
stageDeclaration = ['sonarqube-check', ...stageDeclaration];
}
- if (isCFamily(buildTool)) {
+ if (isCFamily(buildTool) || buildTool === BuildTools.Dart) {
stages = [getBinaries, ...stages];
stageDeclaration = ['get-binaries', ...stageDeclaration];
}
[BuildTools.DotNet]: DotNet,
[BuildTools.Cpp]: CFamily,
[BuildTools.ObjectiveC]: CFamily,
+ [BuildTools.Dart]: Other,
[BuildTools.Other]: Other,
};
await user.click(ui.macosButton.get());
expect(getCopyToClipboardValue(3, 'Copy')).toMatchSnapshot(`objectivec: macos jenkinsfile`);
+ // Dart
+ await user.click(ui.dartBuildButton.get());
+ expect(getCopyToClipboardValue(2, 'Copy')).toMatchSnapshot(`Dart: sonar-project.properties`);
+ expect(getCopyToClipboardValue(3, 'Copy')).toMatchSnapshot(`Dart: jenkinsfile`);
+
// Other
await user.click(ui.otherBuildButton.get());
expect(getCopyToClipboardValue(2, 'Copy')).toMatchSnapshot(
// Jest Snapshot v1, https://goo.gl/fbAQLP
+exports[`bitbucket: can select devops platform and complete all the steps with copying code snippets: Dart: jenkinsfile 1`] = `
+"node {
+ stage('SCM') {
+ checkout scm
+ }
+ stage('SonarQube Analysis') {
+ def scannerHome = tool 'SonarScanner';
+ withSonarQubeEnv() {
+ sh "\${scannerHome}/bin/sonar-scanner"
+ }
+ }
+}"
+`;
+
+exports[`bitbucket: can select devops platform and complete all the steps with copying code snippets: Dart: sonar-project.properties 1`] = `"sonar.projectKey=my-project"`;
+
exports[`bitbucket: can select devops platform and complete all the steps with copying code snippets: Groovy: build.gradle file 1`] = `
"plugins {
id "org.sonarqube" version "5.0.0.4638"
"
`;
+exports[`bitbucketcloud: can select devops platform and complete all the steps with copying code snippets: Dart: jenkinsfile 1`] = `
+"node {
+ stage('SCM') {
+ checkout scm
+ }
+ stage('SonarQube Analysis') {
+ def scannerHome = tool 'SonarScanner';
+ withSonarQubeEnv() {
+ sh "\${scannerHome}/bin/sonar-scanner"
+ }
+ }
+}"
+`;
+
+exports[`bitbucketcloud: can select devops platform and complete all the steps with copying code snippets: Dart: sonar-project.properties 1`] = `"sonar.projectKey=my-project"`;
+
exports[`bitbucketcloud: can select devops platform and complete all the steps with copying code snippets: Groovy: build.gradle file 1`] = `
"plugins {
id "org.sonarqube" version "5.0.0.4638"
"
`;
+exports[`github: can select devops platform and complete all the steps with copying code snippets: Dart: jenkinsfile 1`] = `
+"node {
+ stage('SCM') {
+ checkout scm
+ }
+ stage('SonarQube Analysis') {
+ def scannerHome = tool 'SonarScanner';
+ withSonarQubeEnv() {
+ sh "\${scannerHome}/bin/sonar-scanner"
+ }
+ }
+}"
+`;
+
+exports[`github: can select devops platform and complete all the steps with copying code snippets: Dart: sonar-project.properties 1`] = `"sonar.projectKey=my-project"`;
+
exports[`github: can select devops platform and complete all the steps with copying code snippets: Groovy: build.gradle file 1`] = `
"plugins {
id "org.sonarqube" version "5.0.0.4638"
"
`;
+exports[`gitlab: can select devops platform and complete all the steps with copying code snippets: Dart: jenkinsfile 1`] = `
+"node {
+ stage('SCM') {
+ checkout scm
+ }
+ stage('SonarQube Analysis') {
+ def scannerHome = tool 'SonarScanner';
+ withSonarQubeEnv() {
+ sh "\${scannerHome}/bin/sonar-scanner"
+ }
+ }
+}"
+`;
+
+exports[`gitlab: can select devops platform and complete all the steps with copying code snippets: Dart: sonar-project.properties 1`] = `"sonar.projectKey=my-project"`;
+
exports[`gitlab: can select devops platform and complete all the steps with copying code snippets: Groovy: build.gradle file 1`] = `
"plugins {
id "org.sonarqube" version "5.0.0.4638"
function handleConfigChange(newConfig: TutorialConfig) {
const selectOsByDefault = (newConfig.buildTool === BuildTools.Cpp ||
newConfig.buildTool === BuildTools.ObjectiveC ||
+ newConfig.buildTool === BuildTools.Dart ||
newConfig.buildTool === BuildTools.Other) && {
os: OSs.Linux,
};
/>
)}
{(config.buildTool === BuildTools.Other ||
+ config.buildTool === BuildTools.Dart ||
config.buildTool === BuildTools.Cpp ||
config.buildTool === BuildTools.ObjectiveC) && (
<RenderOptions
);
expect(getCopyToClipboardValue(3, 'Copy')).toMatchSnapshot('objective-c macos: execute scanner');
+ // Dart - Linux
+ await user.click(ui.dartBuildButton.get());
+ await user.click(ui.linuxButton.get());
+ expect(getCopyToClipboardValue(0, 'Copy')).toMatchSnapshot('Dart linux: download scanner');
+ expect(getCopyToClipboardValue(1, 'Copy')).toMatchSnapshot('Dart linux: execute scanner');
+
+ // Dart - Windows
+ await user.click(ui.windowsButton.get());
+ expect(getCopyToClipboardValue(0, 'Copy')).toMatchSnapshot('Dart windows: download scanner');
+ expect(getCopyToClipboardValue(1, 'Copy')).toMatchSnapshot('Dart windows: execute scanner');
+
+ // Dart - MacOS
+ await user.click(ui.macosButton.get());
+ expect(getCopyToClipboardValue(0, 'Copy')).toMatchSnapshot('Dart macos: download scanner');
+ expect(getCopyToClipboardValue(1, 'Copy')).toMatchSnapshot('Dart macos: execute scanner');
+
// Other - Linux
await user.click(ui.otherBuildButton.get());
await user.click(ui.linuxButton.get());
// Jest Snapshot v1, https://goo.gl/fbAQLP
+exports[`can choose build tools and copy provided settings: Dart linux: download scanner 1`] = `
+"export SONAR_SCANNER_VERSION=6.1.0.4477
+export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux-x64
+curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux-x64.zip
+unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
+export PATH=$SONAR_SCANNER_HOME/bin:$PATH
+export SONAR_SCANNER_OPTS="-server"
+"
+`;
+
+exports[`can choose build tools and copy provided settings: Dart linux: execute scanner 1`] = `
+"sonar-scanner \\
+ -Dsonar.projectKey=my-project \\
+ -Dsonar.sources=. \\
+ -Dsonar.host.url=http://localhost:9000"
+`;
+
+exports[`can choose build tools and copy provided settings: Dart windows: download scanner 1`] = `
+"$env:SONAR_SCANNER_VERSION = "6.1.0.4477"
+$env:SONAR_DIRECTORY = [System.IO.Path]::Combine($(get-location).Path,".sonar")
+$env:SONAR_SCANNER_HOME = "$env:SONAR_DIRECTORY/sonar-scanner-$env:SONAR_SCANNER_VERSION-windows-x64"
+rm $env:SONAR_SCANNER_HOME -Force -Recurse -ErrorAction SilentlyContinue
+New-Item -path $env:SONAR_SCANNER_HOME -type directory
+(New-Object System.Net.WebClient).DownloadFile("https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$env:SONAR_SCANNER_VERSION-windows-x64.zip", "$env:SONAR_DIRECTORY/sonar-scanner.zip")
+Add-Type -AssemblyName System.IO.Compression.FileSystem
+[System.IO.Compression.ZipFile]::ExtractToDirectory("$env:SONAR_DIRECTORY/sonar-scanner.zip", "$env:SONAR_DIRECTORY")
+rm ./.sonar/sonar-scanner.zip -Force -ErrorAction SilentlyContinue
+$env:Path += ";$env:SONAR_SCANNER_HOME/bin"
+$env:SONAR_SCANNER_OPTS="-server"
+"
+`;
+
+exports[`can choose build tools and copy provided settings: Dart windows: execute scanner 1`] = `"sonar-scanner.bat -D"sonar.projectKey=my-project" -D"sonar.sources=." -D"sonar.host.url=http://localhost:9000""`;
+
+exports[`can choose build tools and copy provided settings: Dart macos: download scanner 1`] = `
+"export SONAR_SCANNER_VERSION=6.1.0.4477
+export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-macosx-x64
+curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-macosx-x64.zip
+unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
+export PATH=$SONAR_SCANNER_HOME/bin:$PATH
+export SONAR_SCANNER_OPTS="-server"
+"
+`;
+
+exports[`can choose build tools and copy provided settings: Dart macos: execute scanner 1`] = `
+"sonar-scanner \\
+ -Dsonar.projectKey=my-project \\
+ -Dsonar.sources=. \\
+ -Dsonar.host.url=http://localhost:9000"
+`;
+
exports[`can choose build tools and copy provided settings: c++ (automatic) and other linux arm64: download scanner 1`] = `
"export SONAR_SCANNER_VERSION=6.1.0.4477
export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux-aarch64
case BuildTools.DotNet:
return <DotNet baseUrl={baseUrl} component={component} token={token} />;
+ case BuildTools.Dart:
case BuildTools.Other:
return (
<Other
dotnetBuildButton: byRole('radio', { name: `onboarding.build.${BuildTools.DotNet}` }),
cppBuildButton: byRole('radio', { name: `onboarding.build.${BuildTools.Cpp}` }),
objCBuildButton: byRole('radio', { name: `onboarding.build.${BuildTools.ObjectiveC}` }),
+ dartBuildButton: byRole('radio', { name: `onboarding.build.${BuildTools.Dart}` }),
otherBuildButton: byRole('radio', { name: `onboarding.build.${BuildTools.Other}` }),
windowsDotnetCoreButton: byRole('radio', {
name: `onboarding.build.${BuildTools.DotNet}.win_core`,
Cpp = 'cpp',
ObjectiveC = 'objectivec',
DotNet = 'dotnet',
+ Dart = 'dart',
Other = 'other',
}
if (supportCFamily) {
list.push(BuildTools.Cpp);
list.push(BuildTools.ObjectiveC);
+ // Both Dart and CFamily are available in Developer Edition and above
+ list.push(BuildTools.Dart);
}
list.push(BuildTools.Other);
return list;
onboarding.build.dotnet.linux_core=Linux + .NET Core
onboarding.build.cpp=C or C++
onboarding.build.objectivec=Objective-C
+onboarding.build.dart=Flutter or Dart
onboarding.build.other=Other (for JS, TS, Go, Python, PHP, ...)
onboarding.build.dotnet.variant=Which framework do you use?
onboarding.tutorial.with.github_action.secret.add.sentence.add_secret=Add secret
onboarding.tutorial.with.github_action.yaml.title=Create Workflow YAML File
onboarding.tutorial.with.github_action.yaml.create_yml=Create or update your {file} YAML file with the following content:
+onboarding.tutorial.with.github_action.dart=Add the following steps to your GitHub Actions Workflow after build of your Flutter or Dart project:
onboarding.tutorial.with.gitlab_ci.title=Analyze your project with GitLab CI
onboarding.tutorial.with.gitlab_ci.project_key.title=Set your project key
onboarding.tutorial.with.gitlab_ci.project_key.maven.step2=Add the following to your {file} file:
onboarding.tutorial.with.gitlab_ci.project_key.gradle.step2=Add the following to your {file} or {file2} file:
onboarding.tutorial.with.gitlab_ci.project_key.other.step2=Create a {file} file in your repository and paste the following code:
+onboarding.tutorial.with.gitlab_ci.project_key.dart.step2=Create a {file} file in your repository and paste the following code:
onboarding.tutorial.with.gitlab_ci.project_key.dotnet.step2=Create a {file} file in your repository and paste the following code:
onboarding.tutorial.with.gitlab_ci.project_key.cpp.step2=Create a {file} file in your repository and paste the following code:
onboarding.tutorial.with.gitlab_ci.project_key.objectivec.step2=Create a {file} file in your repository and paste the following code: