From cf118411cbbc5c7244fcc54af143f241001529a8 Mon Sep 17 00:00:00 2001
From: Vasileios Naskos <168648790+vnaskos-sonar@users.noreply.github.com>
Date: Wed, 18 Dec 2024 16:40:35 +0000
Subject: [PATCH] SLVS-1692 Update SlCore to 10.12.0.79820 (#5910)
---
src/EmbeddedSonarAnalyzer.props | 2 +-
.../SLCoreInstanceHandleTests.cs | 37 ++++++++++---------
.../Lifecycle/InitializeParamsTests.cs | 7 +++-
src/SLCore/ISLCoreInstanceHandle.cs | 7 ++--
.../Lifecycle/Models/JsTsRequirementsDto.cs | 23 ++++++++++++
.../Models/LanguageSpecificRequirements.cs | 2 +-
6 files changed, 52 insertions(+), 26 deletions(-)
create mode 100644 src/SLCore/Service/Lifecycle/Models/JsTsRequirementsDto.cs
diff --git a/src/EmbeddedSonarAnalyzer.props b/src/EmbeddedSonarAnalyzer.props
index 6c76e28ddd..ebf8e4ebbd 100644
--- a/src/EmbeddedSonarAnalyzer.props
+++ b/src/EmbeddedSonarAnalyzer.props
@@ -9,6 +9,6 @@
10.18.0.28572
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 616cf044c5..9bf783f670 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 0771e99e17..0deb9f879a 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 31170d00a1..4416d0004b 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 0000000000..9d81f445a3
--- /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 fe9aff8900..1f105f3c2a 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