Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SLVS-1692 Update SlCore to 10.12.0.79820 #5910

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/EmbeddedSonarAnalyzer.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
<EmbeddedSonarJSAnalyzerVersion>10.18.0.28572</EmbeddedSonarJSAnalyzerVersion>
<EmbeddedSonarSecretsJarVersion>2.19.0.4883</EmbeddedSonarSecretsJarVersion>
<!-- SLOOP: Binaries for SonarLint Out Of Process -->
<EmbeddedSloopVersion>10.11.2.79730</EmbeddedSloopVersion>
<EmbeddedSloopVersion>10.12.0.79820</EmbeddedSloopVersion>
</PropertyGroup>
</Project>
37 changes: 19 additions & 18 deletions src/SLCore.UnitTests/SLCoreInstanceHandleTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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<string> JarList = new() { "jar1" };
private static readonly Dictionary<string, string> ConnectedModeJarList = new() { {"key", "jar1"} };
private ISLCoreRpcFactory slCoreRpcFactory;
Expand Down Expand Up @@ -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(() =>
Expand All @@ -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()
{
Expand All @@ -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()
{
Expand All @@ -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()
{
Expand Down Expand Up @@ -212,8 +213,8 @@ public void Dispose_Initialized_ShutsDownAndDisposesRpc()
var serviceProvider = rpc.ServiceProvider;
serviceProvider.ClearReceivedCalls();
testSubject.Dispose();


serviceProvider.Received().TryGetTransientService(out Arg.Any<ILifecycleManagementSLCoreService>());
Received.InOrder(() =>
{
Expand All @@ -224,7 +225,7 @@ public void Dispose_Initialized_ShutsDownAndDisposesRpc()
});
rpc.Received().Dispose();
}

[TestMethod]
public void Dispose_IgnoresServiceProviderException()
{
Expand All @@ -238,12 +239,12 @@ public void Dispose_IgnoresServiceProviderException()
serviceProvider.ClearSubstitute();
serviceProvider.ClearReceivedCalls();
serviceProvider.TryGetTransientService(out Arg.Any<AnySLCoreService>()).Throws(new Exception());

var act = () => testSubject.Dispose();

act.Should().NotThrow();
}

[TestMethod]
public void Dispose_IgnoresShutdownException()
{
Expand All @@ -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()
{
Expand All @@ -275,7 +276,7 @@ public void Dispose_ConnectionDied_DisposesRpc()
serviceProvider.ClearReceivedCalls();
serviceProvider.TryGetTransientService(out Arg.Any<AnySLCoreService>()).Returns(false);
testSubject.Dispose();

serviceProvider.ReceivedWithAnyArgs().TryGetTransientService(out Arg.Any<ILifecycleManagementSLCoreService>());
rpc.Received().Dispose();
Received.InOrder(() =>
Expand All @@ -286,7 +287,7 @@ public void Dispose_ConnectionDied_DisposesRpc()
});
lifecycleManagement.DidNotReceive().Shutdown();
}

[TestMethod]
public void Dispose_NotInitialized_DoesNothing()
{
Expand All @@ -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<string, ServerConnectionConfiguration>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ [new SonarCloudConnectionConfigurationDto("con2", false, "organization1")],
false,
new TelemetryClientConstantAttributesDto("TESTkey", "TESTname", "TESTversion", "TESTde", new Dictionary<string, object>{{"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 = """
Expand Down Expand Up @@ -142,7 +142,10 @@ [new SonarCloudConnectionConfigurationDto("con2", false, "organization1")],
"numUseDays": 123
},
"languageSpecificRequirements": {
"clientNodeJsPath": "node"
"jsTsRequirements": {
"clientNodeJsPath": "node",
"bundlePath": "bundlePath"
}
}
}
""";
Expand Down
7 changes: 3 additions & 4 deletions src/SLCore/ISLCoreInstanceHandle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand All @@ -144,6 +143,6 @@ private void Shutdown()
{
// ignore
}

}
}
23 changes: 23 additions & 0 deletions src/SLCore/Service/Lifecycle/Models/JsTsRequirementsDto.cs
Original file line number Diff line number Diff line change
@@ -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);
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading