Skip to content

Commit

Permalink
Update to .NET Core 1.1 and latest Roslyn packages
Browse files Browse the repository at this point in the history
  • Loading branch information
DustinCampbell committed Jan 12, 2017
1 parent d3eec44 commit 1a8fe13
Show file tree
Hide file tree
Showing 30 changed files with 331 additions and 254 deletions.
1 change: 1 addition & 0 deletions NuGet.Config
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<clear />
<add key="dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
<add key="cli-deps" value="https://dotnet.myget.org/F/cli-deps/api/v3/index.json" />
<add key="roslyn" value="https://dotnet.myget.org/f/roslyn/api/v3/index.json" />
<add key="NuGet" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>
4 changes: 2 additions & 2 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ var scriptFolder = System.IO.Path.Combine(artifactFolder, "scripts");
var packagesFolder = System.IO.Path.Combine(workingDirectory, buildPlan.PackagesFolder);
var msbuildBaseFolder = System.IO.Path.Combine(workingDirectory, ".msbuild");
var msbuildNet46Folder = msbuildBaseFolder + "-net46";
var msbuildNetCoreAppFolder = msbuildBaseFolder + "-netcoreapp1.0";
var msbuildNetCoreAppFolder = msbuildBaseFolder + "-netcoreapp1.1";
var msbuildRuntimeForMonoInstallFolder = System.IO.Path.Combine(packagesFolder, "Microsoft.Build.Runtime.Mono");
var msbuildLibForMonoInstallFolder = System.IO.Path.Combine(packagesFolder, "Microsoft.Build.Lib.Mono");

Expand Down Expand Up @@ -400,7 +400,7 @@ Task("TestCore")
{
var logFile = System.IO.Path.Combine(logFolder, $"{testProject}-core-result.xml");
var testWorkingDir = System.IO.Path.Combine(testFolder, testProject);
Run(dotnetcli, $"test -f netcoreapp1.0 -xml \"{logFile}\" -notrait category=failing", testWorkingDir)
Run(dotnetcli, $"test -f netcoreapp1.1 -xml \"{logFile}\" -notrait category=failing", testWorkingDir)
.ExceptionOnError($"Test {testProject} failed for .NET Core.");
}
});
Expand Down
18 changes: 9 additions & 9 deletions build.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"UseSystemDotNetPath": "false",
"DotNetFolder": ".dotnet",
"DotNetInstallScriptURL": "https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0-preview2/scripts/obtain",
"DotNetInstallScriptURL": "https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0-preview2.1/scripts/obtain",
"DotNetChannel": "preview",
"DotNetVersion": "1.0.0-preview2-003131",
"DotNetVersion": "1.0.0-preview2-1-003177",
"DownloadURL": "https://omnisharpdownload.blob.core.windows.net/ext",
"MSBuildRuntimeForMono": "Microsoft.Build.Runtime.Mono-alpha1.zip",
"MSBuildLibForMono": "Microsoft.Build.Lib.Mono-alpha1.zip",
Expand All @@ -12,29 +12,29 @@
"PackagesFolder": "packages",
"TestProjects": {
"OmniSharp.MSBuild.Tests": [
"netcoreapp1.0",
"netcoreapp1.1",
"net46"
],
"OmniSharp.Roslyn.CSharp.Tests": [
"netcoreapp1.0"
"netcoreapp1.1"
],
"OmniSharp.Stdio.Tests": [
"netcoreapp1.0",
"netcoreapp1.1",
"net46"
],
"OmniSharp.DotNet.Tests": [
"netcoreapp1.0"
"netcoreapp1.1"
],
"OmniSharp.DotNetTest.Tests": [
"netcoreapp1.0"
"netcoreapp1.1"
],
"OmniSharp.Tests": [
"netcoreapp1.0"
"netcoreapp1.1"
]
},
"Frameworks": [
"net46",
"netcoreapp1.0"
"netcoreapp1.1"
],
"MainProject": "OmniSharp"
}
4 changes: 4 additions & 0 deletions src/OmniSharp.Abstractions/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ public static class Configuration
public const string RoslynVersion = "2.0.0.0";
public const string RoslynPublicKeyToken = "31bf3856ad364e35";

public readonly static string RoslynFeatures = GetRoslynAssemblyFullName("Microsoft.CodeAnalysis.Features");
public readonly static string RoslynCSharpFeatures = GetRoslynAssemblyFullName("Microsoft.CodeAnalysis.CSharp.Features");
public readonly static string RoslynWorkspaces = GetRoslynAssemblyFullName("Microsoft.CodeAnalysis.Workspaces");

