diff --git a/.cirrus.yaml b/.cirrus.yaml index 30223effd..34afcbae8 100644 --- a/.cirrus.yaml +++ b/.cirrus.yaml @@ -40,7 +40,7 @@ build_task: SM_CLIENT_CRT: VAULT[development/team/sonarlint/kv/data/codesigning/2023-2025 data.cert] SM_HOST: VAULT[development/team/sonarlint/kv/data/codesigning/2023-2025 data.host] SM_KP: key_525594307 - SOLUTION_PATH: SonarLint.VisualStudio.Integration.sln + SOLUTION_PATH: SonarQube.VisualStudio.sln SONAR_TOKEN: VAULT[development/kv/data/sonarcloud data.token] SONAR_URL: VAULT[development/kv/data/sonarcloud data.url] SONARSOURCE_SNK_FILE: ${TMP_DIR}\SonarSource.snk @@ -90,7 +90,7 @@ build_task: sbomname="SonarLint.visualstudio.sbom-${PROJECT_VERSION}-2022.json" gpg --batch --passphrase "$SIGN_PASSPHRASE" --allow-secret-key-import --import <(echo "$SIGN_KEY") gpg --list-secret-keys - dotnet CycloneDX SonarLint.VisualStudio.Integration.sln -t -j -o binaries + dotnet CycloneDX "${SOLUTION_PATH}" -t -j -o binaries cd binaries mv bom.json $sbomname gpg --pinentry-mode loopback --passphrase "$SIGN_PASSPHRASE" --armor --detach-sig --default-key infra@sonarsource.com "$sbomname" diff --git a/SonarLint.VsTargetVersion.props b/SonarLint.VsTargetVersion.props index 03ef6be26..e2e1a76bc 100644 --- a/SonarLint.VsTargetVersion.props +++ b/SonarLint.VsTargetVersion.props @@ -17,7 +17,7 @@ Alternatively, you can explicitly specify the version of VS to target e.g. - msbuild.exe SonarLint.VisualStudio.Integration.sln /p:VsTargetVersion=2022 + msbuild.exe SonarQube.VisualStudio.sln /p:VsTargetVersion=2022 The allowed value for VsTargetVersion is 2022. diff --git a/SonarLint.VisualStudio.Integration.sln b/SonarQube.VisualStudio.sln similarity index 100% rename from SonarLint.VisualStudio.Integration.sln rename to SonarQube.VisualStudio.sln diff --git a/SonarLint.VisualStudio.Integration.sln.DotSettings b/SonarQube.VisualStudio.sln.DotSettings similarity index 100% rename from SonarLint.VisualStudio.Integration.sln.DotSettings rename to SonarQube.VisualStudio.sln.DotSettings diff --git a/src/EmbeddedSonarAnalyzer.props b/src/EmbeddedSonarAnalyzer.props index 6c76e28dd..6731d0eb0 100644 --- a/src/EmbeddedSonarAnalyzer.props +++ b/src/EmbeddedSonarAnalyzer.props @@ -6,9 +6,9 @@ 10.3.0.106239 6.61.0.77816 - 10.18.0.28572 + 10.19.0.29100 2.19.0.4883 - 10.11.2.79730 + 10.12.0.79820 \ No newline at end of file diff --git a/src/SLCore.UnitTests/SLCoreInstanceHandleTests.cs b/src/SLCore.UnitTests/SLCoreInstanceHandleTests.cs index 616cf044c..9bf783f67 100644 --- a/src/SLCore.UnitTests/SLCoreInstanceHandleTests.cs +++ b/src/SLCore.UnitTests/SLCoreInstanceHandleTests.cs @@ -43,7 +43,7 @@ public class SLCoreInstanceHandleTests private const string StorageRoot = "storageRootSl"; private const string WorkDir = "workDirSl"; private const string UserHome = "userHomeSl"; - + private static readonly ClientConstantsDto ClientConstants = new(default, default, default); private static readonly FeatureFlagsDto FeatureFlags = new(default, default, default, default, default, default, default, default, default); private static readonly TelemetryClientConstantAttributesDto TelemetryConstants = new(default, default, default, default, default); @@ -53,7 +53,7 @@ public class SLCoreInstanceHandleTests private static readonly SonarCloudConnectionConfigurationDto SonarCloudConnection = new("sc", true, "https://sonarcloud.io/"); private static readonly BoundServerProject Binding = new("solution", "projectKey", new ServerConnection.SonarQube(new Uri("http://localhost"))); - + private static readonly List JarList = new() { "jar1" }; private static readonly Dictionary ConnectedModeJarList = new() { {"key", "jar1"} }; private ISLCoreRpcFactory slCoreRpcFactory; @@ -119,7 +119,7 @@ public void Initialize_SuccessfullyInitializesInCorrectOrder(string nodeJsPath) nodeLocator.Get().Returns(nodeJsPath); var telemetryMigrationDto = new TelemetryMigrationDto(default, default, default); telemetryMigrationProvider.Get().Returns(telemetryMigrationDto); - + testSubject.Initialize(); Received.InOrder(() => @@ -139,12 +139,13 @@ public void Initialize_SuccessfullyInitializesInCorrectOrder(string nodeJsPath) && parameters.standaloneRuleConfigByKey.Count == 0 && !parameters.isFocusOnNewCode && parameters.telemetryConstantAttributes == TelemetryConstants - && parameters.languageSpecificRequirements.clientNodeJsPath == nodeJsPath + && parameters.languageSpecificRequirements.jsTsRequirements.clientNodeJsPath == nodeJsPath + && parameters.languageSpecificRequirements.jsTsRequirements.bundlePath == null && parameters.telemetryMigration == telemetryMigrationDto)); configScopeUpdater.UpdateConfigScopeForCurrentSolution(Binding); }); } - + [TestMethod] public void Initialize_NoLanguagesAnalysisEnabled_DisablesAllLanguages() { @@ -159,7 +160,7 @@ public void Initialize_NoLanguagesAnalysisEnabled_DisablesAllLanguages() Language[] expectedDisabledLanguages = [Language.ABAP, Language.APEX, Language.YAML, Language.XML]; initializeParams.disabledPluginKeysForAnalysis.Should().BeEquivalentTo(expectedDisabledLanguages.Select(l => l.GetPluginKey())); } - + [TestMethod] public void Initialize_AnalysisPartiallyEnabled_DisablesAllNotEnabledLanguages() { @@ -174,7 +175,7 @@ public void Initialize_AnalysisPartiallyEnabled_DisablesAllNotEnabledLanguages() Language[] expectedDisabledLanguages = [Language.ABAP, Language.XML]; initializeParams.disabledPluginKeysForAnalysis.Should().BeEquivalentTo(expectedDisabledLanguages.Select(l => l.GetPluginKey())); } - + [TestMethod] public void Initialize_AnalysisFullyEnabled_DisablesNoLanguages() { @@ -212,8 +213,8 @@ public void Dispose_Initialized_ShutsDownAndDisposesRpc() var serviceProvider = rpc.ServiceProvider; serviceProvider.ClearReceivedCalls(); testSubject.Dispose(); - - + + serviceProvider.Received().TryGetTransientService(out Arg.Any()); Received.InOrder(() => { @@ -224,7 +225,7 @@ public void Dispose_Initialized_ShutsDownAndDisposesRpc() }); rpc.Received().Dispose(); } - + [TestMethod] public void Dispose_IgnoresServiceProviderException() { @@ -238,12 +239,12 @@ public void Dispose_IgnoresServiceProviderException() serviceProvider.ClearSubstitute(); serviceProvider.ClearReceivedCalls(); serviceProvider.TryGetTransientService(out Arg.Any()).Throws(new Exception()); - + var act = () => testSubject.Dispose(); - + act.Should().NotThrow(); } - + [TestMethod] public void Dispose_IgnoresShutdownException() { @@ -257,10 +258,10 @@ public void Dispose_IgnoresShutdownException() var serviceProvider = rpc.ServiceProvider; serviceProvider.ClearReceivedCalls(); var act = () => testSubject.Dispose(); - + act.Should().NotThrow(); } - + [TestMethod] public void Dispose_ConnectionDied_DisposesRpc() { @@ -275,7 +276,7 @@ public void Dispose_ConnectionDied_DisposesRpc() serviceProvider.ClearReceivedCalls(); serviceProvider.TryGetTransientService(out Arg.Any()).Returns(false); testSubject.Dispose(); - + serviceProvider.ReceivedWithAnyArgs().TryGetTransientService(out Arg.Any()); rpc.Received().Dispose(); Received.InOrder(() => @@ -286,7 +287,7 @@ public void Dispose_ConnectionDied_DisposesRpc() }); lifecycleManagement.DidNotReceive().Shutdown(); } - + [TestMethod] public void Dispose_NotInitialized_DoesNothing() { @@ -303,7 +304,7 @@ private void SetUpSuccessfulInitialization(out ILifecycleManagementSLCoreService constantsProvider.ClientConstants.Returns(ClientConstants); constantsProvider.FeatureFlags.Returns(FeatureFlags); constantsProvider.TelemetryConstants.Returns(TelemetryConstants); - + foldersProvider.GetWorkFolders().Returns(new SLCoreFolders(StorageRoot, WorkDir, UserHome)); connectionsProvider.GetServerConnections().Returns(new Dictionary { diff --git a/src/SLCore.UnitTests/Service/Lifecycle/InitializeParamsTests.cs b/src/SLCore.UnitTests/Service/Lifecycle/InitializeParamsTests.cs index 0771e99e1..0deb9f879 100644 --- a/src/SLCore.UnitTests/Service/Lifecycle/InitializeParamsTests.cs +++ b/src/SLCore.UnitTests/Service/Lifecycle/InitializeParamsTests.cs @@ -55,7 +55,7 @@ [new SonarCloudConnectionConfigurationDto("con2", false, "organization1")], false, new TelemetryClientConstantAttributesDto("TESTkey", "TESTname", "TESTversion", "TESTde", new Dictionary{{"telemetryObj", new {field = 10}}}), new TelemetryMigrationDto(true, new DateTimeOffset(2024, 07, 30, 14, 46, 28, TimeSpan.FromHours(1)), 123), - new LanguageSpecificRequirements("node") + new LanguageSpecificRequirements(new JsTsRequirementsDto("node", "bundlePath")) ); const string expectedString = """ @@ -142,7 +142,10 @@ [new SonarCloudConnectionConfigurationDto("con2", false, "organization1")], "numUseDays": 123 }, "languageSpecificRequirements": { - "clientNodeJsPath": "node" + "jsTsRequirements": { + "clientNodeJsPath": "node", + "bundlePath": "bundlePath" + } } } """; diff --git a/src/SLCore/ISLCoreInstanceHandle.cs b/src/SLCore/ISLCoreInstanceHandle.cs index 31170d00a..4416d0004 100644 --- a/src/SLCore/ISLCoreInstanceHandle.cs +++ b/src/SLCore/ISLCoreInstanceHandle.cs @@ -28,7 +28,6 @@ using SonarLint.VisualStudio.SLCore.Service.Connection.Models; using SonarLint.VisualStudio.SLCore.Service.Lifecycle; using SonarLint.VisualStudio.SLCore.Service.Lifecycle.Models; -using SonarLint.VisualStudio.SLCore.Service.Rules.Models; using SonarLint.VisualStudio.SLCore.State; namespace SonarLint.VisualStudio.SLCore; @@ -114,11 +113,11 @@ public void Initialize() isFocusOnNewCode: false, constantsProvider.TelemetryConstants, telemetryMigrationProvider.Get(), - new LanguageSpecificRequirements(nodeLocator.Get()))); + new LanguageSpecificRequirements(new JsTsRequirementsDto(nodeLocator.Get(), null)))); configScopeUpdater.UpdateConfigScopeForCurrentSolution(activeSolutionBoundTracker.CurrentConfiguration.Project); } - + public void Dispose() { Shutdown(); @@ -144,6 +143,6 @@ private void Shutdown() { // ignore } - + } } diff --git a/src/SLCore/Service/Lifecycle/Models/JsTsRequirementsDto.cs b/src/SLCore/Service/Lifecycle/Models/JsTsRequirementsDto.cs new file mode 100644 index 000000000..9d81f445a --- /dev/null +++ b/src/SLCore/Service/Lifecycle/Models/JsTsRequirementsDto.cs @@ -0,0 +1,23 @@ +/* + * SonarLint for Visual Studio + * Copyright (C) 2016-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. + */ + +namespace SonarLint.VisualStudio.SLCore.Service.Lifecycle.Models; + +public record JsTsRequirementsDto(string clientNodeJsPath, string bundlePath); diff --git a/src/SLCore/Service/Lifecycle/Models/LanguageSpecificRequirements.cs b/src/SLCore/Service/Lifecycle/Models/LanguageSpecificRequirements.cs index fe9aff890..1f105f3c2 100644 --- a/src/SLCore/Service/Lifecycle/Models/LanguageSpecificRequirements.cs +++ b/src/SLCore/Service/Lifecycle/Models/LanguageSpecificRequirements.cs @@ -22,7 +22,7 @@ namespace SonarLint.VisualStudio.SLCore.Service.Lifecycle.Models; -public record LanguageSpecificRequirements(string clientNodeJsPath) +public record LanguageSpecificRequirements(JsTsRequirementsDto jsTsRequirements) { [ExcludeFromCodeCoverage] private object omnisharpRequirements => null; // org.sonarsource.sonarlint.core.rpc.protocol.backend.initialize.OmnisharpRequirementsDto diff --git a/tools/CleanRebuild.cmd b/tools/CleanRebuild.cmd index 37fde4f9d..42fbc42c9 100644 --- a/tools/CleanRebuild.cmd +++ b/tools/CleanRebuild.cmd @@ -5,4 +5,4 @@ (for %%a in ("%~dp0..\src\Integration.Vsix\lib" "%LOCALAPPDATA%\SLVS_Build_DownloadedJars" "%LOCALAPPDATA%\SLVS_CFamily_Build" "%LOCALAPPDATA%\SLVS_TypeScript_Build" "%LOCALAPPDATA%\SLVS_Build_SLOOP" "%LOCALAPPDATA%\SLVS_Build_Dotnet") do rd /s /q "%%~a") call msbuild.exe %~dp0..\build\DownloadDependencies -t:Rebuild -call msbuild.exe "%~dp0..\SonarLint.VisualStudio.Integration.sln" -t:Rebuild +call msbuild.exe "%~dp0..\SonarQube.VisualStudio.sln" -t:Rebuild