open: boolean;
}
+// To remove when CFamily is includ in this tutorial
+type BuildToolsWithoutCFamily = Exclude<BuildTools, BuildTools.CFamily>;
+
const BUILDTOOL_COMPONENT_MAP: {
- [x in BuildTools]: React.ComponentType<{ component: T.Component }>;
+ [x in BuildToolsWithoutCFamily]: React.ComponentType<{ component: T.Component }>;
} = {
[BuildTools.Maven]: Maven,
[BuildTools.Gradle]: Gradle,
component,
open
} = props;
- const [buildTool, setBuildTool] = React.useState<BuildTools | undefined>(undefined);
+ const [buildTool, setBuildTool] = React.useState<BuildToolsWithoutCFamily | undefined>(undefined);
return (
<Step
finished={false}
<RenderOptions
checked={buildTool}
name="buildtool"
- onCheck={value => setBuildTool(value as BuildTools)}
+ onCheck={value => setBuildTool(value as BuildToolsWithoutCFamily)}
optionLabelKey="onboarding.build"
options={Object.values(BuildTools)}
/>
Array [
"maven",
"gradle",
+ "cfamily",
"dotnet",
"other",
]
Array [
"maven",
"gradle",
+ "cfamily",
"dotnet",
"other",
]
Array [
"maven",
"gradle",
+ "cfamily",
"dotnet",
"other",
]
Array [
"maven",
"gradle",
+ "cfamily",
"dotnet",
"other",
]
Array [
"maven",
"gradle",
+ "cfamily",
"dotnet",
"other",
]
Array [
"maven",
"gradle",
+ "cfamily",
"dotnet",
"other",
]
};
handleOSChange = (os: OSs) => {
- this.setState({ config: { buildTool: BuildTools.Other, os } }, () => {
- this.props.onDone(this.state.config);
- });
+ this.setState(
+ ({ config }) => ({ config: { buildTool: config.buildTool, os } }),
+ () => {
+ this.props.onDone(this.state.config);
+ }
+ );
};
render() {
const { config } = this.state;
- const buildTools = [BuildTools.Maven, BuildTools.Gradle, BuildTools.DotNet, BuildTools.Other];
+ const buildTools = [
+ BuildTools.Maven,
+ BuildTools.Gradle,
+ BuildTools.DotNet,
+ BuildTools.CFamily,
+ BuildTools.Other
+ ];
return (
<>
/>
</div>
- {config.buildTool === BuildTools.Other && (
+ {(config.buildTool === BuildTools.Other || config.buildTool === BuildTools.CFamily) && (
<RenderOptions
checked={config.os}
name="os"
wrapper.instance().handleBuildToolChange(BuildTools.Gradle);
expect(onDone).toBeCalledWith(expect.objectContaining({ buildTool: BuildTools.Gradle }));
+ wrapper.setState({ config: { buildTool: BuildTools.Other } });
wrapper.instance().handleOSChange(OSs.Windows);
expect(onDone).toBeCalledWith(
expect.objectContaining({ os: OSs.Windows, buildTool: BuildTools.Other })
"label": "onboarding.build.dotnet",
"value": "dotnet",
},
+ Object {
+ "label": "onboarding.build.cfamily",
+ "value": "cfamily",
+ },
Object {
"label": "onboarding.build.other",
"value": "other",
"label": "onboarding.build.dotnet",
"value": "dotnet",
},
+ Object {
+ "label": "onboarding.build.cfamily",
+ "value": "cfamily",
+ },
Object {
"label": "onboarding.build.other",
"value": "other",
"label": "onboarding.build.dotnet",
"value": "dotnet",
},
+ Object {
+ "label": "onboarding.build.cfamily",
+ "value": "cfamily",
+ },
Object {
"label": "onboarding.build.other",
"value": "other",
import * as React from 'react';
import { getHostUrl } from 'sonar-ui-common/helpers/urls';
import { BuildTools, ManualTutorialConfig } from '../../types';
+import ClangGCCCustom from './ClangGCCCommand';
import DotNet from './DotNet';
import JavaGradle from './JavaGradle';
import JavaMaven from './JavaMaven';
case BuildTools.DotNet:
return <DotNet host={host} projectKey={projectKey} token={token} />;
+ case BuildTools.CFamily:
+ return languageConfig.os !== undefined ? (
+ <ClangGCCCustom os={languageConfig.os} host={host} projectKey={projectKey} token={token} />
+ ) : null;
+
case BuildTools.Other:
return languageConfig.os !== undefined ? (
<Other host={host} os={languageConfig.os} projectKey={projectKey} token={token} />
--- /dev/null
+/*
+ * 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 { OSs } from '../../types';
+import DownloadBuildWrapper from './DownloadBuildWrapper';
+import DownloadScanner from './DownloadScanner';
+import ExecBuildWrapper from './ExecBuildWrapper';
+import ExecScanner from './ExecScanner';
+
+export interface ClangGCCCustomProps {
+ host: string;
+ os: OSs;
+ projectKey: string;
+ token: string;
+}
+
+export default function ClangGCCCustom(props: ClangGCCCustomProps) {
+ const { os, host, projectKey, token } = props;
+
+ return (
+ <div>
+ <DownloadBuildWrapper os={os} />
+ <DownloadScanner os={os} />
+ <ExecBuildWrapper os={os} />
+ <ExecScanner host={host} projectKey={projectKey} os={os} token={token} cfamily={true} />
+ </div>
+ );
+}
--- /dev/null
+/*
+ * 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';
+import { getBaseUrl } from 'sonar-ui-common/helpers/urls';
+import { OSs } from '../../types';
+
+export interface DownloadBuildWrapperProps {
+ os: OSs;
+}
+
+const filenames: { [x in OSs]: string } = {
+ win: 'build-wrapper-win-x86.zip',
+ linux: 'build-wrapper-linux-x86.zip',
+ mac: 'build-wrapper-macosx-x86.zip'
+};
+
+export default function DownloadBuildWrapper(props: DownloadBuildWrapperProps) {
+ const { os } = props;
+ return (
+ <div className="spacer-bottom">
+ <h4 className="spacer-bottom">{translate('onboarding.analysis.build_wrapper.header', os)}</h4>
+ <p className="spacer-bottom markdown">
+ <FormattedMessage
+ defaultMessage={translate('onboarding.analysis.build_wrapper.text')}
+ id="onboarding.analysis.build_wrapper.text"
+ values={{
+ env_var: <code>{os === 'win' ? '%PATH%' : 'PATH'}</code>
+ }}
+ />
+ </p>
+ <p>
+ <a
+ className="button"
+ download={filenames[os]}
+ href={`${getBaseUrl()}/static/cpp/${filenames[os]}`}
+ rel="noopener noreferrer"
+ target="_blank">
+ {translate('download_verb')}
+ </a>
+ </p>
+ </div>
+ );
+}
--- /dev/null
+/*
+ * 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 { Link } from 'react-router';
+import { translate } from 'sonar-ui-common/helpers/l10n';
+import { OSs } from '../../types';
+
+interface Props {
+ os: OSs;
+}
+
+export default function SQScanner(props: Props) {
+ const { os } = props;
+ return (
+ <div>
+ <h4 className="spacer-bottom">{translate('onboarding.analysis.sq_scanner.header', os)}</h4>
+ <p className="spacer-bottom markdown">
+ <FormattedMessage
+ defaultMessage={translate('onboarding.analysis.sq_scanner.text')}
+ id="onboarding.analysis.sq_scanner.text"
+ values={{
+ dir: <code>bin</code>,
+ env_var: <code>{os === OSs.Windows ? '%PATH%' : 'PATH'}</code>
+ }}
+ />
+ </p>
+ <p>
+ <Link className="button" to="/documentation/analysis/scan/sonarscanner/" target="_blank">
+ {translate('download_verb')}
+ </Link>
+ </p>
+ </div>
+ );
+}
--- /dev/null
+/*
+ * 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 { Link } from 'react-router';
+import { translate } from 'sonar-ui-common/helpers/l10n';
+import CodeSnippet from '../../../common/CodeSnippet';
+import { OSs } from '../../types';
+
+export interface ExecBuildWrapperProps {
+ os: OSs;
+}
+
+const executables: { [x in OSs]: string } = {
+ linux: 'build-wrapper-linux-x86-64',
+ win: 'build-wrapper-win-x86-64.exe',
+ mac: 'build-wrapper-macosx-x86'
+};
+
+export default function ExecBuildWrapper(props: ExecBuildWrapperProps) {
+ const { os } = props;
+
+ return (
+ <>
+ <h4 className="huge-spacer-top spacer-bottom">
+ {translate('onboarding.analysis.build_wrapper.execute')}
+ </h4>
+ <p className="spacer-bottom markdown">
+ {translate('onboarding.analysis.build_wrapper.execute_text')}
+ </p>
+ <CodeSnippet
+ snippet={`${executables[os]} --out-dir bw-output ${translate(
+ 'onboarding.analysis.build_wrapper.execute_build_command'
+ )}`}
+ />
+ <p className="big-spacer-top markdown">
+ <FormattedMessage
+ defaultMessage={translate('onboarding.analysis.build_wrapper.docs')}
+ id="onboarding.analysis.build_wrapper.docs"
+ values={{
+ link: (
+ <Link to="/documentation/analysis/languages/cfamily/" target="_blank">
+ {translate('onboarding.analysis.build_wrapper.docs_link')}
+ </Link>
+ )
+ }}
+ />
+ </p>
+ </>
+ );
+}
--- /dev/null
+/*
+ * 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 { Link } from 'react-router';
+import { translate } from 'sonar-ui-common/helpers/l10n';
+import CodeSnippet from '../../../common/CodeSnippet';
+import InstanceMessage from '../../../common/InstanceMessage';
+import { OSs } from '../../types';
+import { quote } from '../../utils';
+
+export interface ExecScannerProps {
+ host: string;
+ os: OSs;
+ projectKey: string;
+ token: string;
+ cfamily?: boolean;
+}
+
+export default function ExecScanner(props: ExecScannerProps) {
+ const { host, os, projectKey, token, cfamily } = props;
+
+ const q = quote(os);
+ const command = [
+ os === OSs.Windows ? 'sonar-scanner.bat' : 'sonar-scanner',
+ '-D' + q(`sonar.projectKey=${projectKey}`),
+ '-D' + q('sonar.sources=.'),
+ cfamily ? '-D' + q('sonar.cfamily.build-wrapper-output=bw-output') : undefined,
+ '-D' + q(`sonar.host.url=${host}`),
+ '-D' + q(`sonar.login=${token}`)
+ ];
+
+ return (
+ <div>
+ <h4 className="huge-spacer-top spacer-bottom">
+ {translate('onboarding.analysis.sq_scanner.execute')}
+ </h4>
+ <InstanceMessage message={translate('onboarding.analysis.sq_scanner.execute.text')}>
+ {transformedMessage => <p className="spacer-bottom markdown">{transformedMessage}</p>}
+ </InstanceMessage>
+ <CodeSnippet isOneLine={os === OSs.Windows} snippet={command} />
+ <p className="big-spacer-top markdown">
+ <FormattedMessage
+ defaultMessage={translate('onboarding.analysis.sq_scanner.docs')}
+ id="onboarding.analysis.sq_scanner.docs"
+ values={{
+ link: (
+ <Link to="/documentation/analysis/scan/sonarscanner/" target="_blank">
+ {translate('onboarding.analysis.sq_scanner.docs_link')}
+ </Link>
+ )
+ }}
+ />
+ </p>
+ <p className="big-spacer-top markdown">
+ {translate('onboarding.analysis.auto_refresh_after_analysis')}
+ </p>
+ </div>
+ );
+}
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
-import { FormattedMessage } from 'react-intl';
-import { Link } from 'react-router';
-import { translate } from 'sonar-ui-common/helpers/l10n';
-import CodeSnippet from '../../../common/CodeSnippet';
-import InstanceMessage from '../../../common/InstanceMessage';
import { OSs } from '../../types';
-import { quote } from '../../utils';
+import DownloadScanner from './DownloadScanner';
+import ExecScanner from './ExecScanner';
export interface OtherProps {
host: string;
export default function Other(props: OtherProps) {
const { host, os, projectKey, token } = props;
- const q = quote(os);
- const command = [
- os === OSs.Windows ? 'sonar-scanner.bat' : 'sonar-scanner',
- '-D' + q(`sonar.projectKey=${projectKey}`),
- '-D' + q('sonar.sources=.'),
- '-D' + q(`sonar.host.url=${host}`),
- '-D' + q(`sonar.login=${token}`)
- ];
-
return (
<div>
- <div>
- <h4 className="spacer-bottom">{translate('onboarding.analysis.sq_scanner.header', os)}</h4>
- <p className="spacer-bottom markdown">
- <FormattedMessage
- defaultMessage={translate('onboarding.analysis.sq_scanner.text')}
- id="onboarding.analysis.sq_scanner.text"
- values={{
- dir: <code>bin</code>,
- env_var: <code>{os === OSs.Windows ? '%PATH%' : 'PATH'}</code>
- }}
- />
- </p>
- <p>
- <Link className="button" to="/documentation/analysis/scan/sonarscanner/" target="_blank">
- {translate('download_verb')}
- </Link>
- </p>
- </div>
-
- <h4 className="huge-spacer-top spacer-bottom">
- {translate('onboarding.analysis.sq_scanner.execute')}
- </h4>
- <InstanceMessage message={translate('onboarding.analysis.sq_scanner.execute.text')}>
- {transformedMessage => <p className="spacer-bottom markdown">{transformedMessage}</p>}
- </InstanceMessage>
- <CodeSnippet isOneLine={os === OSs.Windows} snippet={command} />
- <p className="big-spacer-top markdown">
- <FormattedMessage
- defaultMessage={translate('onboarding.analysis.sq_scanner.docs')}
- id="onboarding.analysis.sq_scanner.docs"
- values={{
- link: (
- <Link to="/documentation/analysis/scan/sonarscanner/" target="_blank">
- {translate('onboarding.analysis.sq_scanner.docs_link')}
- </Link>
- )
- }}
- />
- </p>
+ <DownloadScanner os={os} />
+ <ExecScanner host={host} os={os} projectKey={projectKey} token={token} />
</div>
);
}
--- /dev/null
+/*
+ * 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 { OSs } from '../../../types';
+import ClangGCCCommand from '../ClangGCCCommand';
+
+it('Shoud renders correctly', () => {
+ expect(
+ shallow(<ClangGCCCommand os={OSs.Linux} host="host" projectKey="projectKey" token="token" />)
+ ).toMatchSnapshot();
+});
--- /dev/null
+/*
+ * 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 { OSs } from '../../../types';
+import DownloadBuildWrapper from '../DownloadBuildWrapper';
+
+it.each([OSs.Linux, OSs.Windows, OSs.MacOS])('Shoud renders for %p correctly', os => {
+ expect(shallow(<DownloadBuildWrapper os={os} />)).toMatchSnapshot();
+});
--- /dev/null
+/*
+ * 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 { OSs } from '../../../types';
+import DownloadScanner from '../DownloadScanner';
+
+it.each([OSs.Linux, OSs.Windows, OSs.MacOS])('Shoud renders for %p correctly', os => {
+ expect(shallow(<DownloadScanner os={os} />)).toMatchSnapshot();
+});
--- /dev/null
+/*
+ * 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 { OSs } from '../../../types';
+import ExecBuildWrapper from '../ExecBuildWrapper';
+
+it.each([OSs.Linux, OSs.Windows, OSs.MacOS])('Shoud renders for %p correctly', os => {
+ expect(shallow(<ExecBuildWrapper os={os} />)).toMatchSnapshot();
+});
--- /dev/null
+/*
+ * 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 { OSs } from '../../../types';
+import ExecScanner, { ExecScannerProps } from '../ExecScanner';
+
+it.each([OSs.Linux, OSs.Windows, OSs.MacOS])('Shoud renders for %p correctly', os => {
+ expect(shallowRender({ os })).toMatchSnapshot();
+});
+
+it('Should render for cfamily', () => {
+ expect(shallowRender({ cfamily: true })).toMatchSnapshot();
+});
+
+function shallowRender(props: Partial<ExecScannerProps> = {}) {
+ return shallow<ExecScannerProps>(
+ <ExecScanner host="host" os={OSs.Linux} projectKey="projectKey" token="token" {...props} />
+ );
+}
--- /dev/null
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`Shoud renders correctly 1`] = `
+<div>
+ <DownloadBuildWrapper
+ os="linux"
+ />
+ <SQScanner
+ os="linux"
+ />
+ <ExecBuildWrapper
+ os="linux"
+ />
+ <ExecScanner
+ cfamily={true}
+ host="host"
+ os="linux"
+ projectKey="projectKey"
+ token="token"
+ />
+</div>
+`;
--- /dev/null
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`Shoud renders for "linux" correctly 1`] = `
+<div
+ className="spacer-bottom"
+>
+ <h4
+ className="spacer-bottom"
+ >
+ onboarding.analysis.build_wrapper.header.linux
+ </h4>
+ <p
+ className="spacer-bottom markdown"
+ >
+ <FormattedMessage
+ defaultMessage="onboarding.analysis.build_wrapper.text"
+ id="onboarding.analysis.build_wrapper.text"
+ values={
+ Object {
+ "env_var": <code>
+ PATH
+ </code>,
+ }
+ }
+ />
+ </p>
+ <p>
+ <a
+ className="button"
+ download="build-wrapper-linux-x86.zip"
+ href="/static/cpp/build-wrapper-linux-x86.zip"
+ rel="noopener noreferrer"
+ target="_blank"
+ >
+ download_verb
+ </a>
+ </p>
+</div>
+`;
+
+exports[`Shoud renders for "mac" correctly 1`] = `
+<div
+ className="spacer-bottom"
+>
+ <h4
+ className="spacer-bottom"
+ >
+ onboarding.analysis.build_wrapper.header.mac
+ </h4>
+ <p
+ className="spacer-bottom markdown"
+ >
+ <FormattedMessage
+ defaultMessage="onboarding.analysis.build_wrapper.text"
+ id="onboarding.analysis.build_wrapper.text"
+ values={
+ Object {
+ "env_var": <code>
+ PATH
+ </code>,
+ }
+ }
+ />
+ </p>
+ <p>
+ <a
+ className="button"
+ download="build-wrapper-macosx-x86.zip"
+ href="/static/cpp/build-wrapper-macosx-x86.zip"
+ rel="noopener noreferrer"
+ target="_blank"
+ >
+ download_verb
+ </a>
+ </p>
+</div>
+`;
+
+exports[`Shoud renders for "win" correctly 1`] = `
+<div
+ className="spacer-bottom"
+>
+ <h4
+ className="spacer-bottom"
+ >
+ onboarding.analysis.build_wrapper.header.win
+ </h4>
+ <p
+ className="spacer-bottom markdown"
+ >
+ <FormattedMessage
+ defaultMessage="onboarding.analysis.build_wrapper.text"
+ id="onboarding.analysis.build_wrapper.text"
+ values={
+ Object {
+ "env_var": <code>
+ %PATH%
+ </code>,
+ }
+ }
+ />
+ </p>
+ <p>
+ <a
+ className="button"
+ download="build-wrapper-win-x86.zip"
+ href="/static/cpp/build-wrapper-win-x86.zip"
+ rel="noopener noreferrer"
+ target="_blank"
+ >
+ download_verb
+ </a>
+ </p>
+</div>
+`;
--- /dev/null
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`Shoud renders for "linux" correctly 1`] = `
+<div>
+ <h4
+ className="spacer-bottom"
+ >
+ onboarding.analysis.sq_scanner.header.linux
+ </h4>
+ <p
+ className="spacer-bottom markdown"
+ >
+ <FormattedMessage
+ defaultMessage="onboarding.analysis.sq_scanner.text"
+ id="onboarding.analysis.sq_scanner.text"
+ values={
+ Object {
+ "dir": <code>
+ bin
+ </code>,
+ "env_var": <code>
+ PATH
+ </code>,
+ }
+ }
+ />
+ </p>
+ <p>
+ <Link
+ className="button"
+ onlyActiveOnIndex={false}
+ style={Object {}}
+ target="_blank"
+ to="/documentation/analysis/scan/sonarscanner/"
+ >
+ download_verb
+ </Link>
+ </p>
+</div>
+`;
+
+exports[`Shoud renders for "mac" correctly 1`] = `
+<div>
+ <h4
+ className="spacer-bottom"
+ >
+ onboarding.analysis.sq_scanner.header.mac
+ </h4>
+ <p
+ className="spacer-bottom markdown"
+ >
+ <FormattedMessage
+ defaultMessage="onboarding.analysis.sq_scanner.text"
+ id="onboarding.analysis.sq_scanner.text"
+ values={
+ Object {
+ "dir": <code>
+ bin
+ </code>,
+ "env_var": <code>
+ PATH
+ </code>,
+ }
+ }
+ />
+ </p>
+ <p>
+ <Link
+ className="button"
+ onlyActiveOnIndex={false}
+ style={Object {}}
+ target="_blank"
+ to="/documentation/analysis/scan/sonarscanner/"
+ >
+ download_verb
+ </Link>
+ </p>
+</div>
+`;
+
+exports[`Shoud renders for "win" correctly 1`] = `
+<div>
+ <h4
+ className="spacer-bottom"
+ >
+ onboarding.analysis.sq_scanner.header.win
+ </h4>
+ <p
+ className="spacer-bottom markdown"
+ >
+ <FormattedMessage
+ defaultMessage="onboarding.analysis.sq_scanner.text"
+ id="onboarding.analysis.sq_scanner.text"
+ values={
+ Object {
+ "dir": <code>
+ bin
+ </code>,
+ "env_var": <code>
+ %PATH%
+ </code>,
+ }
+ }
+ />
+ </p>
+ <p>
+ <Link
+ className="button"
+ onlyActiveOnIndex={false}
+ style={Object {}}
+ target="_blank"
+ to="/documentation/analysis/scan/sonarscanner/"
+ >
+ download_verb
+ </Link>
+ </p>
+</div>
+`;
--- /dev/null
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`Shoud renders for "linux" correctly 1`] = `
+<Fragment>
+ <h4
+ className="huge-spacer-top spacer-bottom"
+ >
+ onboarding.analysis.build_wrapper.execute
+ </h4>
+ <p
+ className="spacer-bottom markdown"
+ >
+ onboarding.analysis.build_wrapper.execute_text
+ </p>
+ <CodeSnippet
+ snippet="build-wrapper-linux-x86-64 --out-dir bw-output onboarding.analysis.build_wrapper.execute_build_command"
+ />
+ <p
+ className="big-spacer-top markdown"
+ >
+ <FormattedMessage
+ defaultMessage="onboarding.analysis.build_wrapper.docs"
+ id="onboarding.analysis.build_wrapper.docs"
+ values={
+ Object {
+ "link": <Link
+ onlyActiveOnIndex={false}
+ style={Object {}}
+ target="_blank"
+ to="/documentation/analysis/languages/cfamily/"
+ >
+ onboarding.analysis.build_wrapper.docs_link
+ </Link>,
+ }
+ }
+ />
+ </p>
+</Fragment>
+`;
+
+exports[`Shoud renders for "mac" correctly 1`] = `
+<Fragment>
+ <h4
+ className="huge-spacer-top spacer-bottom"
+ >
+ onboarding.analysis.build_wrapper.execute
+ </h4>
+ <p
+ className="spacer-bottom markdown"
+ >
+ onboarding.analysis.build_wrapper.execute_text
+ </p>
+ <CodeSnippet
+ snippet="build-wrapper-macosx-x86 --out-dir bw-output onboarding.analysis.build_wrapper.execute_build_command"
+ />
+ <p
+ className="big-spacer-top markdown"
+ >
+ <FormattedMessage
+ defaultMessage="onboarding.analysis.build_wrapper.docs"
+ id="onboarding.analysis.build_wrapper.docs"
+ values={
+ Object {
+ "link": <Link
+ onlyActiveOnIndex={false}
+ style={Object {}}
+ target="_blank"
+ to="/documentation/analysis/languages/cfamily/"
+ >
+ onboarding.analysis.build_wrapper.docs_link
+ </Link>,
+ }
+ }
+ />
+ </p>
+</Fragment>
+`;
+
+exports[`Shoud renders for "win" correctly 1`] = `
+<Fragment>
+ <h4
+ className="huge-spacer-top spacer-bottom"
+ >
+ onboarding.analysis.build_wrapper.execute
+ </h4>
+ <p
+ className="spacer-bottom markdown"
+ >
+ onboarding.analysis.build_wrapper.execute_text
+ </p>
+ <CodeSnippet
+ snippet="build-wrapper-win-x86-64.exe --out-dir bw-output onboarding.analysis.build_wrapper.execute_build_command"
+ />
+ <p
+ className="big-spacer-top markdown"
+ >
+ <FormattedMessage
+ defaultMessage="onboarding.analysis.build_wrapper.docs"
+ id="onboarding.analysis.build_wrapper.docs"
+ values={
+ Object {
+ "link": <Link
+ onlyActiveOnIndex={false}
+ style={Object {}}
+ target="_blank"
+ to="/documentation/analysis/languages/cfamily/"
+ >
+ onboarding.analysis.build_wrapper.docs_link
+ </Link>,
+ }
+ }
+ />
+ </p>
+</Fragment>
+`;
--- /dev/null
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`Shoud renders for "linux" correctly 1`] = `
+<div>
+ <h4
+ className="huge-spacer-top spacer-bottom"
+ >
+ onboarding.analysis.sq_scanner.execute
+ </h4>
+ <InstanceMessage
+ message="onboarding.analysis.sq_scanner.execute.text"
+ >
+ <Component />
+ </InstanceMessage>
+ <CodeSnippet
+ isOneLine={false}
+ snippet={
+ Array [
+ "sonar-scanner",
+ "-Dsonar.projectKey=projectKey",
+ "-Dsonar.sources=.",
+ undefined,
+ "-Dsonar.host.url=host",
+ "-Dsonar.login=token",
+ ]
+ }
+ />
+ <p
+ className="big-spacer-top markdown"
+ >
+ <FormattedMessage
+ defaultMessage="onboarding.analysis.sq_scanner.docs"
+ id="onboarding.analysis.sq_scanner.docs"
+ values={
+ Object {
+ "link": <Link
+ onlyActiveOnIndex={false}
+ style={Object {}}
+ target="_blank"
+ to="/documentation/analysis/scan/sonarscanner/"
+ >
+ onboarding.analysis.sq_scanner.docs_link
+ </Link>,
+ }
+ }
+ />
+ </p>
+ <p
+ className="big-spacer-top markdown"
+ >
+ onboarding.analysis.auto_refresh_after_analysis
+ </p>
+</div>
+`;
+
+exports[`Shoud renders for "mac" correctly 1`] = `
+<div>
+ <h4
+ className="huge-spacer-top spacer-bottom"
+ >
+ onboarding.analysis.sq_scanner.execute
+ </h4>
+ <InstanceMessage
+ message="onboarding.analysis.sq_scanner.execute.text"
+ >
+ <Component />
+ </InstanceMessage>
+ <CodeSnippet
+ isOneLine={false}
+ snippet={
+ Array [
+ "sonar-scanner",
+ "-Dsonar.projectKey=projectKey",
+ "-Dsonar.sources=.",
+ undefined,
+ "-Dsonar.host.url=host",
+ "-Dsonar.login=token",
+ ]
+ }
+ />
+ <p
+ className="big-spacer-top markdown"
+ >
+ <FormattedMessage
+ defaultMessage="onboarding.analysis.sq_scanner.docs"
+ id="onboarding.analysis.sq_scanner.docs"
+ values={
+ Object {
+ "link": <Link
+ onlyActiveOnIndex={false}
+ style={Object {}}
+ target="_blank"
+ to="/documentation/analysis/scan/sonarscanner/"
+ >
+ onboarding.analysis.sq_scanner.docs_link
+ </Link>,
+ }
+ }
+ />
+ </p>
+ <p
+ className="big-spacer-top markdown"
+ >
+ onboarding.analysis.auto_refresh_after_analysis
+ </p>
+</div>
+`;
+
+exports[`Shoud renders for "win" correctly 1`] = `
+<div>
+ <h4
+ className="huge-spacer-top spacer-bottom"
+ >
+ onboarding.analysis.sq_scanner.execute
+ </h4>
+ <InstanceMessage
+ message="onboarding.analysis.sq_scanner.execute.text"
+ >
+ <Component />
+ </InstanceMessage>
+ <CodeSnippet
+ isOneLine={true}
+ snippet={
+ Array [
+ "sonar-scanner.bat",
+ "-D\\"sonar.projectKey=projectKey\\"",
+ "-D\\"sonar.sources=.\\"",
+ undefined,
+ "-D\\"sonar.host.url=host\\"",
+ "-D\\"sonar.login=token\\"",
+ ]
+ }
+ />
+ <p
+ className="big-spacer-top markdown"
+ >
+ <FormattedMessage
+ defaultMessage="onboarding.analysis.sq_scanner.docs"
+ id="onboarding.analysis.sq_scanner.docs"
+ values={
+ Object {
+ "link": <Link
+ onlyActiveOnIndex={false}
+ style={Object {}}
+ target="_blank"
+ to="/documentation/analysis/scan/sonarscanner/"
+ >
+ onboarding.analysis.sq_scanner.docs_link
+ </Link>,
+ }
+ }
+ />
+ </p>
+ <p
+ className="big-spacer-top markdown"
+ >
+ onboarding.analysis.auto_refresh_after_analysis
+ </p>
+</div>
+`;
+
+exports[`Should render for cfamily 1`] = `
+<div>
+ <h4
+ className="huge-spacer-top spacer-bottom"
+ >
+ onboarding.analysis.sq_scanner.execute
+ </h4>
+ <InstanceMessage
+ message="onboarding.analysis.sq_scanner.execute.text"
+ >
+ <Component />
+ </InstanceMessage>
+ <CodeSnippet
+ isOneLine={false}
+ snippet={
+ Array [
+ "sonar-scanner",
+ "-Dsonar.projectKey=projectKey",
+ "-Dsonar.sources=.",
+ "-Dsonar.cfamily.build-wrapper-output=bw-output",
+ "-Dsonar.host.url=host",
+ "-Dsonar.login=token",
+ ]
+ }
+ />
+ <p
+ className="big-spacer-top markdown"
+ >
+ <FormattedMessage
+ defaultMessage="onboarding.analysis.sq_scanner.docs"
+ id="onboarding.analysis.sq_scanner.docs"
+ values={
+ Object {
+ "link": <Link
+ onlyActiveOnIndex={false}
+ style={Object {}}
+ target="_blank"
+ to="/documentation/analysis/scan/sonarscanner/"
+ >
+ onboarding.analysis.sq_scanner.docs_link
+ </Link>,
+ }
+ }
+ />
+ </p>
+ <p
+ className="big-spacer-top markdown"
+ >
+ onboarding.analysis.auto_refresh_after_analysis
+ </p>
+</div>
+`;
exports[`renders correctly: linux 1`] = `
<div>
- <div>
- <h4
- className="spacer-bottom"
- >
- onboarding.analysis.sq_scanner.header.linux
- </h4>
- <p
- className="spacer-bottom markdown"
- >
- <FormattedMessage
- defaultMessage="onboarding.analysis.sq_scanner.text"
- id="onboarding.analysis.sq_scanner.text"
- values={
- Object {
- "dir": <code>
- bin
- </code>,
- "env_var": <code>
- PATH
- </code>,
- }
- }
- />
- </p>
- <p>
- <Link
- className="button"
- onlyActiveOnIndex={false}
- style={Object {}}
- target="_blank"
- to="/documentation/analysis/scan/sonarscanner/"
- >
- download_verb
- </Link>
- </p>
- </div>
- <h4
- className="huge-spacer-top spacer-bottom"
- >
- onboarding.analysis.sq_scanner.execute
- </h4>
- <InstanceMessage
- message="onboarding.analysis.sq_scanner.execute.text"
- >
- <Component />
- </InstanceMessage>
- <CodeSnippet
- isOneLine={false}
- snippet={
- Array [
- "sonar-scanner",
- "-Dsonar.projectKey=projectKey",
- "-Dsonar.sources=.",
- "-Dsonar.host.url=host",
- "-Dsonar.login=token",
- ]
- }
+ <SQScanner
+ os="linux"
+ />
+ <ExecScanner
+ host="host"
+ os="linux"
+ projectKey="projectKey"
+ token="token"
/>
- <p
- className="big-spacer-top markdown"
- >
- <FormattedMessage
- defaultMessage="onboarding.analysis.sq_scanner.docs"
- id="onboarding.analysis.sq_scanner.docs"
- values={
- Object {
- "link": <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- target="_blank"
- to="/documentation/analysis/scan/sonarscanner/"
- >
- onboarding.analysis.sq_scanner.docs_link
- </Link>,
- }
- }
- />
- </p>
</div>
`;
exports[`renders correctly: macos 1`] = `
<div>
- <div>
- <h4
- className="spacer-bottom"
- >
- onboarding.analysis.sq_scanner.header.mac
- </h4>
- <p
- className="spacer-bottom markdown"
- >
- <FormattedMessage
- defaultMessage="onboarding.analysis.sq_scanner.text"
- id="onboarding.analysis.sq_scanner.text"
- values={
- Object {
- "dir": <code>
- bin
- </code>,
- "env_var": <code>
- PATH
- </code>,
- }
- }
- />
- </p>
- <p>
- <Link
- className="button"
- onlyActiveOnIndex={false}
- style={Object {}}
- target="_blank"
- to="/documentation/analysis/scan/sonarscanner/"
- >
- download_verb
- </Link>
- </p>
- </div>
- <h4
- className="huge-spacer-top spacer-bottom"
- >
- onboarding.analysis.sq_scanner.execute
- </h4>
- <InstanceMessage
- message="onboarding.analysis.sq_scanner.execute.text"
- >
- <Component />
- </InstanceMessage>
- <CodeSnippet
- isOneLine={false}
- snippet={
- Array [
- "sonar-scanner",
- "-Dsonar.projectKey=projectKey",
- "-Dsonar.sources=.",
- "-Dsonar.host.url=host",
- "-Dsonar.login=token",
- ]
- }
+ <SQScanner
+ os="mac"
+ />
+ <ExecScanner
+ host="host"
+ os="mac"
+ projectKey="projectKey"
+ token="token"
/>
- <p
- className="big-spacer-top markdown"
- >
- <FormattedMessage
- defaultMessage="onboarding.analysis.sq_scanner.docs"
- id="onboarding.analysis.sq_scanner.docs"
- values={
- Object {
- "link": <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- target="_blank"
- to="/documentation/analysis/scan/sonarscanner/"
- >
- onboarding.analysis.sq_scanner.docs_link
- </Link>,
- }
- }
- />
- </p>
</div>
`;
exports[`renders correctly: windows 1`] = `
<div>
- <div>
- <h4
- className="spacer-bottom"
- >
- onboarding.analysis.sq_scanner.header.win
- </h4>
- <p
- className="spacer-bottom markdown"
- >
- <FormattedMessage
- defaultMessage="onboarding.analysis.sq_scanner.text"
- id="onboarding.analysis.sq_scanner.text"
- values={
- Object {
- "dir": <code>
- bin
- </code>,
- "env_var": <code>
- %PATH%
- </code>,
- }
- }
- />
- </p>
- <p>
- <Link
- className="button"
- onlyActiveOnIndex={false}
- style={Object {}}
- target="_blank"
- to="/documentation/analysis/scan/sonarscanner/"
- >
- download_verb
- </Link>
- </p>
- </div>
- <h4
- className="huge-spacer-top spacer-bottom"
- >
- onboarding.analysis.sq_scanner.execute
- </h4>
- <InstanceMessage
- message="onboarding.analysis.sq_scanner.execute.text"
- >
- <Component />
- </InstanceMessage>
- <CodeSnippet
- isOneLine={true}
- snippet={
- Array [
- "sonar-scanner.bat",
- "-D\\"sonar.projectKey=projectKey\\"",
- "-D\\"sonar.sources=.\\"",
- "-D\\"sonar.host.url=host\\"",
- "-D\\"sonar.login=token\\"",
- ]
- }
+ <SQScanner
+ os="win"
+ />
+ <ExecScanner
+ host="host"
+ os="win"
+ projectKey="projectKey"
+ token="token"
/>
- <p
- className="big-spacer-top markdown"
- >
- <FormattedMessage
- defaultMessage="onboarding.analysis.sq_scanner.docs"
- id="onboarding.analysis.sq_scanner.docs"
- values={
- Object {
- "link": <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- target="_blank"
- to="/documentation/analysis/scan/sonarscanner/"
- >
- onboarding.analysis.sq_scanner.docs_link
- </Link>,
- }
- }
- />
- </p>
</div>
`;
export enum BuildTools {
Maven = 'maven',
Gradle = 'gradle',
+ CFamily = 'cfamily',
DotNet = 'dotnet',
Other = 'other'
}
export type ManualTutorialConfig =
| { buildTool?: BuildTools.Maven | BuildTools.Gradle | BuildTools.DotNet }
- | { buildTool: BuildTools.Other; os?: OSs };
+ | { buildTool: BuildTools.Other | BuildTools.CFamily; os?: OSs };
onboarding.build.gradle=Gradle
onboarding.build.make=Make
onboarding.build.dotnet=.NET
+onboarding.build.cfamily=C,C++ or ObjC
onboarding.build.other=Other (for JS, TS, Go, Python, PHP, ...)
onboarding.build.other.os=What is your OS?
onboarding.build.other.os.mac=macOS
onboarding.analysis.docs=Please visit the {link} for more details.
+onboarding.analysis.build_wrapper.header.linux=Download and unzip the Build Wrapper for Linux
+onboarding.analysis.build_wrapper.header.win=Download and unzip the Build Wrapper for Windows
+onboarding.analysis.build_wrapper.header.mac=Download and unzip the Build Wrapper for macOS
+onboarding.analysis.build_wrapper.text=And add the executable's directory to the {env_var} environment variable
+onboarding.analysis.build_wrapper.execute=Execute the Build Wrapper as a prefix to your build command
+onboarding.analysis.build_wrapper.execute_text=Run the following command in your project's folder.
+onboarding.analysis.build_wrapper.execute_build_command=<your clean build command>
+onboarding.analysis.build_wrapper.docs=Please visit the {link} of the Build Wrapper for more details.
+onboarding.analysis.build_wrapper.docs_link=official documentation
+
onboarding.analysis.java.maven.header=Execute the Scanner for Maven from your computer
onboarding.analysis.java.maven.header.ci=Execute the Scanner for Maven from your CI