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

Cake support #932

Merged
merged 40 commits into from
Oct 25, 2017
Merged
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
a651d6a
Adds OmniSharp.Cake project and Cake project system
bjorkstromm Jul 3, 2017
d9cd7a6
Project System now loads Cake files
bjorkstromm Jul 3, 2017
a1bcaba
Remove Cake.Core dependency
bjorkstromm Jul 4, 2017
054ecf9
Use Cake Configuration
bjorkstromm Jul 7, 2017
3fec513
Adds Buffer handlers for Cake
bjorkstromm Jul 14, 2017
3635771
Added more services
bjorkstromm Jul 14, 2017
ec9af89
Adds context model to Cake
bjorkstromm Jul 14, 2017
e6225ac
Fix hostObjectType loading for Cake
bjorkstromm Jul 15, 2017
c46a223
Update dependencies
bjorkstromm Aug 2, 2017
fa78f27
Remove target netstandard1.6
bjorkstromm Aug 15, 2017
b4b9b3f
Use IAssemblyLoader
bjorkstromm Aug 15, 2017
5c6760e
Use TargetFramework instead of TargetFrameworks
bjorkstromm Aug 15, 2017
392c2b8
Add DocumentationProvider
bjorkstromm Aug 15, 2017
6f66afa
Reorder request handlers
bjorkstromm Aug 16, 2017
e78d168
Refactor Cake Script Service
bjorkstromm Aug 16, 2017
063fe25
Fix line number translations to work when a cake file is loaded.
bjorkstromm Aug 17, 2017
55b6b27
Cache references and using and react on changes
bjorkstromm Aug 21, 2017
f207ceb
Find Cake.Bakery if path contains version
bjorkstromm Aug 21, 2017
f616e2e
Fix translation of lines for requests and responses
bjorkstromm Aug 22, 2017
e7b24c4
Added unit test project and fixed some translations.
bjorkstromm Aug 24, 2017
3f61d56
Support method and property aliases in gotodefinition handler.
bjorkstromm Aug 25, 2017
7299149
Git ignore launchSettings.json
bjorkstromm Sep 23, 2017
7340b9f
Git ignore Rider stuff
bjorkstromm Oct 5, 2017
753ebfe
Initial tests for Cake handlers.
bjorkstromm Oct 5, 2017
6d99493
Catch any exception when parsing configuration.
bjorkstromm Oct 10, 2017
a295267
Use package versions from packages.props
bjorkstromm Oct 10, 2017
65518ba
Handle incremental changes.
bjorkstromm Oct 17, 2017
cdd109a
Merge branch 'master' into feature/cake
david-driscoll Oct 18, 2017
e126ff4
Address code review comments.
bjorkstromm Oct 18, 2017
54c3bab
Merge branch 'master' into feature/cake
DustinCampbell Oct 19, 2017
e2dd7df
Make Cake Bakery resolution case insensitive
bjorkstromm Oct 19, 2017
a6194f6
Update Cake.Scripting and Bakery versions
bjorkstromm Oct 19, 2017
9fecd07
Add mono wrapper for executing bakery
bjorkstromm Oct 19, 2017
eb02fde
Fix LineIndexHelper and tests on Linux/OSX
bjorkstromm Oct 21, 2017
f6afebf
Add gotodefinition tests.
bjorkstromm Oct 22, 2017
e0cdfa5
Update to release bits of Cake.Scripting and Bakery
bjorkstromm Oct 22, 2017
50ad596
CakeConfiguration was never used.
bjorkstromm Oct 24, 2017
04825e0
Enhance compilation options usage in project system.
bjorkstromm Oct 24, 2017
48a2e73
Removed some magic integers.
bjorkstromm Oct 24, 2017
8a59058
Added MIT License for code copied from Cake repo
bjorkstromm Oct 24, 2017
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
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,16 @@ scripts/Omnisharp*
tools/*
!tools/packages.config

# Test assets
test-assets/**/tools/*
!test-assets/**/tools/packages.config

# VS Code
/.vscode/settings.json
/.vscode/launch.json

# VS
launchSettings.json

