|
1 | 1 | #nullable disable |
2 | 2 | namespace Reqnroll.VisualStudio.Connectors; |
3 | 3 |
|
4 | | -public class OutProcReqnrollConnector |
| 4 | +public abstract class OutProcReqnrollConnector |
5 | 5 | { |
6 | | - private const string ConnectorV1AnyCpu = @"Reqnroll-V1\reqnroll-vs.exe"; |
7 | | - private const string ConnectorV1X86 = @"Reqnroll-V1\reqnroll-vs-x86.exe"; |
8 | | - private const string SpecFlowConnectorV1AnyCpu = @"SpecFlow-V1\specflow-vs.exe"; |
9 | | - private const string SpecFlowConnectorV1X86 = @"SpecFlow-V1\specflow-vs-x86.exe"; |
10 | | - private const string SpecFlowConnectorV2Net60 = @"SpecFlow-V2-net6.0\specflow-vs.dll"; |
11 | | - private const string SpecFlowConnectorV3Net60 = @"SpecFlow-V3-net6.0\specflow-vs.dll"; |
12 | 6 | private const string BindingDiscoveryCommandName = "binding discovery"; |
13 | 7 |
|
14 | | - private readonly DeveroomConfiguration _configuration; |
15 | | - private readonly string _extensionFolder; |
16 | | - private readonly IDeveroomLogger _logger; |
17 | | - private readonly IMonitoringService _monitoringService; |
18 | | - private readonly ProcessorArchitectureSetting _processorArchitecture; |
| 8 | + protected readonly DeveroomConfiguration _configuration; |
| 9 | + protected readonly string _extensionFolder; |
| 10 | + protected readonly IDeveroomLogger _logger; |
| 11 | + protected readonly IMonitoringService _monitoringService; |
| 12 | + protected readonly ProcessorArchitectureSetting _processorArchitecture; |
19 | 13 | protected readonly ProjectSettings _projectSettings; |
20 | 14 | protected readonly TargetFrameworkMoniker _targetFrameworkMoniker; |
21 | 15 | protected NuGetVersion ReqnrollVersion => _projectSettings.ReqnrollVersion; |
22 | 16 |
|
23 | | - public OutProcReqnrollConnector(DeveroomConfiguration configuration, IDeveroomLogger logger, |
| 17 | + protected OutProcReqnrollConnector(DeveroomConfiguration configuration, IDeveroomLogger logger, |
24 | 18 | TargetFrameworkMoniker targetFrameworkMoniker, string extensionFolder, |
25 | 19 | ProcessorArchitectureSetting processorArchitecture, ProjectSettings projectSettings, |
26 | 20 | IMonitoringService monitoringService) |
@@ -127,30 +121,7 @@ private string GetDetailedErrorMessage(ProcessHelper.RunProcessResult result, st |
127 | 121 | $"Error during {command}. {Environment.NewLine}Command executed:{Environment.NewLine} {result.CommandLine}{Environment.NewLine}Exit code: {exitCode}{Environment.NewLine}Message: {Environment.NewLine}{errorMessage}"; |
128 | 122 | } |
129 | 123 |
|
130 | | - protected virtual string GetConnectorPath(List<string> arguments) |
131 | | - { |
132 | | - var connectorsFolder = GetConnectorsFolder(); |
133 | | - |
134 | | - if (_targetFrameworkMoniker.IsNetCore && _projectSettings.IsSpecFlowProject) |
135 | | - { |
136 | | - if (ReqnrollVersion != null && ReqnrollVersion.Version >= new Version(3, 9, 22)) |
137 | | - return GetDotNetExecCommand(arguments, connectorsFolder, SpecFlowConnectorV3Net60); |
138 | | - return GetDotNetExecCommand(arguments, connectorsFolder, SpecFlowConnectorV2Net60); |
139 | | - } |
140 | | - |
141 | | - //V1 |
142 | | - string connectorName = _projectSettings.IsSpecFlowProject ? |
143 | | - SpecFlowConnectorV1AnyCpu : ConnectorV1AnyCpu; |
144 | | - if (_processorArchitecture == ProcessorArchitectureSetting.X86) |
145 | | - connectorName = _projectSettings.IsSpecFlowProject ? |
146 | | - SpecFlowConnectorV1X86 : ConnectorV1X86; |
147 | | - |
148 | | -#if DEBUG |
149 | | - _logger.LogInfo($"Invoking '{connectorName}'..."); |
150 | | -#endif |
151 | | - |
152 | | - return Path.Combine(connectorsFolder, connectorName); |
153 | | - } |
| 124 | + protected abstract string GetConnectorPath(List<string> arguments); |
154 | 125 |
|
155 | 126 | private string GetDotNetInstallLocation() |
156 | 127 | { |
|
0 commit comments