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

Bump Dotnet.Script.DependencyModel to version 0.50.0 #1609

Merged
merged 17 commits into from
Oct 2, 2019
Merged
Show file tree
Hide file tree
Changes from 9 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
171 changes: 86 additions & 85 deletions build/Packages.props
Original file line number Diff line number Diff line change
@@ -1,89 +1,90 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
<MSBuildPackageVersion>16.3.0-preview-19426-01</MSBuildPackageVersion>
<NuGetPackageVersion>5.0.0</NuGetPackageVersion>
<RoslynPackageVersion>3.4.0-beta1-19460-02</RoslynPackageVersion>
<XunitPackageVersion>2.4.0</XunitPackageVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Update="Cake.Scripting.Transport" Version="0.3.0" />

<PackageReference Update="Dotnet.Script.DependencyModel" Version="0.6.1" />
<PackageReference Update="Dotnet.Script.DependencyModel.NuGet" Version="0.6.2" />

<PackageReference Update="Humanizer" Version="2.2.0" />
<PackageReference Update="McMaster.Extensions.CommandLineUtils" Version="2.2.4" />

<PackageReference Update="Microsoft.AspNetCore.Diagnostics" Version="2.1.1" />
<PackageReference Update="Microsoft.AspNetCore.Hosting" Version="2.1.1" />
<PackageReference Update="Microsoft.AspNetCore.Http.Features" Version="2.1.1" />
<PackageReference Update="Microsoft.AspNetCore.Server.Kestrel" Version="2.1.1" />

<PackageReference Update="Microsoft.Build" Version="$(MSBuildPackageVersion)" />
<PackageReference Update="Microsoft.Build.Framework" Version="$(MSBuildPackageVersion)" />
<PackageReference Update="Microsoft.Build.Tasks.Core" Version="$(MSBuildPackageVersion)" />
<PackageReference Update="Microsoft.Build.Utilities.Core" Version="$(MSBuildPackageVersion)" />

<PackageReference Update="Microsoft.CodeAnalysis.Common" Version="$(RoslynPackageVersion)" />
<PackageReference Update="Microsoft.CodeAnalysis.CSharp" Version="$(RoslynPackageVersion)" />
<PackageReference Update="Microsoft.CodeAnalysis.CSharp.Features" Version="$(RoslynPackageVersion)" />
<PackageReference Update="Microsoft.CodeAnalysis.CSharp.Scripting" Version="$(RoslynPackageVersion)" />
<PackageReference Update="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="$(RoslynPackageVersion)" />
<PackageReference Update="Microsoft.CodeAnalysis.Workspaces.Common" Version="$(RoslynPackageVersion)" />

<PackageReference Update="Microsoft.Extensions.Caching.Memory" Version="2.1.1" />
<PackageReference Update="Microsoft.Extensions.Configuration" Version="2.1.1" />
<PackageReference Update="Microsoft.Extensions.Configuration.Binder" Version="2.1.1" />
<PackageReference Update="Microsoft.Extensions.Configuration.CommandLine" Version="2.1.1" />
<PackageReference Update="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="2.1.1" />
<PackageReference Update="Microsoft.Extensions.Configuration.Json" Version="2.1.1" />
<PackageReference Update="Microsoft.Extensions.DependencyInjection" Version="2.1.1" />
<PackageReference Update="Microsoft.Extensions.DependencyModel" Version="2.1.0" />
<PackageReference Update="Microsoft.Extensions.FileProviders.Physical" Version="2.1.1" />
<PackageReference Update="Microsoft.Extensions.FileSystemGlobbing" Version="2.1.1" />
<PackageReference Update="Microsoft.Extensions.Logging" Version="2.1.1" />
<PackageReference Update="Microsoft.Extensions.Logging.Console" Version="2.1.1" />
<PackageReference Update="Microsoft.Extensions.Options" Version="2.1.1" />
<PackageReference Update="Microsoft.Extensions.Options.ConfigurationExtensions" Version="2.1.1" />

<PackageReference Update="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0-preview.1" />
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="15.7.2" />
<PackageReference Update="Microsoft.TestPlatform.TranslationLayer" Version="15.7.2" />
<PackageReference Update="Microsoft.VisualStudio.CodingConventions" Version="1.1.20180503.2" />
<PackageReference Update="Microsoft.VisualStudio.Setup.Configuration.Interop" Version="1.14.114" />
<PackageReference Update="Microsoft.VisualStudio.SDK.EmbedInteropTypes" Version="15.0.12" />

