Skip to content

Commit

Permalink
Merge branch 'master' into fixRefusingHTTPConenctions
Browse files Browse the repository at this point in the history
  • Loading branch information
Ravi Chande authored Mar 13, 2019
2 parents b5b1a33 + d94de60 commit bf6fcc5
Show file tree
Hide file tree
Showing 92 changed files with 2,016 additions and 545 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ mono: latest
os:
- linux
- osx
osx_image: xcode9.2
osx_image: xcode9.4
script:
- git fetch --unshallow
- git fetch origin '+refs/heads/*:refs/heads/*'
Expand Down Expand Up @@ -48,6 +48,7 @@ install:
sudo ldconfig
elif [ "$TRAVIS_OS_NAME" == "osx" ]; then
# On OSX, we install libuv via Homebrew
brew update
brew install libuv
fi
- export PATH="$PWD/.dotnet:$PATH"
Expand Down
17 changes: 15 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
# Changelog
All changes to the project will be documented in this file.

## [1.32.9] - not yet released
* Updated to Roslyn 2.10.0 (PR: [#1344](https://github.com/OmniSharp/omnisharp-roslyn/pull/1344))
## [1.32.11] - 2019-02-27
* Updated to Roslyn `3.0.0-beta4-19126-05` to match VS 16.0p4 ([#1413](https://github.com/OmniSharp/omnisharp-roslyn/issues/1413), PR: [#1414](https://github.com/OmniSharp/omnisharp-roslyn/pull/1414))
* Added support for reading C# 8.0 `NullableContextOptions` from csproj files ([#1396](https://github.com/OmniSharp/omnisharp-roslyn/issues/1396), PR: [#1404](https://github.com/OmniSharp/omnisharp-roslyn/pull/1404))

## [1.32.10] - 2019-01-25
* Updated to Roslyn 3.0 to match [VS 2019](https://docs.microsoft.com/en-us/visualstudio/releases/2019/release-notes-preview#VS2019_Preview2) (PR: [#1391](https://github.com/OmniSharp/omnisharp-roslyn/pull/1391))
* Fixed shutdown event handling for LSP _(Contributed by [@LoneBoco](https://github.com/LoneBoco))_ ([#1113](https://github.com/OmniSharp/omnisharp-roslyn/issues/1113), PR: [#1345](https://github.com/OmniSharp/omnisharp-roslyn/pull/1345))

## [1.32.9] - 2019-1-22
* Updated to Roslyn `2.11.0-beta1-final` and initial support for C# 8 (PR: [#1365](https://github.com/OmniSharp/omnisharp-roslyn/pull/1365))
* Incorporate *IndentSwitchCaseSectionWhenBlock* into OmniSharp's formatting options. This fixes the default formatting behavior, as the setting is set to *true* by default, and still allows users to disable it if needed. ([#1351](https://github.com/OmniSharp/omnisharp-roslyn/issues/1351), PR: [#1353](https://github.com/OmniSharp/omnisharp-roslyn/pull/1353))
* Removed unused `-stdio` flag from the `StdioCommandLineApplication` (PR: [#1362](https://github.com/OmniSharp/omnisharp-roslyn/pull/1362))
* Fixed finding references to operator overloads _(Contributed by [@SirIntruder](https://github.com/SirIntruder))_ (PR: [#1371](https://github.com/OmniSharp/omnisharp-roslyn/pull/1371))
* Fixed a 1.29.0 regression that caused LSP not to work with `StdioCommandLineApplication` ([#1269](https://github.com/OmniSharp/omnisharp-roslyn/issues/1269), PR: [#1346](https://github.com/OmniSharp/omnisharp-roslyn/pull/1346))
* Improved handling of files moving on disk (PR: [#1368](https://github.com/OmniSharp/omnisharp-roslyn/pull/1368))
* Improved detection of MSBuild when multiple instances are available _(Contributed by [@johnnyasantoss ](https://github.com/johnnyasantoss))_ (PR: [#1349](https://github.com/OmniSharp/omnisharp-roslyn/pull/1349))

## [1.32.8] - 2018-11-14
* Fixed MSBuild discovery path (1.32.7 regression) (PR: [#1337](https://github.com/OmniSharp/omnisharp-roslyn/pull/1337))
Expand Down
2 changes: 2 additions & 0 deletions NuGet.Config
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@
<clear />
<add key="NuGet" value="https://api.nuget.org/v3/index.json" />
<add key="dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
<add key="OmniSharp" value="https://www.myget.org/F/omnisharp/api/v3/index.json" />
<add key="roslyn-myget" value="https://dotnet.myget.org/F/roslyn/api/v3/index.json" />
</packageSources>
</configuration>
33 changes: 33 additions & 0 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,12 @@ void CopyMonoBuild(BuildEnvironment env, string sourceFolder, string outputFolde

}

void CopyExtraDependencies(BuildEnvironment env, string outputFolder)
{
// copy license
FileHelper.Copy(CombinePaths(env.WorkingDirectory, "license.md"), CombinePaths(outputFolder, "license.md"), overwrite: true);
}

string PublishMonoBuild(string project, BuildEnvironment env, BuildPlan plan, string configuration)
{
Information($"Publishing Mono build for {project}...");
Expand All @@ -672,8 +678,31 @@ string PublishMonoBuild(string project, BuildEnvironment env, BuildPlan plan, st

CopyMonoBuild(env, buildFolder, outputFolder);

CopyExtraDependencies(env, outputFolder);

Package(project, "mono", outputFolder, env.Folders.ArtifactsPackage, env.Folders.DeploymentPackage);

// Copy dependencies of Mono build
FileHelper.Copy(
source: CombinePaths(env.Folders.Tools, "SQLitePCLRaw.core", "lib", "net45", "SQLitePCLRaw.core.dll"),
destination: CombinePaths(outputFolder, "SQLitePCLRaw.core.dll"),
overwrite: true);

FileHelper.Copy(
source: CombinePaths(env.Folders.Tools, "SQLitePCLRaw.provider.e_sqlite3.net45", "lib", "net45", "SQLitePCLRaw.provider.e_sqlite3.dll"),
destination: CombinePaths(outputFolder, "SQLitePCLRaw.provider.e_sqlite3.dll"),
overwrite: true);

FileHelper.Copy(
source: CombinePaths(env.Folders.Tools, "SQLitePCLRaw.bundle_green", "lib", "net45", "SQLitePCLRaw.batteries_v2.dll"),
destination: CombinePaths(outputFolder, "SQLitePCLRaw.batteries_v2.dll"),
overwrite: true);

FileHelper.Copy(
source: CombinePaths(env.Folders.Tools, "SQLitePCLRaw.bundle_green", "lib", "net45", "SQLitePCLRaw.batteries_green.dll"),
destination: CombinePaths(outputFolder, "SQLitePCLRaw.batteries_green.dll"),
overwrite: true);

return outputFolder;
}

Expand All @@ -693,6 +722,8 @@ string PublishMonoBuildForPlatform(string project, MonoRuntime monoRuntime, Buil

CopyMonoBuild(env, sourceFolder, omnisharpFolder);

CopyExtraDependencies(env, outputFolder);

Package(project, monoRuntime.PlatformName, outputFolder, env.Folders.ArtifactsPackage, env.Folders.DeploymentPackage);

return outputFolder;
Expand Down Expand Up @@ -753,6 +784,8 @@ string PublishWindowsBuild(string project, BuildEnvironment env, BuildPlan plan,
// Copy MSBuild to output
DirectoryHelper.Copy($"{env.Folders.MSBuild}", CombinePaths(outputFolder, "msbuild"));

CopyExtraDependencies(env, outputFolder);

Package(project, rid, outputFolder, env.Folders.ArtifactsPackage, env.Folders.DeploymentPackage);

return outputFolder;
Expand Down
3 changes: 2 additions & 1 deletion build.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
"CSharpAndFSharp",
"ProjectWithMismatchedFileName",
"SolutionWithSignedProject",
"ProjectWithMultiTFMLib"
"ProjectWithMultiTFMLib",
"ExternAlias"
],
"LegacyTestAssets": [
"LegacyNUnitTestProject",
Expand Down
10 changes: 8 additions & 2 deletions build/Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<PropertyGroup>
<MSBuildPackageVersion>15.8.166</MSBuildPackageVersion>
<NuGetPackageVersion>4.8.0</NuGetPackageVersion>
<RoslynPackageVersion>2.10.0</RoslynPackageVersion>
<RoslynPackageVersion>3.0.0-beta4-19126-05</RoslynPackageVersion>
<XunitPackageVersion>2.4.0</XunitPackageVersion>
</PropertyGroup>

Expand Down Expand Up @@ -60,11 +60,17 @@
<PackageReference Update="Nuget.ProjectModel" Version="$(NuGetPackageVersion)" />
<PackageReference Update="Nuget.Versioning" Version="$(NuGetPackageVersion)" />

<PackageReference Update="OmniSharp.Extensions.LanguageServer" Version="0.11.3" />

<PackageReference Update="SQLitePCLRaw.bundle_green" Version="1.1.2" />
<PackageReference Update="System.Collections.Immutable" Version="1.4.0" />
<PackageReference Update="System.ComponentModel.Composition" Version="4.5.0" />
<PackageReference Update="System.Composition" Version="1.0.31" />
<PackageReference Update="System.Reflection.Metadata" Version="1.4.2" />
<PackageReference Update="System.Threading.Tasks.Dataflow" Version="4.5.24" />
<PackageReference Update="System.ValueTuple" Version="4.3.0" />
<PackageReference Update="System.ValueTuple" Version="4.4.0" />

<PackageReference Update="System.Reactive" Version="4.1.2" />

<PackageReference Update="xunit.runner.visualstudio" Version="$(XunitPackageVersion)" />
<PackageReference Update="xunit" Version="$(XunitPackageVersion)" />
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"sdk": {
"version": "2.1.301"
}
}
}
2 changes: 1 addition & 1 deletion src/OmniSharp.Abstractions/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ internal static class Configuration
{
public static bool ZeroBasedIndices = false;

public const string RoslynVersion = "2.10.0.0";
public const string RoslynVersion = "3.0.0.0";
public const string RoslynPublicKeyToken = "31bf3856ad364e35";

public readonly static string RoslynFeatures = GetRoslynAssemblyFullName("Microsoft.CodeAnalysis.Features");
Expand Down
22 changes: 22 additions & 0 deletions src/OmniSharp.Abstractions/Eventing/IEventEmitterExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
using System;
using System.Collections.Generic;
using OmniSharp.Models.Events;
using OmniSharp;
using OmniSharp.Models;
using System.Linq;

namespace OmniSharp.Eventing
{
Expand Down Expand Up @@ -41,5 +44,24 @@ public static void UnresolvedDepdendencies(this IEventEmitter emitter, string pr
UnresolvedDependencies = unresolvedDependencies
});
}

public static void ProjectInformation(this IEventEmitter emitter,
HashedString projectGuid,
IEnumerable<HashedString> targetFrameworks,
IEnumerable<HashedString> references,
IEnumerable<HashedString> fileExtensions)
{
var projectConfiguration = new ProjectConfigurationMessage()
{
TargetFrameworks = targetFrameworks.Select(hashed => hashed.Value),
ProjectGuid = projectGuid.Value,
References = references.Select(hashed => hashed.Value),
FileExtensions = fileExtensions.Select(hashed => hashed.Value)
};

emitter.Emit(
EventTypes.ProjectConfiguration,
projectConfiguration);
}
}
}
1 change: 1 addition & 0 deletions src/OmniSharp.Abstractions/Models/Events/EventTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ public static class EventTypes
public const string PackageRestoreStarted = nameof(PackageRestoreStarted);
public const string PackageRestoreFinished = nameof(PackageRestoreFinished);
public const string UnresolvedDependencies = nameof(UnresolvedDependencies);
public const string ProjectConfiguration = nameof(ProjectConfiguration);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System.Collections;
using System.Collections.Generic;

namespace OmniSharp.Models.Events
{
public class ProjectConfigurationMessage
{
public string ProjectGuid { get; set; }
public IEnumerable<string> TargetFrameworks { get; set; }
public IEnumerable<string> References { get; set; }
public IEnumerable<string> FileExtensions { get; set; }
}
}
18 changes: 18 additions & 0 deletions src/OmniSharp.Abstractions/Models/HashedString.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace OmniSharp.Models
{
public class HashedString
{
public HashedString(string value)
{
Value = value;
}

public string Value { get; }
}
}
96 changes: 70 additions & 26 deletions src/OmniSharp.Host/MSBuild/Discovery/Extensions.cs
Original file line number Diff line number Diff line change
@@ -1,52 +1,96 @@
using Microsoft.Extensions.Logging;
using System.IO;
using Microsoft.Extensions.Logging;

namespace OmniSharp.MSBuild.Discovery
{
internal static class Extensions
{
public static void RegisterDefaultInstance(this IMSBuildLocator msbuildLocator, ILogger logger)
{
MSBuildInstance instanceToRegister = null;
var invalidVSFound = false;
var bestInstanceFound = GetBestInstance(msbuildLocator, out var invalidVSFound);

foreach (var instance in msbuildLocator.GetInstances())
{
if (instance.IsInvalidVisualStudio())
{
invalidVSFound = true;
}
else
{
instanceToRegister = instance;
break;
}
}


if (instanceToRegister != null)
if (bestInstanceFound != null)
{
// Did we end up choosing the standalone MSBuild because there was an invalid Visual Studio?
// If so, provide a helpful message to the user.
if (invalidVSFound && instanceToRegister.DiscoveryType == DiscoveryType.StandAlone)
if (invalidVSFound && bestInstanceFound.DiscoveryType == DiscoveryType.StandAlone)
{
logger.LogWarning(@"It looks like you have Visual Studio 2017 RTM installed.
Try updating Visual Studio 2017 to the most recent release to enable better MSBuild support.");
logger.LogWarning(
@"It looks like you have Visual Studio 2017 RTM installed.
Try updating Visual Studio 2017 to the most recent release to enable better MSBuild support."
);
}

msbuildLocator.RegisterInstance(instanceToRegister);
msbuildLocator.RegisterInstance(bestInstanceFound);
}
else
{
logger.LogError("Could not locate MSBuild instance to register with OmniSharp");
}
}

public static bool HasDotNetSdksResolvers(this MSBuildInstance instance)
{
const string dotnetSdkResolver = "Microsoft.DotNet.MSBuildSdkResolver";

return File.Exists(
Path.Combine(
instance.MSBuildPath,
"SdkResolvers",
dotnetSdkResolver,
dotnetSdkResolver + ".dll"
)
);
}

/// <summary>
/// Checks if it is MSBuild from Visual Studio 2017 RTM that cannot be used.
/// </summary>
public static bool IsInvalidVisualStudio(this MSBuildInstance instance)
// MSBuild from Visual Studio 2017 RTM cannot be used.
=> instance.Version.Major == 15
&& instance.Version.Minor == 0
&& (instance.DiscoveryType == DiscoveryType.DeveloperConsole
|| instance.DiscoveryType == DiscoveryType.VisualStudioSetup);
&& instance.Version.Minor == 0
&& (instance.DiscoveryType == DiscoveryType.DeveloperConsole
|| instance.DiscoveryType == DiscoveryType.VisualStudioSetup);

public static MSBuildInstance GetBestInstance(this IMSBuildLocator msbuildLocator, out bool invalidVSFound)
{
invalidVSFound = false;
MSBuildInstance bestMatchInstance = null;
var bestMatchScore = 0;

foreach (var instance in msbuildLocator.GetInstances())
{
var score = GetInstanceFeatureScore(instance);

invalidVSFound = invalidVSFound || instance.IsInvalidVisualStudio();

if (score > bestMatchScore
|| (score == bestMatchScore && instance.Version.Major > (bestMatchInstance?.Version.Major ?? 0)))
{
bestMatchInstance = instance;
bestMatchScore = score;
}
}

return bestMatchInstance;
}

private static int GetInstanceFeatureScore(MSBuildInstance i)
{
var score = 0;

if (i.HasDotNetSdksResolvers())
score++;

if (i.IsInvalidVisualStudio())
return int.MinValue;
else
score++;

if (i.DiscoveryType == DiscoveryType.StandAlone)
score--;

return score;
}
}
}
1 change: 1 addition & 0 deletions src/OmniSharp.Host/OmniSharp.Host.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" />
<PackageReference Include="Microsoft.VisualStudio.Setup.Configuration.Interop" PrivateAssets="all" />
<PackageReference Include="Microsoft.VisualStudio.SDK.EmbedInteropTypes" PrivateAssets="all" />
<PackageReference Include="SQLitePCLRaw.bundle_green" PrivateAssets="all" />
</ItemGroup>

</Project>
6 changes: 3 additions & 3 deletions src/OmniSharp.Http.Driver/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-2.10.0.0" newVersion="2.10.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.CSharp" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-2.10.0.0" newVersion="2.10.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.Workspaces" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-2.10.0.0" newVersion="2.10.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
</dependentAssembly>

<dependentAssembly>
Expand Down
Loading

0 comments on commit bf6fcc5

Please sign in to comment.