# Rider
.idea/
30 changes: 30 additions & 0 deletions OmniSharp.sln
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OmniSharp.Http.Tests", "tes
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OmniSharp.DotNet.ProjectModel", "src\OmniSharp.DotNet.ProjectModel\OmniSharp.DotNet.ProjectModel.csproj", "{31580626-6D87-491D-A65E-F6B881164398}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OmniSharp.Cake", "src\OmniSharp.Cake\OmniSharp.Cake.csproj", "{BA0713A6-EF63-419D-B60D-7A84B134531F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OmniSharp.Cake.Tests", "tests\OmniSharp.Cake.Tests\OmniSharp.Cake.Tests.csproj", "{17DAECA3-AE28-4B40-AA52-1EF618346A85}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -327,6 +331,30 @@ Global
{31580626-6D87-491D-A65E-F6B881164398}.Release|x64.Build.0 = Release|Any CPU
{31580626-6D87-491D-A65E-F6B881164398}.Release|x86.ActiveCfg = Release|Any CPU
{31580626-6D87-491D-A65E-F6B881164398}.Release|x86.Build.0 = Release|Any CPU
{BA0713A6-EF63-419D-B60D-7A84B134531F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BA0713A6-EF63-419D-B60D-7A84B134531F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BA0713A6-EF63-419D-B60D-7A84B134531F}.Debug|x64.ActiveCfg = Debug|Any CPU
{BA0713A6-EF63-419D-B60D-7A84B134531F}.Debug|x64.Build.0 = Debug|Any CPU
{BA0713A6-EF63-419D-B60D-7A84B134531F}.Debug|x86.ActiveCfg = Debug|Any CPU
{BA0713A6-EF63-419D-B60D-7A84B134531F}.Debug|x86.Build.0 = Debug|Any CPU
{BA0713A6-EF63-419D-B60D-7A84B134531F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BA0713A6-EF63-419D-B60D-7A84B134531F}.Release|Any CPU.Build.0 = Release|Any CPU
{BA0713A6-EF63-419D-B60D-7A84B134531F}.Release|x64.ActiveCfg = Release|Any CPU
{BA0713A6-EF63-419D-B60D-7A84B134531F}.Release|x64.Build.0 = Release|Any CPU
{BA0713A6-EF63-419D-B60D-7A84B134531F}.Release|x86.ActiveCfg = Release|Any CPU
{BA0713A6-EF63-419D-B60D-7A84B134531F}.Release|x86.Build.0 = Release|Any CPU
{17DAECA3-AE28-4B40-AA52-1EF618346A85}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{17DAECA3-AE28-4B40-AA52-1EF618346A85}.Debug|Any CPU.Build.0 = Debug|Any CPU
{17DAECA3-AE28-4B40-AA52-1EF618346A85}.Debug|x64.ActiveCfg = Debug|Any CPU
{17DAECA3-AE28-4B40-AA52-1EF618346A85}.Debug|x64.Build.0 = Debug|Any CPU
{17DAECA3-AE28-4B40-AA52-1EF618346A85}.Debug|x86.ActiveCfg = Debug|Any CPU
{17DAECA3-AE28-4B40-AA52-1EF618346A85}.Debug|x86.Build.0 = Debug|Any CPU
{17DAECA3-AE28-4B40-AA52-1EF618346A85}.Release|Any CPU.ActiveCfg = Release|Any CPU
{17DAECA3-AE28-4B40-AA52-1EF618346A85}.Release|Any CPU.Build.0 = Release|Any CPU
{17DAECA3-AE28-4B40-AA52-1EF618346A85}.Release|x64.ActiveCfg = Release|Any CPU
{17DAECA3-AE28-4B40-AA52-1EF618346A85}.Release|x64.Build.0 = Release|Any CPU
{17DAECA3-AE28-4B40-AA52-1EF618346A85}.Release|x86.ActiveCfg = Release|Any CPU
{17DAECA3-AE28-4B40-AA52-1EF618346A85}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -353,6 +381,8 @@ Global
{0A9BF1CC-2F0D-431C-BAFD-403658E233F1} = {2C348365-A9D8-459E-9276-56FC46AAEE31}
{1217C534-E8EB-454D-B6E1-12BD30E72F8E} = {35E025BF-BBB2-4FAC-9F4B-37CBA083EE47}
{31580626-6D87-491D-A65E-F6B881164398} = {2C348365-A9D8-459E-9276-56FC46AAEE31}
{BA0713A6-EF63-419D-B60D-7A84B134531F} = {2C348365-A9D8-459E-9276-56FC46AAEE31}
{17DAECA3-AE28-4B40-AA52-1EF618346A85} = {35E025BF-BBB2-4FAC-9F4B-37CBA083EE47}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4DD725CE-B49A-4151-8B77-BB33FE88E46E}
Expand Down
18 changes: 18 additions & 0 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,24 @@ Task("PrepareTestAssets")
.ExceptionOnError($"Failed to build '{folder}'.");
}
}

// Restore Cake test assets with NuGet
foreach (var project in buildPlan.CakeTestAssets)
{
Information("Restoring: {0}...", project);

var toolsFolder = CombinePaths(env.Folders.TestAssets, "test-projects", project, "tools");
var packagesConfig = CombinePaths(toolsFolder, "packages.config");

NuGetInstallFromConfig(packagesConfig, new NuGetInstallSettings {
OutputDirectory = toolsFolder,
Prerelease = true,
Verbosity = NuGetVerbosity.Quiet,
Source = new[] {
"https://api.nuget.org/v3/index.json"
}
});
}
});