public static string GetRoslynAssemblyFullName(string name)
{
return $"{name}, Version={RoslynVersion}, Culture=neutral, PublicKeyToken={RoslynPublicKeyToken}";
Expand Down
162 changes: 162 additions & 0 deletions src/OmniSharp.Abstractions/Extensions/ReflectionExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
using System;
using System.Reflection;

namespace OmniSharp.Services
{
public static class ReflectionExtensions
{
public static Lazy<Type> LazyGetType(this Lazy<Assembly> lazyAssembly, string typeName)
{
if (lazyAssembly == null)
{
throw new ArgumentNullException(nameof(lazyAssembly));
}

return new Lazy<Type>(() =>
{
var type = lazyAssembly.Value.GetType(typeName);
if (type == null)
{
throw new InvalidOperationException($"Could not get type '{typeName}'");
}
return type;
});
}

public static Lazy<MethodInfo> LazyGetMethod(this Lazy<Type> lazyType, string methodName)
{
if (lazyType == null)
{
throw new ArgumentNullException(nameof(lazyType));
}

return new Lazy<MethodInfo>(() =>
{
var methodInfo = lazyType.Value.GetMethod(methodName);
if (methodInfo == null)
{
throw new InvalidOperationException($"Could not get type '{methodName}'");
}
return methodInfo;
});
}

public static Lazy<MethodInfo> LazyGetMethod(this Lazy<Type> lazyType, string methodName, BindingFlags bindingFlags)
{
if (lazyType == null)
{
throw new ArgumentNullException(nameof(lazyType));
}

return new Lazy<MethodInfo>(() =>
{
var methodInfo = lazyType.Value.GetMethod(methodName, bindingFlags);
if (methodInfo == null)
{
throw new InvalidOperationException($"Could not get type '{methodName}'");
}
return methodInfo;
});
}

public static MethodInfo GetMethod(this Lazy<Type> lazyType, string methodName)
{
if (lazyType == null)
{
throw new ArgumentNullException(nameof(lazyType));
}

var methodInfo = lazyType.Value.GetMethod(methodName);

if (methodInfo == null)
{
throw new InvalidOperationException($"Could not get type '{methodName}'");
}

return methodInfo;
}

public static MethodInfo GetMethod(this Lazy<Type> lazyType, string methodName, BindingFlags bindingFlags)
{
if (lazyType == null)
{
throw new ArgumentNullException(nameof(lazyType));
}

var methodInfo = lazyType.Value.GetMethod(methodName, bindingFlags);

if (methodInfo == null)
{
throw new InvalidOperationException($"Could not get type '{methodName}'");
}

return methodInfo;
}

public static object CreateInstance(this Lazy<Type> lazyType, params object[] args)
{
if (lazyType == null)
{
throw new ArgumentNullException(nameof(lazyType));
}

return Activator.CreateInstance(lazyType.Value, args);
}

public static T Invoke<T>(this MethodInfo methodInfo, object obj, object[] args)
{
if (methodInfo == null)
{
throw new ArgumentNullException(nameof(methodInfo));
}

return (T)methodInfo.Invoke(obj, args);
}

public static T Invoke<T>(this Lazy<MethodInfo> lazyMethodInfo, object obj, object[] args)
{
if (lazyMethodInfo == null)
{
throw new ArgumentNullException(nameof(lazyMethodInfo));
}

return (T)lazyMethodInfo.Value.Invoke(obj, args);
}

public static T InvokeStatic<T>(this MethodInfo methodInfo, object[] args)
{
if (methodInfo == null)
{
throw new ArgumentNullException(nameof(methodInfo));
}

return (T)methodInfo.Invoke(null, args);
}

public static T InvokeStatic<T>(this Lazy<MethodInfo> lazyMethodInfo, object[] args)
{
if (lazyMethodInfo == null)
{
throw new ArgumentNullException(nameof(lazyMethodInfo));
}

return lazyMethodInfo.Value.InvokeStatic<T>(args);
}

public static object InvokeStatic(this MethodInfo methodInfo, object[] args)
{
return methodInfo.Invoke(null, args);
}

public static object InvokeStatic(this Lazy<MethodInfo> lazyMethodInfo, object[] args)
{
return lazyMethodInfo.InvokeStatic(args);
}
}
}
14 changes: 7 additions & 7 deletions src/OmniSharp.Abstractions/Services/IOmnisharpAssemblyLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,27 @@ public interface IOmnisharpAssemblyLoader

public static class IOmniSharpAssemblyLoaderExtensions
{
public static Lazy<Assembly> LazyLoad(this IOmnisharpAssemblyLoader self, string name)
public static Lazy<Assembly> LazyLoad(this IOmnisharpAssemblyLoader loader, string assemblyName)
{
return new Lazy<Assembly>(() => self.Load(name));
return new Lazy<Assembly>(() => loader.Load(assemblyName));
}

public static Assembly Load(this IOmnisharpAssemblyLoader self, string name)
public static Assembly Load(this IOmnisharpAssemblyLoader loader, string name)
{
var assemblyName = name;
if (name.EndsWith(".dll", StringComparison.OrdinalIgnoreCase))
{
assemblyName = name.Substring(0, name.Length - 4);
}

return self.Load(new AssemblyName(assemblyName));
return loader.Load(new AssemblyName(assemblyName));
}

public static IEnumerable<Assembly> Load(this IOmnisharpAssemblyLoader self, params string[] names)
public static IEnumerable<Assembly> Load(this IOmnisharpAssemblyLoader loader, params string[] assemblyNames)
{
foreach (var name in names)
foreach (var name in assemblyNames)
{
yield return Load(self, name);
yield return Load(loader, name);
}
}
}
Expand Down
43 changes: 14 additions & 29 deletions src/OmniSharp.Abstractions/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,43 +5,28 @@
},
"dependencies": {
"Newtonsoft.Json": "9.0.1",
"Microsoft.CodeAnalysis.Common": "2.0.0-rc",
"Microsoft.CodeAnalysis.Workspaces.Common": "2.0.0-rc",
"Microsoft.Composition": "1.0.30",
"Microsoft.Extensions.Caching.Memory": "1.0.0",
"Microsoft.Extensions.Configuration": "1.0.0",
"Microsoft.Extensions.Configuration.Binder": "1.0.0",
"Microsoft.Extensions.FileSystemGlobbing": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.PlatformAbstractions": "1.0.0"
"Microsoft.CodeAnalysis.Common": "2.0.0-rc3-61312-01",
"Microsoft.CodeAnalysis.Workspaces.Common": "2.0.0-rc3-61312-01",
"Microsoft.Extensions.Caching.Memory": "1.1.0",
"Microsoft.Extensions.Configuration": "1.1.0",
"Microsoft.Extensions.Configuration.Binder": "1.1.0",
"Microsoft.Extensions.FileSystemGlobbing": "1.1.0",
"Microsoft.Extensions.Logging.Console": "1.1.0",
"Microsoft.Extensions.PlatformAbstractions": "1.1.0"
},
"frameworks": {
"net46": {
"frameworkAssemblies": {
"System.Runtime": "",
"System.Threading": "",
"System.Threading.Tasks": "",
"System.Collections": "",
"System.Linq": "",
"System.Text.Encoding": "",
"System.Reflection": "",
"System.Security": "",
"System.Globalization": "",
"System.Xml": "",
"System.Xml.Linq": ""
}
},
"net46": {},
"netstandard1.6": {
"imports": [
"dotnet5.4",
"portable-net45+win8"
],
"dependencies": {
"NETStandard.Library": "1.6.0",
"System.Diagnostics.Process": "4.1.0",
"System.Dynamic.Runtime": "4.0.11",
"System.IO.FileSystem.Watcher": "4.0.0",
"System.Threading.Thread": "4.0.0"
"NETStandard.Library": "1.6.1",
"System.Diagnostics.Process": "4.3.0",
"System.Dynamic.Runtime": "4.3.0",
"System.IO.FileSystem.Watcher": "4.3.0",
"System.Threading.Thread": "4.3.0"
}
}
}
Expand Down
24 changes: 10 additions & 14 deletions src/OmniSharp.DotNet/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,24 @@
"dependencies": {
"OmniSharp.Abstractions": "1.0.0",
"OmniSharp.Roslyn": "1.0.0",
"Microsoft.CodeAnalysis.CSharp": "2.0.0-rc",
"Microsoft.DotNet.ProjectModel": "1.0.0-rc3-003121",
"Microsoft.Extensions.PlatformAbstractions": "1.0.0"
"Microsoft.CodeAnalysis.CSharp": "2.0.0-rc3-61312-01",
"Microsoft.DotNet.ProjectModel": "1.0.0-rc3-1-003177",
"Microsoft.DotNet.InternalAbstractions": "1.0.500-preview2-1-003177",
"Microsoft.Extensions.PlatformAbstractions": "1.1.0"
},
"frameworks": {
"net46": {
"frameworkAssemblies": {
"System.IO": "",
"System.Collections": ""
}
},
"net46": {},
"netstandard1.6": {
"imports": [
"dotnet5.6",
"portable-net45+win8"
],
"dependencies": {
"NETStandard.Library": "1.6.0",
"System.IO.Compression": "4.1.0",
"System.Runtime.Loader": "4.0.0",
"System.Runtime.Serialization.Primitives": "4.1.1",
"System.Security.Cryptography.Algorithms": "4.2.0"
"NETStandard.Library": "1.6.1",
"System.IO.Compression": "4.3.0",
"System.Runtime.Loader": "4.3.0",
"System.Runtime.Serialization.Primitives": "4.3.0",
"System.Security.Cryptography.Algorithms": "4.3.0"
}
}
}
Expand Down
Loading

0 comments on commit 1a8fe13

Please sign in to comment.