<PackageReference Update="Newtonsoft.Json" Version="9.0.1" />

<PackageReference Update="Nuget.Packaging" Version="$(NuGetPackageVersion)" />
<PackageReference Update="Nuget.Packaging.Core" Version="$(NuGetPackageVersion)" />
<PackageReference Update="Nuget.ProjectModel" Version="$(NuGetPackageVersion)" />
<PackageReference Update="Nuget.Versioning" Version="$(NuGetPackageVersion)" />

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

<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.DispatchProxy" Version="4.5.1" />
<PackageReference Update="System.Reflection.Metadata" Version="1.4.2" />
<PackageReference Update="System.Threading.Tasks.Dataflow" Version="4.9.0" />
<PackageReference Update="System.ValueTuple" Version="4.4.0" />

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

<PackageReference Update="System.Reflection.DispatchProxy" Version="4.5.1" />

<PackageReference Update="xunit.runner.visualstudio" Version="$(XunitPackageVersion)" />
<PackageReference Update="xunit" Version="$(XunitPackageVersion)" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-18618-05" PrivateAssets="All" />
</ItemGroup>
<Project ToolsVersion="14.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you please reset the changes to this file so that only the relevant lines are updated? we often look here at the blame to identify when a specific dependency was introduced - and this will break it

xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
<MSBuildPackageVersion>16.3.0-preview-19426-01</MSBuildPackageVersion>
<NuGetPackageVersion>5.2.0</NuGetPackageVersion>
<RoslynPackageVersion>3.4.0-beta1-19460-02</RoslynPackageVersion>
<XunitPackageVersion>2.4.0</XunitPackageVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Update="Cake.Scripting.Transport" Version="0.3.0" />

<PackageReference Update="Dotnet.Script.DependencyModel" Version="0.50.0" />
<PackageReference Update="Dotnet.Script.DependencyModel.NuGet" Version="0.50.0" />

<PackageReference Update="Humanizer" Version="2.2.0" />
<PackageReference Update="McMaster.Extensions.CommandLineUtils" Version="2.2.4" />

<PackageReference Update="Microsoft.AspNetCore.Diagnostics" Version="2.1.1" />
<PackageReference Update="Microsoft.AspNetCore.Hosting" Version="2.1.1" />
<PackageReference Update="Microsoft.AspNetCore.Http.Features" Version="2.1.1" />
<PackageReference Update="Microsoft.AspNetCore.Server.Kestrel" Version="2.1.1" />

<PackageReference Update="Microsoft.Build" Version="$(MSBuildPackageVersion)" />
<PackageReference Update="Microsoft.Build.Framework" Version="$(MSBuildPackageVersion)" />
<PackageReference Update="Microsoft.Build.Tasks.Core" Version="$(MSBuildPackageVersion)" />
<PackageReference Update="Microsoft.Build.Utilities.Core" Version="$(MSBuildPackageVersion)" />

<PackageReference Update="Microsoft.CodeAnalysis.Common" Version="$(RoslynPackageVersion)" />
<PackageReference Update="Microsoft.CodeAnalysis.CSharp" Version="$(RoslynPackageVersion)" />
<PackageReference Update="Microsoft.CodeAnalysis.CSharp.Features" Version="$(RoslynPackageVersion)" />
<PackageReference Update="Microsoft.CodeAnalysis.CSharp.Scripting" Version="$(RoslynPackageVersion)" />
<PackageReference Update="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="$(RoslynPackageVersion)" />
<PackageReference Update="Microsoft.CodeAnalysis.Workspaces.Common" Version="$(RoslynPackageVersion)" />

<PackageReference Update="Microsoft.Extensions.Caching.Memory" Version="2.1.1" />
<PackageReference Update="Microsoft.Extensions.Configuration" Version="2.1.1" />
<PackageReference Update="Microsoft.Extensions.Configuration.Binder" Version="2.1.1" />
<PackageReference Update="Microsoft.Extensions.Configuration.CommandLine" Version="2.1.1" />
<PackageReference Update="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="2.1.1" />
<PackageReference Update="Microsoft.Extensions.Configuration.Json" Version="2.1.1" />
<PackageReference Update="Microsoft.Extensions.DependencyInjection" Version="2.1.1" />
<PackageReference Update="Microsoft.Extensions.DependencyModel" Version="2.1.0" />
<PackageReference Update="Microsoft.Extensions.FileProviders.Physical" Version="2.1.1" />
<PackageReference Update="Microsoft.Extensions.FileSystemGlobbing" Version="2.1.1" />
<PackageReference Update="Microsoft.Extensions.Logging" Version="2.1.1" />
<PackageReference Update="Microsoft.Extensions.Logging.Console" Version="2.1.1" />
<PackageReference Update="Microsoft.Extensions.Options" Version="2.1.1" />
<PackageReference Update="Microsoft.Extensions.Options.ConfigurationExtensions" Version="2.1.1" />

