You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

AnalysisCommand.tsx 3.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /*
  2. * SonarQube
  3. * Copyright (C) 2009-2024 SonarSource SA
  4. * mailto:info AT sonarsource DOT com
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 3 of the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public License
  17. * along with this program; if not, write to the Free Software Foundation,
  18. * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  19. */
  20. import * as React from 'react';
  21. import withAvailableFeatures, {
  22. WithAvailableFeaturesProps,
  23. } from '../../../app/components/available-features/withAvailableFeatures';
  24. import { Feature } from '../../../types/features';
  25. import { Component } from '../../../types/types';
  26. import { BuildTools } from '../types';
  27. import CFamily from './commands/CFamily';
  28. import DotNet from './commands/DotNet';
  29. import Gradle from './commands/Gradle';
  30. import JavaMaven from './commands/JavaMaven';
  31. import Others from './commands/Others';
  32. export interface AnalysisCommandProps extends WithAvailableFeaturesProps {
  33. buildTool: BuildTools;
  34. mainBranchName: string;
  35. component: Component;
  36. monorepo?: boolean;
  37. }
  38. export function AnalysisCommand(props: Readonly<AnalysisCommandProps>) {
  39. const { buildTool, component, mainBranchName, monorepo } = props;
  40. const branchSupportEnabled = props.hasFeature(Feature.BranchSupport);
  41. switch (buildTool) {
  42. case BuildTools.Maven:
  43. return (
  44. <JavaMaven
  45. branchesEnabled={branchSupportEnabled}
  46. mainBranchName={mainBranchName}
  47. monorepo={monorepo}
  48. component={component}
  49. />
  50. );
  51. case BuildTools.Gradle:
  52. return (
  53. <Gradle
  54. branchesEnabled={branchSupportEnabled}
  55. mainBranchName={mainBranchName}
  56. monorepo={monorepo}
  57. component={component}
  58. />
  59. );
  60. case BuildTools.DotNet:
  61. return (
  62. <DotNet
  63. branchesEnabled={branchSupportEnabled}
  64. mainBranchName={mainBranchName}
  65. monorepo={monorepo}
  66. component={component}
  67. />
  68. );
  69. case BuildTools.CFamily:
  70. return (
  71. <CFamily
  72. branchesEnabled={branchSupportEnabled}
  73. mainBranchName={mainBranchName}
  74. monorepo={monorepo}
  75. component={component}
  76. />
  77. );
  78. case BuildTools.Other:
  79. return (
  80. <Others
  81. branchesEnabled={branchSupportEnabled}
  82. mainBranchName={mainBranchName}
  83. monorepo={monorepo}
  84. component={component}
  85. />
  86. );
  87. default:
  88. return undefined;
  89. }
  90. }
  91. export default withAvailableFeatures(AnalysisCommand);