void BuildProject(BuildEnvironment env, string projectName, string projectFilePath, string configuration, string outputType = null)
Expand Down
6 changes: 5 additions & 1 deletion build.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"OmniSharp.Stdio.Tests",
"OmniSharp.DotNet.Tests",
"OmniSharp.DotNetTest.Tests",
"OmniSharp.Tests"
"OmniSharp.Tests",
"OmniSharp.Cake.Tests"
],
"TestAssets": [
"NUnitTestProject",
Expand All @@ -42,5 +43,8 @@
"LegacyXunitTestProject",
"LegacyMSTestProject",
"LegacyProjectJsonApp"
],
"CakeTestAssets": [
"CakeProject"
]
}
3 changes: 2 additions & 1 deletion build/Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
<CakeScriptinTransportVersion>0.1.0</CakeScriptinTransportVersion>
<DotnetScriptDependencyModelVersion>0.1.0</DotnetScriptDependencyModelVersion>
<DotnetScriptDependencyModelNuGetVersion>0.1.0</DotnetScriptDependencyModelNuGetVersion>
<DotnetScriptDependencyModelNuGetVersion>0.1.0</DotnetScriptDependencyModelNuGetVersion>
<MicrosoftAspNetCoreDiagnosticsVersion>1.1.0</MicrosoftAspNetCoreDiagnosticsVersion>
<MicrosoftAspNetCoreHostingVersion>1.1.0</MicrosoftAspNetCoreHostingVersion>
<MicrosoftAspNetCoreHttpFeaturesVersion>1.1.0</MicrosoftAspNetCoreHttpFeaturesVersion>
Expand Down
1 change: 1 addition & 0 deletions scripts/common.cake
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ public class BuildPlan
public string[] TestProjects { get; set; }
public string[] TestAssets { get; set; }
public string[] LegacyTestAssets { get; set; }
public string[] CakeTestAssets { get; set; }

public static BuildPlan Load(BuildEnvironment env)
{
Expand Down
3 changes: 3 additions & 0 deletions src/OmniSharp.Cake/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
using System.Runtime.CompilerServices;

[assembly: InternalsVisibleTo("OmniSharp.Cake.Tests")]
59 changes: 59 additions & 0 deletions src/OmniSharp.Cake/CachingScriptMetadataResolver.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
using System.Collections.Generic;
using System.Collections.Immutable;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Scripting;

namespace OmniSharp.Cake
{
internal class CachingScriptMetadataResolver : MetadataReferenceResolver
{
private static readonly Dictionary<string, ImmutableArray<PortableExecutableReference>> DirectReferenceCache = new Dictionary<string, ImmutableArray<PortableExecutableReference>>();
private static readonly Dictionary<string, PortableExecutableReference> MissingReferenceCache = new Dictionary<string, PortableExecutableReference>();
Copy link
Contributor

Choose a reason for hiding this comment

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

Should either of these caches be case-insensitive on the key?

Copy link
Member Author

Choose a reason for hiding this comment

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

Dunno, this was copy-pasted-with-pride from what used to be in OmniSharp.Script. Let’s ask @filipw?

private static readonly MetadataReferenceResolver DefaultRuntimeResolver = ScriptMetadataResolver.Default;

public override bool Equals(object other)
{
return DefaultRuntimeResolver.Equals(other);
}

public override int GetHashCode()
{
return DefaultRuntimeResolver.GetHashCode();
}

public override bool ResolveMissingAssemblies => DefaultRuntimeResolver.ResolveMissingAssemblies;

public override PortableExecutableReference ResolveMissingAssembly(MetadataReference definition, AssemblyIdentity referenceIdentity)
{
if (MissingReferenceCache.TryGetValue(referenceIdentity.Name, out var result))
{
return result;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

minor nit: Could this use TryGetValue rather than doing two dictionary look ups?


result = DefaultRuntimeResolver.ResolveMissingAssembly(definition, referenceIdentity);
if (result != null)
{
MissingReferenceCache[referenceIdentity.Name] = result;
}

return result;
}

public override ImmutableArray<PortableExecutableReference> ResolveReference(string reference, string baseFilePath, MetadataReferenceProperties properties)
{
var key = $"{reference}-{baseFilePath}";
if (DirectReferenceCache.TryGetValue(key, out var result))
{
return result;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

minor nit: Could this use TryGetValue rather than doing two dictionary look ups?


result = DefaultRuntimeResolver.ResolveReference(reference, baseFilePath, properties);
if (result.Length > 0)
{
DirectReferenceCache[key] = result;
}

return result;
}
}
}
12 changes: 12 additions & 0 deletions src/OmniSharp.Cake/CakeContextModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace OmniSharp.Cake
{
internal class CakeContextModel
{
public CakeContextModel(string filePath)
{
Path = filePath;
}

public string Path { get; }
}
}
14 changes: 14 additions & 0 deletions src/OmniSharp.Cake/CakeContextModelCollection.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System.Collections.Generic;

namespace OmniSharp.Cake
{
internal class CakeContextModelCollection
{
public CakeContextModelCollection(IEnumerable<CakeContextModel> projects)
{
Projects = projects;
}

public IEnumerable<CakeContextModel> Projects { get; }
}
}
Loading