<PackageReference Update="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0-preview.1" />
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="15.7.2" />
<PackageReference Update="Microsoft.TestPlatform.TranslationLayer" Version="15.7.2" />
<PackageReference Update="Microsoft.VisualStudio.CodingConventions" Version="1.1.20180503.2" />
<PackageReference Update="Microsoft.VisualStudio.Setup.Configuration.Interop" Version="1.14.114" />
<PackageReference Update="Microsoft.VisualStudio.SDK.EmbedInteropTypes" Version="15.0.12" />

<PackageReference Update="Newtonsoft.Json" Version="9.0.1" />

<PackageReference Update="Nuget.Packaging" Version="$(NuGetPackageVersion)" />
<PackageReference Update="Nuget.Packaging.Core" Version="$(NuGetPackageVersion)" />
<PackageReference Update="Nuget.ProjectModel" Version="$(NuGetPackageVersion)" />
<PackageReference Update="Nuget.Versioning" Version="$(NuGetPackageVersion)" />

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

<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.DispatchProxy" Version="4.5.1" />
<PackageReference Update="System.Reflection.Metadata" Version="1.4.2" />
<PackageReference Update="System.Threading.Tasks.Dataflow" Version="4.9.0" />
<PackageReference Update="System.ValueTuple" Version="4.4.0" />

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

<PackageReference Update="System.Reflection.DispatchProxy" Version="4.5.1" />

<PackageReference Update="xunit.runner.visualstudio" Version="$(XunitPackageVersion)" />
<PackageReference Update="xunit" Version="$(XunitPackageVersion)" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-18618-05" PrivateAssets="All" />
</ItemGroup>



Expand Down
3 changes: 1 addition & 2 deletions src/OmniSharp.Script/ScriptContext.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using Dotnet.Script.DependencyModel.Compilation;
using Microsoft.CodeAnalysis;

namespace OmniSharp.Script
Expand All @@ -21,6 +20,6 @@ public ScriptContext(ScriptProjectProvider scriptProjectProvider, HashSet<Metada

public CompilationDependency[] CompilationDependencies { get; }

public Type GlobalsType { get; }
public Type GlobalsType { get; }
}
}
10 changes: 7 additions & 3 deletions src/OmniSharp.Script/ScriptContextProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Scripting.Hosting;
using Microsoft.Extensions.Logging;
using OmniSharp.FileSystem;
using OmniSharp.Roslyn.Utilities;
using OmniSharp.Services;
using LogLevel = Dotnet.Script.DependencyModel.Logging.LogLevel;
Expand All @@ -23,21 +24,23 @@ public class ScriptContextProvider
private readonly CompilationDependencyResolver _compilationDependencyResolver;
private readonly IOmniSharpEnvironment _env;
private readonly MetadataFileReferenceCache _metadataFileReferenceCache;
private readonly FileSystemHelper _fileSystemHelper;
private readonly ILogger _logger;

[ImportingConstructor]
public ScriptContextProvider(ILoggerFactory loggerFactory, IOmniSharpEnvironment env, MetadataFileReferenceCache metadataFileReferenceCache)
public ScriptContextProvider(ILoggerFactory loggerFactory, IOmniSharpEnvironment env, MetadataFileReferenceCache metadataFileReferenceCache, FileSystemHelper fileSystemHelper)
{
_loggerFactory = loggerFactory;
_env = env;
_metadataFileReferenceCache = metadataFileReferenceCache;
_fileSystemHelper = fileSystemHelper;
_logger = loggerFactory.CreateLogger<ScriptContextProvider>();
_compilationDependencyResolver = new CompilationDependencyResolver(type =>
{
// Prefix with "OmniSharp" so that we make it through the log filter.
var categoryName = $"OmniSharp.Script.{type.FullName}";
var dependencyResolverLogger = loggerFactory.CreateLogger(categoryName);
return ((level, message) =>
return ((level, message, exception) =>
{
if (level == LogLevel.Debug)
{
Expand Down Expand Up @@ -66,8 +69,9 @@ public ScriptContext CreateScriptContext(ScriptOptions scriptOptions)
CompilationDependency[] compilationDependencies = null;
try
{
var allCsxFiles = scriptOptions.CsxFiles;
_logger.LogInformation($"Searching for compilation dependencies with the fallback framework of '{scriptOptions.DefaultTargetFramework}'.");
compilationDependencies = _compilationDependencyResolver.GetDependencies(_env.TargetDirectory, scriptOptions.IsNugetEnabled(), scriptOptions.DefaultTargetFramework).ToArray();
compilationDependencies = _compilationDependencyResolver.GetDependencies(_env.TargetDirectory, allCsxFiles, scriptOptions.IsNugetEnabled(), scriptOptions.DefaultTargetFramework).ToArray();
}
catch (Exception e)
{
Expand Down
27 changes: 26 additions & 1 deletion src/OmniSharp.Script/ScriptOptions.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,30 @@
using System.IO;
using System;
using System.Collections.Generic;
using System.IO;
using Microsoft.CodeAnalysis;

namespace OmniSharp.Script
{
public class ScriptOptions
{
private Lazy<Dictionary<string, ReportDiagnostic>> _nullableDiagnostics;

public ScriptOptions()
{
_nullableDiagnostics = new Lazy<Dictionary<string, ReportDiagnostic>>(CreateNullableDiagnostics);
}

private Dictionary<string, ReportDiagnostic> CreateNullableDiagnostics()
{
var nullableDiagnostics = new Dictionary<string, ReportDiagnostic>();
for (var i = 8600; i <= 8655; i++)
{
nullableDiagnostics.Add($"CS{i}", ReportDiagnostic.Error);
}

return nullableDiagnostics;
}

public bool EnableScriptNuGetReferences { get; set; }

public string DefaultTargetFramework { get; set; } = "net461";
Expand All @@ -24,5 +45,9 @@ public string GetNormalizedRspFilePath(IOmniSharpEnvironment env)
? RspFilePath
: Path.Combine(env.TargetDirectory, RspFilePath);
}

public Dictionary<string, ReportDiagnostic> NullableDiagnostics => _nullableDiagnostics.Value;

public string[] CsxFiles { get; set; }
}
}
13 changes: 9 additions & 4 deletions src/OmniSharp.Script/ScriptProjectProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ private CSharpCommandLineArguments CreateCommandLineArguments()
_isDesktopClr ? Path.GetDirectoryName(typeof(object).GetTypeInfo().Assembly.ManifestModule.FullyQualifiedName) : null);
}
}

return null;
}

Expand All @@ -100,6 +100,11 @@ private CSharpCompilationOptions CreateCompilationOptions()
.WithAssemblyIdentityComparer(DesktopAssemblyIdentityComparer.Default)
.WithSpecificDiagnosticOptions(CompilationOptionsHelper.GetDefaultSuppressedDiagnosticOptions());

if (_scriptOptions.IsNugetEnabled())
{
compilationOptions = compilationOptions.WithSpecificDiagnosticOptions(_scriptOptions.NullableDiagnostics);
}

var topLevelBinderFlagsProperty = typeof(CSharpCompilationOptions).GetProperty(TopLevelBinderFlagsProperty, BindingFlags.Instance | BindingFlags.NonPublic);
var binderFlagsType = typeof(CSharpCompilationOptions).GetTypeInfo().Assembly.GetType(BinderFlagsType);

Expand All @@ -124,18 +129,18 @@ private CachingScriptMetadataResolver CreateMetadataReferenceResolver()
InjectXMLDocumentationProviderIntoRuntimeMetadataReferenceResolver(defaultResolver);

var decoratedResolver = _scriptOptions.EnableScriptNuGetReferences
? new CachingScriptMetadataResolver(new NuGetMetadataReferenceResolver(defaultResolver))
? new CachingScriptMetadataResolver(new NuGetMetadataReferenceResolver(defaultResolver))
: new CachingScriptMetadataResolver(defaultResolver);

return decoratedResolver;
}

public ProjectInfo CreateProject(string csxFileName, IEnumerable<MetadataReference> references, string csxFilePath, Type globalsType, IEnumerable<string> namespaces = null)
{
var csharpCommandLineArguments = _commandLineArgs.Value;

// if RSP file was used, include the metadata references from RSP merged with the provided set
// otherwise just use the provided metadata references
// otherwise just use the provided metadata references
if (csharpCommandLineArguments != null && csharpCommandLineArguments.MetadataReferences.Any())
{
var resolvedRspReferences = csharpCommandLineArguments.ResolveMetadataReferences(_compilationOptions.Value.MetadataReferenceResolver);
Expand Down
Loading