From a651d6ade8d00bc329b11e8f9048280cb7a9da9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Bj=C3=B6rkstr=C3=B6m?= Date: Mon, 3 Jul 2017 22:46:11 +0300 Subject: [PATCH 01/38] Adds OmniSharp.Cake project and Cake project system --- OmniSharp.sln | 19 ++++++++++++++ src/OmniSharp.Cake/CakeProjectSystem.cs | 33 ++++++++++++++++++++++++ src/OmniSharp.Cake/Constants.cs | 10 +++++++ src/OmniSharp.Cake/OmniSharp.Cake.csproj | 16 ++++++++++++ 4 files changed, 78 insertions(+) create mode 100644 src/OmniSharp.Cake/CakeProjectSystem.cs create mode 100644 src/OmniSharp.Cake/Constants.cs create mode 100644 src/OmniSharp.Cake/OmniSharp.Cake.csproj diff --git a/OmniSharp.sln b/OmniSharp.sln index 09d3896b0c..c3097eb107 100644 --- a/OmniSharp.sln +++ b/OmniSharp.sln @@ -1,6 +1,10 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 +<<<<<<< HEAD VisualStudioVersion = 15.0.27004.2000 +======= +VisualStudioVersion = 15.0.26730.3 +>>>>>>> 80646728... Adds OmniSharp.Cake project and Cake project system MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{2C348365-A9D8-459E-9276-56FC46AAEE31}" EndProject @@ -65,6 +69,8 @@ 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 Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -327,6 +333,18 @@ 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 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -353,6 +371,7 @@ 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} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {4DD725CE-B49A-4151-8B77-BB33FE88E46E} diff --git a/src/OmniSharp.Cake/CakeProjectSystem.cs b/src/OmniSharp.Cake/CakeProjectSystem.cs new file mode 100644 index 0000000000..e4d667d788 --- /dev/null +++ b/src/OmniSharp.Cake/CakeProjectSystem.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Composition; +using System.Threading.Tasks; +using Microsoft.Extensions.Configuration; +using OmniSharp.Models.WorkspaceInformation; +using OmniSharp.Services; + +namespace OmniSharp.Cake +{ + [Export(typeof(IProjectSystem)), Shared] + public class CakeProjectSystem : IProjectSystem + { + public string Key => "Cake"; + public string Language => Constants.LanguageNames.Cake; + public IEnumerable Extensions => new[] { ".cake" }; + + public void Initalize(IConfiguration configuration) + { + throw new NotImplementedException(); + } + + public Task GetWorkspaceModelAsync(WorkspaceInformationRequest request) + { + throw new NotImplementedException(); + } + + public Task GetProjectModelAsync(string filePath) + { + throw new NotImplementedException(); + } + } +} diff --git a/src/OmniSharp.Cake/Constants.cs b/src/OmniSharp.Cake/Constants.cs new file mode 100644 index 0000000000..3c2cc1c55d --- /dev/null +++ b/src/OmniSharp.Cake/Constants.cs @@ -0,0 +1,10 @@ +namespace OmniSharp.Cake +{ + internal class Constants + { + public static class LanguageNames + { + public const string Cake = "Cake"; + } + } +} diff --git a/src/OmniSharp.Cake/OmniSharp.Cake.csproj b/src/OmniSharp.Cake/OmniSharp.Cake.csproj new file mode 100644 index 0000000000..cc62414c6d --- /dev/null +++ b/src/OmniSharp.Cake/OmniSharp.Cake.csproj @@ -0,0 +1,16 @@ + + + + net46;netstandard1.6 + true + AnyCPU + + + $(PackageTargetFallback);dotnet5.4;portable-net45+win8 + + + + + + + From d9cd7a682dc76b531adaf2020a74fb89651c394e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Bj=C3=B6rkstr=C3=B6m?= Date: Tue, 4 Jul 2017 00:45:33 +0300 Subject: [PATCH 02/38] Project System now loads Cake files --- NuGet.Config | 1 + .../CachingScriptMetadataResolver.cs | 59 ++++++++ src/OmniSharp.Cake/CakeProjectSystem.cs | 126 +++++++++++++++++- src/OmniSharp.Cake/CakeTextLoader.cs | 55 ++++++++ src/OmniSharp.Cake/OmniSharp.Cake.csproj | 11 ++ .../Services/CakeGenerationService.cs | 38 ++++++ src/OmniSharp.Http/OmniSharp.Http.csproj | 1 + src/OmniSharp.Stdio/OmniSharp.Stdio.csproj | 1 + 8 files changed, 291 insertions(+), 1 deletion(-) create mode 100644 src/OmniSharp.Cake/CachingScriptMetadataResolver.cs create mode 100644 src/OmniSharp.Cake/CakeTextLoader.cs create mode 100644 src/OmniSharp.Cake/Services/CakeGenerationService.cs diff --git a/NuGet.Config b/NuGet.Config index 41c0ecd6d8..7f59d1ff82 100644 --- a/NuGet.Config +++ b/NuGet.Config @@ -5,5 +5,6 @@ + diff --git a/src/OmniSharp.Cake/CachingScriptMetadataResolver.cs b/src/OmniSharp.Cake/CachingScriptMetadataResolver.cs new file mode 100644 index 0000000000..dee0a21fb4 --- /dev/null +++ b/src/OmniSharp.Cake/CachingScriptMetadataResolver.cs @@ -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> DirectReferenceCache = new Dictionary>(); + private static readonly Dictionary MissingReferenceCache = new Dictionary(); + 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.ContainsKey(referenceIdentity.Name)) + { + return MissingReferenceCache[referenceIdentity.Name]; + } + + var result = _defaultRuntimeResolver.ResolveMissingAssembly(definition, referenceIdentity); + if (result != null) + { + MissingReferenceCache[referenceIdentity.Name] = result; + } + + return result; + } + + public override ImmutableArray ResolveReference(string reference, string baseFilePath, MetadataReferenceProperties properties) + { + var key = $"{reference}-{baseFilePath}"; + if (DirectReferenceCache.ContainsKey(key)) + { + return DirectReferenceCache[key]; + } + + var result = _defaultRuntimeResolver.ResolveReference(reference, baseFilePath, properties); + if (result.Length > 0) + { + DirectReferenceCache[key] = result; + } + + return result; + } + } +} \ No newline at end of file diff --git a/src/OmniSharp.Cake/CakeProjectSystem.cs b/src/OmniSharp.Cake/CakeProjectSystem.cs index e4d667d788..d6b0e01b47 100644 --- a/src/OmniSharp.Cake/CakeProjectSystem.cs +++ b/src/OmniSharp.Cake/CakeProjectSystem.cs @@ -1,8 +1,18 @@ using System; using System.Collections.Generic; using System.Composition; +using System.IO; +using System.Linq; +using System.Reflection; using System.Threading.Tasks; +using Cake.Core.Scripting; +using Cake.Scripting.Abstractions; +using Cake.Scripting.Abstractions.Models; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp; +using Microsoft.CodeAnalysis.Scripting; using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Logging; using OmniSharp.Models.WorkspaceInformation; using OmniSharp.Services; @@ -11,13 +21,76 @@ namespace OmniSharp.Cake [Export(typeof(IProjectSystem)), Shared] public class CakeProjectSystem : IProjectSystem { + private readonly OmniSharpWorkspace _workspace; + private readonly IOmniSharpEnvironment _environment; + private readonly ILogger _logger; + private readonly IScriptGenerationService _generationService; + private readonly Dictionary _projects; + public string Key => "Cake"; public string Language => Constants.LanguageNames.Cake; public IEnumerable Extensions => new[] { ".cake" }; + [ImportingConstructor] + public CakeProjectSystem( + OmniSharpWorkspace workspace, + IOmniSharpEnvironment environment, + ILoggerFactory loggerFactory, + IScriptGenerationService generationService) + { + _workspace = workspace ?? throw new ArgumentNullException(nameof(workspace)); + _environment = environment ?? throw new ArgumentNullException(nameof(environment)); + _logger = loggerFactory?.CreateLogger() ?? throw new ArgumentNullException(nameof(loggerFactory)); + _generationService = generationService ?? throw new ArgumentNullException(nameof(generationService)); + + _projects = new Dictionary(); + } + public void Initalize(IConfiguration configuration) { - throw new NotImplementedException(); + _logger.LogInformation($"Detecting Cake files in '{_environment.TargetDirectory}'."); + + // Nothing to do if there are no Cake files + var allCakeFiles = Directory.GetFiles(_environment.TargetDirectory, "*.cake", SearchOption.AllDirectories); + if (allCakeFiles.Length == 0) + { + _logger.LogInformation("Could not find any Cake files"); + return; + } + + _logger.LogInformation($"Found {allCakeFiles.Length} Cake files."); + + foreach (var cakePath in allCakeFiles) + { + try + { + var cakeScript = _generationService.Generate(new FileChange + { + FileName = cakePath, + FromDisk = true + }); + var project = GetProject(cakeScript, cakePath); + + // add Cake project to workspace + _workspace.AddProject(project); + var documentId = DocumentId.CreateNewId(project.Id); + var loader = new CakeTextLoader(cakePath, _generationService); + var documentInfo = DocumentInfo.Create( + documentId, + cakePath, + filePath: cakePath, + loader: loader, + sourceCodeKind: SourceCodeKind.Script); + + _workspace.AddDocument(documentInfo); + _projects[cakePath] = project; + _logger.LogInformation($"Added Cake project '{cakePath}' to the workspace."); + } + catch (Exception ex) + { + _logger.LogError(ex, $"{cakePath} will be ignored due to an following error"); + } + } } public Task GetWorkspaceModelAsync(WorkspaceInformationRequest request) @@ -29,5 +102,56 @@ public Task GetProjectModelAsync(string filePath) { throw new NotImplementedException(); } + + private ProjectInfo GetProject(CakeScript cakeScript, string filePath) + { + var name = Path.GetFileName(filePath); + + return ProjectInfo.Create( + id: ProjectId.CreateNewId(Guid.NewGuid().ToString()), + version: VersionStamp.Create(), + name: name, + filePath: filePath, + assemblyName: $"{name}.dll", + language: LanguageNames.CSharp, + compilationOptions: GetCompilationOptions(cakeScript.Usings), + parseOptions: new CSharpParseOptions(LanguageVersion.Default, DocumentationMode.Parse, SourceCodeKind.Script), + // TODO: Create Documentation for reference also + metadataReferences: cakeScript.References.Select(reference => MetadataReference.CreateFromFile(reference/*, documentation: CreateDocumentationProvider(referencePath))*/)), + // TODO: projectReferences? + isSubmission: true, + hostObjectType: typeof(IScriptHost)); + } + + private CompilationOptions GetCompilationOptions(ISet usings) + { + var compilationOptions = new CSharpCompilationOptions( + OutputKind.DynamicallyLinkedLibrary, + usings: usings, + allowUnsafe: true, + metadataReferenceResolver: new CachingScriptMetadataResolver(), + sourceReferenceResolver: ScriptSourceResolver.Default, + assemblyIdentityComparer: DesktopAssemblyIdentityComparer.Default). + WithSpecificDiagnosticOptions(new Dictionary + { + // ensure that specific warnings about assembly references are always suppressed + // https://github.com/dotnet/roslyn/issues/5501 + { "CS1701", ReportDiagnostic.Suppress }, + { "CS1702", ReportDiagnostic.Suppress }, + { "CS1705", ReportDiagnostic.Suppress } + }); + + var topLevelBinderFlagsProperty = typeof(CSharpCompilationOptions).GetProperty("TopLevelBinderFlags", BindingFlags.Instance | BindingFlags.NonPublic); + var binderFlagsType = typeof(CSharpCompilationOptions).GetTypeInfo().Assembly.GetType("Microsoft.CodeAnalysis.CSharp.BinderFlags"); + + var ignoreCorLibraryDuplicatedTypesMember = binderFlagsType?.GetField("IgnoreCorLibraryDuplicatedTypes", BindingFlags.Static | BindingFlags.Public); + var ignoreCorLibraryDuplicatedTypesValue = ignoreCorLibraryDuplicatedTypesMember?.GetValue(null); + if (ignoreCorLibraryDuplicatedTypesValue != null) + { + topLevelBinderFlagsProperty?.SetValue(compilationOptions, ignoreCorLibraryDuplicatedTypesValue); + } + + return compilationOptions; + } } } diff --git a/src/OmniSharp.Cake/CakeTextLoader.cs b/src/OmniSharp.Cake/CakeTextLoader.cs new file mode 100644 index 0000000000..e703c2d4eb --- /dev/null +++ b/src/OmniSharp.Cake/CakeTextLoader.cs @@ -0,0 +1,55 @@ +using System; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Cake.Scripting.Abstractions; +using Cake.Scripting.Abstractions.Models; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.Text; + +namespace OmniSharp.Cake +{ + internal class CakeTextLoader : TextLoader + { + private readonly string _filePath; + private readonly IScriptGenerationService _generationService; + + public CakeTextLoader(string filePath, IScriptGenerationService generationService) + { + if (filePath == null) + { + throw new ArgumentNullException(nameof(filePath)); + } + + if (!Path.IsPathRooted(filePath)) + { + throw new ArgumentException("Expected an absolute file path", nameof(filePath)); + } + + _filePath = filePath; + _generationService = generationService ?? throw new ArgumentNullException(nameof(generationService)); + } + + public override Task LoadTextAndVersionAsync(Workspace workspace, DocumentId documentId, CancellationToken cancellationToken) + { + var prevLastWriteTime = File.GetLastWriteTimeUtc(_filePath); + + var script = _generationService.Generate(new FileChange + { + FileName = _filePath, + FromDisk = true + }); + var version = VersionStamp.Create(prevLastWriteTime); + var text = SourceText.From(script.Source); + var textAndVersion = TextAndVersion.Create(text, version, _filePath); + + var newLastWriteTime = File.GetLastWriteTimeUtc(_filePath); + if (!newLastWriteTime.Equals(prevLastWriteTime)) + { + throw new IOException($"File was externally modified: {_filePath}"); + } + + return Task.FromResult(textAndVersion); + } + } +} \ No newline at end of file diff --git a/src/OmniSharp.Cake/OmniSharp.Cake.csproj b/src/OmniSharp.Cake/OmniSharp.Cake.csproj index cc62414c6d..5d8a2f3baf 100644 --- a/src/OmniSharp.Cake/OmniSharp.Cake.csproj +++ b/src/OmniSharp.Cake/OmniSharp.Cake.csproj @@ -11,6 +11,17 @@ + + + + + + + + + + all + diff --git a/src/OmniSharp.Cake/Services/CakeGenerationService.cs b/src/OmniSharp.Cake/Services/CakeGenerationService.cs new file mode 100644 index 0000000000..a636366801 --- /dev/null +++ b/src/OmniSharp.Cake/Services/CakeGenerationService.cs @@ -0,0 +1,38 @@ +using System; +using System.Composition; +using System.IO; +using Cake.Scripting.Abstractions; +using Cake.Scripting.Abstractions.Models; +using Cake.Scripting.Transport.Tcp.Client; +using Microsoft.Extensions.Logging; + +namespace OmniSharp.Cake.Services +{ + [Export(typeof(IScriptGenerationService)), Shared] + public class CakeGenerationService : IScriptGenerationService + { + private readonly IScriptGenerationService _generationService; + + [ImportingConstructor] + public CakeGenerationService(IOmniSharpEnvironment environment, ILoggerFactory loggerFactory) + { + if (environment == null) + { + throw new ArgumentNullException(nameof(environment)); + } + if (loggerFactory == null) + { + throw new ArgumentNullException(nameof(loggerFactory)); + } + + // TODO: Read from cake configuration, don't assume Bakery is in tools folder + var bakeryExe = Path.Combine(environment.TargetDirectory, "tools", "Cake.Bakery", "tools", "Cake.Bakery.exe"); + _generationService = new ScriptGenerationClient(bakeryExe, environment.TargetDirectory, loggerFactory); + } + + public CakeScript Generate(FileChange fileChange) + { + return _generationService.Generate(fileChange); + } + } +} diff --git a/src/OmniSharp.Http/OmniSharp.Http.csproj b/src/OmniSharp.Http/OmniSharp.Http.csproj index d52ed1eb2d..8d6afc27ec 100644 --- a/src/OmniSharp.Http/OmniSharp.Http.csproj +++ b/src/OmniSharp.Http/OmniSharp.Http.csproj @@ -16,6 +16,7 @@ + diff --git a/src/OmniSharp.Stdio/OmniSharp.Stdio.csproj b/src/OmniSharp.Stdio/OmniSharp.Stdio.csproj index 649e3e002a..b5d62ea255 100644 --- a/src/OmniSharp.Stdio/OmniSharp.Stdio.csproj +++ b/src/OmniSharp.Stdio/OmniSharp.Stdio.csproj @@ -16,6 +16,7 @@ + From a1bcaba1121879f9ce42856ee9401c7ff9e2eb92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Bj=C3=B6rkstr=C3=B6m?= Date: Wed, 5 Jul 2017 00:06:54 +0300 Subject: [PATCH 03/38] Remove Cake.Core dependency --- src/OmniSharp.Cake/CakeProjectSystem.cs | 6 ++++-- src/OmniSharp.Cake/OmniSharp.Cake.csproj | 11 ++++++----- src/OmniSharp.Cake/Polyfill/AssemblyLoader.cs | 16 ++++++++++++++++ 3 files changed, 26 insertions(+), 7 deletions(-) create mode 100644 src/OmniSharp.Cake/Polyfill/AssemblyLoader.cs diff --git a/src/OmniSharp.Cake/CakeProjectSystem.cs b/src/OmniSharp.Cake/CakeProjectSystem.cs index d6b0e01b47..2b9547aeb8 100644 --- a/src/OmniSharp.Cake/CakeProjectSystem.cs +++ b/src/OmniSharp.Cake/CakeProjectSystem.cs @@ -5,7 +5,6 @@ using System.Linq; using System.Reflection; using System.Threading.Tasks; -using Cake.Core.Scripting; using Cake.Scripting.Abstractions; using Cake.Scripting.Abstractions.Models; using Microsoft.CodeAnalysis; @@ -13,6 +12,7 @@ using Microsoft.CodeAnalysis.Scripting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; +using OmniSharp.Cake.Polyfill; using OmniSharp.Models.WorkspaceInformation; using OmniSharp.Services; @@ -107,6 +107,8 @@ private ProjectInfo GetProject(CakeScript cakeScript, string filePath) { var name = Path.GetFileName(filePath); + AssemblyLoader.LoadFrom(cakeScript.Host.AssemblyPath); + return ProjectInfo.Create( id: ProjectId.CreateNewId(Guid.NewGuid().ToString()), version: VersionStamp.Create(), @@ -120,7 +122,7 @@ private ProjectInfo GetProject(CakeScript cakeScript, string filePath) metadataReferences: cakeScript.References.Select(reference => MetadataReference.CreateFromFile(reference/*, documentation: CreateDocumentationProvider(referencePath))*/)), // TODO: projectReferences? isSubmission: true, - hostObjectType: typeof(IScriptHost)); + hostObjectType: Type.GetType(cakeScript.Host.TypeName)); } private CompilationOptions GetCompilationOptions(ISet usings) diff --git a/src/OmniSharp.Cake/OmniSharp.Cake.csproj b/src/OmniSharp.Cake/OmniSharp.Cake.csproj index 5d8a2f3baf..a0325bd427 100644 --- a/src/OmniSharp.Cake/OmniSharp.Cake.csproj +++ b/src/OmniSharp.Cake/OmniSharp.Cake.csproj @@ -17,11 +17,12 @@ - - - - all - + + + + + + diff --git a/src/OmniSharp.Cake/Polyfill/AssemblyLoader.cs b/src/OmniSharp.Cake/Polyfill/AssemblyLoader.cs new file mode 100644 index 0000000000..e18dd281db --- /dev/null +++ b/src/OmniSharp.Cake/Polyfill/AssemblyLoader.cs @@ -0,0 +1,16 @@ +using System.Reflection; + +namespace OmniSharp.Cake.Polyfill +{ + internal static class AssemblyLoader + { + public static Assembly LoadFrom(string assemblyPath) + { +#if NET46 + return Assembly.LoadFrom(assemblyPath); +#else + return System.Runtime.Loader.AssemblyLoadContext.Default.LoadFromAssemblyPath(assemblyPath); +#endif + } + } +} From 054ecf97fb2e44b88bc27f036f089a602c0ca745 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Bj=C3=B6rkstr=C3=B6m?= Date: Sat, 8 Jul 2017 00:04:57 +0300 Subject: [PATCH 04/38] Use Cake Configuration --- src/OmniSharp.Cake/CakeProjectSystem.cs | 21 +++- .../Configuration/CakeConfiguration.cs | 43 +++++++ .../Configuration/ConfigurationTokenStream.cs | 64 ++++++++++ .../Configuration/ICakeConfiguration.cs | 19 +++ .../Configuration/KeyNormalizer.cs | 15 +++ .../Parser/ConfigurationParser.cs | 106 +++++++++++++++++ .../Parser/ConfigurationToken.cs | 19 +++ .../Parser/ConfigurationTokenKind.cs | 13 ++ .../Parser/ConfigurationTokenizer.cs | 111 ++++++++++++++++++ src/OmniSharp.Cake/Constants.cs | 5 + .../Services/CakeGenerationService.cs | 16 ++- .../CakeGenerationServiceToolResolver.cs | 21 ++++ 12 files changed, 445 insertions(+), 8 deletions(-) create mode 100644 src/OmniSharp.Cake/Configuration/CakeConfiguration.cs create mode 100644 src/OmniSharp.Cake/Configuration/ConfigurationTokenStream.cs create mode 100644 src/OmniSharp.Cake/Configuration/ICakeConfiguration.cs create mode 100644 src/OmniSharp.Cake/Configuration/KeyNormalizer.cs create mode 100644 src/OmniSharp.Cake/Configuration/Parser/ConfigurationParser.cs create mode 100644 src/OmniSharp.Cake/Configuration/Parser/ConfigurationToken.cs create mode 100644 src/OmniSharp.Cake/Configuration/Parser/ConfigurationTokenKind.cs create mode 100644 src/OmniSharp.Cake/Configuration/Parser/ConfigurationTokenizer.cs create mode 100644 src/OmniSharp.Cake/Services/CakeGenerationServiceToolResolver.cs diff --git a/src/OmniSharp.Cake/CakeProjectSystem.cs b/src/OmniSharp.Cake/CakeProjectSystem.cs index 2b9547aeb8..f68018e1c8 100644 --- a/src/OmniSharp.Cake/CakeProjectSystem.cs +++ b/src/OmniSharp.Cake/CakeProjectSystem.cs @@ -12,7 +12,9 @@ using Microsoft.CodeAnalysis.Scripting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; +using OmniSharp.Cake.Configuration; using OmniSharp.Cake.Polyfill; +using OmniSharp.Cake.Services; using OmniSharp.Models.WorkspaceInformation; using OmniSharp.Services; @@ -23,8 +25,9 @@ public class CakeProjectSystem : IProjectSystem { private readonly OmniSharpWorkspace _workspace; private readonly IOmniSharpEnvironment _environment; - private readonly ILogger _logger; + private readonly ICakeConfiguration _cakeConfiguration; private readonly IScriptGenerationService _generationService; + private readonly ILogger _logger; private readonly Dictionary _projects; public string Key => "Cake"; @@ -35,13 +38,15 @@ public class CakeProjectSystem : IProjectSystem public CakeProjectSystem( OmniSharpWorkspace workspace, IOmniSharpEnvironment environment, - ILoggerFactory loggerFactory, - IScriptGenerationService generationService) + ICakeConfiguration cakeConfiguration, + IScriptGenerationService generationService, + ILoggerFactory loggerFactory) { _workspace = workspace ?? throw new ArgumentNullException(nameof(workspace)); _environment = environment ?? throw new ArgumentNullException(nameof(environment)); - _logger = loggerFactory?.CreateLogger() ?? throw new ArgumentNullException(nameof(loggerFactory)); + _cakeConfiguration = cakeConfiguration ?? throw new ArgumentNullException(nameof(cakeConfiguration)); _generationService = generationService ?? throw new ArgumentNullException(nameof(generationService)); + _logger = loggerFactory?.CreateLogger() ?? throw new ArgumentNullException(nameof(loggerFactory)); _projects = new Dictionary(); } @@ -60,6 +65,14 @@ public void Initalize(IConfiguration configuration) _logger.LogInformation($"Found {allCakeFiles.Length} Cake files."); + // Check that bakery is installed + var bakeryPath = CakeGenerationServiceToolResolver.GetServerExecutablePath(_environment.TargetDirectory, _cakeConfiguration); + if (!File.Exists(bakeryPath)) + { + _logger.LogError("Cake.Bakery not installed"); + return; + } + foreach (var cakePath in allCakeFiles) { try diff --git a/src/OmniSharp.Cake/Configuration/CakeConfiguration.cs b/src/OmniSharp.Cake/Configuration/CakeConfiguration.cs new file mode 100644 index 0000000000..31bd539478 --- /dev/null +++ b/src/OmniSharp.Cake/Configuration/CakeConfiguration.cs @@ -0,0 +1,43 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; +using System.Composition; +using System.IO; +using OmniSharp.Cake.Configuration.Parser; + +namespace OmniSharp.Cake.Configuration +{ + [Export(typeof(ICakeConfiguration)), Shared] + internal sealed class CakeConfiguration : ICakeConfiguration + { + private readonly Dictionary _lookup; + + [ImportingConstructor] + public CakeConfiguration(IOmniSharpEnvironment environment) + { + _lookup = new Dictionary(StringComparer.OrdinalIgnoreCase); + + // Parse the configuration file. + var configurationPath = Path.Combine(environment.TargetDirectory, "cake.config"); + if (File.Exists(configurationPath)) + { + var parser = new ConfigurationParser(); + var configuration = parser.Read(configurationPath); + foreach (var key in configuration.Keys) + { + _lookup[KeyNormalizer.Normalize(key)] = configuration[key]; + } + } + } + + public string GetValue(string key) + { + key = KeyNormalizer.Normalize(key); + return _lookup.ContainsKey(key) + ? _lookup[key] : null; + } + } +} \ No newline at end of file diff --git a/src/OmniSharp.Cake/Configuration/ConfigurationTokenStream.cs b/src/OmniSharp.Cake/Configuration/ConfigurationTokenStream.cs new file mode 100644 index 0000000000..b7748f0480 --- /dev/null +++ b/src/OmniSharp.Cake/Configuration/ConfigurationTokenStream.cs @@ -0,0 +1,64 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using OmniSharp.Cake.Configuration.Parser; + +namespace OmniSharp.Cake.Configuration +{ + internal sealed class ConfigurationTokenStream : IReadOnlyList + { + private readonly List _tokens; + private int _position; + + public ConfigurationToken Current => _position >= Count ? null : _tokens[_position]; + + public ConfigurationToken this[int index] => _tokens[index]; + + public int Count => _tokens.Count; + + public ConfigurationTokenStream(IEnumerable tokens) + { + _tokens = new List(tokens ?? Enumerable.Empty()); + } + + public ConfigurationToken Peek() + { + return _position >= Count ? null : _tokens[_position]; + } + + public ConfigurationToken Expect(ConfigurationTokenKind tokenType, string message) + { + if (Current == null || Current.Kind != tokenType) + { + throw new InvalidOperationException(message); + } + return Current; + } + + public ConfigurationToken Consume() + { + if (_position >= Count) + { + return null; + } + var token = _tokens[_position]; + _position++; + return token; + } + + public IEnumerator GetEnumerator() + { + return _tokens.GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} \ No newline at end of file diff --git a/src/OmniSharp.Cake/Configuration/ICakeConfiguration.cs b/src/OmniSharp.Cake/Configuration/ICakeConfiguration.cs new file mode 100644 index 0000000000..8e21e942dc --- /dev/null +++ b/src/OmniSharp.Cake/Configuration/ICakeConfiguration.cs @@ -0,0 +1,19 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace OmniSharp.Cake.Configuration +{ + /// + /// Represents the Cake configuration. + /// + public interface ICakeConfiguration + { + /// + /// Gets the value that corresponds to the specified key. + /// + /// The key. + /// The value for the specified key, or null if key doesn't exists. + string GetValue(string key); + } +} \ No newline at end of file diff --git a/src/OmniSharp.Cake/Configuration/KeyNormalizer.cs b/src/OmniSharp.Cake/Configuration/KeyNormalizer.cs new file mode 100644 index 0000000000..11614a9ddb --- /dev/null +++ b/src/OmniSharp.Cake/Configuration/KeyNormalizer.cs @@ -0,0 +1,15 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace OmniSharp.Cake.Configuration +{ + internal static class KeyNormalizer + { + public static string Normalize(string key) + { + key = key.ToUpperInvariant(); + return key.Trim(); + } + } +} \ No newline at end of file diff --git a/src/OmniSharp.Cake/Configuration/Parser/ConfigurationParser.cs b/src/OmniSharp.Cake/Configuration/Parser/ConfigurationParser.cs new file mode 100644 index 0000000000..d8b5020eb6 --- /dev/null +++ b/src/OmniSharp.Cake/Configuration/Parser/ConfigurationParser.cs @@ -0,0 +1,106 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Globalization; +using System.IO; + +namespace OmniSharp.Cake.Configuration.Parser +{ + internal sealed class ConfigurationParser + { + [SuppressMessage("Microsoft.Usage", "CA2202:Do not dispose objects multiple times")] + public IDictionary Read(string path) + { + // Make sure that the configuration file exist. + if (!File.Exists(path)) + { + throw new FileNotFoundException("Unable to find the configuration file.", path); + } + + using (var stream = File.OpenRead(path)) + using (var reader = new StreamReader(stream)) + { + return ReadFileContent(reader.ReadToEnd()); + } + } + + private static IDictionary ReadFileContent(string text) + { + var tokens = ConfigurationTokenizer.Tokenize(text); + var section = string.Empty; + var result = new Dictionary(StringComparer.OrdinalIgnoreCase); + + while (tokens.Current != null) + { + switch (tokens.Current.Kind) + { + case ConfigurationTokenKind.Section: + section = ParseSection(tokens); + break; + case ConfigurationTokenKind.Value: + var pair = ParseKeyAndValue(tokens, section); + result[pair.Key] = pair.Value; + break; + default: + throw new InvalidOperationException("Encountered unexpected token."); + } + } + return result; + } + + private static string ParseSection(ConfigurationTokenStream tokens) + { + var value = tokens.Current.Value; + if (ContainsWhiteSpace(value)) + { + throw new InvalidOperationException("Sections cannot contain whitespace."); + } + tokens.Consume(); + return value; + } + + private static KeyValuePair ParseKeyAndValue(ConfigurationTokenStream tokens, string section) + { + // Get the key. + var key = tokens.Current.Value; + tokens.Consume(); + if (ContainsWhiteSpace(key)) + { + const string message = "The key '{0}' contains whitespace."; + throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, message, key)); + } + + // Expect the equality sign. + tokens.Expect(ConfigurationTokenKind.Equals, "Expected to find '=' token."); + tokens.Consume(); + + // Get the value. + tokens.Expect(ConfigurationTokenKind.Value, "Expected to find value."); + var value = tokens.Current.Value; + tokens.Consume(); + + // Append section to key? + if (!string.IsNullOrWhiteSpace(section)) + { + key = string.Concat(section, "_", key); + } + return new KeyValuePair(key, value); + } + + private static bool ContainsWhiteSpace(string text) + { + foreach (var character in text) + { + if (char.IsWhiteSpace(character)) + { + return true; + } + } + return false; + } + } +} \ No newline at end of file diff --git a/src/OmniSharp.Cake/Configuration/Parser/ConfigurationToken.cs b/src/OmniSharp.Cake/Configuration/Parser/ConfigurationToken.cs new file mode 100644 index 0000000000..006c76296e --- /dev/null +++ b/src/OmniSharp.Cake/Configuration/Parser/ConfigurationToken.cs @@ -0,0 +1,19 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace OmniSharp.Cake.Configuration.Parser +{ + internal sealed class ConfigurationToken + { + public ConfigurationTokenKind Kind { get; } + + public string Value { get; } + + public ConfigurationToken(ConfigurationTokenKind kind, string value) + { + Kind = kind; + Value = value; + } + } +} \ No newline at end of file diff --git a/src/OmniSharp.Cake/Configuration/Parser/ConfigurationTokenKind.cs b/src/OmniSharp.Cake/Configuration/Parser/ConfigurationTokenKind.cs new file mode 100644 index 0000000000..fde1c0b976 --- /dev/null +++ b/src/OmniSharp.Cake/Configuration/Parser/ConfigurationTokenKind.cs @@ -0,0 +1,13 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace OmniSharp.Cake.Configuration.Parser +{ + internal enum ConfigurationTokenKind + { + Section, + Value, + Equals + } +} \ No newline at end of file diff --git a/src/OmniSharp.Cake/Configuration/Parser/ConfigurationTokenizer.cs b/src/OmniSharp.Cake/Configuration/Parser/ConfigurationTokenizer.cs new file mode 100644 index 0000000000..443b81537b --- /dev/null +++ b/src/OmniSharp.Cake/Configuration/Parser/ConfigurationTokenizer.cs @@ -0,0 +1,111 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; + +namespace OmniSharp.Cake.Configuration.Parser +{ + internal static class ConfigurationTokenizer + { + public static ConfigurationTokenStream Tokenize(string text) + { + var result = new List(); + var reader = new StringReader(text); + while (reader.Peek() != -1) + { + var token = Tokenize(reader); + if (token != null) + { + result.Add(token); + } + } + return new ConfigurationTokenStream(result); + } + + private static ConfigurationToken Tokenize(StringReader reader) + { + EatWhitespace(reader); + if (reader.Peek() == -1) + { + return null; + } + + var character = (char)reader.Peek(); + switch (character) + { + case ';': + reader.Read(); + SkipComment(reader); + return null; + case '[': + reader.Read(); + return ReadSection(reader); + case '=': + reader.Read(); + return new ConfigurationToken(ConfigurationTokenKind.Equals, "="); + } + + return ReadValue(reader); + } + + private static void EatWhitespace(TextReader reader) + { + int ch; + while ((ch = reader.Peek()) != -1) + { + if (!char.IsWhiteSpace((char)ch)) + { + break; + } + reader.Read(); + } + } + + private static void SkipComment(StringReader reader) + { + while (reader.Peek() != -1) + { + var token = (char)reader.Read(); + if (token == '\n' || token == '\r') + { + break; + } + } + } + + private static ConfigurationToken ReadSection(StringReader reader) + { + var accumulator = new StringBuilder(); + while (reader.Peek() != -1) + { + var character = (char)reader.Read(); + if (character == ']') + { + return new ConfigurationToken(ConfigurationTokenKind.Section, accumulator.ToString()); + } + accumulator.Append(character); + } + throw new InvalidOperationException("Encountered malformed section."); + } + + private static ConfigurationToken ReadValue(StringReader reader) + { + var accumulator = new StringBuilder(); + while (reader.Peek() != -1) + { + var character = (char)reader.Peek(); + if (character == '=' || character == '\n' || character == '\r') + { + break; + } + reader.Read(); + accumulator.Append(character); + } + return new ConfigurationToken(ConfigurationTokenKind.Value, accumulator.ToString()); + } + } +} \ No newline at end of file diff --git a/src/OmniSharp.Cake/Constants.cs b/src/OmniSharp.Cake/Constants.cs index 3c2cc1c55d..a5ec4fc44d 100644 --- a/src/OmniSharp.Cake/Constants.cs +++ b/src/OmniSharp.Cake/Constants.cs @@ -6,5 +6,10 @@ public static class LanguageNames { public const string Cake = "Cake"; } + + public static class Paths + { + public const string Tools = "Paths_Tools"; + } } } diff --git a/src/OmniSharp.Cake/Services/CakeGenerationService.cs b/src/OmniSharp.Cake/Services/CakeGenerationService.cs index a636366801..868521940c 100644 --- a/src/OmniSharp.Cake/Services/CakeGenerationService.cs +++ b/src/OmniSharp.Cake/Services/CakeGenerationService.cs @@ -5,6 +5,7 @@ using Cake.Scripting.Abstractions.Models; using Cake.Scripting.Transport.Tcp.Client; using Microsoft.Extensions.Logging; +using OmniSharp.Cake.Configuration; namespace OmniSharp.Cake.Services { @@ -14,20 +15,27 @@ public class CakeGenerationService : IScriptGenerationService private readonly IScriptGenerationService _generationService; [ImportingConstructor] - public CakeGenerationService(IOmniSharpEnvironment environment, ILoggerFactory loggerFactory) + public CakeGenerationService(IOmniSharpEnvironment environment, ICakeConfiguration configuration, ILoggerFactory loggerFactory) { if (environment == null) { throw new ArgumentNullException(nameof(environment)); } + if (configuration == null) + { + throw new ArgumentNullException(nameof(configuration)); + } if (loggerFactory == null) { throw new ArgumentNullException(nameof(loggerFactory)); } - // TODO: Read from cake configuration, don't assume Bakery is in tools folder - var bakeryExe = Path.Combine(environment.TargetDirectory, "tools", "Cake.Bakery", "tools", "Cake.Bakery.exe"); - _generationService = new ScriptGenerationClient(bakeryExe, environment.TargetDirectory, loggerFactory); + var serverExecutablePath = CakeGenerationServiceToolResolver.GetServerExecutablePath(environment.TargetDirectory, configuration); + + if (File.Exists(serverExecutablePath)) + { + _generationService = new ScriptGenerationClient(serverExecutablePath, environment.TargetDirectory, loggerFactory); + } } public CakeScript Generate(FileChange fileChange) diff --git a/src/OmniSharp.Cake/Services/CakeGenerationServiceToolResolver.cs b/src/OmniSharp.Cake/Services/CakeGenerationServiceToolResolver.cs new file mode 100644 index 0000000000..50c49ef5ef --- /dev/null +++ b/src/OmniSharp.Cake/Services/CakeGenerationServiceToolResolver.cs @@ -0,0 +1,21 @@ +using System.IO; +using OmniSharp.Cake.Configuration; + +namespace OmniSharp.Cake.Services +{ + internal static class CakeGenerationServiceToolResolver + { + public static string GetServerExecutablePath(string rootPath, ICakeConfiguration configuration) + { + var toolPath = GetToolPath(rootPath, configuration); + + return Path.Combine(toolPath, "Cake.Bakery", "tools", "Cake.Bakery.exe"); + } + + private static string GetToolPath(string rootPath, ICakeConfiguration configuration) + { + var toolPath = configuration.GetValue(Constants.Paths.Tools); + return Path.Combine(rootPath, !string.IsNullOrWhiteSpace(toolPath) ? toolPath : "tools"); + } + } +} From 3fec51321e7a15680fcf0e51e1aad2389a974c38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Bj=C3=B6rkstr=C3=B6m?= Date: Fri, 14 Jul 2017 15:14:01 +0300 Subject: [PATCH 05/38] Adds Buffer handlers for Cake --- src/OmniSharp.Cake/CakeProjectSystem.cs | 4 +- .../Extensions/RequestExtensions.cs | 23 +++++ .../Extensions/ResponseExtensions.cs | 97 +++++++++++++++++++ src/OmniSharp.Cake/OmniSharp.Cake.csproj | 3 +- .../Services/Buffer/ChangeBufferHandler.cs | 55 +++++++++++ .../Services/Buffer/UpdateBufferHandler.cs | 72 ++++++++++++++ .../Services/CakeRequestHandler.cs | 79 +++++++++++++++ .../CakeGenerationTool.cs} | 9 +- .../CakeGenerationToolResolver.cs} | 4 +- .../Utilities/LineOffsetHelper.cs | 31 ++++++ 10 files changed, 367 insertions(+), 10 deletions(-) create mode 100644 src/OmniSharp.Cake/Extensions/RequestExtensions.cs create mode 100644 src/OmniSharp.Cake/Extensions/ResponseExtensions.cs create mode 100644 src/OmniSharp.Cake/Services/Buffer/ChangeBufferHandler.cs create mode 100644 src/OmniSharp.Cake/Services/Buffer/UpdateBufferHandler.cs create mode 100644 src/OmniSharp.Cake/Services/CakeRequestHandler.cs rename src/OmniSharp.Cake/{Services/CakeGenerationService.cs => Tools/CakeGenerationTool.cs} (74%) rename src/OmniSharp.Cake/{Services/CakeGenerationServiceToolResolver.cs => Tools/CakeGenerationToolResolver.cs} (87%) create mode 100644 src/OmniSharp.Cake/Utilities/LineOffsetHelper.cs diff --git a/src/OmniSharp.Cake/CakeProjectSystem.cs b/src/OmniSharp.Cake/CakeProjectSystem.cs index f68018e1c8..be571e5065 100644 --- a/src/OmniSharp.Cake/CakeProjectSystem.cs +++ b/src/OmniSharp.Cake/CakeProjectSystem.cs @@ -66,7 +66,7 @@ public void Initalize(IConfiguration configuration) _logger.LogInformation($"Found {allCakeFiles.Length} Cake files."); // Check that bakery is installed - var bakeryPath = CakeGenerationServiceToolResolver.GetServerExecutablePath(_environment.TargetDirectory, _cakeConfiguration); + var bakeryPath = CakeGenerationToolResolver.GetServerExecutablePath(_environment.TargetDirectory, _cakeConfiguration); if (!File.Exists(bakeryPath)) { _logger.LogError("Cake.Bakery not installed"); @@ -138,7 +138,7 @@ private ProjectInfo GetProject(CakeScript cakeScript, string filePath) hostObjectType: Type.GetType(cakeScript.Host.TypeName)); } - private CompilationOptions GetCompilationOptions(ISet usings) + private static CompilationOptions GetCompilationOptions(IEnumerable usings) { var compilationOptions = new CSharpCompilationOptions( OutputKind.DynamicallyLinkedLibrary, diff --git a/src/OmniSharp.Cake/Extensions/RequestExtensions.cs b/src/OmniSharp.Cake/Extensions/RequestExtensions.cs new file mode 100644 index 0000000000..1aa99887e4 --- /dev/null +++ b/src/OmniSharp.Cake/Extensions/RequestExtensions.cs @@ -0,0 +1,23 @@ +using System.Threading.Tasks; +using OmniSharp.Cake.Utilities; +using OmniSharp.Models; + +namespace OmniSharp.Cake.Extensions +{ + internal static class RequestExtensions + { + public static async Task TranslateAsync(this TRequest request, OmniSharpWorkspace workspace) where TRequest : Request + { + var offset = await GetOffset(request.FileName, workspace); + + request.Line += offset; + + return request; + } + + private static async Task GetOffset(string fileName, OmniSharpWorkspace workspace) + { + return await LineOffsetHelper.GetOffset(fileName, workspace) + 1; + } + } +} diff --git a/src/OmniSharp.Cake/Extensions/ResponseExtensions.cs b/src/OmniSharp.Cake/Extensions/ResponseExtensions.cs new file mode 100644 index 0000000000..0b3f5ac8e7 --- /dev/null +++ b/src/OmniSharp.Cake/Extensions/ResponseExtensions.cs @@ -0,0 +1,97 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using OmniSharp.Cake.Utilities; +using OmniSharp.Models; +using OmniSharp.Models.GotoDefinition; +using OmniSharp.Models.Navigate; +using OmniSharp.Models.MembersTree; + +namespace OmniSharp.Cake.Extensions +{ + internal static class ResponseExtensions + { + public static Task TranslateAsync(this QuickFixResponse response, OmniSharpWorkspace workspace) + { + return response.TranslateAsync(workspace, new Request()); + } + + public static async Task TranslateAsync(this QuickFixResponse response, OmniSharpWorkspace workspace, Request request) + { + var offsets = new Dictionary(); + + foreach (var quickFix in response.QuickFixes) + { + await quickFix.TranslateAsync(workspace, request, offsets); + } + + return response; + } + + public static async Task TranslateAsync(this GotoDefinitionResponse response, OmniSharpWorkspace workspace) + { + var offset = await GetOffset(response.FileName, workspace); + + response.Line -= offset; + + return response; + } + + public static async Task TranslateAsync(this NavigateResponse response, OmniSharpWorkspace workspace, Request request) + { + var offset = await GetOffset(request.FileName, workspace); + + response.Line -= offset; + + return response; + } + + public static async Task TranslateAsync(this FileMemberTree response, OmniSharpWorkspace workspace, Request request) + { + var offsets = new Dictionary(); + + foreach (var topLevelTypeDefinition in response.TopLevelTypeDefinitions) + { + await topLevelTypeDefinition.TranslateAsync(workspace, request, offsets); + } + + return response; + } + + private static async Task TranslateAsync(this FileMemberElement element, OmniSharpWorkspace workspace, Request request, IDictionary offsets) + { + element.Location = await element.Location.TranslateAsync(workspace, request, offsets); + + foreach (var childNode in element.ChildNodes) + { + await childNode.TranslateAsync(workspace, request, offsets); + } + + return element; + } + + private static async Task TranslateAsync(this QuickFix quickFix, OmniSharpWorkspace workspace, Request request, IDictionary offsets) + { + var fileName = !string.IsNullOrEmpty(quickFix.FileName) ? quickFix.FileName : request.FileName; + + if (string.IsNullOrEmpty(fileName)) + { + return quickFix; + } + + if (!offsets.ContainsKey(fileName)) + { + offsets[fileName] = await GetOffset(fileName, workspace); + } + + quickFix.Line -= offsets[fileName]; + quickFix.EndLine -= offsets[fileName]; + + return quickFix; + } + + private static async Task GetOffset(string fileName, OmniSharpWorkspace workspace) + { + return await LineOffsetHelper.GetOffset(fileName, workspace) + 1; + } + } +} diff --git a/src/OmniSharp.Cake/OmniSharp.Cake.csproj b/src/OmniSharp.Cake/OmniSharp.Cake.csproj index a0325bd427..f3bf71bd04 100644 --- a/src/OmniSharp.Cake/OmniSharp.Cake.csproj +++ b/src/OmniSharp.Cake/OmniSharp.Cake.csproj @@ -17,8 +17,7 @@ - - + diff --git a/src/OmniSharp.Cake/Services/Buffer/ChangeBufferHandler.cs b/src/OmniSharp.Cake/Services/Buffer/ChangeBufferHandler.cs new file mode 100644 index 0000000000..9477f80039 --- /dev/null +++ b/src/OmniSharp.Cake/Services/Buffer/ChangeBufferHandler.cs @@ -0,0 +1,55 @@ +using System.Composition; +using System.Threading.Tasks; +using Cake.Scripting.Abstractions; +using Cake.Scripting.Abstractions.Models; +using OmniSharp.Mef; +using OmniSharp.Models.ChangeBuffer; +using OmniSharp.Models.UpdateBuffer; + +namespace OmniSharp.Cake.Services.Buffer +{ + [OmniSharpHandler(OmniSharpEndpoints.ChangeBuffer, Constants.LanguageNames.Cake)] + public class ChangeBufferHandler : IRequestHandler + { + private readonly OmniSharpWorkspace _workspace; + private readonly IScriptGenerationService _generationService; + + [ImportingConstructor] + public ChangeBufferHandler( + OmniSharpWorkspace workspace, + IScriptGenerationService generationService) + { + _workspace = workspace; + _generationService = generationService; + } + + public async Task Handle(ChangeBufferRequest request) + { + if (request.FileName == null) + { + return true; + } + + var script = _generationService.Generate(new FileChange + { + FileName = request.FileName, + LineChanges = { new LineChange + { + StartLine = request.StartLine, + StartColumn = request.StartColumn, + EndLine = request.EndLine, + EndColumn = request.EndColumn, + NewText = request.NewText + }} + }); + + // Redirect to UpdateBuffer + await _workspace.BufferManager.UpdateBufferAsync(new UpdateBufferRequest + { + Buffer = script.Source, + FileName = request.FileName + }); + return true; + } + } +} diff --git a/src/OmniSharp.Cake/Services/Buffer/UpdateBufferHandler.cs b/src/OmniSharp.Cake/Services/Buffer/UpdateBufferHandler.cs new file mode 100644 index 0000000000..3f28feb590 --- /dev/null +++ b/src/OmniSharp.Cake/Services/Buffer/UpdateBufferHandler.cs @@ -0,0 +1,72 @@ +using System.Composition; +using System.Linq; +using System.Threading.Tasks; +using OmniSharp.Mef; +using OmniSharp.Models; +using OmniSharp; +using Cake.OmniSharp.IO; +using Cake.OmniSharp.Scripting; +using Cake.Scripting.Abstractions; +using Cake.Scripting.Abstractions.Models; +using OmniSharp.Models.UpdateBuffer; + +namespace OmniSharp.Cake.Services.Buffer +{ + [OmniSharpHandler(OmniSharpEndpoints.UpdateBuffer, Constants.LanguageNames.Cake)] + public class UpdateBufferHandler : IRequestHandler + { + private readonly OmniSharpWorkspace _workspace; + private readonly IScriptGenerationService _generationService; + + [ImportingConstructor] + public UpdateBufferHandler( + OmniSharpWorkspace workspace, + IScriptGenerationService generationService) + { + _workspace = workspace; + _generationService = generationService; + } + + public async Task Handle(UpdateBufferRequest request) + { + if (request.FileName == null) + { + return true; + } + + var fileChange = new FileChange + { + FileName = request.FileName + }; + + if(request.Changes != null) + { + foreach(var change in request.Changes) + { + fileChange.LineChanges.Add(new LineChange + { + StartLine = change.StartLine, + StartColumn = change.StartColumn, + EndLine = change.EndLine, + EndColumn = change.EndColumn, + NewText = change.NewText + }); + } + } + else + { + fileChange.Buffer = request.Buffer; + fileChange.FromDisk = request.FromDisk; + } + var script = _generationService.Generate(fileChange); + + // Avoid having buffer manager reading from disk + request.FromDisk = false; + request.Buffer = script.Source; + request.Changes = null; + + await _workspace.BufferManager.UpdateBufferAsync(request); + return true; + } + } +} diff --git a/src/OmniSharp.Cake/Services/CakeRequestHandler.cs b/src/OmniSharp.Cake/Services/CakeRequestHandler.cs new file mode 100644 index 0000000000..5d92ce5fe0 --- /dev/null +++ b/src/OmniSharp.Cake/Services/CakeRequestHandler.cs @@ -0,0 +1,79 @@ +using System; +using System.Collections.Generic; +using System.Composition; +using System.Linq; +using System.Reflection; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis; +using OmniSharp.Cake.Extensions; +using OmniSharp.Mef; +using OmniSharp.Models; + +namespace OmniSharp.Cake.Services +{ + public abstract class CakeRequestHandler : IRequestHandler + { + private string _endpointName; + public string EndpointName + { + get + { + if(string.IsNullOrEmpty(_endpointName)) + { + _endpointName = GetType().GetTypeInfo().GetCustomAttribute()?.EndpointName; + } + + return _endpointName; + } + } + + [ImportMany] + public IEnumerable> Handlers { get; set; } + public OmniSharpWorkspace Workspace { get; } + public Lazy> Service { get; } + + protected CakeRequestHandler(OmniSharpWorkspace workspace) + { + Workspace = workspace; + Service = new Lazy>(() => + { + return Handlers.FirstOrDefault(s => + s.Metadata.EndpointName.Equals(EndpointName, StringComparison.Ordinal) && + s.Metadata.Language.Equals(LanguageNames.CSharp, StringComparison.Ordinal))?.Value + as IRequestHandler; + }); + } + + public virtual async Task Handle(TRequest request) + { + var service = Service.Value; + if(service == null) + { + throw new NotSupportedException(); + } + + request = await TranslateRequestAsync(request); + + var response = await service.Handle(request); + + return await TranslateResponse(response, request); + } + + protected virtual async Task TranslateRequestAsync(TRequest req) + { + var request = req as Request; + + if (request != null) + { + await request.TranslateAsync(Workspace); + } + + return req; + } + + protected virtual Task TranslateResponse(TResponse response, TRequest request) + { + return Task.FromResult(response); + } + } +} diff --git a/src/OmniSharp.Cake/Services/CakeGenerationService.cs b/src/OmniSharp.Cake/Tools/CakeGenerationTool.cs similarity index 74% rename from src/OmniSharp.Cake/Services/CakeGenerationService.cs rename to src/OmniSharp.Cake/Tools/CakeGenerationTool.cs index 868521940c..506e705d1b 100644 --- a/src/OmniSharp.Cake/Services/CakeGenerationService.cs +++ b/src/OmniSharp.Cake/Tools/CakeGenerationTool.cs @@ -7,15 +7,15 @@ using Microsoft.Extensions.Logging; using OmniSharp.Cake.Configuration; -namespace OmniSharp.Cake.Services +namespace OmniSharp.Cake.Tools { [Export(typeof(IScriptGenerationService)), Shared] - public class CakeGenerationService : IScriptGenerationService + public class CakeGenerationTool : IScriptGenerationService { private readonly IScriptGenerationService _generationService; [ImportingConstructor] - public CakeGenerationService(IOmniSharpEnvironment environment, ICakeConfiguration configuration, ILoggerFactory loggerFactory) + public CakeGenerationTool(IOmniSharpEnvironment environment, ICakeConfiguration configuration, ILoggerFactory loggerFactory) { if (environment == null) { @@ -30,7 +30,8 @@ public CakeGenerationService(IOmniSharpEnvironment environment, ICakeConfigurati throw new ArgumentNullException(nameof(loggerFactory)); } - var serverExecutablePath = CakeGenerationServiceToolResolver.GetServerExecutablePath(environment.TargetDirectory, configuration); + // TODO: Not like this... I think... + var serverExecutablePath = CakeGenerationToolResolver.GetServerExecutablePath(environment.TargetDirectory, configuration); if (File.Exists(serverExecutablePath)) { diff --git a/src/OmniSharp.Cake/Services/CakeGenerationServiceToolResolver.cs b/src/OmniSharp.Cake/Tools/CakeGenerationToolResolver.cs similarity index 87% rename from src/OmniSharp.Cake/Services/CakeGenerationServiceToolResolver.cs rename to src/OmniSharp.Cake/Tools/CakeGenerationToolResolver.cs index 50c49ef5ef..56e815c635 100644 --- a/src/OmniSharp.Cake/Services/CakeGenerationServiceToolResolver.cs +++ b/src/OmniSharp.Cake/Tools/CakeGenerationToolResolver.cs @@ -1,9 +1,9 @@ using System.IO; using OmniSharp.Cake.Configuration; -namespace OmniSharp.Cake.Services +namespace OmniSharp.Cake.Tools { - internal static class CakeGenerationServiceToolResolver + internal static class CakeGenerationToolResolver { public static string GetServerExecutablePath(string rootPath, ICakeConfiguration configuration) { diff --git a/src/OmniSharp.Cake/Utilities/LineOffsetHelper.cs b/src/OmniSharp.Cake/Utilities/LineOffsetHelper.cs new file mode 100644 index 0000000000..46e6549801 --- /dev/null +++ b/src/OmniSharp.Cake/Utilities/LineOffsetHelper.cs @@ -0,0 +1,31 @@ +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using OmniSharp; + +namespace OmniSharp.Cake.Utilities +{ + internal static class LineOffsetHelper + { + public static async Task GetOffset(string fileName, OmniSharpWorkspace workspace) + { + if (string.IsNullOrEmpty(fileName)) + { + return 0; + } + + var document = workspace.GetDocument(fileName); + if (document == null) + { + return 0; + } + + var fullPath = Path.GetFullPath(fileName).Replace('\\','/'); + var sourceText = await document.GetTextAsync(); + + var offset = sourceText.Lines.FirstOrDefault(line => line.ToString().Equals($"#line 1 \"{fullPath}\"")).LineNumber; + + return offset; + } + } +} From 36357718c76d1206c826c4c944436a127f59d791 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Bj=C3=B6rkstr=C3=B6m?= Date: Fri, 14 Jul 2017 23:21:34 +0300 Subject: [PATCH 06/38] Added more services --- .../CachingScriptMetadataResolver.cs | 12 +++--- src/OmniSharp.Cake/CakeProjectSystem.cs | 2 +- .../Services/Buffer/UpdateBufferHandler.cs | 5 --- .../Services/Diagnostics/CodeCheckHandler.cs | 18 +++++++++ .../Intellisense/AutoCompleteHandler.cs | 17 +++++++++ .../Navigation/FindImplementationsHandler.cs | 24 ++++++++++++ .../Services/Navigation/FindSymbolsHandler.cs | 24 ++++++++++++ .../Services/Navigation/FindUsagesHandler.cs | 25 ++++++++++++ .../Navigation/GotoDefinitionHandler.cs | 24 ++++++++++++ .../Services/Navigation/GotoFileHandler.cs | 25 ++++++++++++ .../Services/Navigation/GotoRegionHandler.cs | 23 +++++++++++ .../Services/Navigation/MetadataHandler.cs | 16 ++++++++ .../Services/Navigation/NavigationHandler.cs | 38 +++++++++++++++++++ .../Refactoring/V2/GetCodeActionsHandler.cs | 17 +++++++++ .../Signatures/SignatureHelpHandler.cs | 15 ++++++++ .../Structure/MembersAsTreeHandler.cs | 24 ++++++++++++ .../Services/Types/TypeLookupHandler.cs | 15 ++++++++ .../Utilities/LineOffsetHelper.cs | 1 - 18 files changed, 312 insertions(+), 13 deletions(-) create mode 100644 src/OmniSharp.Cake/Services/Diagnostics/CodeCheckHandler.cs create mode 100644 src/OmniSharp.Cake/Services/Intellisense/AutoCompleteHandler.cs create mode 100644 src/OmniSharp.Cake/Services/Navigation/FindImplementationsHandler.cs create mode 100644 src/OmniSharp.Cake/Services/Navigation/FindSymbolsHandler.cs create mode 100644 src/OmniSharp.Cake/Services/Navigation/FindUsagesHandler.cs create mode 100644 src/OmniSharp.Cake/Services/Navigation/GotoDefinitionHandler.cs create mode 100644 src/OmniSharp.Cake/Services/Navigation/GotoFileHandler.cs create mode 100644 src/OmniSharp.Cake/Services/Navigation/GotoRegionHandler.cs create mode 100644 src/OmniSharp.Cake/Services/Navigation/MetadataHandler.cs create mode 100644 src/OmniSharp.Cake/Services/Navigation/NavigationHandler.cs create mode 100644 src/OmniSharp.Cake/Services/Refactoring/V2/GetCodeActionsHandler.cs create mode 100644 src/OmniSharp.Cake/Services/Signatures/SignatureHelpHandler.cs create mode 100644 src/OmniSharp.Cake/Services/Structure/MembersAsTreeHandler.cs create mode 100644 src/OmniSharp.Cake/Services/Types/TypeLookupHandler.cs diff --git a/src/OmniSharp.Cake/CachingScriptMetadataResolver.cs b/src/OmniSharp.Cake/CachingScriptMetadataResolver.cs index dee0a21fb4..b282e33a0e 100644 --- a/src/OmniSharp.Cake/CachingScriptMetadataResolver.cs +++ b/src/OmniSharp.Cake/CachingScriptMetadataResolver.cs @@ -9,19 +9,19 @@ internal class CachingScriptMetadataResolver : MetadataReferenceResolver { private static readonly Dictionary> DirectReferenceCache = new Dictionary>(); private static readonly Dictionary MissingReferenceCache = new Dictionary(); - private static readonly MetadataReferenceResolver _defaultRuntimeResolver = ScriptMetadataResolver.Default; + private static readonly MetadataReferenceResolver DefaultRuntimeResolver = ScriptMetadataResolver.Default; public override bool Equals(object other) { - return _defaultRuntimeResolver.Equals(other); + return DefaultRuntimeResolver.Equals(other); } public override int GetHashCode() { - return _defaultRuntimeResolver.GetHashCode(); + return DefaultRuntimeResolver.GetHashCode(); } - public override bool ResolveMissingAssemblies => _defaultRuntimeResolver.ResolveMissingAssemblies; + public override bool ResolveMissingAssemblies => DefaultRuntimeResolver.ResolveMissingAssemblies; public override PortableExecutableReference ResolveMissingAssembly(MetadataReference definition, AssemblyIdentity referenceIdentity) { @@ -30,7 +30,7 @@ public override PortableExecutableReference ResolveMissingAssembly(MetadataRefer return MissingReferenceCache[referenceIdentity.Name]; } - var result = _defaultRuntimeResolver.ResolveMissingAssembly(definition, referenceIdentity); + var result = DefaultRuntimeResolver.ResolveMissingAssembly(definition, referenceIdentity); if (result != null) { MissingReferenceCache[referenceIdentity.Name] = result; @@ -47,7 +47,7 @@ public override ImmutableArray ResolveReference(str return DirectReferenceCache[key]; } - var result = _defaultRuntimeResolver.ResolveReference(reference, baseFilePath, properties); + var result = DefaultRuntimeResolver.ResolveReference(reference, baseFilePath, properties); if (result.Length > 0) { DirectReferenceCache[key] = result; diff --git a/src/OmniSharp.Cake/CakeProjectSystem.cs b/src/OmniSharp.Cake/CakeProjectSystem.cs index be571e5065..877a92251a 100644 --- a/src/OmniSharp.Cake/CakeProjectSystem.cs +++ b/src/OmniSharp.Cake/CakeProjectSystem.cs @@ -14,7 +14,7 @@ using Microsoft.Extensions.Logging; using OmniSharp.Cake.Configuration; using OmniSharp.Cake.Polyfill; -using OmniSharp.Cake.Services; +using OmniSharp.Cake.Tools; using OmniSharp.Models.WorkspaceInformation; using OmniSharp.Services; diff --git a/src/OmniSharp.Cake/Services/Buffer/UpdateBufferHandler.cs b/src/OmniSharp.Cake/Services/Buffer/UpdateBufferHandler.cs index 3f28feb590..a14012dad9 100644 --- a/src/OmniSharp.Cake/Services/Buffer/UpdateBufferHandler.cs +++ b/src/OmniSharp.Cake/Services/Buffer/UpdateBufferHandler.cs @@ -1,11 +1,6 @@ using System.Composition; -using System.Linq; using System.Threading.Tasks; using OmniSharp.Mef; -using OmniSharp.Models; -using OmniSharp; -using Cake.OmniSharp.IO; -using Cake.OmniSharp.Scripting; using Cake.Scripting.Abstractions; using Cake.Scripting.Abstractions.Models; using OmniSharp.Models.UpdateBuffer; diff --git a/src/OmniSharp.Cake/Services/Diagnostics/CodeCheckHandler.cs b/src/OmniSharp.Cake/Services/Diagnostics/CodeCheckHandler.cs new file mode 100644 index 0000000000..2e094087bd --- /dev/null +++ b/src/OmniSharp.Cake/Services/Diagnostics/CodeCheckHandler.cs @@ -0,0 +1,18 @@ +using OmniSharp.Mef; +using OmniSharp.Models; +using System.Composition; +using OmniSharp.Models.CodeCheck; + +namespace OmniSharp.Cake.Services.Diagnostics +{ + [OmniSharpHandler(OmniSharpEndpoints.CodeCheck, Constants.LanguageNames.Cake), Shared] + public class CodeCheckHandler : CakeRequestHandler + { + [ImportingConstructor] + public CodeCheckHandler( + OmniSharpWorkspace workspace) + : base(workspace) + { + } + } +} diff --git a/src/OmniSharp.Cake/Services/Intellisense/AutoCompleteHandler.cs b/src/OmniSharp.Cake/Services/Intellisense/AutoCompleteHandler.cs new file mode 100644 index 0000000000..5d3ef45096 --- /dev/null +++ b/src/OmniSharp.Cake/Services/Intellisense/AutoCompleteHandler.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; +using System.Composition; +using OmniSharp.Mef; +using OmniSharp.Models.AutoComplete; + +namespace OmniSharp.Cake.Services.Intellisense +{ + [OmniSharpHandler(OmniSharpEndpoints.AutoComplete, Constants.LanguageNames.Cake), Shared] + public class AutoCompleteHandler : CakeRequestHandler> + { + [ImportingConstructor] + public AutoCompleteHandler(OmniSharpWorkspace workspace) + : base(workspace) + { + } + } +} diff --git a/src/OmniSharp.Cake/Services/Navigation/FindImplementationsHandler.cs b/src/OmniSharp.Cake/Services/Navigation/FindImplementationsHandler.cs new file mode 100644 index 0000000000..2b0b495148 --- /dev/null +++ b/src/OmniSharp.Cake/Services/Navigation/FindImplementationsHandler.cs @@ -0,0 +1,24 @@ +using System.Composition; +using System.Threading.Tasks; +using OmniSharp.Mef; +using OmniSharp.Models; +using OmniSharp.Cake.Extensions; +using OmniSharp.Models.FindImplementations; + +namespace OmniSharp.Cake.Services.Navigation +{ + [OmniSharpHandler(OmniSharpEndpoints.FindImplementations, Constants.LanguageNames.Cake), Shared] + public class FindImplementationsHandler : CakeRequestHandler + { + [ImportingConstructor] + public FindImplementationsHandler(OmniSharpWorkspace workspace) + : base(workspace) + { + } + + protected override Task TranslateResponse(QuickFixResponse response, FindImplementationsRequest request) + { + return response.TranslateAsync(Workspace, request); + } + } +} diff --git a/src/OmniSharp.Cake/Services/Navigation/FindSymbolsHandler.cs b/src/OmniSharp.Cake/Services/Navigation/FindSymbolsHandler.cs new file mode 100644 index 0000000000..1e34ff034e --- /dev/null +++ b/src/OmniSharp.Cake/Services/Navigation/FindSymbolsHandler.cs @@ -0,0 +1,24 @@ +using System.Composition; +using System.Threading.Tasks; +using OmniSharp.Mef; +using OmniSharp.Models; +using OmniSharp.Cake.Extensions; +using OmniSharp.Models.FindSymbols; + +namespace OmniSharp.Cake.Services.Navigation +{ + [OmniSharpHandler(OmniSharpEndpoints.FindSymbols, Constants.LanguageNames.Cake), Shared] + public class FindSymbolsHandler : CakeRequestHandler + { + [ImportingConstructor] + public FindSymbolsHandler(OmniSharpWorkspace workspace) + : base(workspace) + { + } + + protected override Task TranslateResponse(QuickFixResponse response, FindSymbolsRequest request) + { + return response.TranslateAsync(Workspace); + } + } +} diff --git a/src/OmniSharp.Cake/Services/Navigation/FindUsagesHandler.cs b/src/OmniSharp.Cake/Services/Navigation/FindUsagesHandler.cs new file mode 100644 index 0000000000..017b5d0cf5 --- /dev/null +++ b/src/OmniSharp.Cake/Services/Navigation/FindUsagesHandler.cs @@ -0,0 +1,25 @@ +using System.Composition; +using System.Threading.Tasks; +using OmniSharp.Mef; +using OmniSharp.Models; +using OmniSharp.Cake.Extensions; +using OmniSharp.Models.FindUsages; + +namespace OmniSharp.Cake.Services.Navigation +{ + [OmniSharpHandler(OmniSharpEndpoints.FindUsages, Constants.LanguageNames.Cake), Shared] + public class FindUsagesHandler : CakeRequestHandler + { + [ImportingConstructor] + public FindUsagesHandler( + OmniSharpWorkspace workspace) + : base(workspace) + { + } + + protected override Task TranslateResponse(QuickFixResponse response, FindUsagesRequest request) + { + return response.TranslateAsync(Workspace, request); + } + } +} diff --git a/src/OmniSharp.Cake/Services/Navigation/GotoDefinitionHandler.cs b/src/OmniSharp.Cake/Services/Navigation/GotoDefinitionHandler.cs new file mode 100644 index 0000000000..ae00703881 --- /dev/null +++ b/src/OmniSharp.Cake/Services/Navigation/GotoDefinitionHandler.cs @@ -0,0 +1,24 @@ +using System.Composition; +using System.Threading.Tasks; +using OmniSharp.Mef; +using OmniSharp.Cake.Extensions; +using OmniSharp.Models.GotoDefinition; + +namespace OmniSharp.Cake.Services.Navigation +{ + [OmniSharpHandler(OmniSharpEndpoints.GotoDefinition, Constants.LanguageNames.Cake), Shared] + public class GotoDefinitionHandler : CakeRequestHandler + { + [ImportingConstructor] + public GotoDefinitionHandler( + OmniSharpWorkspace workspace) + : base(workspace) + { + } + + protected override Task TranslateResponse(GotoDefinitionResponse response, GotoDefinitionRequest request) + { + return response.TranslateAsync(Workspace); + } + } +} \ No newline at end of file diff --git a/src/OmniSharp.Cake/Services/Navigation/GotoFileHandler.cs b/src/OmniSharp.Cake/Services/Navigation/GotoFileHandler.cs new file mode 100644 index 0000000000..eb7726a424 --- /dev/null +++ b/src/OmniSharp.Cake/Services/Navigation/GotoFileHandler.cs @@ -0,0 +1,25 @@ +using System.Composition; +using System.Threading.Tasks; +using OmniSharp.Mef; +using OmniSharp.Models; +using OmniSharp.Cake.Extensions; +using OmniSharp.Models.GotoFile; + +namespace OmniSharp.Cake.Services.Navigation +{ + [OmniSharpHandler(OmniSharpEndpoints.GotoFile, Constants.LanguageNames.Cake), Shared] + public class GotoFileHandler : CakeRequestHandler + { + [ImportingConstructor] + public GotoFileHandler( + OmniSharpWorkspace workspace) + : base(workspace) + { + } + + protected override Task TranslateResponse(QuickFixResponse response, GotoFileRequest request) + { + return response.TranslateAsync(Workspace, request); + } + } +} diff --git a/src/OmniSharp.Cake/Services/Navigation/GotoRegionHandler.cs b/src/OmniSharp.Cake/Services/Navigation/GotoRegionHandler.cs new file mode 100644 index 0000000000..0a2d903ccd --- /dev/null +++ b/src/OmniSharp.Cake/Services/Navigation/GotoRegionHandler.cs @@ -0,0 +1,23 @@ +using System.Composition; +using System.Threading.Tasks; +using OmniSharp.Cake.Extensions; +using OmniSharp.Mef; +using OmniSharp.Models; +using OmniSharp.Models.GotoRegion; + +namespace OmniSharp.Cake.Services.Navigation +{ + [OmniSharpHandler(OmniSharpEndpoints.GotoRegion, Constants.LanguageNames.Cake), Shared] + public class GotoRegionHandler : CakeRequestHandler + { + [ImportingConstructor] + public GotoRegionHandler(OmniSharpWorkspace workspace) : base(workspace) + { + } + + protected override Task TranslateResponse(QuickFixResponse response, GotoRegionRequest request) + { + return response.TranslateAsync(Workspace, request); + } + } +} diff --git a/src/OmniSharp.Cake/Services/Navigation/MetadataHandler.cs b/src/OmniSharp.Cake/Services/Navigation/MetadataHandler.cs new file mode 100644 index 0000000000..7e095a84ac --- /dev/null +++ b/src/OmniSharp.Cake/Services/Navigation/MetadataHandler.cs @@ -0,0 +1,16 @@ +using System.Composition; +using OmniSharp.Mef; +using OmniSharp.Models.Metadata; + +namespace OmniSharp.Cake.Services.Navigation +{ + [OmniSharpHandler(OmniSharpEndpoints.Metadata, Constants.LanguageNames.Cake), Shared] + public class MetadataHandler : CakeRequestHandler + { + [ImportingConstructor] + public MetadataHandler(OmniSharpWorkspace workspace) + : base(workspace) + { + } + } +} diff --git a/src/OmniSharp.Cake/Services/Navigation/NavigationHandler.cs b/src/OmniSharp.Cake/Services/Navigation/NavigationHandler.cs new file mode 100644 index 0000000000..483f9c62b4 --- /dev/null +++ b/src/OmniSharp.Cake/Services/Navigation/NavigationHandler.cs @@ -0,0 +1,38 @@ +using System.Composition; +using System.Threading.Tasks; +using OmniSharp.Cake.Extensions; +using OmniSharp.Mef; +using OmniSharp.Models.Navigate; + +namespace OmniSharp.Cake.Services.Navigation +{ + [OmniSharpHandler(OmniSharpEndpoints.NavigateUp, Constants.LanguageNames.Cake), Shared] + public class NavigateUpHandler : CakeRequestHandler + { + [ImportingConstructor] + public NavigateUpHandler(OmniSharpWorkspace workspace) + : base(workspace) + { + } + + protected override Task TranslateResponse(NavigateResponse response, NavigateUpRequest request) + { + return response.TranslateAsync(Workspace, request); + } + } + + [OmniSharpHandler(OmniSharpEndpoints.NavigateDown, Constants.LanguageNames.Cake), Shared] + public class NavigateDownHandler : CakeRequestHandler + { + [ImportingConstructor] + public NavigateDownHandler(OmniSharpWorkspace workspace) + : base(workspace) + { + } + + protected override Task TranslateResponse(NavigateResponse response, NavigateDownRequest request) + { + return response.TranslateAsync(Workspace, request); + } + } +} diff --git a/src/OmniSharp.Cake/Services/Refactoring/V2/GetCodeActionsHandler.cs b/src/OmniSharp.Cake/Services/Refactoring/V2/GetCodeActionsHandler.cs new file mode 100644 index 0000000000..d381caa1ad --- /dev/null +++ b/src/OmniSharp.Cake/Services/Refactoring/V2/GetCodeActionsHandler.cs @@ -0,0 +1,17 @@ +using System.Composition; +using OmniSharp.Mef; +using OmniSharp.Models.V2; + +namespace OmniSharp.Cake.Services.Refactoring.V2 +{ + [OmniSharpHandler(OmniSharpEndpoints.V2.GetCodeActions, Constants.LanguageNames.Cake), Shared] + public class GetCodeActionsHandler : CakeRequestHandler + { + [ImportingConstructor] + public GetCodeActionsHandler( + OmniSharpWorkspace workspace) + : base(workspace) + { + } + } +} diff --git a/src/OmniSharp.Cake/Services/Signatures/SignatureHelpHandler.cs b/src/OmniSharp.Cake/Services/Signatures/SignatureHelpHandler.cs new file mode 100644 index 0000000000..5a8d3b4108 --- /dev/null +++ b/src/OmniSharp.Cake/Services/Signatures/SignatureHelpHandler.cs @@ -0,0 +1,15 @@ +using System.Composition; +using OmniSharp.Mef; +using OmniSharp.Models.SignatureHelp; + +namespace OmniSharp.Cake.Services.Signatures +{ + [OmniSharpHandler(OmniSharpEndpoints.SignatureHelp, Constants.LanguageNames.Cake), Shared] + public class SignatureHelpHandler : CakeRequestHandler + { + [ImportingConstructor] + public SignatureHelpHandler(OmniSharpWorkspace workspace) : base(workspace) + { + } + } +} diff --git a/src/OmniSharp.Cake/Services/Structure/MembersAsTreeHandler.cs b/src/OmniSharp.Cake/Services/Structure/MembersAsTreeHandler.cs new file mode 100644 index 0000000000..85fbd2950b --- /dev/null +++ b/src/OmniSharp.Cake/Services/Structure/MembersAsTreeHandler.cs @@ -0,0 +1,24 @@ +using System.Composition; +using System.Threading.Tasks; +using OmniSharp.Cake.Extensions; +using OmniSharp.Mef; +using OmniSharp.Models.MembersTree; + +namespace OmniSharp.Cake.Services.Structure +{ + [OmniSharpHandler(OmniSharpEndpoints.MembersTree, Constants.LanguageNames.Cake), Shared] + public class MembersAsTreeHandler : CakeRequestHandler + { + [ImportingConstructor] + public MembersAsTreeHandler( + OmniSharpWorkspace workspace) + : base(workspace) + { + } + + protected override Task TranslateResponse(FileMemberTree response, MembersTreeRequest request) + { + return response.TranslateAsync(Workspace, request); + } + } +} diff --git a/src/OmniSharp.Cake/Services/Types/TypeLookupHandler.cs b/src/OmniSharp.Cake/Services/Types/TypeLookupHandler.cs new file mode 100644 index 0000000000..6e94f736fd --- /dev/null +++ b/src/OmniSharp.Cake/Services/Types/TypeLookupHandler.cs @@ -0,0 +1,15 @@ +using System.Composition; +using OmniSharp.Mef; +using OmniSharp.Models.TypeLookup; + +namespace OmniSharp.Cake.Services.Types +{ + [OmniSharpHandler(OmniSharpEndpoints.TypeLookup, Constants.LanguageNames.Cake), Shared] + public class TypeLookupHandler : CakeRequestHandler + { + [ImportingConstructor] + public TypeLookupHandler(OmniSharpWorkspace workspace) : base(workspace) + { + } + } +} diff --git a/src/OmniSharp.Cake/Utilities/LineOffsetHelper.cs b/src/OmniSharp.Cake/Utilities/LineOffsetHelper.cs index 46e6549801..3cf6985d73 100644 --- a/src/OmniSharp.Cake/Utilities/LineOffsetHelper.cs +++ b/src/OmniSharp.Cake/Utilities/LineOffsetHelper.cs @@ -1,7 +1,6 @@ using System.IO; using System.Linq; using System.Threading.Tasks; -using OmniSharp; namespace OmniSharp.Cake.Utilities { From ec9af89f62ef53715595409064429a032d449c85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Bj=C3=B6rkstr=C3=B6m?= Date: Sat, 15 Jul 2017 00:47:56 +0300 Subject: [PATCH 07/38] Adds context model to Cake --- src/OmniSharp.Cake/CakeContextModel.cs | 12 +++++++ .../CakeContextModelCollection.cs | 14 ++++++++ src/OmniSharp.Cake/CakeProjectSystem.cs | 34 +++++++++++++++++-- 3 files changed, 57 insertions(+), 3 deletions(-) create mode 100644 src/OmniSharp.Cake/CakeContextModel.cs create mode 100644 src/OmniSharp.Cake/CakeContextModelCollection.cs diff --git a/src/OmniSharp.Cake/CakeContextModel.cs b/src/OmniSharp.Cake/CakeContextModel.cs new file mode 100644 index 0000000000..20b0b552bf --- /dev/null +++ b/src/OmniSharp.Cake/CakeContextModel.cs @@ -0,0 +1,12 @@ +namespace OmniSharp.Cake +{ + internal class CakeContextModel + { + public CakeContextModel(string filePath) + { + Path = filePath; + } + + public string Path { get; } + } +} \ No newline at end of file diff --git a/src/OmniSharp.Cake/CakeContextModelCollection.cs b/src/OmniSharp.Cake/CakeContextModelCollection.cs new file mode 100644 index 0000000000..fcc0e8f4fd --- /dev/null +++ b/src/OmniSharp.Cake/CakeContextModelCollection.cs @@ -0,0 +1,14 @@ +using System.Collections.Generic; + +namespace OmniSharp.Cake +{ + internal class CakeContextModelCollection + { + public CakeContextModelCollection(IEnumerable projects) + { + Projects = projects; + } + + public IEnumerable Projects { get; } + } +} \ No newline at end of file diff --git a/src/OmniSharp.Cake/CakeProjectSystem.cs b/src/OmniSharp.Cake/CakeProjectSystem.cs index 877a92251a..5fd86fa15f 100644 --- a/src/OmniSharp.Cake/CakeProjectSystem.cs +++ b/src/OmniSharp.Cake/CakeProjectSystem.cs @@ -108,15 +108,43 @@ public void Initalize(IConfiguration configuration) public Task GetWorkspaceModelAsync(WorkspaceInformationRequest request) { - throw new NotImplementedException(); + var scriptContextModels = new List(); + foreach (var project in _projects) + { + scriptContextModels.Add(new CakeContextModel(project.Key)); + } + return Task.FromResult(new CakeContextModelCollection(scriptContextModels)); } public Task GetProjectModelAsync(string filePath) { - throw new NotImplementedException(); + // only react to .cake file paths + if (!filePath.EndsWith(".cake", StringComparison.OrdinalIgnoreCase)) + { + return Task.FromResult(null); + } + + var document = _workspace.GetDocument(filePath); + var projectFilePath = document != null + ? document.Project.FilePath + : filePath; + + var projectInfo = GetProjectFileInfo(projectFilePath); + if (projectInfo == null) + { + _logger.LogDebug($"Could not locate project for '{projectFilePath}'"); + return Task.FromResult(null); + } + + return Task.FromResult(new CakeContextModel(filePath)); + } + + private ProjectInfo GetProjectFileInfo(string path) + { + return !_projects.TryGetValue(path, out ProjectInfo projectFileInfo) ? null : projectFileInfo; } - private ProjectInfo GetProject(CakeScript cakeScript, string filePath) + private static ProjectInfo GetProject(CakeScript cakeScript, string filePath) { var name = Path.GetFileName(filePath); From e6225ac1a763a808a358038f550791a730a5391c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Bj=C3=B6rkstr=C3=B6m?= Date: Sat, 15 Jul 2017 23:05:28 +0300 Subject: [PATCH 08/38] Fix hostObjectType loading for Cake --- src/OmniSharp.Cake/CakeProjectSystem.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/OmniSharp.Cake/CakeProjectSystem.cs b/src/OmniSharp.Cake/CakeProjectSystem.cs index 5fd86fa15f..557d6c2838 100644 --- a/src/OmniSharp.Cake/CakeProjectSystem.cs +++ b/src/OmniSharp.Cake/CakeProjectSystem.cs @@ -148,7 +148,12 @@ private static ProjectInfo GetProject(CakeScript cakeScript, string filePath) { var name = Path.GetFileName(filePath); - AssemblyLoader.LoadFrom(cakeScript.Host.AssemblyPath); + var assembly = AssemblyLoader.LoadFrom(cakeScript.Host.AssemblyPath); +#if NET46 + var hostObjectType = Type.GetType(cakeScript.Host.TypeName, a => assembly, null, true); +#else + var hostObjectType = Type.GetType(cakeScript.Host.TypeName); +#endif return ProjectInfo.Create( id: ProjectId.CreateNewId(Guid.NewGuid().ToString()), @@ -163,7 +168,7 @@ private static ProjectInfo GetProject(CakeScript cakeScript, string filePath) metadataReferences: cakeScript.References.Select(reference => MetadataReference.CreateFromFile(reference/*, documentation: CreateDocumentationProvider(referencePath))*/)), // TODO: projectReferences? isSubmission: true, - hostObjectType: Type.GetType(cakeScript.Host.TypeName)); + hostObjectType: hostObjectType); } private static CompilationOptions GetCompilationOptions(IEnumerable usings) From c46a223d2f56a2a872283c1c0d5185306edbefa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Bj=C3=B6rkstr=C3=B6m?= Date: Wed, 2 Aug 2017 23:27:11 +0300 Subject: [PATCH 09/38] Update dependencies --- src/OmniSharp.Cake/OmniSharp.Cake.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/OmniSharp.Cake/OmniSharp.Cake.csproj b/src/OmniSharp.Cake/OmniSharp.Cake.csproj index f3bf71bd04..cb87e4de0f 100644 --- a/src/OmniSharp.Cake/OmniSharp.Cake.csproj +++ b/src/OmniSharp.Cake/OmniSharp.Cake.csproj @@ -15,8 +15,8 @@ - - + + From fa78f2756c17b4835b8082bb16a0f038d701c66e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Bj=C3=B6rkstr=C3=B6m?= Date: Tue, 15 Aug 2017 20:52:42 +0300 Subject: [PATCH 10/38] Remove target netstandard1.6 --- src/OmniSharp.Cake/CakeProjectSystem.cs | 4 ---- src/OmniSharp.Cake/OmniSharp.Cake.csproj | 12 ++---------- src/OmniSharp.Cake/Polyfill/AssemblyLoader.cs | 4 ---- 3 files changed, 2 insertions(+), 18 deletions(-) diff --git a/src/OmniSharp.Cake/CakeProjectSystem.cs b/src/OmniSharp.Cake/CakeProjectSystem.cs index 557d6c2838..23246498c8 100644 --- a/src/OmniSharp.Cake/CakeProjectSystem.cs +++ b/src/OmniSharp.Cake/CakeProjectSystem.cs @@ -149,11 +149,7 @@ private static ProjectInfo GetProject(CakeScript cakeScript, string filePath) var name = Path.GetFileName(filePath); var assembly = AssemblyLoader.LoadFrom(cakeScript.Host.AssemblyPath); -#if NET46 var hostObjectType = Type.GetType(cakeScript.Host.TypeName, a => assembly, null, true); -#else - var hostObjectType = Type.GetType(cakeScript.Host.TypeName); -#endif return ProjectInfo.Create( id: ProjectId.CreateNewId(Guid.NewGuid().ToString()), diff --git a/src/OmniSharp.Cake/OmniSharp.Cake.csproj b/src/OmniSharp.Cake/OmniSharp.Cake.csproj index cb87e4de0f..27a6aaf367 100644 --- a/src/OmniSharp.Cake/OmniSharp.Cake.csproj +++ b/src/OmniSharp.Cake/OmniSharp.Cake.csproj @@ -1,12 +1,9 @@  - net46;netstandard1.6 + net46 true AnyCPU - - - $(PackageTargetFallback);dotnet5.4;portable-net45+win8 @@ -17,11 +14,6 @@ - - - - - + - diff --git a/src/OmniSharp.Cake/Polyfill/AssemblyLoader.cs b/src/OmniSharp.Cake/Polyfill/AssemblyLoader.cs index e18dd281db..9e2fd23e55 100644 --- a/src/OmniSharp.Cake/Polyfill/AssemblyLoader.cs +++ b/src/OmniSharp.Cake/Polyfill/AssemblyLoader.cs @@ -6,11 +6,7 @@ internal static class AssemblyLoader { public static Assembly LoadFrom(string assemblyPath) { -#if NET46 return Assembly.LoadFrom(assemblyPath); -#else - return System.Runtime.Loader.AssemblyLoadContext.Default.LoadFromAssemblyPath(assemblyPath); -#endif } } } From b4b9b3f06c0c7028d953ecaedd4acbd672a76ed8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Bj=C3=B6rkstr=C3=B6m?= Date: Tue, 15 Aug 2017 21:20:20 +0300 Subject: [PATCH 11/38] Use IAssemblyLoader --- src/OmniSharp.Cake/CakeProjectSystem.cs | 8 +++++--- src/OmniSharp.Cake/Polyfill/AssemblyLoader.cs | 12 ------------ 2 files changed, 5 insertions(+), 15 deletions(-) delete mode 100644 src/OmniSharp.Cake/Polyfill/AssemblyLoader.cs diff --git a/src/OmniSharp.Cake/CakeProjectSystem.cs b/src/OmniSharp.Cake/CakeProjectSystem.cs index 23246498c8..26e7f0803f 100644 --- a/src/OmniSharp.Cake/CakeProjectSystem.cs +++ b/src/OmniSharp.Cake/CakeProjectSystem.cs @@ -13,7 +13,6 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; using OmniSharp.Cake.Configuration; -using OmniSharp.Cake.Polyfill; using OmniSharp.Cake.Tools; using OmniSharp.Models.WorkspaceInformation; using OmniSharp.Services; @@ -25,6 +24,7 @@ public class CakeProjectSystem : IProjectSystem { private readonly OmniSharpWorkspace _workspace; private readonly IOmniSharpEnvironment _environment; + private readonly IAssemblyLoader _assemblyLoader; private readonly ICakeConfiguration _cakeConfiguration; private readonly IScriptGenerationService _generationService; private readonly ILogger _logger; @@ -38,12 +38,14 @@ public class CakeProjectSystem : IProjectSystem public CakeProjectSystem( OmniSharpWorkspace workspace, IOmniSharpEnvironment environment, + IAssemblyLoader assemblyLoader, ICakeConfiguration cakeConfiguration, IScriptGenerationService generationService, ILoggerFactory loggerFactory) { _workspace = workspace ?? throw new ArgumentNullException(nameof(workspace)); _environment = environment ?? throw new ArgumentNullException(nameof(environment)); + _assemblyLoader = assemblyLoader ?? throw new ArgumentNullException(nameof(assemblyLoader)); _cakeConfiguration = cakeConfiguration ?? throw new ArgumentNullException(nameof(cakeConfiguration)); _generationService = generationService ?? throw new ArgumentNullException(nameof(generationService)); _logger = loggerFactory?.CreateLogger() ?? throw new ArgumentNullException(nameof(loggerFactory)); @@ -144,11 +146,11 @@ private ProjectInfo GetProjectFileInfo(string path) return !_projects.TryGetValue(path, out ProjectInfo projectFileInfo) ? null : projectFileInfo; } - private static ProjectInfo GetProject(CakeScript cakeScript, string filePath) + private ProjectInfo GetProject(CakeScript cakeScript, string filePath) { var name = Path.GetFileName(filePath); - var assembly = AssemblyLoader.LoadFrom(cakeScript.Host.AssemblyPath); + var assembly = _assemblyLoader.LoadFrom(cakeScript.Host.AssemblyPath); var hostObjectType = Type.GetType(cakeScript.Host.TypeName, a => assembly, null, true); return ProjectInfo.Create( diff --git a/src/OmniSharp.Cake/Polyfill/AssemblyLoader.cs b/src/OmniSharp.Cake/Polyfill/AssemblyLoader.cs deleted file mode 100644 index 9e2fd23e55..0000000000 --- a/src/OmniSharp.Cake/Polyfill/AssemblyLoader.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Reflection; - -namespace OmniSharp.Cake.Polyfill -{ - internal static class AssemblyLoader - { - public static Assembly LoadFrom(string assemblyPath) - { - return Assembly.LoadFrom(assemblyPath); - } - } -} From 5c6760e80827852d7b095ddcfc0d6b91129eb031 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Bj=C3=B6rkstr=C3=B6m?= Date: Tue, 15 Aug 2017 22:46:07 +0300 Subject: [PATCH 12/38] Use TargetFramework instead of TargetFrameworks --- src/OmniSharp.Cake/OmniSharp.Cake.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OmniSharp.Cake/OmniSharp.Cake.csproj b/src/OmniSharp.Cake/OmniSharp.Cake.csproj index 27a6aaf367..473bde13b8 100644 --- a/src/OmniSharp.Cake/OmniSharp.Cake.csproj +++ b/src/OmniSharp.Cake/OmniSharp.Cake.csproj @@ -1,7 +1,7 @@  - net46 + net46 true AnyCPU From 392c2b846274b8244f95367fe368c4e97f10e4e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Bj=C3=B6rkstr=C3=B6m?= Date: Tue, 15 Aug 2017 23:38:35 +0300 Subject: [PATCH 13/38] Add DocumentationProvider --- src/OmniSharp.Cake/CakeProjectSystem.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/OmniSharp.Cake/CakeProjectSystem.cs b/src/OmniSharp.Cake/CakeProjectSystem.cs index 26e7f0803f..0573109b3f 100644 --- a/src/OmniSharp.Cake/CakeProjectSystem.cs +++ b/src/OmniSharp.Cake/CakeProjectSystem.cs @@ -162,13 +162,20 @@ private ProjectInfo GetProject(CakeScript cakeScript, string filePath) language: LanguageNames.CSharp, compilationOptions: GetCompilationOptions(cakeScript.Usings), parseOptions: new CSharpParseOptions(LanguageVersion.Default, DocumentationMode.Parse, SourceCodeKind.Script), - // TODO: Create Documentation for reference also - metadataReferences: cakeScript.References.Select(reference => MetadataReference.CreateFromFile(reference/*, documentation: CreateDocumentationProvider(referencePath))*/)), + metadataReferences: cakeScript.References.Select(reference => MetadataReference.CreateFromFile(reference, documentation: GetDocumentationProvider(reference))), // TODO: projectReferences? isSubmission: true, hostObjectType: hostObjectType); } + private static DocumentationProvider GetDocumentationProvider(string assemblyPath) + { + var assemblyDocumentationPath = Path.ChangeExtension(assemblyPath, ".xml"); + return File.Exists(assemblyDocumentationPath) + ? XmlDocumentationProvider.CreateFromFile(assemblyDocumentationPath) + : DocumentationProvider.Default; + } + private static CompilationOptions GetCompilationOptions(IEnumerable usings) { var compilationOptions = new CSharpCompilationOptions( From 6f66afa4d5cb439e82ff3af427457b5fb2d54a63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Bj=C3=B6rkstr=C3=B6m?= Date: Wed, 16 Aug 2017 21:45:57 +0300 Subject: [PATCH 14/38] Reorder request handlers --- .../{ => RequestHandlers}/Buffer/ChangeBufferHandler.cs | 4 ++-- .../{ => RequestHandlers}/Buffer/UpdateBufferHandler.cs | 4 ++-- .../Services/{ => RequestHandlers}/CakeRequestHandler.cs | 2 +- .../{ => RequestHandlers}/Diagnostics/CodeCheckHandler.cs | 6 +++--- .../Intellisense/AutoCompleteHandler.cs | 2 +- .../Navigation/FindImplementationsHandler.cs | 4 ++-- .../{ => RequestHandlers}/Navigation/FindSymbolsHandler.cs | 4 ++-- .../{ => RequestHandlers}/Navigation/FindUsagesHandler.cs | 4 ++-- .../Navigation/GotoDefinitionHandler.cs | 6 +++--- .../{ => RequestHandlers}/Navigation/GotoFileHandler.cs | 4 ++-- .../{ => RequestHandlers}/Navigation/GotoRegionHandler.cs | 2 +- .../{ => RequestHandlers}/Navigation/MetadataHandler.cs | 2 +- .../{ => RequestHandlers}/Navigation/NavigationHandler.cs | 2 +- .../Refactoring/V2/GetCodeActionsHandler.cs | 2 +- .../Signatures/SignatureHelpHandler.cs | 2 +- .../{ => RequestHandlers}/Structure/MembersAsTreeHandler.cs | 2 +- .../{ => RequestHandlers}/Types/TypeLookupHandler.cs | 2 +- 17 files changed, 27 insertions(+), 27 deletions(-) rename src/OmniSharp.Cake/Services/{ => RequestHandlers}/Buffer/ChangeBufferHandler.cs (95%) rename src/OmniSharp.Cake/Services/{ => RequestHandlers}/Buffer/UpdateBufferHandler.cs (97%) rename src/OmniSharp.Cake/Services/{ => RequestHandlers}/CakeRequestHandler.cs (97%) rename src/OmniSharp.Cake/Services/{ => RequestHandlers}/Diagnostics/CodeCheckHandler.cs (78%) rename src/OmniSharp.Cake/Services/{ => RequestHandlers}/Intellisense/AutoCompleteHandler.cs (88%) rename src/OmniSharp.Cake/Services/{ => RequestHandlers}/Navigation/FindImplementationsHandler.cs (92%) rename src/OmniSharp.Cake/Services/{ => RequestHandlers}/Navigation/FindSymbolsHandler.cs (92%) rename src/OmniSharp.Cake/Services/{ => RequestHandlers}/Navigation/FindUsagesHandler.cs (92%) rename src/OmniSharp.Cake/Services/{ => RequestHandlers}/Navigation/GotoDefinitionHandler.cs (92%) rename src/OmniSharp.Cake/Services/{ => RequestHandlers}/Navigation/GotoFileHandler.cs (92%) rename src/OmniSharp.Cake/Services/{ => RequestHandlers}/Navigation/GotoRegionHandler.cs (92%) rename src/OmniSharp.Cake/Services/{ => RequestHandlers}/Navigation/MetadataHandler.cs (87%) rename src/OmniSharp.Cake/Services/{ => RequestHandlers}/Navigation/NavigationHandler.cs (95%) rename src/OmniSharp.Cake/Services/{ => RequestHandlers}/Refactoring/V2/GetCodeActionsHandler.cs (87%) rename src/OmniSharp.Cake/Services/{ => RequestHandlers}/Signatures/SignatureHelpHandler.cs (87%) rename src/OmniSharp.Cake/Services/{ => RequestHandlers}/Structure/MembersAsTreeHandler.cs (92%) rename src/OmniSharp.Cake/Services/{ => RequestHandlers}/Types/TypeLookupHandler.cs (88%) diff --git a/src/OmniSharp.Cake/Services/Buffer/ChangeBufferHandler.cs b/src/OmniSharp.Cake/Services/RequestHandlers/Buffer/ChangeBufferHandler.cs similarity index 95% rename from src/OmniSharp.Cake/Services/Buffer/ChangeBufferHandler.cs rename to src/OmniSharp.Cake/Services/RequestHandlers/Buffer/ChangeBufferHandler.cs index 9477f80039..36a61359b9 100644 --- a/src/OmniSharp.Cake/Services/Buffer/ChangeBufferHandler.cs +++ b/src/OmniSharp.Cake/Services/RequestHandlers/Buffer/ChangeBufferHandler.cs @@ -1,12 +1,12 @@ using System.Composition; -using System.Threading.Tasks; +using System.Threading.Tasks; using Cake.Scripting.Abstractions; using Cake.Scripting.Abstractions.Models; using OmniSharp.Mef; using OmniSharp.Models.ChangeBuffer; using OmniSharp.Models.UpdateBuffer; -namespace OmniSharp.Cake.Services.Buffer +namespace OmniSharp.Cake.Services.RequestHandlers.Buffer { [OmniSharpHandler(OmniSharpEndpoints.ChangeBuffer, Constants.LanguageNames.Cake)] public class ChangeBufferHandler : IRequestHandler diff --git a/src/OmniSharp.Cake/Services/Buffer/UpdateBufferHandler.cs b/src/OmniSharp.Cake/Services/RequestHandlers/Buffer/UpdateBufferHandler.cs similarity index 97% rename from src/OmniSharp.Cake/Services/Buffer/UpdateBufferHandler.cs rename to src/OmniSharp.Cake/Services/RequestHandlers/Buffer/UpdateBufferHandler.cs index a14012dad9..9fe605df68 100644 --- a/src/OmniSharp.Cake/Services/Buffer/UpdateBufferHandler.cs +++ b/src/OmniSharp.Cake/Services/RequestHandlers/Buffer/UpdateBufferHandler.cs @@ -1,11 +1,11 @@ using System.Composition; using System.Threading.Tasks; -using OmniSharp.Mef; using Cake.Scripting.Abstractions; using Cake.Scripting.Abstractions.Models; +using OmniSharp.Mef; using OmniSharp.Models.UpdateBuffer; -namespace OmniSharp.Cake.Services.Buffer +namespace OmniSharp.Cake.Services.RequestHandlers.Buffer { [OmniSharpHandler(OmniSharpEndpoints.UpdateBuffer, Constants.LanguageNames.Cake)] public class UpdateBufferHandler : IRequestHandler diff --git a/src/OmniSharp.Cake/Services/CakeRequestHandler.cs b/src/OmniSharp.Cake/Services/RequestHandlers/CakeRequestHandler.cs similarity index 97% rename from src/OmniSharp.Cake/Services/CakeRequestHandler.cs rename to src/OmniSharp.Cake/Services/RequestHandlers/CakeRequestHandler.cs index 5d92ce5fe0..3bfd8b5a62 100644 --- a/src/OmniSharp.Cake/Services/CakeRequestHandler.cs +++ b/src/OmniSharp.Cake/Services/RequestHandlers/CakeRequestHandler.cs @@ -9,7 +9,7 @@ using OmniSharp.Mef; using OmniSharp.Models; -namespace OmniSharp.Cake.Services +namespace OmniSharp.Cake.Services.RequestHandlers { public abstract class CakeRequestHandler : IRequestHandler { diff --git a/src/OmniSharp.Cake/Services/Diagnostics/CodeCheckHandler.cs b/src/OmniSharp.Cake/Services/RequestHandlers/Diagnostics/CodeCheckHandler.cs similarity index 78% rename from src/OmniSharp.Cake/Services/Diagnostics/CodeCheckHandler.cs rename to src/OmniSharp.Cake/Services/RequestHandlers/Diagnostics/CodeCheckHandler.cs index 2e094087bd..8a857b9422 100644 --- a/src/OmniSharp.Cake/Services/Diagnostics/CodeCheckHandler.cs +++ b/src/OmniSharp.Cake/Services/RequestHandlers/Diagnostics/CodeCheckHandler.cs @@ -1,9 +1,9 @@ -using OmniSharp.Mef; +using System.Composition; +using OmniSharp.Mef; using OmniSharp.Models; -using System.Composition; using OmniSharp.Models.CodeCheck; -namespace OmniSharp.Cake.Services.Diagnostics +namespace OmniSharp.Cake.Services.RequestHandlers.Diagnostics { [OmniSharpHandler(OmniSharpEndpoints.CodeCheck, Constants.LanguageNames.Cake), Shared] public class CodeCheckHandler : CakeRequestHandler diff --git a/src/OmniSharp.Cake/Services/Intellisense/AutoCompleteHandler.cs b/src/OmniSharp.Cake/Services/RequestHandlers/Intellisense/AutoCompleteHandler.cs similarity index 88% rename from src/OmniSharp.Cake/Services/Intellisense/AutoCompleteHandler.cs rename to src/OmniSharp.Cake/Services/RequestHandlers/Intellisense/AutoCompleteHandler.cs index 5d3ef45096..9c74aec8da 100644 --- a/src/OmniSharp.Cake/Services/Intellisense/AutoCompleteHandler.cs +++ b/src/OmniSharp.Cake/Services/RequestHandlers/Intellisense/AutoCompleteHandler.cs @@ -3,7 +3,7 @@ using OmniSharp.Mef; using OmniSharp.Models.AutoComplete; -namespace OmniSharp.Cake.Services.Intellisense +namespace OmniSharp.Cake.Services.RequestHandlers.Intellisense { [OmniSharpHandler(OmniSharpEndpoints.AutoComplete, Constants.LanguageNames.Cake), Shared] public class AutoCompleteHandler : CakeRequestHandler> diff --git a/src/OmniSharp.Cake/Services/Navigation/FindImplementationsHandler.cs b/src/OmniSharp.Cake/Services/RequestHandlers/Navigation/FindImplementationsHandler.cs similarity index 92% rename from src/OmniSharp.Cake/Services/Navigation/FindImplementationsHandler.cs rename to src/OmniSharp.Cake/Services/RequestHandlers/Navigation/FindImplementationsHandler.cs index 2b0b495148..5226e2229f 100644 --- a/src/OmniSharp.Cake/Services/Navigation/FindImplementationsHandler.cs +++ b/src/OmniSharp.Cake/Services/RequestHandlers/Navigation/FindImplementationsHandler.cs @@ -1,11 +1,11 @@ using System.Composition; using System.Threading.Tasks; +using OmniSharp.Cake.Extensions; using OmniSharp.Mef; using OmniSharp.Models; -using OmniSharp.Cake.Extensions; using OmniSharp.Models.FindImplementations; -namespace OmniSharp.Cake.Services.Navigation +namespace OmniSharp.Cake.Services.RequestHandlers.Navigation { [OmniSharpHandler(OmniSharpEndpoints.FindImplementations, Constants.LanguageNames.Cake), Shared] public class FindImplementationsHandler : CakeRequestHandler diff --git a/src/OmniSharp.Cake/Services/Navigation/FindSymbolsHandler.cs b/src/OmniSharp.Cake/Services/RequestHandlers/Navigation/FindSymbolsHandler.cs similarity index 92% rename from src/OmniSharp.Cake/Services/Navigation/FindSymbolsHandler.cs rename to src/OmniSharp.Cake/Services/RequestHandlers/Navigation/FindSymbolsHandler.cs index 1e34ff034e..a3e4046526 100644 --- a/src/OmniSharp.Cake/Services/Navigation/FindSymbolsHandler.cs +++ b/src/OmniSharp.Cake/Services/RequestHandlers/Navigation/FindSymbolsHandler.cs @@ -1,11 +1,11 @@ using System.Composition; using System.Threading.Tasks; +using OmniSharp.Cake.Extensions; using OmniSharp.Mef; using OmniSharp.Models; -using OmniSharp.Cake.Extensions; using OmniSharp.Models.FindSymbols; -namespace OmniSharp.Cake.Services.Navigation +namespace OmniSharp.Cake.Services.RequestHandlers.Navigation { [OmniSharpHandler(OmniSharpEndpoints.FindSymbols, Constants.LanguageNames.Cake), Shared] public class FindSymbolsHandler : CakeRequestHandler diff --git a/src/OmniSharp.Cake/Services/Navigation/FindUsagesHandler.cs b/src/OmniSharp.Cake/Services/RequestHandlers/Navigation/FindUsagesHandler.cs similarity index 92% rename from src/OmniSharp.Cake/Services/Navigation/FindUsagesHandler.cs rename to src/OmniSharp.Cake/Services/RequestHandlers/Navigation/FindUsagesHandler.cs index 017b5d0cf5..8af6f81419 100644 --- a/src/OmniSharp.Cake/Services/Navigation/FindUsagesHandler.cs +++ b/src/OmniSharp.Cake/Services/RequestHandlers/Navigation/FindUsagesHandler.cs @@ -1,11 +1,11 @@ using System.Composition; using System.Threading.Tasks; +using OmniSharp.Cake.Extensions; using OmniSharp.Mef; using OmniSharp.Models; -using OmniSharp.Cake.Extensions; using OmniSharp.Models.FindUsages; -namespace OmniSharp.Cake.Services.Navigation +namespace OmniSharp.Cake.Services.RequestHandlers.Navigation { [OmniSharpHandler(OmniSharpEndpoints.FindUsages, Constants.LanguageNames.Cake), Shared] public class FindUsagesHandler : CakeRequestHandler diff --git a/src/OmniSharp.Cake/Services/Navigation/GotoDefinitionHandler.cs b/src/OmniSharp.Cake/Services/RequestHandlers/Navigation/GotoDefinitionHandler.cs similarity index 92% rename from src/OmniSharp.Cake/Services/Navigation/GotoDefinitionHandler.cs rename to src/OmniSharp.Cake/Services/RequestHandlers/Navigation/GotoDefinitionHandler.cs index ae00703881..fffe8d45df 100644 --- a/src/OmniSharp.Cake/Services/Navigation/GotoDefinitionHandler.cs +++ b/src/OmniSharp.Cake/Services/RequestHandlers/Navigation/GotoDefinitionHandler.cs @@ -1,10 +1,10 @@ using System.Composition; using System.Threading.Tasks; -using OmniSharp.Mef; using OmniSharp.Cake.Extensions; +using OmniSharp.Mef; using OmniSharp.Models.GotoDefinition; -namespace OmniSharp.Cake.Services.Navigation +namespace OmniSharp.Cake.Services.RequestHandlers.Navigation { [OmniSharpHandler(OmniSharpEndpoints.GotoDefinition, Constants.LanguageNames.Cake), Shared] public class GotoDefinitionHandler : CakeRequestHandler @@ -21,4 +21,4 @@ protected override Task TranslateResponse(GotoDefinition return response.TranslateAsync(Workspace); } } -} \ No newline at end of file +} diff --git a/src/OmniSharp.Cake/Services/Navigation/GotoFileHandler.cs b/src/OmniSharp.Cake/Services/RequestHandlers/Navigation/GotoFileHandler.cs similarity index 92% rename from src/OmniSharp.Cake/Services/Navigation/GotoFileHandler.cs rename to src/OmniSharp.Cake/Services/RequestHandlers/Navigation/GotoFileHandler.cs index eb7726a424..bef7ce8971 100644 --- a/src/OmniSharp.Cake/Services/Navigation/GotoFileHandler.cs +++ b/src/OmniSharp.Cake/Services/RequestHandlers/Navigation/GotoFileHandler.cs @@ -1,11 +1,11 @@ using System.Composition; using System.Threading.Tasks; +using OmniSharp.Cake.Extensions; using OmniSharp.Mef; using OmniSharp.Models; -using OmniSharp.Cake.Extensions; using OmniSharp.Models.GotoFile; -namespace OmniSharp.Cake.Services.Navigation +namespace OmniSharp.Cake.Services.RequestHandlers.Navigation { [OmniSharpHandler(OmniSharpEndpoints.GotoFile, Constants.LanguageNames.Cake), Shared] public class GotoFileHandler : CakeRequestHandler diff --git a/src/OmniSharp.Cake/Services/Navigation/GotoRegionHandler.cs b/src/OmniSharp.Cake/Services/RequestHandlers/Navigation/GotoRegionHandler.cs similarity index 92% rename from src/OmniSharp.Cake/Services/Navigation/GotoRegionHandler.cs rename to src/OmniSharp.Cake/Services/RequestHandlers/Navigation/GotoRegionHandler.cs index 0a2d903ccd..920080be18 100644 --- a/src/OmniSharp.Cake/Services/Navigation/GotoRegionHandler.cs +++ b/src/OmniSharp.Cake/Services/RequestHandlers/Navigation/GotoRegionHandler.cs @@ -5,7 +5,7 @@ using OmniSharp.Models; using OmniSharp.Models.GotoRegion; -namespace OmniSharp.Cake.Services.Navigation +namespace OmniSharp.Cake.Services.RequestHandlers.Navigation { [OmniSharpHandler(OmniSharpEndpoints.GotoRegion, Constants.LanguageNames.Cake), Shared] public class GotoRegionHandler : CakeRequestHandler diff --git a/src/OmniSharp.Cake/Services/Navigation/MetadataHandler.cs b/src/OmniSharp.Cake/Services/RequestHandlers/Navigation/MetadataHandler.cs similarity index 87% rename from src/OmniSharp.Cake/Services/Navigation/MetadataHandler.cs rename to src/OmniSharp.Cake/Services/RequestHandlers/Navigation/MetadataHandler.cs index 7e095a84ac..a1b43f16cb 100644 --- a/src/OmniSharp.Cake/Services/Navigation/MetadataHandler.cs +++ b/src/OmniSharp.Cake/Services/RequestHandlers/Navigation/MetadataHandler.cs @@ -2,7 +2,7 @@ using OmniSharp.Mef; using OmniSharp.Models.Metadata; -namespace OmniSharp.Cake.Services.Navigation +namespace OmniSharp.Cake.Services.RequestHandlers.Navigation { [OmniSharpHandler(OmniSharpEndpoints.Metadata, Constants.LanguageNames.Cake), Shared] public class MetadataHandler : CakeRequestHandler diff --git a/src/OmniSharp.Cake/Services/Navigation/NavigationHandler.cs b/src/OmniSharp.Cake/Services/RequestHandlers/Navigation/NavigationHandler.cs similarity index 95% rename from src/OmniSharp.Cake/Services/Navigation/NavigationHandler.cs rename to src/OmniSharp.Cake/Services/RequestHandlers/Navigation/NavigationHandler.cs index 483f9c62b4..744e39d46a 100644 --- a/src/OmniSharp.Cake/Services/Navigation/NavigationHandler.cs +++ b/src/OmniSharp.Cake/Services/RequestHandlers/Navigation/NavigationHandler.cs @@ -4,7 +4,7 @@ using OmniSharp.Mef; using OmniSharp.Models.Navigate; -namespace OmniSharp.Cake.Services.Navigation +namespace OmniSharp.Cake.Services.RequestHandlers.Navigation { [OmniSharpHandler(OmniSharpEndpoints.NavigateUp, Constants.LanguageNames.Cake), Shared] public class NavigateUpHandler : CakeRequestHandler diff --git a/src/OmniSharp.Cake/Services/Refactoring/V2/GetCodeActionsHandler.cs b/src/OmniSharp.Cake/Services/RequestHandlers/Refactoring/V2/GetCodeActionsHandler.cs similarity index 87% rename from src/OmniSharp.Cake/Services/Refactoring/V2/GetCodeActionsHandler.cs rename to src/OmniSharp.Cake/Services/RequestHandlers/Refactoring/V2/GetCodeActionsHandler.cs index d381caa1ad..5ba17d61db 100644 --- a/src/OmniSharp.Cake/Services/Refactoring/V2/GetCodeActionsHandler.cs +++ b/src/OmniSharp.Cake/Services/RequestHandlers/Refactoring/V2/GetCodeActionsHandler.cs @@ -2,7 +2,7 @@ using OmniSharp.Mef; using OmniSharp.Models.V2; -namespace OmniSharp.Cake.Services.Refactoring.V2 +namespace OmniSharp.Cake.Services.RequestHandlers.Refactoring.V2 { [OmniSharpHandler(OmniSharpEndpoints.V2.GetCodeActions, Constants.LanguageNames.Cake), Shared] public class GetCodeActionsHandler : CakeRequestHandler diff --git a/src/OmniSharp.Cake/Services/Signatures/SignatureHelpHandler.cs b/src/OmniSharp.Cake/Services/RequestHandlers/Signatures/SignatureHelpHandler.cs similarity index 87% rename from src/OmniSharp.Cake/Services/Signatures/SignatureHelpHandler.cs rename to src/OmniSharp.Cake/Services/RequestHandlers/Signatures/SignatureHelpHandler.cs index 5a8d3b4108..89f51128ac 100644 --- a/src/OmniSharp.Cake/Services/Signatures/SignatureHelpHandler.cs +++ b/src/OmniSharp.Cake/Services/RequestHandlers/Signatures/SignatureHelpHandler.cs @@ -2,7 +2,7 @@ using OmniSharp.Mef; using OmniSharp.Models.SignatureHelp; -namespace OmniSharp.Cake.Services.Signatures +namespace OmniSharp.Cake.Services.RequestHandlers.Signatures { [OmniSharpHandler(OmniSharpEndpoints.SignatureHelp, Constants.LanguageNames.Cake), Shared] public class SignatureHelpHandler : CakeRequestHandler diff --git a/src/OmniSharp.Cake/Services/Structure/MembersAsTreeHandler.cs b/src/OmniSharp.Cake/Services/RequestHandlers/Structure/MembersAsTreeHandler.cs similarity index 92% rename from src/OmniSharp.Cake/Services/Structure/MembersAsTreeHandler.cs rename to src/OmniSharp.Cake/Services/RequestHandlers/Structure/MembersAsTreeHandler.cs index 85fbd2950b..36e8aaf758 100644 --- a/src/OmniSharp.Cake/Services/Structure/MembersAsTreeHandler.cs +++ b/src/OmniSharp.Cake/Services/RequestHandlers/Structure/MembersAsTreeHandler.cs @@ -4,7 +4,7 @@ using OmniSharp.Mef; using OmniSharp.Models.MembersTree; -namespace OmniSharp.Cake.Services.Structure +namespace OmniSharp.Cake.Services.RequestHandlers.Structure { [OmniSharpHandler(OmniSharpEndpoints.MembersTree, Constants.LanguageNames.Cake), Shared] public class MembersAsTreeHandler : CakeRequestHandler diff --git a/src/OmniSharp.Cake/Services/Types/TypeLookupHandler.cs b/src/OmniSharp.Cake/Services/RequestHandlers/Types/TypeLookupHandler.cs similarity index 88% rename from src/OmniSharp.Cake/Services/Types/TypeLookupHandler.cs rename to src/OmniSharp.Cake/Services/RequestHandlers/Types/TypeLookupHandler.cs index 6e94f736fd..5c1c7ba070 100644 --- a/src/OmniSharp.Cake/Services/Types/TypeLookupHandler.cs +++ b/src/OmniSharp.Cake/Services/RequestHandlers/Types/TypeLookupHandler.cs @@ -2,7 +2,7 @@ using OmniSharp.Mef; using OmniSharp.Models.TypeLookup; -namespace OmniSharp.Cake.Services.Types +namespace OmniSharp.Cake.Services.RequestHandlers.Types { [OmniSharpHandler(OmniSharpEndpoints.TypeLookup, Constants.LanguageNames.Cake), Shared] public class TypeLookupHandler : CakeRequestHandler From e78d1682cd21453b1c1e04d2619ee6a8a968a187 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Bj=C3=B6rkstr=C3=B6m?= Date: Wed, 16 Aug 2017 23:24:57 +0300 Subject: [PATCH 15/38] Refactor Cake Script Service - Allow updating metadatareferences and using on script change --- src/OmniSharp.Cake/CakeProjectSystem.cs | 74 ++++++++++++++++--- src/OmniSharp.Cake/CakeTextLoader.cs | 12 +-- .../Services/CakeScriptService.cs | 69 +++++++++++++++++ .../Services/ICakeScriptService.cs | 50 +++++++++++++ .../Buffer/ChangeBufferHandler.cs | 9 +-- .../Buffer/UpdateBufferHandler.cs | 9 +-- .../ScriptGenerationToolResolver.cs} | 6 +- .../Tools/CakeGenerationTool.cs | 47 ------------ 8 files changed, 199 insertions(+), 77 deletions(-) create mode 100644 src/OmniSharp.Cake/Services/CakeScriptService.cs create mode 100644 src/OmniSharp.Cake/Services/ICakeScriptService.cs rename src/OmniSharp.Cake/{Tools/CakeGenerationToolResolver.cs => Services/ScriptGenerationToolResolver.cs} (73%) delete mode 100644 src/OmniSharp.Cake/Tools/CakeGenerationTool.cs diff --git a/src/OmniSharp.Cake/CakeProjectSystem.cs b/src/OmniSharp.Cake/CakeProjectSystem.cs index 0573109b3f..dd272860ab 100644 --- a/src/OmniSharp.Cake/CakeProjectSystem.cs +++ b/src/OmniSharp.Cake/CakeProjectSystem.cs @@ -5,7 +5,6 @@ using System.Linq; using System.Reflection; using System.Threading.Tasks; -using Cake.Scripting.Abstractions; using Cake.Scripting.Abstractions.Models; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; @@ -13,7 +12,7 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; using OmniSharp.Cake.Configuration; -using OmniSharp.Cake.Tools; +using OmniSharp.Cake.Services; using OmniSharp.Models.WorkspaceInformation; using OmniSharp.Services; @@ -26,7 +25,7 @@ public class CakeProjectSystem : IProjectSystem private readonly IOmniSharpEnvironment _environment; private readonly IAssemblyLoader _assemblyLoader; private readonly ICakeConfiguration _cakeConfiguration; - private readonly IScriptGenerationService _generationService; + private readonly ICakeScriptService _scriptService; private readonly ILogger _logger; private readonly Dictionary _projects; @@ -40,14 +39,14 @@ public CakeProjectSystem( IOmniSharpEnvironment environment, IAssemblyLoader assemblyLoader, ICakeConfiguration cakeConfiguration, - IScriptGenerationService generationService, + ICakeScriptService scriptService, ILoggerFactory loggerFactory) { _workspace = workspace ?? throw new ArgumentNullException(nameof(workspace)); _environment = environment ?? throw new ArgumentNullException(nameof(environment)); _assemblyLoader = assemblyLoader ?? throw new ArgumentNullException(nameof(assemblyLoader)); _cakeConfiguration = cakeConfiguration ?? throw new ArgumentNullException(nameof(cakeConfiguration)); - _generationService = generationService ?? throw new ArgumentNullException(nameof(generationService)); + _scriptService = scriptService ?? throw new ArgumentNullException(nameof(scriptService)); _logger = loggerFactory?.CreateLogger() ?? throw new ArgumentNullException(nameof(loggerFactory)); _projects = new Dictionary(); @@ -67,11 +66,10 @@ public void Initalize(IConfiguration configuration) _logger.LogInformation($"Found {allCakeFiles.Length} Cake files."); - // Check that bakery is installed - var bakeryPath = CakeGenerationToolResolver.GetServerExecutablePath(_environment.TargetDirectory, _cakeConfiguration); - if (!File.Exists(bakeryPath)) + // Check that script service is connected + if (!_scriptService.IsConnected) { - _logger.LogError("Cake.Bakery not installed"); + _logger.LogWarning("Cake script service not connected. Aborting."); return; } @@ -79,7 +77,7 @@ public void Initalize(IConfiguration configuration) { try { - var cakeScript = _generationService.Generate(new FileChange + var cakeScript = _scriptService.Generate(new FileChange { FileName = cakePath, FromDisk = true @@ -89,7 +87,7 @@ public void Initalize(IConfiguration configuration) // add Cake project to workspace _workspace.AddProject(project); var documentId = DocumentId.CreateNewId(project.Id); - var loader = new CakeTextLoader(cakePath, _generationService); + var loader = new CakeTextLoader(cakePath, _scriptService); var documentInfo = DocumentInfo.Create( documentId, cakePath, @@ -106,6 +104,60 @@ public void Initalize(IConfiguration configuration) _logger.LogError(ex, $"{cakePath} will be ignored due to an following error"); } } + + // Hook up Cake script events + _scriptService.ReferencesChanged += ScriptReferencesChanged; + _scriptService.UsingsChanged += ScriptUsingsChanged; + } + + private void ScriptUsingsChanged(object sender, UsingsChangedEventArgs e) + { + var solution = _workspace.CurrentSolution; + + var documentIds = solution.GetDocumentIdsWithFilePath(e.ScriptPath); + if (documentIds.IsEmpty) + { + return; + } + + foreach (var documentId in documentIds) + { + var document = solution.GetDocument(documentId); + var project = document.Project; + var compilationOptions = GetCompilationOptions(e.Usings); + + _workspace.SetCompilationOptions(project.Id, compilationOptions); + } + } + + private void ScriptReferencesChanged(object sender, ReferencesChangedEventArgs e) + { + var solution = _workspace.CurrentSolution; + + var documentIds = solution.GetDocumentIdsWithFilePath(e.ScriptPath); + if (documentIds.IsEmpty) + { + return; + } + + foreach (var documentId in documentIds) + { + var document = solution.GetDocument(documentId); + var project = document.Project; + + var metadataReferences = e.References.Select(reference => MetadataReference.CreateFromFile(reference, documentation: GetDocumentationProvider(reference))); + var fileReferencesToRemove = project.MetadataReferences; + + foreach (var reference in metadataReferences) + { + _workspace.AddMetadataReference(project.Id, reference); + } + + foreach (var reference in fileReferencesToRemove) + { + _workspace.RemoveMetadataReference(project.Id, reference); + } + } } public Task GetWorkspaceModelAsync(WorkspaceInformationRequest request) diff --git a/src/OmniSharp.Cake/CakeTextLoader.cs b/src/OmniSharp.Cake/CakeTextLoader.cs index e703c2d4eb..ed48ab64e6 100644 --- a/src/OmniSharp.Cake/CakeTextLoader.cs +++ b/src/OmniSharp.Cake/CakeTextLoader.cs @@ -2,19 +2,19 @@ using System.IO; using System.Threading; using System.Threading.Tasks; -using Cake.Scripting.Abstractions; using Cake.Scripting.Abstractions.Models; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Text; +using OmniSharp.Cake.Services; namespace OmniSharp.Cake { internal class CakeTextLoader : TextLoader { private readonly string _filePath; - private readonly IScriptGenerationService _generationService; + private readonly ICakeScriptService _scriptService; - public CakeTextLoader(string filePath, IScriptGenerationService generationService) + public CakeTextLoader(string filePath, ICakeScriptService generationService) { if (filePath == null) { @@ -27,14 +27,14 @@ public CakeTextLoader(string filePath, IScriptGenerationService generationServic } _filePath = filePath; - _generationService = generationService ?? throw new ArgumentNullException(nameof(generationService)); + _scriptService = generationService ?? throw new ArgumentNullException(nameof(generationService)); } public override Task LoadTextAndVersionAsync(Workspace workspace, DocumentId documentId, CancellationToken cancellationToken) { var prevLastWriteTime = File.GetLastWriteTimeUtc(_filePath); - var script = _generationService.Generate(new FileChange + var script = _scriptService.Generate(new FileChange { FileName = _filePath, FromDisk = true @@ -52,4 +52,4 @@ public override Task LoadTextAndVersionAsync(Workspace workspace return Task.FromResult(textAndVersion); } } -} \ No newline at end of file +} diff --git a/src/OmniSharp.Cake/Services/CakeScriptService.cs b/src/OmniSharp.Cake/Services/CakeScriptService.cs new file mode 100644 index 0000000000..be9a4bd1fc --- /dev/null +++ b/src/OmniSharp.Cake/Services/CakeScriptService.cs @@ -0,0 +1,69 @@ +using System; +using System.Composition; +using System.IO; +using System.Linq; +using Cake.Scripting.Abstractions; +using Cake.Scripting.Abstractions.Models; +using Cake.Scripting.Transport.Tcp.Client; +using Microsoft.Extensions.Logging; +using OmniSharp.Cake.Configuration; + +namespace OmniSharp.Cake.Services +{ + [Export(typeof(ICakeScriptService)), Shared] + public sealed class CakeScriptService : ICakeScriptService + { + private readonly IScriptGenerationService _generationService; + + [ImportingConstructor] + public CakeScriptService(IOmniSharpEnvironment environment, ICakeConfiguration configuration, ILoggerFactory loggerFactory) + { + if (environment == null) + { + throw new ArgumentNullException(nameof(environment)); + } + if (configuration == null) + { + throw new ArgumentNullException(nameof(configuration)); + } + if (loggerFactory == null) + { + throw new ArgumentNullException(nameof(loggerFactory)); + } + + var serverExecutablePath = ScriptGenerationToolResolver.GetExecutablePath(environment.TargetDirectory, configuration); + + if (File.Exists(serverExecutablePath)) + { + _generationService = new ScriptGenerationClient(serverExecutablePath, environment.TargetDirectory, loggerFactory); + } + + IsConnected = _generationService != null; + } + + public CakeScript Generate(FileChange fileChange) + { + var cakeScript = _generationService.Generate(fileChange); + + // TODO: Cache these, don't invoke if nothing changed + OnReferencesChanged(new ReferencesChangedEventArgs(fileChange.FileName, cakeScript.References.ToList())); + OnUsingsChanged(new UsingsChangedEventArgs(fileChange.FileName, cakeScript.Usings.ToList())); + + return cakeScript; + } + + public bool IsConnected { get; } + public event EventHandler ReferencesChanged; + public event EventHandler UsingsChanged; + + private void OnReferencesChanged(ReferencesChangedEventArgs e) + { + ReferencesChanged?.Invoke(this, e); + } + + private void OnUsingsChanged(UsingsChangedEventArgs e) + { + UsingsChanged?.Invoke(this, e); + } + } +} diff --git a/src/OmniSharp.Cake/Services/ICakeScriptService.cs b/src/OmniSharp.Cake/Services/ICakeScriptService.cs new file mode 100644 index 0000000000..a7e47f4fc4 --- /dev/null +++ b/src/OmniSharp.Cake/Services/ICakeScriptService.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using Cake.Scripting.Abstractions; + +namespace OmniSharp.Cake.Services +{ + public interface ICakeScriptService : IScriptGenerationService + { + bool IsConnected { get; } + + event EventHandler ReferencesChanged; + + event EventHandler UsingsChanged; + } + + public abstract class ScriptChangedEventArgs : EventArgs + { + public string ScriptPath { get; } + + protected ScriptChangedEventArgs(string scriptPath) + { + if (string.IsNullOrWhiteSpace(scriptPath)) + { + throw new ArgumentNullException(nameof(scriptPath)); + } + + ScriptPath = scriptPath; + } + } + + public class ReferencesChangedEventArgs : ScriptChangedEventArgs + { + public IReadOnlyCollection References { get; } + + public ReferencesChangedEventArgs(string scriptPath, IReadOnlyCollection references) : base(scriptPath) + { + References = references ?? new List(); + } + } + + public class UsingsChangedEventArgs : ScriptChangedEventArgs + { + public IReadOnlyCollection Usings { get; } + + public UsingsChangedEventArgs(string scriptPath, IReadOnlyCollection usings) : base(scriptPath) + { + Usings = usings ?? new List(); + } + } +} diff --git a/src/OmniSharp.Cake/Services/RequestHandlers/Buffer/ChangeBufferHandler.cs b/src/OmniSharp.Cake/Services/RequestHandlers/Buffer/ChangeBufferHandler.cs index 36a61359b9..e02be30862 100644 --- a/src/OmniSharp.Cake/Services/RequestHandlers/Buffer/ChangeBufferHandler.cs +++ b/src/OmniSharp.Cake/Services/RequestHandlers/Buffer/ChangeBufferHandler.cs @@ -1,6 +1,5 @@ using System.Composition; using System.Threading.Tasks; -using Cake.Scripting.Abstractions; using Cake.Scripting.Abstractions.Models; using OmniSharp.Mef; using OmniSharp.Models.ChangeBuffer; @@ -12,15 +11,15 @@ namespace OmniSharp.Cake.Services.RequestHandlers.Buffer public class ChangeBufferHandler : IRequestHandler { private readonly OmniSharpWorkspace _workspace; - private readonly IScriptGenerationService _generationService; + private readonly ICakeScriptService _scriptService; [ImportingConstructor] public ChangeBufferHandler( OmniSharpWorkspace workspace, - IScriptGenerationService generationService) + ICakeScriptService scriptService) { _workspace = workspace; - _generationService = generationService; + _scriptService = scriptService; } public async Task Handle(ChangeBufferRequest request) @@ -30,7 +29,7 @@ public async Task Handle(ChangeBufferRequest request) return true; } - var script = _generationService.Generate(new FileChange + var script = _scriptService.Generate(new FileChange { FileName = request.FileName, LineChanges = { new LineChange diff --git a/src/OmniSharp.Cake/Services/RequestHandlers/Buffer/UpdateBufferHandler.cs b/src/OmniSharp.Cake/Services/RequestHandlers/Buffer/UpdateBufferHandler.cs index 9fe605df68..b25c2c20cd 100644 --- a/src/OmniSharp.Cake/Services/RequestHandlers/Buffer/UpdateBufferHandler.cs +++ b/src/OmniSharp.Cake/Services/RequestHandlers/Buffer/UpdateBufferHandler.cs @@ -1,6 +1,5 @@ using System.Composition; using System.Threading.Tasks; -using Cake.Scripting.Abstractions; using Cake.Scripting.Abstractions.Models; using OmniSharp.Mef; using OmniSharp.Models.UpdateBuffer; @@ -11,15 +10,15 @@ namespace OmniSharp.Cake.Services.RequestHandlers.Buffer public class UpdateBufferHandler : IRequestHandler { private readonly OmniSharpWorkspace _workspace; - private readonly IScriptGenerationService _generationService; + private readonly ICakeScriptService _scriptService; [ImportingConstructor] public UpdateBufferHandler( OmniSharpWorkspace workspace, - IScriptGenerationService generationService) + ICakeScriptService scriptService) { _workspace = workspace; - _generationService = generationService; + _scriptService = scriptService; } public async Task Handle(UpdateBufferRequest request) @@ -53,7 +52,7 @@ public async Task Handle(UpdateBufferRequest request) fileChange.Buffer = request.Buffer; fileChange.FromDisk = request.FromDisk; } - var script = _generationService.Generate(fileChange); + var script = _scriptService.Generate(fileChange); // Avoid having buffer manager reading from disk request.FromDisk = false; diff --git a/src/OmniSharp.Cake/Tools/CakeGenerationToolResolver.cs b/src/OmniSharp.Cake/Services/ScriptGenerationToolResolver.cs similarity index 73% rename from src/OmniSharp.Cake/Tools/CakeGenerationToolResolver.cs rename to src/OmniSharp.Cake/Services/ScriptGenerationToolResolver.cs index 56e815c635..4ad310cc2b 100644 --- a/src/OmniSharp.Cake/Tools/CakeGenerationToolResolver.cs +++ b/src/OmniSharp.Cake/Services/ScriptGenerationToolResolver.cs @@ -1,11 +1,11 @@ using System.IO; using OmniSharp.Cake.Configuration; -namespace OmniSharp.Cake.Tools +namespace OmniSharp.Cake.Services { - internal static class CakeGenerationToolResolver + internal static class ScriptGenerationToolResolver { - public static string GetServerExecutablePath(string rootPath, ICakeConfiguration configuration) + public static string GetExecutablePath(string rootPath, ICakeConfiguration configuration) { var toolPath = GetToolPath(rootPath, configuration); diff --git a/src/OmniSharp.Cake/Tools/CakeGenerationTool.cs b/src/OmniSharp.Cake/Tools/CakeGenerationTool.cs deleted file mode 100644 index 506e705d1b..0000000000 --- a/src/OmniSharp.Cake/Tools/CakeGenerationTool.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System; -using System.Composition; -using System.IO; -using Cake.Scripting.Abstractions; -using Cake.Scripting.Abstractions.Models; -using Cake.Scripting.Transport.Tcp.Client; -using Microsoft.Extensions.Logging; -using OmniSharp.Cake.Configuration; - -namespace OmniSharp.Cake.Tools -{ - [Export(typeof(IScriptGenerationService)), Shared] - public class CakeGenerationTool : IScriptGenerationService - { - private readonly IScriptGenerationService _generationService; - - [ImportingConstructor] - public CakeGenerationTool(IOmniSharpEnvironment environment, ICakeConfiguration configuration, ILoggerFactory loggerFactory) - { - if (environment == null) - { - throw new ArgumentNullException(nameof(environment)); - } - if (configuration == null) - { - throw new ArgumentNullException(nameof(configuration)); - } - if (loggerFactory == null) - { - throw new ArgumentNullException(nameof(loggerFactory)); - } - - // TODO: Not like this... I think... - var serverExecutablePath = CakeGenerationToolResolver.GetServerExecutablePath(environment.TargetDirectory, configuration); - - if (File.Exists(serverExecutablePath)) - { - _generationService = new ScriptGenerationClient(serverExecutablePath, environment.TargetDirectory, loggerFactory); - } - } - - public CakeScript Generate(FileChange fileChange) - { - return _generationService.Generate(fileChange); - } - } -} From 063fe25c59e80f86662e6fd6ffad7fb7bf41cc70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Bj=C3=B6rkstr=C3=B6m?= Date: Fri, 18 Aug 2017 00:13:04 +0300 Subject: [PATCH 16/38] Fix line number translations to work when a cake file is loaded. --- .../Extensions/RequestExtensions.cs | 10 ++---- .../Extensions/ResponseExtensions.cs | 34 ++++++------------- .../Utilities/LineOffsetHelper.cs | 27 ++++++++++++--- 3 files changed, 37 insertions(+), 34 deletions(-) diff --git a/src/OmniSharp.Cake/Extensions/RequestExtensions.cs b/src/OmniSharp.Cake/Extensions/RequestExtensions.cs index 1aa99887e4..5dd051eb0d 100644 --- a/src/OmniSharp.Cake/Extensions/RequestExtensions.cs +++ b/src/OmniSharp.Cake/Extensions/RequestExtensions.cs @@ -1,4 +1,5 @@ -using System.Threading.Tasks; +using System.Collections.Generic; +using System.Threading.Tasks; using OmniSharp.Cake.Utilities; using OmniSharp.Models; @@ -8,16 +9,11 @@ internal static class RequestExtensions { public static async Task TranslateAsync(this TRequest request, OmniSharpWorkspace workspace) where TRequest : Request { - var offset = await GetOffset(request.FileName, workspace); + var offset = await LineOffsetHelper.GetOffset(request.FileName, request.Line, workspace); request.Line += offset; return request; } - - private static async Task GetOffset(string fileName, OmniSharpWorkspace workspace) - { - return await LineOffsetHelper.GetOffset(fileName, workspace) + 1; - } } } diff --git a/src/OmniSharp.Cake/Extensions/ResponseExtensions.cs b/src/OmniSharp.Cake/Extensions/ResponseExtensions.cs index 0b3f5ac8e7..4e0ae289fc 100644 --- a/src/OmniSharp.Cake/Extensions/ResponseExtensions.cs +++ b/src/OmniSharp.Cake/Extensions/ResponseExtensions.cs @@ -17,11 +17,9 @@ public static Task TranslateAsync(this QuickFixResponse respon public static async Task TranslateAsync(this QuickFixResponse response, OmniSharpWorkspace workspace, Request request) { - var offsets = new Dictionary(); - foreach (var quickFix in response.QuickFixes) { - await quickFix.TranslateAsync(workspace, request, offsets); + await quickFix.TranslateAsync(workspace, request); } return response; @@ -29,7 +27,7 @@ public static async Task TranslateAsync(this QuickFixResponse public static async Task TranslateAsync(this GotoDefinitionResponse response, OmniSharpWorkspace workspace) { - var offset = await GetOffset(response.FileName, workspace); + var offset = await LineOffsetHelper.GetOffset(response.FileName, response.Line, workspace); response.Line -= offset; @@ -38,7 +36,7 @@ public static async Task TranslateAsync(this GotoDefinit public static async Task TranslateAsync(this NavigateResponse response, OmniSharpWorkspace workspace, Request request) { - var offset = await GetOffset(request.FileName, workspace); + var offset = await LineOffsetHelper.GetOffset(request.FileName, response.Line, workspace); response.Line -= offset; @@ -47,29 +45,27 @@ public static async Task TranslateAsync(this NavigateResponse public static async Task TranslateAsync(this FileMemberTree response, OmniSharpWorkspace workspace, Request request) { - var offsets = new Dictionary(); - foreach (var topLevelTypeDefinition in response.TopLevelTypeDefinitions) { - await topLevelTypeDefinition.TranslateAsync(workspace, request, offsets); + await topLevelTypeDefinition.TranslateAsync(workspace, request); } return response; } - private static async Task TranslateAsync(this FileMemberElement element, OmniSharpWorkspace workspace, Request request, IDictionary offsets) + private static async Task TranslateAsync(this FileMemberElement element, OmniSharpWorkspace workspace, Request request) { - element.Location = await element.Location.TranslateAsync(workspace, request, offsets); + element.Location = await element.Location.TranslateAsync(workspace, request); foreach (var childNode in element.ChildNodes) { - await childNode.TranslateAsync(workspace, request, offsets); + await childNode.TranslateAsync(workspace, request); } return element; } - private static async Task TranslateAsync(this QuickFix quickFix, OmniSharpWorkspace workspace, Request request, IDictionary offsets) + private static async Task TranslateAsync(this QuickFix quickFix, OmniSharpWorkspace workspace, Request request) { var fileName = !string.IsNullOrEmpty(quickFix.FileName) ? quickFix.FileName : request.FileName; @@ -78,20 +74,12 @@ private static async Task TranslateAsync(this QuickFix quickFix, OmniS return quickFix; } - if (!offsets.ContainsKey(fileName)) - { - offsets[fileName] = await GetOffset(fileName, workspace); - } + var offset = await LineOffsetHelper.GetOffset(fileName, quickFix.Line, workspace); - quickFix.Line -= offsets[fileName]; - quickFix.EndLine -= offsets[fileName]; + quickFix.Line -= offset; + quickFix.EndLine -= offset; return quickFix; } - - private static async Task GetOffset(string fileName, OmniSharpWorkspace workspace) - { - return await LineOffsetHelper.GetOffset(fileName, workspace) + 1; - } } } diff --git a/src/OmniSharp.Cake/Utilities/LineOffsetHelper.cs b/src/OmniSharp.Cake/Utilities/LineOffsetHelper.cs index 3cf6985d73..a6bbb7b718 100644 --- a/src/OmniSharp.Cake/Utilities/LineOffsetHelper.cs +++ b/src/OmniSharp.Cake/Utilities/LineOffsetHelper.cs @@ -1,4 +1,5 @@ -using System.IO; +using System.Collections.Generic; +using System.IO; using System.Linq; using System.Threading.Tasks; @@ -6,7 +7,7 @@ namespace OmniSharp.Cake.Utilities { internal static class LineOffsetHelper { - public static async Task GetOffset(string fileName, OmniSharpWorkspace workspace) + public static async Task GetOffset(string fileName, int target, OmniSharpWorkspace workspace) { if (string.IsNullOrEmpty(fileName)) { @@ -22,9 +23,27 @@ public static async Task GetOffset(string fileName, OmniSharpWorkspace work var fullPath = Path.GetFullPath(fileName).Replace('\\','/'); var sourceText = await document.GetTextAsync(); - var offset = sourceText.Lines.FirstOrDefault(line => line.ToString().Equals($"#line 1 \"{fullPath}\"")).LineNumber; + for (var i = sourceText.Lines.Count - 1; i >= 0; i--) + { + var text = sourceText.Lines[i].ToString(); + + if (!text.StartsWith("#line ") || !text.EndsWith($" \"{fullPath}\"")) + { + continue; + } + + var tokens = text.Split(' '); + if (tokens.Length <= 2 || !int.TryParse(tokens[1], out int lineNumber)) + { + continue; + } + if (target >= lineNumber) + { + return sourceText.Lines[i].LineNumber - lineNumber + 2; + } + } - return offset; + return 0; } } } From 55b6b27075fec01aa68816c1bcfd61a5ee7577ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Bj=C3=B6rkstr=C3=B6m?= Date: Mon, 21 Aug 2017 22:27:51 +0300 Subject: [PATCH 17/38] Cache references and using and react on changes --- .../Services/CakeScriptService.cs | 30 +++++++++++++++++-- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/src/OmniSharp.Cake/Services/CakeScriptService.cs b/src/OmniSharp.Cake/Services/CakeScriptService.cs index be9a4bd1fc..3efafd58ab 100644 --- a/src/OmniSharp.Cake/Services/CakeScriptService.cs +++ b/src/OmniSharp.Cake/Services/CakeScriptService.cs @@ -1,4 +1,6 @@ using System; +using System.Collections.Concurrent; +using System.Collections.Generic; using System.Composition; using System.IO; using System.Linq; @@ -14,6 +16,8 @@ namespace OmniSharp.Cake.Services public sealed class CakeScriptService : ICakeScriptService { private readonly IScriptGenerationService _generationService; + private readonly IDictionary> _cachedReferences; + private readonly IDictionary> _cachedUsings; [ImportingConstructor] public CakeScriptService(IOmniSharpEnvironment environment, ICakeConfiguration configuration, ILoggerFactory loggerFactory) @@ -39,15 +43,35 @@ public CakeScriptService(IOmniSharpEnvironment environment, ICakeConfiguration c } IsConnected = _generationService != null; + _cachedReferences = new Dictionary>(); + _cachedUsings = new Dictionary>(); } public CakeScript Generate(FileChange fileChange) { var cakeScript = _generationService.Generate(fileChange); - // TODO: Cache these, don't invoke if nothing changed - OnReferencesChanged(new ReferencesChangedEventArgs(fileChange.FileName, cakeScript.References.ToList())); - OnUsingsChanged(new UsingsChangedEventArgs(fileChange.FileName, cakeScript.Usings.ToList())); + // Check if references changed + if (!_cachedReferences.TryGetValue(fileChange.FileName, out var references)) + { + references = new HashSet(); + } + if (!cakeScript.References.SetEquals(references)) + { + _cachedReferences[fileChange.FileName] = cakeScript.References; + OnReferencesChanged(new ReferencesChangedEventArgs(fileChange.FileName, cakeScript.References.ToList())); + } + + // Check if usings changed + if (!_cachedUsings.TryGetValue(fileChange.FileName, out var usings)) + { + usings = new HashSet(); + } + if (!cakeScript.Usings.SetEquals(usings)) + { + _cachedUsings[fileChange.FileName] = cakeScript.Usings; + OnUsingsChanged(new UsingsChangedEventArgs(fileChange.FileName, cakeScript.Usings.ToList())); + } return cakeScript; } From f207ceb37766c6b22bec807cf50703e695879245 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Bj=C3=B6rkstr=C3=B6m?= Date: Mon, 21 Aug 2017 23:45:02 +0300 Subject: [PATCH 18/38] Find Cake.Bakery if path contains version --- .../Services/ScriptGenerationToolResolver.cs | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/OmniSharp.Cake/Services/ScriptGenerationToolResolver.cs b/src/OmniSharp.Cake/Services/ScriptGenerationToolResolver.cs index 4ad310cc2b..4d42603299 100644 --- a/src/OmniSharp.Cake/Services/ScriptGenerationToolResolver.cs +++ b/src/OmniSharp.Cake/Services/ScriptGenerationToolResolver.cs @@ -1,4 +1,5 @@ using System.IO; +using System.Linq; using OmniSharp.Cake.Configuration; namespace OmniSharp.Cake.Services @@ -9,7 +10,19 @@ public static string GetExecutablePath(string rootPath, ICakeConfiguration confi { var toolPath = GetToolPath(rootPath, configuration); - return Path.Combine(toolPath, "Cake.Bakery", "tools", "Cake.Bakery.exe"); + if (!Directory.Exists(toolPath)) + { + return string.Empty; + } + + var bakeryPath = GetLatestBakeryPath(toolPath); + + if (bakeryPath == null) + { + return string.Empty; + } + + return Path.Combine(toolPath, bakeryPath, "tools", "Cake.Bakery.exe"); } private static string GetToolPath(string rootPath, ICakeConfiguration configuration) @@ -17,5 +30,13 @@ private static string GetToolPath(string rootPath, ICakeConfiguration configurat var toolPath = configuration.GetValue(Constants.Paths.Tools); return Path.Combine(rootPath, !string.IsNullOrWhiteSpace(toolPath) ? toolPath : "tools"); } + + private static string GetLatestBakeryPath(string toolPath) + { + var directories = Directory.GetDirectories(toolPath, "cake.bakery*", SearchOption.TopDirectoryOnly); + + // TODO: Sort by semantic version? + return directories.OrderByDescending(x => x).FirstOrDefault(); + } } } From f616e2e6a6eecd03542b65bee8d7f533158196c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Bj=C3=B6rkstr=C3=B6m?= Date: Tue, 22 Aug 2017 22:52:51 +0300 Subject: [PATCH 19/38] Fix translation of lines for requests and responses --- .../Extensions/RequestExtensions.cs | 2 +- .../Extensions/ResponseExtensions.cs | 23 +++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/OmniSharp.Cake/Extensions/RequestExtensions.cs b/src/OmniSharp.Cake/Extensions/RequestExtensions.cs index 5dd051eb0d..1091386135 100644 --- a/src/OmniSharp.Cake/Extensions/RequestExtensions.cs +++ b/src/OmniSharp.Cake/Extensions/RequestExtensions.cs @@ -9,7 +9,7 @@ internal static class RequestExtensions { public static async Task TranslateAsync(this TRequest request, OmniSharpWorkspace workspace) where TRequest : Request { - var offset = await LineOffsetHelper.GetOffset(request.FileName, request.Line, workspace); + var offset = await LineOffsetHelper.GetOffset(request.FileName, request.Line + 1, workspace); request.Line += offset; diff --git a/src/OmniSharp.Cake/Extensions/ResponseExtensions.cs b/src/OmniSharp.Cake/Extensions/ResponseExtensions.cs index 4e0ae289fc..55085f7054 100644 --- a/src/OmniSharp.Cake/Extensions/ResponseExtensions.cs +++ b/src/OmniSharp.Cake/Extensions/ResponseExtensions.cs @@ -17,11 +17,19 @@ public static Task TranslateAsync(this QuickFixResponse respon public static async Task TranslateAsync(this QuickFixResponse response, OmniSharpWorkspace workspace, Request request) { + var quickFixes = new List(); + foreach (var quickFix in response.QuickFixes) { await quickFix.TranslateAsync(workspace, request); + + if (quickFix.Line >= 0) + { + quickFixes.Add(quickFix); + } } + response.QuickFixes = quickFixes; return response; } @@ -45,23 +53,38 @@ public static async Task TranslateAsync(this NavigateResponse public static async Task TranslateAsync(this FileMemberTree response, OmniSharpWorkspace workspace, Request request) { + var topLevelTypeDefinitions = new List(); + foreach (var topLevelTypeDefinition in response.TopLevelTypeDefinitions) { await topLevelTypeDefinition.TranslateAsync(workspace, request); + + if (topLevelTypeDefinition.Location.Line >= 0) + { + topLevelTypeDefinitions.Add(topLevelTypeDefinition); + } } + response.TopLevelTypeDefinitions = topLevelTypeDefinitions; return response; } private static async Task TranslateAsync(this FileMemberElement element, OmniSharpWorkspace workspace, Request request) { element.Location = await element.Location.TranslateAsync(workspace, request); + var childNodes = new List(); foreach (var childNode in element.ChildNodes) { await childNode.TranslateAsync(workspace, request); + + if (childNode.Location.Line >= 0) + { + childNodes.Add(childNode); + } } + element.ChildNodes = childNodes; return element; } From e7b24c42e216c7f653bb93875f59e9ef21972c27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Bj=C3=B6rkstr=C3=B6m?= Date: Fri, 25 Aug 2017 00:53:45 +0300 Subject: [PATCH 20/38] Added unit test project and fixed some translations. --- OmniSharp.sln | 15 + src/OmniSharp.Cake/AssemblyInfo.cs | 3 + .../Extensions/RequestExtensions.cs | 4 +- .../Extensions/ResponseExtensions.cs | 32 +- .../Navigation/GotoDefinitionHandler.cs | 3 +- .../Utilities/LineIndexHelper.cs | 97 + .../Utilities/LineOffsetHelper.cs | 49 - .../LineIndexHelperFacts.cs | 112 + .../OmniSharp.Cake.Tests.csproj | 36 + .../TestAssets/multi.cake.g.txt | 8237 +++++++++++++++++ .../TestAssets/multi.cake.txt | 15 + .../TestAssets/single.cake.g.txt | 8220 ++++++++++++++++ .../TestAssets/single.cake.txt | 12 + 13 files changed, 16767 insertions(+), 68 deletions(-) create mode 100644 src/OmniSharp.Cake/AssemblyInfo.cs create mode 100644 src/OmniSharp.Cake/Utilities/LineIndexHelper.cs delete mode 100644 src/OmniSharp.Cake/Utilities/LineOffsetHelper.cs create mode 100644 tests/OmniSharp.Cake.Tests/LineIndexHelperFacts.cs create mode 100644 tests/OmniSharp.Cake.Tests/OmniSharp.Cake.Tests.csproj create mode 100644 tests/OmniSharp.Cake.Tests/TestAssets/multi.cake.g.txt create mode 100644 tests/OmniSharp.Cake.Tests/TestAssets/multi.cake.txt create mode 100644 tests/OmniSharp.Cake.Tests/TestAssets/single.cake.g.txt create mode 100644 tests/OmniSharp.Cake.Tests/TestAssets/single.cake.txt diff --git a/OmniSharp.sln b/OmniSharp.sln index c3097eb107..b7bc67dc63 100644 --- a/OmniSharp.sln +++ b/OmniSharp.sln @@ -71,6 +71,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OmniSharp.DotNet.ProjectMod 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 @@ -345,6 +347,18 @@ Global {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 @@ -372,6 +386,7 @@ Global {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} diff --git a/src/OmniSharp.Cake/AssemblyInfo.cs b/src/OmniSharp.Cake/AssemblyInfo.cs new file mode 100644 index 0000000000..f054e8c848 --- /dev/null +++ b/src/OmniSharp.Cake/AssemblyInfo.cs @@ -0,0 +1,3 @@ +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("OmniSharp.Cake.Tests")] diff --git a/src/OmniSharp.Cake/Extensions/RequestExtensions.cs b/src/OmniSharp.Cake/Extensions/RequestExtensions.cs index 1091386135..87ea1ea7eb 100644 --- a/src/OmniSharp.Cake/Extensions/RequestExtensions.cs +++ b/src/OmniSharp.Cake/Extensions/RequestExtensions.cs @@ -9,9 +9,7 @@ internal static class RequestExtensions { public static async Task TranslateAsync(this TRequest request, OmniSharpWorkspace workspace) where TRequest : Request { - var offset = await LineOffsetHelper.GetOffset(request.FileName, request.Line + 1, workspace); - - request.Line += offset; + request.Line = await LineIndexHelper.TranslateToGenerated(request.FileName, request.Line, workspace); return request; } diff --git a/src/OmniSharp.Cake/Extensions/ResponseExtensions.cs b/src/OmniSharp.Cake/Extensions/ResponseExtensions.cs index 55085f7054..282ee40712 100644 --- a/src/OmniSharp.Cake/Extensions/ResponseExtensions.cs +++ b/src/OmniSharp.Cake/Extensions/ResponseExtensions.cs @@ -33,30 +33,27 @@ public static async Task TranslateAsync(this QuickFixResponse return response; } - public static async Task TranslateAsync(this GotoDefinitionResponse response, OmniSharpWorkspace workspace) - { - var offset = await LineOffsetHelper.GetOffset(response.FileName, response.Line, workspace); - - response.Line -= offset; - - return response; - } - public static async Task TranslateAsync(this NavigateResponse response, OmniSharpWorkspace workspace, Request request) { - var offset = await LineOffsetHelper.GetOffset(request.FileName, response.Line, workspace); + var (line, _) = await LineIndexHelper.TranslateFromGenerated(request.FileName, response.Line, workspace, true); - response.Line -= offset; + response.Line = line; return response; } public static async Task TranslateAsync(this FileMemberTree response, OmniSharpWorkspace workspace, Request request) { + var zeroIndex = await LineIndexHelper.TranslateToGenerated(request.FileName, 0, workspace); var topLevelTypeDefinitions = new List(); foreach (var topLevelTypeDefinition in response.TopLevelTypeDefinitions) { + if (topLevelTypeDefinition.Location.Line < zeroIndex) + { + continue; + } + await topLevelTypeDefinition.TranslateAsync(workspace, request); if (topLevelTypeDefinition.Location.Line >= 0) @@ -90,17 +87,22 @@ private static async Task TranslateAsync(this FileMemberEleme private static async Task TranslateAsync(this QuickFix quickFix, OmniSharpWorkspace workspace, Request request) { - var fileName = !string.IsNullOrEmpty(quickFix.FileName) ? quickFix.FileName : request.FileName; + var sameFile = string.IsNullOrEmpty(quickFix.FileName); + var fileName = !sameFile ? quickFix.FileName : request.FileName; if (string.IsNullOrEmpty(fileName)) { return quickFix; } - var offset = await LineOffsetHelper.GetOffset(fileName, quickFix.Line, workspace); + var (line, newFileName) = await LineIndexHelper.TranslateFromGenerated(fileName, quickFix.Line, workspace, sameFile); + + quickFix.Line = line; + quickFix.FileName = newFileName; + + (line, _) = await LineIndexHelper.TranslateFromGenerated(fileName, quickFix.EndLine, workspace, sameFile); - quickFix.Line -= offset; - quickFix.EndLine -= offset; + quickFix.EndLine = line; return quickFix; } diff --git a/src/OmniSharp.Cake/Services/RequestHandlers/Navigation/GotoDefinitionHandler.cs b/src/OmniSharp.Cake/Services/RequestHandlers/Navigation/GotoDefinitionHandler.cs index fffe8d45df..231f8a8455 100644 --- a/src/OmniSharp.Cake/Services/RequestHandlers/Navigation/GotoDefinitionHandler.cs +++ b/src/OmniSharp.Cake/Services/RequestHandlers/Navigation/GotoDefinitionHandler.cs @@ -18,7 +18,8 @@ public GotoDefinitionHandler( protected override Task TranslateResponse(GotoDefinitionResponse response, GotoDefinitionRequest request) { - return response.TranslateAsync(Workspace); + // TODO: If outside range, it's an alias. Then fetch metadata. + return Task.FromResult(response); } } } diff --git a/src/OmniSharp.Cake/Utilities/LineIndexHelper.cs b/src/OmniSharp.Cake/Utilities/LineIndexHelper.cs new file mode 100644 index 0000000000..bd3fa6dbf4 --- /dev/null +++ b/src/OmniSharp.Cake/Utilities/LineIndexHelper.cs @@ -0,0 +1,97 @@ +using System; +using System.IO; +using System.Threading.Tasks; + +namespace OmniSharp.Cake.Utilities +{ + internal static class LineIndexHelper + { + public static async Task TranslateToGenerated(string fileName, int index, OmniSharpWorkspace workspace) + { + if (string.IsNullOrEmpty(fileName)) + { + return index; + } + + var document = workspace.GetDocument(fileName); + if (document == null) + { + return index; + } + + var fullPath = Path.GetFullPath(fileName).Replace('\\', '/'); + var sourceText = await document.GetTextAsync(); + for (var i = sourceText.Lines.Count - 1; i >= 0; i--) + { + var text = sourceText.Lines[i].ToString(); + + if (!text.StartsWith("#line ") || !text.EndsWith($" \"{fullPath}\"")) + { + continue; + } + + var tokens = text.Split(' '); + if (tokens.Length <= 2 || !int.TryParse(tokens[1], out int lineNumber)) + { + continue; + } + lineNumber--; + if (index >= lineNumber) + { + return sourceText.Lines[i].LineNumber - lineNumber + index + 1; + } + } + + return index; + } + + public static async Task<(int, string)> TranslateFromGenerated(string fileName, int index, OmniSharpWorkspace workspace, bool sameFile) + { + if (string.IsNullOrEmpty(fileName)) + { + return (-1, fileName); + } + + fileName = fileName.Replace('/', '\\'); + var document = workspace.GetDocument(fileName); + if (document == null) + { + return (-1, fileName); + } + + var sourceText = await document.GetTextAsync(); + if (index > sourceText.Lines.Count) + { + return (-1, fileName); + } + + for (var i = index; i >= 0; i--) + { + var text = sourceText.Lines[i].ToString(); + + if (!text.StartsWith("#line ")) + { + continue; + } + + var tokens = text.Split(new[] {' '}, 3, StringSplitOptions.RemoveEmptyEntries); + if (tokens.Length < 3 || !int.TryParse(tokens[1], out int lineNumber)) + { + continue; + } + + var newFileName = tokens[2].Trim('"').Replace('/', '\\'); + if (sameFile && !newFileName.Equals(fileName)) + { + return (-1, fileName); + } + + var newIndex = lineNumber - 2 + (index - i); + + return (newIndex, newFileName); + } + + return (-1, fileName); + } + } +} diff --git a/src/OmniSharp.Cake/Utilities/LineOffsetHelper.cs b/src/OmniSharp.Cake/Utilities/LineOffsetHelper.cs deleted file mode 100644 index a6bbb7b718..0000000000 --- a/src/OmniSharp.Cake/Utilities/LineOffsetHelper.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Threading.Tasks; - -namespace OmniSharp.Cake.Utilities -{ - internal static class LineOffsetHelper - { - public static async Task GetOffset(string fileName, int target, OmniSharpWorkspace workspace) - { - if (string.IsNullOrEmpty(fileName)) - { - return 0; - } - - var document = workspace.GetDocument(fileName); - if (document == null) - { - return 0; - } - - var fullPath = Path.GetFullPath(fileName).Replace('\\','/'); - var sourceText = await document.GetTextAsync(); - - for (var i = sourceText.Lines.Count - 1; i >= 0; i--) - { - var text = sourceText.Lines[i].ToString(); - - if (!text.StartsWith("#line ") || !text.EndsWith($" \"{fullPath}\"")) - { - continue; - } - - var tokens = text.Split(' '); - if (tokens.Length <= 2 || !int.TryParse(tokens[1], out int lineNumber)) - { - continue; - } - if (target >= lineNumber) - { - return sourceText.Lines[i].LineNumber - lineNumber + 2; - } - } - - return 0; - } - } -} diff --git a/tests/OmniSharp.Cake.Tests/LineIndexHelperFacts.cs b/tests/OmniSharp.Cake.Tests/LineIndexHelperFacts.cs new file mode 100644 index 0000000000..baa2c916ba --- /dev/null +++ b/tests/OmniSharp.Cake.Tests/LineIndexHelperFacts.cs @@ -0,0 +1,112 @@ +using System; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.Text; +using Microsoft.Extensions.Logging; +using OmniSharp.Cake.Utilities; +using OmniSharp.Services; +using Xunit; + +namespace OmniSharp.Cake.Tests +{ + public class LineIndexHelperFacts + { + private static Assembly Assembly => typeof(LineIndexHelperFacts).GetTypeInfo().Assembly; + private static string ResourcePath => "OmniSharp.Cake.Tests.TestAssets"; + + private static string SingleCakePath => @"C:\Work\single.cake"; + + private static string MultiCakePath => @"C:\Work\multi.cake"; + + private static string GetResourceContent(string resourceName) + { + using (var stream = Assembly.GetManifestResourceStream(resourceName)) + { + if (stream == null) + { + throw new InvalidOperationException("Could not load manifest resource stream."); + } + using (var reader = new StreamReader(stream)) + { + return reader.ReadToEnd().TrimEnd('\r', '\n'); + } + } + } + + private static string GetGeneratedFileContent(string name) + { + return GetResourceContent($"{ResourcePath}.{Path.GetFileName(name)}.g.txt"); + } + + private static string GetFileContent(string name) + { + return GetResourceContent($"{ResourcePath}.{Path.GetFileName(name)}.txt"); + } + + private static OmniSharpWorkspace CreateSimpleWorkspace(string fileName, string contents) + { + var workspace = new OmniSharpWorkspace( + new HostServicesAggregator( + Enumerable.Empty(), new LoggerFactory())); + + var projectInfo = ProjectInfo.Create(ProjectId.CreateNewId(), VersionStamp.Create(), + "ProjectNameVal", "AssemblyNameVal", LanguageNames.CSharp); + + var documentInfo = DocumentInfo.Create(DocumentId.CreateNewId(projectInfo.Id), fileName, + null, SourceCodeKind.Regular, + TextLoader.From(TextAndVersion.Create(SourceText.From(contents), VersionStamp.Create())), + fileName); + + workspace.AddProject(projectInfo); + workspace.AddDocument(documentInfo); + + return workspace; + } + + [Theory] + [InlineData(0, 8208)] + [InlineData(7, 8215)] + public async Task TranslateToGenerated_Should_Translate_Index_In_Single_File(int index, int expected) + { + var fileName = SingleCakePath; + var workspace = CreateSimpleWorkspace(fileName, GetGeneratedFileContent(fileName)); + + var actual = await LineIndexHelper.TranslateToGenerated(fileName, index, workspace); + + Assert.Equal(expected, actual); + Assert.Equal(GetFileContent(fileName).Split('\n')[index], + GetGeneratedFileContent(fileName).Split('\n')[actual]); + } + + [Theory] + [InlineData(8208, 0)] + [InlineData(8215, 7)] + public async Task TranslateFromGenerated_Should_Translate_Index_In_Single_File(int index, int expected) + { + var fileName = SingleCakePath; + var workspace = CreateSimpleWorkspace(fileName, GetGeneratedFileContent(fileName)); + + var (actualIndex, actualFileName) = await LineIndexHelper.TranslateFromGenerated(fileName, index, workspace, true); + + Assert.Equal(expected, actualIndex); + Assert.Equal(GetGeneratedFileContent(fileName).Split('\n')[index], + GetFileContent(actualFileName).Split('\n')[actualIndex]); + } + + [Fact] + public async Task TranslateFromGenerated_Should_Translate_To_Negative_If_Outside_Bounds() + { + const int index = 8206; + const int expected = -1; + var fileName = SingleCakePath; + var workspace = CreateSimpleWorkspace(fileName, GetGeneratedFileContent(fileName)); + + var (actualIndex, _) = await LineIndexHelper.TranslateFromGenerated(fileName, index, workspace, true); + + Assert.Equal(expected, actualIndex); + } + } +} diff --git a/tests/OmniSharp.Cake.Tests/OmniSharp.Cake.Tests.csproj b/tests/OmniSharp.Cake.Tests/OmniSharp.Cake.Tests.csproj new file mode 100644 index 0000000000..6ff2c27368 --- /dev/null +++ b/tests/OmniSharp.Cake.Tests/OmniSharp.Cake.Tests.csproj @@ -0,0 +1,36 @@ + + + + net46 + true + AnyCPU + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/OmniSharp.Cake.Tests/TestAssets/multi.cake.g.txt b/tests/OmniSharp.Cake.Tests/TestAssets/multi.cake.g.txt new file mode 100644 index 0000000000..6bdae180a1 --- /dev/null +++ b/tests/OmniSharp.Cake.Tests/TestAssets/multi.cake.g.txt @@ -0,0 +1,8237 @@ +/// +/// Determines whether or not the specified argument exist. +/// +/// The context. +/// The argument name. +/// Whether or not the specified argument exist. +/// +/// This sample shows how to call the method. +/// +/// var argumentName = "myArgument"; +/// //Cake.exe .\hasargument.cake -myArgument="is specified" +/// if (HasArgument(argumentName)) +/// { +/// Information("{0} is specified", argumentName); +/// } +/// //Cake.exe .\hasargument.cake +/// else +/// { +/// Warning("{0} not specified", argumentName); +/// } +/// +/// +public System.Boolean HasArgument(System.String name) +{ + return Cake.Common.ArgumentAliases.HasArgument(Context, name); +} + +/// +/// Gets an argument and throws if the argument is missing. +/// +/// The argument type. +/// The context. +/// The argument name. +/// The value of the argument. +/// +/// +/// //Cake.exe .\argument.cake -myArgument="is valid" -loopCount = 5 +/// Information("Argument {0}", Argument<string>("myArgument")); +/// var loopCount = Argument<int>("loopCount"); +/// for(var index = 0;index<loopCount; index++) +/// { +/// Information("Index {0}", index); +/// } +/// +/// +/// Argument value is null. +/// +/// is null. +public T Argument(System.String name) +{ + return Cake.Common.ArgumentAliases.Argument(Context, name); +} + +/// +/// Gets an argument and returns the provided if the argument is missing. +/// +/// The argument type. +/// The context. +/// The argument name. +/// The value to return if the argument is missing. +/// The value of the argument if it exist; otherwise . +/// +/// +/// //Cake.exe .\argument.cake -myArgument="is valid" -loopCount = 5 +/// Information("Argument {0}", Argument<string>("myArgument", "is NOT valid")); +/// var loopCount = Argument<int>("loopCount", 10); +/// for(var index = 0;index<loopCount; index++) +/// { +/// Information("Index {0}", index); +/// } +/// +/// +public T Argument(System.String name, T defaultValue) +{ + return Cake.Common.ArgumentAliases.Argument(Context, name, defaultValue); +} + +/// +/// Retrieves the value of the environment variable or null if the environment variable does not exist. +/// +/// +/// +/// Information(EnvironmentVariable("HOME") ?? "Unknown location"); +/// +/// +/// The context. +/// The environment variable. +/// The environment variable or null if the environment variable does not exist. +public System.String EnvironmentVariable(System.String variable) +{ + return Cake.Common.EnvironmentAliases.EnvironmentVariable(Context, variable); +} + +/// +/// Retrieves all environment variables +/// +/// +/// +/// var envVars = EnvironmentVariables(); +/// +/// string path; +/// if (envVars.TryGetValue("PATH", out path)) +/// { +/// Information("Path: {0}", path); +/// } +/// +/// foreach(var envVar in envVars) +/// { +/// Information( +/// "Key: {0}\tValue: \"{1}\"", +/// envVar.Key, +/// envVar.Value +/// ); +/// } +/// +/// +/// The context. +/// The environment variables +public System.Collections.Generic.IDictionary EnvironmentVariables() +{ + return Cake.Common.EnvironmentAliases.EnvironmentVariables(Context); +} + +/// +/// Checks for the existence of a value for a given environment variable. +/// +/// +/// +/// if (HasEnvironmentVariable("SOME_ENVIRONMENT_VARIABLE")) +/// { +/// Information("The environment variable was present."); +/// } +/// +/// +/// The context. +/// The environment variable. +/// +/// true if the environment variable exist; otherwise false. +/// +public System.Boolean HasEnvironmentVariable(System.String variable) +{ + return Cake.Common.EnvironmentAliases.HasEnvironmentVariable(Context, variable); +} + +/// +/// Determines whether the build script is running on Windows. +/// +/// +/// +/// if (IsRunningOnWindows()) +/// { +/// Information("Windows!"); +/// } +/// +/// +/// The context. +/// +/// true if the build script is running on Windows; otherwise false. +/// +public System.Boolean IsRunningOnWindows() +{ + return Cake.Common.EnvironmentAliases.IsRunningOnWindows(Context); +} + +/// +/// Determines whether the build script running on a Unix or Linux based system. +/// +/// +/// +/// if (IsRunningOnUnix()) +/// { +/// Information("Not Windows!"); +/// } +/// +/// +/// The context. +/// +/// true if the build script running on a Unix or Linux based system; otherwise false. +/// +public System.Boolean IsRunningOnUnix() +{ + return Cake.Common.EnvironmentAliases.IsRunningOnUnix(Context); +} + +/// +/// Starts the process resource that is specified by the filename. +/// +/// The context. +/// The file name. +/// The exit code that the started process specified when it terminated. +/// +/// +/// var exitCodeWithoutArguments = StartProcess("ping"); +/// // This should output 1 as argument is missing +/// Information("Exit code: {0}", exitCodeWithoutArguments); +/// +/// +public System.Int32 StartProcess(Cake.Core.IO.FilePath fileName) +{ + return Cake.Common.ProcessAliases.StartProcess(Context, fileName); +} + +/// +/// Starts the process resource that is specified by the filename and arguments +/// +/// The context. +/// Name of the file. +/// The arguments used in the process settings. +/// The exit code that the started process specified when it terminated. +/// +/// +/// var exitCodeWithArgument = StartProcess("ping", "localhost"); +/// // This should output 0 as valid arguments supplied +/// Information("Exit code: {0}", exitCodeWithArgument); +/// +/// +public System.Int32 StartProcess(Cake.Core.IO.FilePath fileName, System.String processArguments) +{ + return Cake.Common.ProcessAliases.StartProcess(Context, fileName, processArguments); +} + +/// +/// Starts the process resource that is specified by the filename and settings. +/// +/// The context. +/// Name of the file. +/// The settings. +/// The exit code that the started process specified when it terminated. +/// +/// +/// var exitCodeWithArgument = StartProcess("ping", new ProcessSettings{ Arguments = "localhost" }); +/// // This should output 0 as valid arguments supplied +/// Information("Exit code: {0}", exitCodeWithArgument); +/// +/// +public System.Int32 StartProcess(Cake.Core.IO.FilePath fileName, Cake.Core.IO.ProcessSettings settings) +{ + return Cake.Common.ProcessAliases.StartProcess(Context, fileName, settings); +} + +public System.Int32 StartProcess(Cake.Core.IO.FilePath fileName, Cake.Core.IO.ProcessSettings settings, out System.Collections.Generic.IEnumerable redirectedStandardOutput) +{ + return Cake.Common.ProcessAliases.StartProcess(Context, fileName, settings, out redirectedStandardOutput); +} + +public System.Int32 StartProcess(Cake.Core.IO.FilePath fileName, Cake.Core.IO.ProcessSettings settings, out System.Collections.Generic.IEnumerable redirectedStandardOutput, out System.Collections.Generic.IEnumerable redirectedErrorOutput) +{ + return Cake.Common.ProcessAliases.StartProcess(Context, fileName, settings, out redirectedStandardOutput, out redirectedErrorOutput); +} + +/// +/// Starts the process resource that is specified by the filename and settings. +/// +/// The context. +/// Name of the file. +/// The settings. +/// The newly started process. +/// +/// +/// using(var process = StartAndReturnProcess("ping", new ProcessSettings{ Arguments = "localhost" })) +/// { +/// process.WaitForExit(); +/// // This should output 0 as valid arguments supplied +/// Information("Exit code: {0}", process.GetExitCode()); +/// } +/// +/// +/// +/// , , or is null. +public Cake.Core.IO.IProcess StartAndReturnProcess(Cake.Core.IO.FilePath fileName, Cake.Core.IO.ProcessSettings settings) +{ + return Cake.Common.ProcessAliases.StartAndReturnProcess(Context, fileName, settings); +} + +/// +/// Starts the process resource that is specified by the filename. +/// +/// The context. +/// Name of the file. +/// The newly started process. +/// +/// +/// using(var process = StartAndReturnProcess("ping")) +/// { +/// process.WaitForExit(); +/// // This should output 0 as valid arguments supplied +/// Information("Exit code: {0}", process.GetExitCode()); +/// } +/// +/// +/// +/// , is null. +public Cake.Core.IO.IProcess StartAndReturnProcess(Cake.Core.IO.FilePath fileName) +{ + return Cake.Common.ProcessAliases.StartAndReturnProcess(Context, fileName); +} + +/// +/// Parses all release notes. +/// +/// The context. +/// The file path. +/// All release notes. +/// +/// +/// var releaseNotes = ParseAllReleaseNotes("./ReleaseNotes.md"); +/// foreach(var releaseNote in releaseNotes) +/// { +/// Information("Version: {0}", releaseNote.Version); +/// foreach(var note in releaseNote.Notes) +/// { +/// Information("\t{0}", note); +/// } +/// } +/// +/// +public System.Collections.Generic.IReadOnlyList ParseAllReleaseNotes(Cake.Core.IO.FilePath filePath) +{ + return Cake.Common.ReleaseNotesAliases.ParseAllReleaseNotes(Context, filePath); +} + +/// +/// Parses the latest release notes. +/// +/// The context. +/// The file path. +/// The latest release notes. +/// +/// +/// var releaseNote = ParseReleaseNotes("./ReleaseNotes.md"); +/// Information("Version: {0}", releaseNote.Version); +/// foreach(var note in releaseNote.Notes) +/// { +/// Information("\t{0}", note); +/// } +/// +/// +public Cake.Common.ReleaseNotes ParseReleaseNotes(Cake.Core.IO.FilePath filePath) +{ + return Cake.Common.ReleaseNotesAliases.ParseReleaseNotes(Context, filePath); +} + +/// +/// Gets the value of a target node. +/// +/// The value found at the given XPath query. +/// The context. +/// The target file. +/// The xpath of the node to get. +/// +/// +/// string autoFacVersion = XmlPeek("./src/Cake/packages.config", "/packages/package[@id='Autofac']/@version"); +/// +/// +public System.String XmlPeek(Cake.Core.IO.FilePath filePath, System.String xpath) +{ + return Cake.Common.Xml.XmlPeekAliases.XmlPeek(Context, filePath, xpath); +} + +/// +/// Get the value of a target node. +/// +/// The value found at the given XPath query. +/// The context. +/// The target file. +/// The xpath of the nodes to set. +/// Additional settings to tweak Xml Peek behavior. +/// +/// +/// XML document: +/// +/// +/// +/// +/// ]]> +/// +/// XmlPeek usage: +/// +/// string version = XmlPeek("./pastery.xml", "/pastery:pastery/pastery:cake/@price", +/// new XmlPeekSettings { +/// Namespaces = new Dictionary<string, string> {{ "pastery", "https://cakebuild.net/pastery" }} +/// }); +/// string unknown = XmlPeek("./pastery.xml", "/pastery:pastery/pastery:cake/@recipe", +/// new XmlPeekSettings { +/// Namespaces = new Dictionary<string, string> {{ "pastery", "https://cakebuild.net/pastery" }}, +/// SuppressWarning = true +/// }); +/// +/// +public System.String XmlPeek(Cake.Core.IO.FilePath filePath, System.String xpath, Cake.Common.Xml.XmlPeekSettings settings) +{ + return Cake.Common.Xml.XmlPeekAliases.XmlPeek(Context, filePath, xpath, settings); +} + +/// +/// Set the value of, or remove, target nodes. +/// +/// The context. +/// The target file. +/// The xpath of the nodes to set. +/// The value to set too. Leave blank to remove the selected nodes. +/// +/// +/// Change the server setting in the configuration from testhost.somecompany.com +/// to productionhost.somecompany.com. +/// +/// XML file: +/// +/// +/// +/// +/// +/// +/// +/// ]]> +/// +/// Cake Task: +/// +/// +/// { +/// var file = File("test.xml"); +/// XmlPoke(file, "/configuration/appSettings/add[@key = 'server']/@value", "productionhost.somecompany.com"); +/// }); +/// ]]> +/// +/// +/// +/// +/// Modify the noNamespaceSchemaLocation in an XML file. +/// +/// XML file: +/// +/// +/// +/// +/// ]]> +/// +/// Cake Task: +/// +/// +/// { +/// var file = File("test.xml"); +/// XmlPoke(file, "/Commands/@xsi:noNamespaceSchemaLocation", "d:\\Commands.xsd", new XmlPokeSettings { +/// Namespaces = new Dictionary { +/// { /* Prefix */ "xsi", /* URI */ "http://www.w3.org/2001/XMLSchema-instance" } +/// } +/// }); +/// }); +/// ]]> +/// +/// +/// +/// Remove an app setting from a config file. +/// +/// XML file: +/// +/// +/// +/// +/// +/// +/// +/// +/// ]]> +/// +/// Cake Task: +/// +/// +/// { +/// var file = File("test.xml"); +/// XmlPoke(file, "/configuration/appSettings/add[@testing]", null); +/// }); +/// ]]> +/// +/// +/// +/// Credit to NAnt for the original example. +/// http://nant.sourceforge.net/release/latest/help/tasks/xmlpoke.html +/// +/// +public void XmlPoke(Cake.Core.IO.FilePath filePath, System.String xpath, System.String value) +{ + Cake.Common.Xml.XmlPokeAliases.XmlPoke(Context, filePath, xpath, value); +} + +/// +/// Set the value of, or remove, target nodes. +/// +/// The context. +/// The target file. +/// The xpath of the nodes to set. +/// The value to set too. Leave blank to remove the selected nodes. +/// Additional settings to tweak Xml Poke behavior. +/// +/// +/// Change the server setting in the configuration from testhost.somecompany.com +/// to productionhost.somecompany.com. +/// +/// XML file: +/// +/// +/// +/// +/// +/// +/// +/// ]]> +/// +/// Cake Task: +/// +/// +/// { +/// var file = File("test.xml"); +/// XmlPoke(file, "/configuration/appSettings/add[@key = 'server']/@value", "productionhost.somecompany.com"); +/// }); +/// ]]> +/// +/// +/// +/// +/// Modify the noNamespaceSchemaLocation in an XML file. +/// +/// XML file: +/// +/// +/// +/// +/// ]]> +/// +/// Cake Task: +/// +/// +/// { +/// var file = File("test.xml"); +/// XmlPoke(file, "/Commands/@xsi:noNamespaceSchemaLocation", "d:\\Commands.xsd", new XmlPokeSettings { +/// Namespaces = new Dictionary { +/// { /* Prefix */ "xsi", /* URI */ "http://www.w3.org/2001/XMLSchema-instance" } +/// } +/// }); +/// }); +/// ]]> +/// +/// +/// +/// Remove an app setting from a config file. +/// +/// XML file: +/// +/// +/// +/// +/// +/// +/// +/// +/// ]]> +/// +/// Cake Task: +/// +/// +/// { +/// var file = File("test.xml"); +/// XmlPoke(file, "/configuration/appSettings/add[@testing]", null); +/// }); +/// ]]> +/// +/// +/// +/// Credit to NAnt for the original example. +/// http://nant.sourceforge.net/release/latest/help/tasks/xmlpoke.html +/// +/// +public void XmlPoke(Cake.Core.IO.FilePath filePath, System.String xpath, System.String value, Cake.Common.Xml.XmlPokeSettings settings) +{ + Cake.Common.Xml.XmlPokeAliases.XmlPoke(Context, filePath, xpath, value, settings); +} + +/// +/// Set the value of, or remove, target nodes. +/// +/// The context. +/// The source xml to transform. +/// The xpath of the nodes to set. +/// The value to set too. Leave blank to remove the selected nodes. +/// Resulting XML. +/// +/// +/// Change the server setting in the configuration from testhost.somecompany.com +/// to productionhost.somecompany.com. +/// +/// XML string: +/// +/// +/// +/// +/// +/// +/// +/// ]]> +/// +/// Cake Task: +/// +/// +/// { +/// var result = XmlPokeString(xmlString, "/configuration/appSettings/add[@key = 'server']/@value", "productionhost.somecompany.com"); +/// }); +/// ]]> +/// +/// +/// +/// +/// Modify the noNamespaceSchemaLocation in an XML file. +/// +/// XML string: +/// +/// +/// +/// +/// ]]> +/// +/// Cake Task: +/// +/// +/// { +/// var result = XmlPokeString(xmlString, "/Commands/@xsi:noNamespaceSchemaLocation", "d:\\Commands.xsd", new XmlPokeSettings { +/// Namespaces = new Dictionary { +/// { /* Prefix */ "xsi", /* URI */ "http://www.w3.org/2001/XMLSchema-instance" } +/// } +/// }); +/// }); +/// ]]> +/// +/// +/// +/// Remove an app setting from a config file. +/// +/// XML string: +/// +/// +/// +/// +/// +/// +/// +/// +/// ]]> +/// +/// Cake Task: +/// +/// +/// { +/// var result = XmlPokeString(xmlString, "/configuration/appSettings/add[@testing]", null); +/// }); +/// ]]> +/// +/// +/// +/// Credit to NAnt for the original example. +/// http://nant.sourceforge.net/release/latest/help/tasks/xmlpoke.html +/// +/// +public System.String XmlPokeString(System.String sourceXml, System.String xpath, System.String value) +{ + return Cake.Common.Xml.XmlPokeAliases.XmlPokeString(Context, sourceXml, xpath, value); +} + +/// +/// Set the value of, or remove, target nodes. +/// +/// The context. +/// The source xml to transform. +/// The xpath of the nodes to set. +/// The value to set too. Leave blank to remove the selected nodes. +/// Additional settings to tweak Xml Poke behavior. +/// Resulting XML. +/// +/// +/// Change the server setting in the configuration from testhost.somecompany.com +/// to productionhost.somecompany.com. +/// +/// XML string: +/// +/// +/// +/// +/// +/// +/// +/// ]]> +/// +/// Cake Task: +/// +/// +/// { +/// var result = XmlPokeString(xmlString, "/configuration/appSettings/add[@key = 'server']/@value", "productionhost.somecompany.com"); +/// }); +/// ]]> +/// +/// +/// +/// +/// Modify the noNamespaceSchemaLocation in an XML file. +/// +/// XML string: +/// +/// +/// +/// +/// ]]> +/// +/// Cake Task: +/// +/// +/// { +/// var result = XmlPokeString(xmlString, "/Commands/@xsi:noNamespaceSchemaLocation", "d:\\Commands.xsd", new XmlPokeSettings { +/// Namespaces = new Dictionary { +/// { /* Prefix */ "xsi", /* URI */ "http://www.w3.org/2001/XMLSchema-instance" } +/// } +/// }); +/// }); +/// ]]> +/// +/// +/// +/// Remove an app setting from a config file. +/// +/// XML string: +/// +/// +/// +/// +/// +/// +/// +/// +/// ]]> +/// +/// Cake Task: +/// +/// +/// { +/// var result = XmlPokeString(xmlString, "/configuration/appSettings/add[@testing]", null); +/// }); +/// ]]> +/// +/// +/// +/// Credit to NAnt for the original example. +/// http://nant.sourceforge.net/release/latest/help/tasks/xmlpoke.html +/// +/// +public System.String XmlPokeString(System.String sourceXml, System.String xpath, System.String value, Cake.Common.Xml.XmlPokeSettings settings) +{ + return Cake.Common.Xml.XmlPokeAliases.XmlPokeString(Context, sourceXml, xpath, value, settings); +} + +/// +/// Performs XML XSL transformation +/// +/// The context. +/// XML style sheet. +/// XML data. +/// Transformed XML string. +/// +/// +/// This example code will convert xml to a new xml strucure using XmlTransform alias. +/// +/// +/// +/// +/// +/// +/// +/// "; +/// +/// string xml = @" +/// +/// +/// "; +/// +/// var priceTag = XmlTransform(xsl, xml); +/// ]]> +/// +/// Result: +/// +/// 1.62]]> +/// +/// +public System.String XmlTransform(System.String xsl, System.String xml) +{ + return Cake.Common.Xml.XmlTransformationAlias.XmlTransform(Context, xsl, xml); +} + +/// +/// Performs XML XSL transformation +/// +/// The context. +/// XML style sheet. +/// XML data. +/// Optional settings for result file xml writer +/// Transformed XML string. +/// +/// +/// This example code will convert specific part of xml to plaintext using XmlTransform alias. +/// +/// +/// +/// +/// "; +/// +/// string xml = @" +/// +/// +/// "; +/// +/// var text = XmlTransform(xsl, xml, new XmlTransformationSettings { +/// ConformanceLevel = System.Xml.ConformanceLevel.Fragment, Encoding = Encoding.ASCII }); +/// ]]> +/// +/// +public System.String XmlTransform(System.String xsl, System.String xml, Cake.Common.Xml.XmlTransformationSettings settings) +{ + return Cake.Common.Xml.XmlTransformationAlias.XmlTransform(Context, xsl, xml, settings); +} + +/// +/// Performs XML XSL transformation +/// +/// The context. +/// Path to xml style sheet. +/// Path xml data. +/// Transformation result path, will overwrite if exists. +/// +/// +/// This example code will convert the Cake nuspec into html using the XmlTransform alias. +/// XML stylesheet: +/// +/// +/// +/// +/// +/// +/// +/// <xsl:for-each select="package/p:metadata"> +/// <xsl:value-of select="p:id"/> +/// </xsl:for-each> +/// +/// +/// +/// +///

+/// +///

+///

Description

+/// +///
+///

Files

+///
    +/// +///
  • +///
    +///
+/// +/// +///
+///
+/// ]]> +///
+/// XmlTransform usage: +/// +/// XmlTransform("./nuspec.xsl", "./nuspec/Cake.nuspec", "./Cake.htm"); +/// +///
+public void XmlTransform(Cake.Core.IO.FilePath xslPath, Cake.Core.IO.FilePath xmlPath, Cake.Core.IO.FilePath resultPath) +{ + Cake.Common.Xml.XmlTransformationAlias.XmlTransform(Context, xslPath, xmlPath, resultPath); +} + +/// +/// Performs XML XSL transformation +/// +/// The context. +/// Path to xml style sheet. +/// Path xml data. +/// Transformation result path. +/// Optional settings for result file xml writer +/// +/// +/// This example code will convert the Cake nuspec into html using the XmlTransform alias, +/// specifying that result should be indented and using Unicode encoding. +/// XML stylesheet: +/// +/// +/// +/// +/// +/// +/// +/// <xsl:for-each select="package/p:metadata"> +/// <xsl:value-of select="p:id"/> +/// </xsl:for-each> +/// +/// +/// +/// +///

+/// +///

+///

Description

+/// +///
+///

Files

+///
    +/// +///
  • +///
    +///
+/// +/// +///
+///
+/// ]]> +///
+/// XmlTransform usage: +/// +/// XmlTransform("./nuspec.xsl", "./nuspec/Cake.nuspec", "./Cake.htm", +/// new XmlTransformationSettings { Indent = true, Encoding = Encoding.Unicode}); +/// +///
+public void XmlTransform(Cake.Core.IO.FilePath xslPath, Cake.Core.IO.FilePath xmlPath, Cake.Core.IO.FilePath resultPath, Cake.Common.Xml.XmlTransformationSettings settings) +{ + Cake.Common.Xml.XmlTransformationAlias.XmlTransform(Context, xslPath, xmlPath, resultPath, settings); +} + +/// +/// Calculates the hash for a given file using the default (SHA256) algorithm. +/// +/// The context. +/// The file path. +/// A instance representing the calculated hash. +/// +/// +/// Information( +/// "Cake executable file SHA256 hash: {0}", +/// CalculateFileHash("Cake.exe").ToHex()); +/// +/// +public Cake.Common.Security.FileHash CalculateFileHash(Cake.Core.IO.FilePath filePath) +{ + return Cake.Common.Security.SecurityAliases.CalculateFileHash(Context, filePath); +} + +/// +/// Calculates the hash for a given file. +/// +/// The context. +/// The file path. +/// The hash algorithm to use. +/// A instance representing the calculated hash. +/// +/// +/// Information( +/// "Cake executable file MD5 hash: {0}", +/// CalculateFileHash("Cake.exe", HashAlgorithm.MD5).ToHex()); +/// +/// +public Cake.Common.Security.FileHash CalculateFileHash(Cake.Core.IO.FilePath filePath, Cake.Common.Security.HashAlgorithm hashAlgorithm) +{ + return Cake.Common.Security.SecurityAliases.CalculateFileHash(Context, filePath, hashAlgorithm); +} + +/// +/// Builds the specified solution using MSBuild or XBuild. +/// +/// +/// +/// DotNetBuild("./project/project.sln"); +/// +/// +/// The context. +/// The solution. +public void DotNetBuild(Cake.Core.IO.FilePath solution) +{ + Cake.Common.Tools.DotNetBuildAliases.DotNetBuild(Context, solution); +} + +/// +/// Builds the specified solution using MSBuild or XBuild. +/// +/// +/// +/// DotNetBuild("./project/project.sln", settings => +/// settings.SetConfiguration("Debug") +/// .SetVerbosity(Core.Diagnostics.Verbosity.Minimal) +/// .WithTarget("Build") +/// .WithProperty("TreatWarningsAsErrors","true")); +/// +/// +/// The context. +/// The solution. +/// The configurator. +public void DotNetBuild(Cake.Core.IO.FilePath solution, System.Action configurator) +{ + Cake.Common.Tools.DotNetBuildAliases.DotNetBuild(Context, solution, configurator); +} + +/// +/// Gets the legacy Visual Studio product installation paths. +/// +/// The context. +/// Get the latest version. +/// The Visual Studio installation path. +/// +/// +/// var legacyInstallationPath = VSWhereLegacy(true); +/// +/// +public Cake.Core.IO.DirectoryPath VSWhereLegacy(System.Boolean latest) +{ + return Cake.Common.Tools.VSWhere.VSWhereAliases.VSWhereLegacy(Context, latest); +} + +/// +/// Gets the legacy Visual Studio product installation paths. +/// +/// The context. +/// The settings. +/// The Visual Studio installation paths. +/// +/// +/// var legacyInstallationPaths = VSWhereLegacy(new VSWhereLegacySettings()); +/// +/// +public Cake.Core.IO.DirectoryPathCollection VSWhereLegacy(Cake.Common.Tools.VSWhere.Legacy.VSWhereLegacySettings settings) +{ + return Cake.Common.Tools.VSWhere.VSWhereAliases.VSWhereLegacy(Context, settings); +} + +/// +/// Gets the latest Visual Studio product installation path. +/// +/// The context. +/// The Visual Studio installation path. +/// +/// +/// var latestInstallationPath = VSWhereLatest(); +/// +/// +public Cake.Core.IO.DirectoryPath VSWhereLatest() +{ + return Cake.Common.Tools.VSWhere.VSWhereAliases.VSWhereLatest(Context); +} + +/// +/// Gets the latest Visual Studio product installation path. +/// +/// The context. +/// The settings. +/// The Visual Studio installation path. +/// +/// +/// var latestInstallationPath = VSWhereLatest(new VSWhereLatestSettings { Requires = "'Microsoft.Component.MSBuild" }); +/// +/// +public Cake.Core.IO.DirectoryPath VSWhereLatest(Cake.Common.Tools.VSWhere.Latest.VSWhereLatestSettings settings) +{ + return Cake.Common.Tools.VSWhere.VSWhereAliases.VSWhereLatest(Context, settings); +} + +/// +/// Gets all Visual Studio product installation paths. +/// +/// The context. +/// The Visual Studio installation paths. +/// +/// +/// var latestInstallationPaths = VSWhereAll(); +/// +/// +public Cake.Core.IO.DirectoryPathCollection VSWhereAll() +{ + return Cake.Common.Tools.VSWhere.VSWhereAliases.VSWhereAll(Context); +} + +/// +/// Gets all Visual Studio product installation paths. +/// +/// The context. +/// The settings. +/// The Visual Studio installation paths. +/// +/// +/// var latestInstallationPaths = VSWhereAll(new VSWhereAllSettings { Requires = "'Microsoft.Component.MSBuild" }); +/// +/// +public Cake.Core.IO.DirectoryPathCollection VSWhereAll(Cake.Common.Tools.VSWhere.All.VSWhereAllSettings settings) +{ + return Cake.Common.Tools.VSWhere.VSWhereAliases.VSWhereAll(Context, settings); +} + +/// +/// Gets Visual Studio product installation paths. +/// +/// The context. +/// The products to find. +/// The Visual Studio installation paths. +/// +/// +/// var latestInstallationPaths = VSWhereProducts("Microsoft.VisualStudio.Product.BuildTools"); +/// +/// +public Cake.Core.IO.DirectoryPathCollection VSWhereProducts(System.String products) +{ + return Cake.Common.Tools.VSWhere.VSWhereAliases.VSWhereProducts(Context, products); +} + +/// +/// Gets Visual Studio product installation paths. +/// +/// The context. +/// The products to find. +/// The settings. +/// The Visual Studio installation paths. +/// +/// +/// var latestInstallationPaths = VSWhereProducts("Microsoft.VisualStudio.Product.BuildTools", new VSWhereProductSettings { Requires = "'Microsoft.Component.MSBuild" }); +/// +/// +public Cake.Core.IO.DirectoryPathCollection VSWhereProducts(System.String products, Cake.Common.Tools.VSWhere.Product.VSWhereProductSettings settings) +{ + return Cake.Common.Tools.VSWhere.VSWhereAliases.VSWhereProducts(Context, products, settings); +} + +/// +/// Runs all VSTest unit tests in the assemblies matching the specified pattern. +/// +/// +/// +/// VSTest("./Tests/*.UnitTests.dll"); +/// +/// +/// The context. +/// The pattern. +public void VSTest(System.String pattern) +{ + Cake.Common.Tools.VSTest.VSTestAliases.VSTest(Context, pattern); +} + +/// +/// Runs all VSTest unit tests in the assemblies matching the specified pattern. +/// +/// +/// +/// VSTest("./Tests/*.UnitTests.dll", new VSTestSettings() { Logger = VSTestLogger.Trx }); +/// +/// +/// The context. +/// The pattern. +/// The settings. +public void VSTest(System.String pattern, Cake.Common.Tools.VSTest.VSTestSettings settings) +{ + Cake.Common.Tools.VSTest.VSTestAliases.VSTest(Context, pattern, settings); +} + +/// +/// Runs all VSTest unit tests in the specified assemblies. +/// +/// +/// +/// var paths = new List<FilePath>() { "./assemblydir1", "./assemblydir2" }; +/// VSTest(paths); +/// +/// +/// The context. +/// The assembly paths. +public void VSTest(System.Collections.Generic.IEnumerable assemblyPaths) +{ + Cake.Common.Tools.VSTest.VSTestAliases.VSTest(Context, assemblyPaths); +} + +/// +/// Runs all VSTest unit tests in the specified assemblies. +/// +/// +/// +/// var paths = new List<FilePath>() { "./assemblydir1", "./assemblydir2" }; +/// VSTest(paths, new VSTestSettings() { InIsolation = true }); +/// +/// +/// The context. +/// The assembly paths. +/// The settings. +public void VSTest(System.Collections.Generic.IEnumerable assemblyPaths, Cake.Common.Tools.VSTest.VSTestSettings settings) +{ + Cake.Common.Tools.VSTest.VSTestAliases.VSTest(Context, assemblyPaths, settings); +} + +/// +/// Transform a text template. +/// +/// +/// +/// // Transform a .tt template. +/// var transform = File("./src/Cake/Transform.tt"); +/// TransformTemplate(transform); +/// +/// +/// The context. +/// The source file. +public void TransformTemplate(Cake.Core.IO.FilePath sourceFile) +{ + Cake.Common.Tools.TextTransform.TextTransformAliases.TransformTemplate(Context, sourceFile); +} + +/// +/// Transform a text template. +/// +/// +/// +/// // Transform a .tt template. +/// var transform = File("./src/Cake/Transform.tt"); +/// TransformTemplate(transform, new TextTransformSettings { OutputFile="./src/Cake/Transform.cs" }); +/// +/// +/// The context. +/// The source file. +/// The settings. +public void TransformTemplate(Cake.Core.IO.FilePath sourceFile, Cake.Common.Tools.TextTransform.TextTransformSettings settings) +{ + Cake.Common.Tools.TextTransform.TextTransformAliases.TransformTemplate(Context, sourceFile, settings); +} + +/// +/// Creates a report that shows the usage and binding status of the steps for the entire project. +/// You can use this report to find both unused code in the automation layer and scenario steps that have no definition yet. +/// See SpecFlow Documentation for more information. +/// +/// The context. +/// The path of the project file containing the feature files. +public void SpecFlowStepDefinitionReport(Cake.Core.IO.FilePath projectFile) +{ + Cake.Common.Tools.SpecFlow.SpecFlowAliases.SpecFlowStepDefinitionReport(Context, projectFile); +} + +/// +/// Creates a report that shows the usage and binding status of the steps for the entire project. +/// You can use this report to find both unused code in the automation layer and scenario steps that have no definition yet. +/// See SpecFlow Documentation for more information. +/// +/// The context. +/// The path of the project file containing the feature files. +/// The settings. +public void SpecFlowStepDefinitionReport(Cake.Core.IO.FilePath projectFile, Cake.Common.Tools.SpecFlow.StepDefinitionReport.SpecFlowStepDefinitionReportSettings settings) +{ + Cake.Common.Tools.SpecFlow.SpecFlowAliases.SpecFlowStepDefinitionReport(Context, projectFile, settings); +} + +/// +/// Creates a formatted HTML report of a test execution. +/// The report contains a summary about the executed tests and the result and also a detailed report for the individual scenario executions. +/// See SpecFlow Documentation for more information. +/// +/// The context. +/// The action to run SpecFlow for. Supported actions are: MSTest, NUnit3 and XUnit2 +/// The path of the project file containing the feature files. +public void SpecFlowTestExecutionReport(System.Action action, Cake.Core.IO.FilePath projectFile) +{ + Cake.Common.Tools.SpecFlow.SpecFlowAliases.SpecFlowTestExecutionReport(Context, action, projectFile); +} + +/// +/// Creates a formatted HTML report of a test execution. +/// The report contains a summary about the executed tests and the result and also a detailed report for the individual scenario executions. +/// See SpecFlow Documentation for more information. +/// +/// The context. +/// The action to run SpecFlow for. Supported actions are: MSTest, NUNit, NUNit3, XUnit and XUnit2 +/// The path of the project file containing the feature files. +/// The settings. +public void SpecFlowTestExecutionReport(System.Action action, Cake.Core.IO.FilePath projectFile, Cake.Common.Tools.SpecFlow.TestExecutionReport.SpecFlowTestExecutionReportSettings settings) +{ + Cake.Common.Tools.SpecFlow.SpecFlowAliases.SpecFlowTestExecutionReport(Context, action, projectFile, settings); +} + +/// +/// Converts the reports in the specified directory into human readable form. +/// +/// The context. +/// The input folder. +/// +/// Provide only an input folder, which will causes ReportUnit to search entire directory for report files. +/// Cake task: +/// +/// ReportUnit("c:/temp"); +/// +/// +public void ReportUnit(Cake.Core.IO.DirectoryPath inputFolder) +{ + Cake.Common.Tools.ReportUnit.ReportUnitAliases.ReportUnit(Context, inputFolder); +} + +/// +/// Converts the reports in the specified directory into human readable form. +/// +/// The context. +/// The input folder. +/// The ReportUnit settings. +/// +/// Provide an input folder and custom ToolPath, which will causes ReportUnit to search entire directory for report files. +/// Cake task: +/// +/// ReportUnit("c:/temp", new ReportUnitSettings(){ +/// ToolPath = "c:/tools/reportunit.exe" +/// }); +/// +/// +public void ReportUnit(Cake.Core.IO.DirectoryPath inputFolder, Cake.Common.Tools.ReportUnit.ReportUnitSettings settings) +{ + Cake.Common.Tools.ReportUnit.ReportUnitAliases.ReportUnit(Context, inputFolder, settings); +} + +/// +/// Converts the reports in the specified directory into human readable form and outputs to specified folder. +/// +/// The context. +/// The input folder. +/// The output folder. +/// The ReportUnit settings. +/// +/// Provide both input and output folder, which will causes ReportUnit to search entire directory for report files, and output the results to specified location. +/// Cake task: +/// +/// ReportUnit("c:/temp/input", "c:/temp/output"); +/// +/// +public void ReportUnit(Cake.Core.IO.DirectoryPath inputFolder, Cake.Core.IO.DirectoryPath outputFolder, Cake.Common.Tools.ReportUnit.ReportUnitSettings settings) +{ + Cake.Common.Tools.ReportUnit.ReportUnitAliases.ReportUnit(Context, inputFolder, outputFolder, settings); +} + +/// +/// Converts the single specified report into human readable form and outputs to specified file. +/// +/// The context. +/// The input file. +/// The output file. +/// +/// Provide both input and output file, which will causes ReportUnit to transform only the specific file, and output to the specified location. +/// Cake task: +/// +/// ReportUnit("c:/temp/input", "c:/temp/output"); +/// +/// +public void ReportUnit(Cake.Core.IO.FilePath inputFile, Cake.Core.IO.FilePath outputFile) +{ + Cake.Common.Tools.ReportUnit.ReportUnitAliases.ReportUnit(Context, inputFile, outputFile); +} + +/// +/// Converts the single specified report into human readable form and outputs to specified file. +/// +/// The context. +/// The input file. +/// The output file. +/// The ReportUnit settings. +/// +/// Provide both input and output file, which will causes ReportUnit to transform only the specific file, and output to the specified location. Also use a custom path for the reportunit.exe. +/// Cake task: +/// +/// ReportUnit("c:/temp/input", "c:/temp/output", new ReportUnitSettings(){ +/// ToolPath = "c:/tools/reportunit.exe" +/// }); +/// +/// +public void ReportUnit(Cake.Core.IO.FilePath inputFile, Cake.Core.IO.FilePath outputFile, Cake.Common.Tools.ReportUnit.ReportUnitSettings settings) +{ + Cake.Common.Tools.ReportUnit.ReportUnitAliases.ReportUnit(Context, inputFile, outputFile, settings); +} + +/// +/// Converts the coverage report specified by the glob pattern into human readable form. +/// +/// The context. +/// The glob pattern. +/// The output directory. +/// +/// +/// ReportGenerator("c:/temp/coverage/*.xml", "c:/temp/output"); +/// +/// +public void ReportGenerator(System.String pattern, Cake.Core.IO.DirectoryPath targetDir) +{ + Cake.Common.Tools.ReportGenerator.ReportGeneratorAliases.ReportGenerator(Context, pattern, targetDir); +} + +/// +/// Converts the coverage report specified by the glob pattern into human readable form using the specified settings. +/// +/// The context. +/// The glob pattern. +/// The output directory. +/// The settings. +/// +/// +/// ReportGenerator("c:/temp/coverage/*.xml", "c:/temp/output", new ReportGeneratorSettings(){ +/// ToolPath = "c:/tools/reportgenerator.exe" +/// }); +/// +/// +public void ReportGenerator(System.String pattern, Cake.Core.IO.DirectoryPath targetDir, Cake.Common.Tools.ReportGenerator.ReportGeneratorSettings settings) +{ + Cake.Common.Tools.ReportGenerator.ReportGeneratorAliases.ReportGenerator(Context, pattern, targetDir, settings); +} + +/// +/// Converts the specified coverage report into human readable form. +/// +/// The context. +/// The coverage report. +/// The output directory. +/// +/// +/// ReportGenerator("c:/temp/coverage/report.xml", "c:/temp/output"); +/// +/// +public void ReportGenerator(Cake.Core.IO.FilePath report, Cake.Core.IO.DirectoryPath targetDir) +{ + Cake.Common.Tools.ReportGenerator.ReportGeneratorAliases.ReportGenerator(Context, report, targetDir); +} + +/// +/// Converts the specified coverage report into human readable form using the specified settings. +/// +/// The context. +/// The coverage report. +/// The output directory. +/// The settings. +/// +/// +/// ReportGenerator("c:/temp/coverage.xml", "c:/temp/output", new ReportGeneratorSettings(){ +/// ToolPath = "c:/tools/reportgenerator.exe" +/// }); +/// +/// +public void ReportGenerator(Cake.Core.IO.FilePath report, Cake.Core.IO.DirectoryPath targetDir, Cake.Common.Tools.ReportGenerator.ReportGeneratorSettings settings) +{ + Cake.Common.Tools.ReportGenerator.ReportGeneratorAliases.ReportGenerator(Context, report, targetDir, settings); +} + +/// +/// Converts the specified coverage reports into human readable form. +/// +/// The context. +/// The coverage reports. +/// The output directory. +/// +/// +/// ReportGenerator(new[] { "c:/temp/coverage1.xml", "c:/temp/coverage2.xml" }, "c:/temp/output"); +/// +/// +public void ReportGenerator(System.Collections.Generic.IEnumerable reports, Cake.Core.IO.DirectoryPath targetDir) +{ + Cake.Common.Tools.ReportGenerator.ReportGeneratorAliases.ReportGenerator(Context, reports, targetDir); +} + +/// +/// Converts the specified coverage reports into human readable form using the specified settings. +/// +/// The context. +/// The coverage reports. +/// The output directory. +/// The settings. +/// +/// +/// ReportGenerator(new[] { "c:/temp/coverage1.xml", "c:/temp/coverage2.xml" }, "c:/temp/output", new ReportGeneratorSettings(){ +/// ToolPath = "c:/tools/reportgenerator.exe" +/// }); +/// +/// +public void ReportGenerator(System.Collections.Generic.IEnumerable reports, Cake.Core.IO.DirectoryPath targetDir, Cake.Common.Tools.ReportGenerator.ReportGeneratorSettings settings) +{ + Cake.Common.Tools.ReportGenerator.ReportGeneratorAliases.ReportGenerator(Context, reports, targetDir, settings); +} + +/// +/// Runs OpenCover +/// for the specified action and settings. +/// +/// The context. +/// The action to run OpenCover for. +/// The OpenCover output file. +/// The settings. +/// +/// +/// OpenCover(tool => { +/// tool.XUnit2("./**/App.Tests.dll", +/// new XUnit2Settings { +/// ShadowCopy = false +/// }); +/// }, +/// new FilePath("./result.xml"), +/// new OpenCoverSettings() +/// .WithFilter("+[App]*") +/// .WithFilter("-[App.Tests]*")); +/// +/// +public void OpenCover(System.Action action, Cake.Core.IO.FilePath outputFile, Cake.Common.Tools.OpenCover.OpenCoverSettings settings) +{ + Cake.Common.Tools.OpenCover.OpenCoverAliases.OpenCover(Context, action, outputFile, settings); +} + +/// +/// Compiles the given NSIS script using the default settings. +/// +/// The context. +/// The path to the .nsi script file to compile. +/// +/// +/// MakeNSIS("./src/Cake.nsi"); +/// +/// +public void MakeNSIS(Cake.Core.IO.FilePath scriptFile) +{ + Cake.Common.Tools.NSIS.NSISAliases.MakeNSIS(Context, scriptFile); +} + +/// +/// Compiles the given NSIS script using the given . +/// +/// The context. +/// The path to the .nsi script file to compile. +/// The to use. +/// +/// +/// MakeNSIS("./src/Cake.nsi", new MakeNSISSettings { +/// NoConfig = true +/// }); +/// +/// +public void MakeNSIS(Cake.Core.IO.FilePath scriptFile, Cake.Common.Tools.NSIS.MakeNSISSettings settings) +{ + Cake.Common.Tools.NSIS.NSISAliases.MakeNSIS(Context, scriptFile, settings); +} + +/// +/// Analyses the specified solution with Resharper's InspectCode. +/// +/// The context. +/// The solution. +/// +/// +/// InspectCode("./src/MySolution.sln"); +/// +/// +public void InspectCode(Cake.Core.IO.FilePath solution) +{ + Cake.Common.Tools.InspectCode.InspectCodeAliases.InspectCode(Context, solution); +} + +/// +/// Analyses the specified solution with Resharper's InspectCode, +/// using the specified settings. +/// +/// The context. +/// The solution. +/// The settings. +/// +/// +/// var buildOutputDirectory = Directory("./.build"); +/// var resharperReportsDirectory = buildOutputDirectory + Directory("_ReSharperReports"); +/// +/// var msBuildProperties = new Dictionary<string, string>(); +/// msBuildProperties.Add("configuration", configuration); +/// msBuildProperties.Add("platform", "AnyCPU"); +/// +/// InspectCode("./MySolution.sln", new InspectCodeSettings { +/// SolutionWideAnalysis = true, +/// Profile = "./MySolution.sln.DotSettings", +/// MsBuildProperties = msBuildProperties, +/// OutputFile = resharperReportsDirectory + File("inspectcode-output.xml"), +/// ThrowExceptionOnFindingViolations = true +/// }); +/// +/// +public void InspectCode(Cake.Core.IO.FilePath solution, Cake.Common.Tools.InspectCode.InspectCodeSettings settings) +{ + Cake.Common.Tools.InspectCode.InspectCodeAliases.InspectCode(Context, solution, settings); +} + +/// +/// Runs ReSharper's InspectCode using the specified config file. +/// +/// The context. +/// The config file. +/// +/// +/// InspectCodeFromConfig("./src/inspectcode.config"); +/// +/// +public void InspectCodeFromConfig(Cake.Core.IO.FilePath configFile) +{ + Cake.Common.Tools.InspectCode.InspectCodeAliases.InspectCodeFromConfig(Context, configFile); +} + +/// +/// Compiles the given Inno Setup script using the default settings. +/// +/// The context. +/// The path to the .iss script file to compile. +/// +/// +/// InnoSetup("./src/Cake.iss"); +/// +/// +public void InnoSetup(Cake.Core.IO.FilePath scriptFile) +{ + Cake.Common.Tools.InnoSetup.InnoSetupAliases.InnoSetup(Context, scriptFile); +} + +/// +/// Compiles the given Inno Setup script using the given . +/// +/// The context. +/// The path to the .iss script file to compile. +/// The to use. +/// +/// +/// InnoSetup("./src/Cake.iss", new InnoSetupSettings { +/// OutputDir = outputDirectory +/// }); +/// +/// +public void InnoSetup(Cake.Core.IO.FilePath scriptFile, Cake.Common.Tools.InnoSetup.InnoSetupSettings settings) +{ + Cake.Common.Tools.InnoSetup.InnoSetupAliases.InnoSetup(Context, scriptFile, settings); +} + +/// +/// Merges the specified assemblies. +/// +/// The context. +/// The output file. +/// The primary assembly. +/// The assembly paths. +/// +/// +/// var assemblyPaths = GetFiles("./**/Cake.*.dll"); +/// ILRepack("./MergedCake.exe", "./Cake.exe", assemblyPaths); +/// +/// +public void ILRepack(Cake.Core.IO.FilePath outputFile, Cake.Core.IO.FilePath primaryAssembly, System.Collections.Generic.IEnumerable assemblyPaths) +{ + Cake.Common.Tools.ILRepack.ILRepackAliases.ILRepack(Context, outputFile, primaryAssembly, assemblyPaths); +} + +/// +/// Merges the specified assemblies. +/// +/// The context. +/// The output file. +/// The primary assembly. +/// The assembly paths. +/// The settings. +/// +/// +/// var assemblyPaths = GetFiles("./**/Cake.*.dll"); +/// ILRepack( +/// "./MergedCake.exe", +/// "./Cake.exe", +/// assemblyPaths, +/// new ILRepackSettings { Internalize = true }); +/// +/// +public void ILRepack(Cake.Core.IO.FilePath outputFile, Cake.Core.IO.FilePath primaryAssembly, System.Collections.Generic.IEnumerable assemblyPaths, Cake.Common.Tools.ILRepack.ILRepackSettings settings) +{ + Cake.Common.Tools.ILRepack.ILRepackAliases.ILRepack(Context, outputFile, primaryAssembly, assemblyPaths, settings); +} + +/// +/// Retrieves the GitVersion output. +/// +/// The context. +/// The git version info. +/// +/// Update the assembly info files for the project. +/// Cake task: +/// +/// +/// { +/// GitVersion(new GitVersionSettings { +/// UpdateAssemblyInfo = true +/// }); +/// }); +/// ]]> +/// +/// Get the git version info for the project using a dynamic repository. +/// Cake task: +/// +/// +/// { +/// var result = GitVersion(new GitVersionSettings { +/// UserName = "MyUser", +/// Password = "MyPassword, +/// Url = "http://git.myhost.com/myproject.git" +/// Branch = "develop" +/// Commit = EnviromentVariable("MY_COMMIT") +/// }); +/// // Use result for building nuget packages, setting build server version, etc... +/// }); +/// ]]> +/// +/// +public Cake.Common.Tools.GitVersion.GitVersion GitVersion() +{ + return Cake.Common.Tools.GitVersion.GitVersionAliases.GitVersion(Context); +} + +/// +/// Retrieves the GitVersion output. +/// +/// The context. +/// The GitVersion settings. +/// The git version info. +/// +/// Update the assembly info files for the project. +/// Cake task: +/// +/// +/// { +/// GitVersion(new GitVersionSettings { +/// UpdateAssemblyInfo = true +/// }); +/// }); +/// ]]> +/// +/// Get the git version info for the project using a dynamic repository. +/// Cake task: +/// +/// +/// { +/// var result = GitVersion(new GitVersionSettings { +/// UserName = "MyUser", +/// Password = "MyPassword, +/// Url = "http://git.myhost.com/myproject.git" +/// Branch = "develop" +/// Commit = EnviromentVariable("MY_COMMIT") +/// }); +/// // Use result for building nuget packages, setting build server version, etc... +/// }); +/// ]]> +/// +/// +public Cake.Common.Tools.GitVersion.GitVersion GitVersion(Cake.Common.Tools.GitVersion.GitVersionSettings settings) +{ + return Cake.Common.Tools.GitVersion.GitVersionAliases.GitVersion(Context, settings); +} + +/// +/// Generates a set of release notes based on the commit history of the repository and specified settings. +/// +/// The context. +/// The output file. +/// The settings. +/// +/// +/// GitReleaseNotes("c:/temp/releasenotes.md", new GitReleaseNotesSettings { +/// WorkingDirectory = "c:/temp", +/// Verbose = true, +/// IssueTracker = IssueTracker.GitHub, +/// AllTags = true, +/// RepoUserName = "bob", +/// RepoPassword = "password", +/// RepoUrl = "http://myrepo.co.uk", +/// RepoBranch = "master", +/// IssueTrackerUrl = "http://myissuetracker.co.uk", +/// IssueTrackerUserName = "bob", +/// IssueTrackerPassword = "password", +/// IssueTrackerProjectId = "1234", +/// Categories = "Category1", +/// Version = "1.2.3.4", +/// AllLabels = true +/// }); +/// +/// +public void GitReleaseNotes(Cake.Core.IO.FilePath outputFile, Cake.Common.Tools.GitReleaseNotes.GitReleaseNotesSettings settings) +{ + Cake.Common.Tools.GitReleaseNotes.GitReleaseNotesAliases.GitReleaseNotes(Context, outputFile, settings); +} + +/// +/// Creates a Package Release. +/// +/// The context. +/// The user name. +/// The password. +/// The owner. +/// The repository. +/// +/// +/// GitReleaseManagerCreate("user", "password", "owner", "repo"); +/// +/// +/// +/// +/// GitReleaseManagerCreate("user", "password", "owner", "repo"); +/// +/// +public void GitReleaseManagerCreate(System.String userName, System.String password, System.String owner, System.String repository) +{ + Cake.Common.Tools.GitReleaseManager.GitReleaseManagerAliases.GitReleaseManagerCreate(Context, userName, password, owner, repository); +} + +/// +/// Creates a Package Release using the specified settings. +/// +/// The context. +/// The user name. +/// The password. +/// The owner. +/// The repository. +/// The settings. +/// +/// +/// GitReleaseManagerCreate("user", "password", "owner", "repo", new GitReleaseManagerCreateSettings { +/// Milestone = "0.1.0", +/// Prerelease = false, +/// Assets = "c:/temp/asset1.txt,c:/temp/asset2.txt", +/// TargetCommitish = "master", +/// TargetDirectory = "c:/repo", +/// LogFilePath = "c:/temp/grm.log" +/// }); +/// +/// +/// +/// +/// GitReleaseManagerCreate("user", "password", "owner", "repo", new GitReleaseManagerCreateSettings { +/// Name = "0.1.0", +/// InputFilePath = "c:/repo/releasenotes.md", +/// Prerelease = false, +/// Assets = "c:/temp/asset1.txt,c:/temp/asset2.txt", +/// TargetCommitish = "master", +/// TargetDirectory = "c:/repo", +/// LogFilePath = "c:/temp/grm.log" +/// }); +/// +/// +public void GitReleaseManagerCreate(System.String userName, System.String password, System.String owner, System.String repository, Cake.Common.Tools.GitReleaseManager.Create.GitReleaseManagerCreateSettings settings) +{ + Cake.Common.Tools.GitReleaseManager.GitReleaseManagerAliases.GitReleaseManagerCreate(Context, userName, password, owner, repository, settings); +} + +/// +/// Add Assets to an existing release. +/// +/// The context. +/// The user name. +/// The password. +/// The owner. +/// The repository. +/// The tag name. +/// The assets. +/// +/// +/// GitReleaseManagerAddAssets("user", "password", "owner", "repo", "0.1.0", "c:/temp/asset1.txt,c:/temp/asset2.txt"); +/// +/// +public void GitReleaseManagerAddAssets(System.String userName, System.String password, System.String owner, System.String repository, System.String tagName, System.String assets) +{ + Cake.Common.Tools.GitReleaseManager.GitReleaseManagerAliases.GitReleaseManagerAddAssets(Context, userName, password, owner, repository, tagName, assets); +} + +/// +/// Add Assets to an existing release using the specified settings. +/// +/// The context. +/// The user name. +/// The password. +/// The owner. +/// The repository. +/// The tag name. +/// The assets. +/// The settings. +/// +/// +/// GitReleaseManagerAddAssets("user", "password", "owner", "repo", "0.1.0", "c:/temp/asset1.txt,c:/temp/asset2.txt" new GitReleaseManagerAddAssetsSettings { +/// TargetDirectory = "c:/repo", +/// LogFilePath = "c:/temp/grm.log" +/// }); +/// +/// +public void GitReleaseManagerAddAssets(System.String userName, System.String password, System.String owner, System.String repository, System.String tagName, System.String assets, Cake.Common.Tools.GitReleaseManager.AddAssets.GitReleaseManagerAddAssetsSettings settings) +{ + Cake.Common.Tools.GitReleaseManager.GitReleaseManagerAliases.GitReleaseManagerAddAssets(Context, userName, password, owner, repository, tagName, assets, settings); +} + +/// +/// Closes the milestone associated with a release. +/// +/// The context. +/// The user name. +/// The password. +/// The owner. +/// The repository. +/// The milestone. +/// +/// +/// GitReleaseManagerClose("user", "password", "owner", "repo", "0.1.0"); +/// +/// +public void GitReleaseManagerClose(System.String userName, System.String password, System.String owner, System.String repository, System.String milestone) +{ + Cake.Common.Tools.GitReleaseManager.GitReleaseManagerAliases.GitReleaseManagerClose(Context, userName, password, owner, repository, milestone); +} + +/// +/// Closes the milestone associated with a release using the specified settings. +/// +/// The context. +/// The user name. +/// The password. +/// The owner. +/// The repository. +/// The milestone. +/// The settings. +/// +/// +/// GitReleaseManagerClose("user", "password", "owner", "repo", "0.1.0", new GitReleaseManagerCloseMilestoneSettings { +/// TargetDirectory = "c:/repo", +/// LogFilePath = "c:/temp/grm.log" +/// }); +/// +/// +public void GitReleaseManagerClose(System.String userName, System.String password, System.String owner, System.String repository, System.String milestone, Cake.Common.Tools.GitReleaseManager.Close.GitReleaseManagerCloseMilestoneSettings settings) +{ + Cake.Common.Tools.GitReleaseManager.GitReleaseManagerAliases.GitReleaseManagerClose(Context, userName, password, owner, repository, milestone, settings); +} + +/// +/// Publishes the release. +/// +/// The context. +/// The user name. +/// The password. +/// The owner. +/// The repository. +/// The tag name. +/// +/// +/// GitReleaseManagerPublish("user", "password", "owner", "repo", "0.1.0"); +/// +/// +public void GitReleaseManagerPublish(System.String userName, System.String password, System.String owner, System.String repository, System.String tagName) +{ + Cake.Common.Tools.GitReleaseManager.GitReleaseManagerAliases.GitReleaseManagerPublish(Context, userName, password, owner, repository, tagName); +} + +/// +/// Publishes the release using the specified settings. +/// +/// The context. +/// The user name. +/// The password. +/// The owner. +/// The repository. +/// The tag name. +/// The settings. +/// +/// +/// GitReleaseManagerPublish("user", "password", "owner", "repo", "0.1.0", new GitReleaseManagerPublishSettings { +/// TargetDirectory = "c:/repo", +/// LogFilePath = "c:/temp/grm.log" +/// }); +/// +/// +public void GitReleaseManagerPublish(System.String userName, System.String password, System.String owner, System.String repository, System.String tagName, Cake.Common.Tools.GitReleaseManager.Publish.GitReleaseManagerPublishSettings settings) +{ + Cake.Common.Tools.GitReleaseManager.GitReleaseManagerAliases.GitReleaseManagerPublish(Context, userName, password, owner, repository, tagName, settings); +} + +/// +/// Exports the release notes. +/// +/// The context. +/// The user name. +/// The password. +/// The owner. +/// The repository. +/// The output file path. +/// +/// +/// GitReleaseManagerExport("user", "password", "owner", "repo", "c:/temp/releasenotes.md") +/// }); +/// +/// +public void GitReleaseManagerExport(System.String userName, System.String password, System.String owner, System.String repository, Cake.Core.IO.FilePath fileOutputPath) +{ + Cake.Common.Tools.GitReleaseManager.GitReleaseManagerAliases.GitReleaseManagerExport(Context, userName, password, owner, repository, fileOutputPath); +} + +/// +/// Exports the release notes using the specified settings. +/// +/// The context. +/// The user name. +/// The password. +/// The owner. +/// The repository. +/// The output file path. +/// The settings. +/// +/// +/// GitReleaseManagerExport("user", "password", "owner", "repo", "c:/temp/releasenotes.md", new GitReleaseManagerExportSettings { +/// TagName = "0.1.0", +/// TargetDirectory = "c:/repo", +/// LogFilePath = "c:/temp/grm.log" +/// }); +/// +/// +public void GitReleaseManagerExport(System.String userName, System.String password, System.String owner, System.String repository, Cake.Core.IO.FilePath fileOutputPath, Cake.Common.Tools.GitReleaseManager.Export.GitReleaseManagerExportSettings settings) +{ + Cake.Common.Tools.GitReleaseManager.GitReleaseManagerAliases.GitReleaseManagerExport(Context, userName, password, owner, repository, fileOutputPath, settings); +} + +/// +/// Update pdb files to link all sources. +/// This will allow anyone to step through the source code while debugging without a symbol source server. +/// +/// The context. +/// The Solution File to analyze. +/// +/// +/// GitLink("C:/temp/solution"); +/// +/// +public void GitLink(Cake.Core.IO.DirectoryPath repositoryRootPath) +{ + Cake.Common.Tools.GitLink.GitLinkAliases.GitLink(Context, repositoryRootPath); +} + +/// +/// Update pdb files to link all sources, using specified settings. +/// This will allow anyone to step through the source code while debugging without a symbol source server. +/// +/// The context. +/// The path to the Root of the Repository to analyze. +/// The settings. +/// +/// +/// GitLink("C:/temp/solution", new GitLinkSettings { +/// RepositoryUrl = "http://mydomain.com", +/// Branch = "master", +/// ShaHash = "abcdef", +/// }); +/// +/// +public void GitLink(Cake.Core.IO.DirectoryPath repositoryRootPath, Cake.Common.Tools.GitLink.GitLinkSettings settings) +{ + Cake.Common.Tools.GitLink.GitLinkAliases.GitLink(Context, repositoryRootPath, settings); +} + +/// +/// Runs all Fixie tests in the assemblies matching the specified pattern. +/// +/// +/// +/// Fixie("./src/UnitTests/*.dll"); +/// +/// +/// The context. +/// The pattern. +public void Fixie(System.String pattern) +{ + Cake.Common.Tools.Fixie.FixieAliases.Fixie(Context, pattern); +} + +/// +/// Runs all Fixie tests in the assemblies matching the specified pattern, +/// using the specified settings. +/// +/// +/// +/// Fixie("./src/UnitTests/*.dll", new FixieSettings { +/// NUnitXml = TestResult.xml +/// }); +/// +/// +/// The context. +/// The pattern. +/// The settings. +public void Fixie(System.String pattern, Cake.Common.Tools.Fixie.FixieSettings settings) +{ + Cake.Common.Tools.Fixie.FixieAliases.Fixie(Context, pattern, settings); +} + +/// +/// Runs all Fixie tests in the specified assemblies. +/// +/// +/// +/// var assemblies = new [] { +/// "UnitTests1.dll", +/// "UnitTests2.dll" +/// }; +/// Fixie(assemblies); +/// +/// +/// The context. +/// The assemblies. +public void Fixie(System.Collections.Generic.IEnumerable assemblies) +{ + Cake.Common.Tools.Fixie.FixieAliases.Fixie(Context, assemblies); +} + +/// +/// Runs all Fixie tests in the specified assemblies. +/// +/// +/// +/// var assemblies = GetFiles("./src/UnitTests/*.dll"); +/// Fixie(assemblies); +/// +/// +/// The context. +/// The assemblies. +public void Fixie(System.Collections.Generic.IEnumerable assemblies) +{ + Cake.Common.Tools.Fixie.FixieAliases.Fixie(Context, assemblies); +} + +/// +/// Runs all Fixie tests in the specified assemblies, +/// using the specified settings. +/// +/// +/// +/// var assemblies = new [] { +/// "UnitTests1.dll", +/// "UnitTests2.dll" +/// }; +/// Fixie(assemblies, new FixieSettings { +/// NUnitXml = TestResult.xml +/// }); +/// +/// +/// The context. +/// The assemblies. +/// The settings. +public void Fixie(System.Collections.Generic.IEnumerable assemblies, Cake.Common.Tools.Fixie.FixieSettings settings) +{ + Cake.Common.Tools.Fixie.FixieAliases.Fixie(Context, assemblies, settings); +} + +/// +/// Runs all Fixie tests in the specified assemblies, +/// using the specified settings. +/// +/// +/// +/// var assemblies = GetFiles("./src/UnitTests/*.dll"); +/// Fixie(assemblies, new FixieSettings { +/// NUnitXml = TestResult.xml +/// }); +/// +/// +/// The context. +/// The assemblies. +/// The settings. +public void Fixie(System.Collections.Generic.IEnumerable assemblies, Cake.Common.Tools.Fixie.FixieSettings settings) +{ + Cake.Common.Tools.Fixie.FixieAliases.Fixie(Context, assemblies, settings); +} + +/// +/// Analyses the specified file with ReSharper's DupFinder. +/// The file can either be a solution/project or a source file. +/// +/// The context. +/// The file to analyze. +/// +/// +/// DupFinder("./src/MySolution.sln"); +/// +/// +public void DupFinder(Cake.Core.IO.FilePath file) +{ + Cake.Common.Tools.DupFinder.DupFinderAliases.DupFinder(Context, file); +} + +/// +/// Analyses the specified file with ReSharper's DupFinder using the specified settings. +/// The file can either be a solution/project or a source file. +/// +/// The context. +/// The file to analyze. +/// The settings. +/// +/// +/// var buildOutputDirectory = Directory("./.build"); +/// var resharperReportsDirectory = buildOutputDirectory + Directory("_ReSharperReports"); +/// var rootDirectoryPath = MakeAbsolute(Context.Environment.WorkingDirectory); +/// +/// DupFinder("./src/MySolution.sln", new DupFinderSettings { +/// ShowStats = true, +/// ShowText = true, +/// ExcludePattern = new String[] +/// { +/// rootDirectoryPath + "/**/*Designer.cs", +/// }, +/// OutputFile = resharperReportsDirectory + File("dupfinder-output.xml"), +/// ThrowExceptionOnFindingDuplicates = true +/// }); +/// +/// +public void DupFinder(Cake.Core.IO.FilePath file, Cake.Common.Tools.DupFinder.DupFinderSettings settings) +{ + Cake.Common.Tools.DupFinder.DupFinderAliases.DupFinder(Context, file, settings); +} + +/// +/// Analyses the specified projects with ReSharper's DupFinder. +/// The files can either be solutions and projects or a source files. +/// +/// The context. +/// The files to analyze. +/// +/// +/// var projects = GetFiles("./src/**/*.csproj"); +/// DupFinder(projects); +/// +/// +public void DupFinder(System.Collections.Generic.IEnumerable files) +{ + Cake.Common.Tools.DupFinder.DupFinderAliases.DupFinder(Context, files); +} + +/// +/// Analyses the specified projects with ReSharper's DupFinder using the specified settings. +/// The files can either be solutions and projects or a source files. +/// +/// The context. +/// The files to analyze. +/// The settings. +/// +/// +/// var buildOutputDirectory = Directory("./.build"); +/// var resharperReportsDirectory = buildOutputDirectory + Directory("_ReSharperReports"); +/// var rootDirectoryPath = MakeAbsolute(Context.Environment.WorkingDirectory); +/// +/// var projects = GetFiles("./src/**/*.csproj"); +/// DupFinder(projects, new DupFinderSettings { +/// ShowStats = true, +/// ShowText = true, +/// ExcludePattern = new String[] +/// { +/// rootDirectoryPath + "/**/*Designer.cs", +/// }, +/// OutputFile = resharperReportsDirectory + File("dupfinder-output.xml"), +/// ThrowExceptionOnFindingDuplicates = true +/// }); +/// +/// +public void DupFinder(System.Collections.Generic.IEnumerable files, Cake.Common.Tools.DupFinder.DupFinderSettings settings) +{ + Cake.Common.Tools.DupFinder.DupFinderAliases.DupFinder(Context, files, settings); +} + +/// +/// Analyses all files matching the specified pattern with ReSharper's DupFinder. +/// +/// The context. +/// The pattern. +/// +/// +/// DupFinder("*.cs"); +/// +/// +public void DupFinder(System.String pattern) +{ + Cake.Common.Tools.DupFinder.DupFinderAliases.DupFinder(Context, pattern); +} + +/// +/// Analyses all files matching the specified pattern with ReSharper's DupFinder, +/// using the specified settings. +/// +/// The context. +/// The pattern. +/// The settings. +/// +/// +/// var buildOutputDirectory = Directory("./.build"); +/// var resharperReportsDirectory = buildOutputDirectory + Directory("_ReSharperReports"); +/// +/// DupFinder("*.cs", new DupFinderSettings { +/// OutputFile = resharperReportsDirectory + File("dupfinder-output.xml"), +/// }); +/// +/// +public void DupFinder(System.String pattern, Cake.Common.Tools.DupFinder.DupFinderSettings settings) +{ + Cake.Common.Tools.DupFinder.DupFinderAliases.DupFinder(Context, pattern, settings); +} + +/// +/// Runs ReSharper's DupFinder using the provided config file. +/// +/// The context. +/// The config file. +/// +/// +/// DupFinderFromConfig("./src/dupfinder.config"); +/// +/// +public void DupFinderFromConfig(Cake.Core.IO.FilePath configFile) +{ + Cake.Common.Tools.DupFinder.DupFinderAliases.DupFinderFromConfig(Context, configFile); +} + +/// +/// Execute an assembly. +/// +/// The context. +/// The assembly path. +/// +/// +/// DotNetCoreExecute("./bin/Debug/app.dll"); +/// +/// +public void DotNetCoreExecute(Cake.Core.IO.FilePath assemblyPath) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreExecute(Context, assemblyPath); +} + +/// +/// Execute an assembly with arguments in the specific path. +/// +/// The context. +/// The assembly path. +/// The arguments. +/// +/// +/// DotNetCoreExecute("./bin/Debug/app.dll", "--arg"); +/// +/// +public void DotNetCoreExecute(Cake.Core.IO.FilePath assemblyPath, Cake.Core.IO.ProcessArgumentBuilder arguments) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreExecute(Context, assemblyPath, arguments); +} + +/// +/// Execute an assembly with arguments in the specific path with settings. +/// +/// The context. +/// The assembly path. +/// The arguments. +/// The settings. +/// +/// +/// var settings = new DotNetCoreExecuteSettings +/// { +/// FrameworkVersion = "1.0.3" +/// }; +/// +/// DotNetCoreExecute("./bin/Debug/app.dll", "--arg", settings); +/// +/// +public void DotNetCoreExecute(Cake.Core.IO.FilePath assemblyPath, Cake.Core.IO.ProcessArgumentBuilder arguments, Cake.Common.Tools.DotNetCore.Execute.DotNetCoreExecuteSettings settings) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreExecute(Context, assemblyPath, arguments, settings); +} + +/// +/// Restore all NuGet Packages. +/// +/// The context. +/// +/// +/// DotNetCoreRestore(); +/// +/// +public void DotNetCoreRestore() +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreRestore(Context); +} + +/// +/// Restore all NuGet Packages in the specified path. +/// +/// The context. +/// List of projects and project folders to restore. Each value can be: a path to a project.json or global.json file, or a folder to recursively search for project.json files. +/// +/// +/// DotNetCoreRestore("./src/*"); +/// +/// +public void DotNetCoreRestore(System.String root) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreRestore(Context, root); +} + +/// +/// Restore all NuGet Packages with the settings. +/// +/// The context. +/// The settings. +/// +/// +/// var settings = new DotNetCoreRestoreSettings +/// { +/// Sources = new[] {"https://www.example.com/nugetfeed", "https://www.example.com/nugetfeed2"}, +/// FallbackSources = new[] {"https://www.example.com/fallbacknugetfeed"}, +/// PackagesDirectory = "./packages", +/// Verbosity = Information, +/// DisableParallel = true, +/// InferRuntimes = new[] {"runtime1", "runtime2"} +/// }; +/// +/// DotNetCoreRestore(settings); +/// +/// +public void DotNetCoreRestore(Cake.Common.Tools.DotNetCore.Restore.DotNetCoreRestoreSettings settings) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreRestore(Context, settings); +} + +/// +/// Restore all NuGet Packages in the specified path with settings. +/// +/// The context. +/// List of projects and project folders to restore. Each value can be: a path to a project.json or global.json file, or a folder to recursively search for project.json files. +/// The settings. +/// +/// +/// var settings = new DotNetCoreRestoreSettings +/// { +/// Sources = new[] {"https://www.example.com/nugetfeed", "https://www.example.com/nugetfeed2"}, +/// FallbackSources = new[] {"https://www.example.com/fallbacknugetfeed"}, +/// PackagesDirectory = "./packages", +/// Verbosity = Information, +/// DisableParallel = true, +/// InferRuntimes = new[] {"runtime1", "runtime2"} +/// }; +/// +/// DotNetCoreRestore("./src/*", settings); +/// +/// +public void DotNetCoreRestore(System.String root, Cake.Common.Tools.DotNetCore.Restore.DotNetCoreRestoreSettings settings) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreRestore(Context, root, settings); +} + +/// +/// Build all projects. +/// +/// The context. +/// The projects path. +/// +/// +/// DotNetCoreBuild("./src/*"); +/// +/// +public void DotNetCoreBuild(System.String project) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreBuild(Context, project); +} + +/// +/// Build all projects. +/// +/// The context. +/// The projects path. +/// The settings. +/// +/// +/// var settings = new DotNetCoreBuildSettings +/// { +/// Framework = "netcoreapp1.0", +/// Configuration = "Debug", +/// OutputDirectory = "./artifacts/" +/// }; +/// +/// DotNetCoreBuild("./src/*", settings); +/// +/// +public void DotNetCoreBuild(System.String project, Cake.Common.Tools.DotNetCore.Build.DotNetCoreBuildSettings settings) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreBuild(Context, project, settings); +} + +/// +/// Package all projects. +/// +/// The context. +/// The projects path. +/// +/// +/// DotNetCorePack("./src/*"); +/// +/// +public void DotNetCorePack(System.String project) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCorePack(Context, project); +} + +/// +/// Package all projects. +/// +/// The context. +/// The projects path. +/// The settings. +/// +/// +/// var settings = new DotNetCorePackSettings +/// { +/// Configuration = "Release", +/// OutputDirectory = "./artifacts/" +/// }; +/// +/// DotNetCorePack("./src/*", settings); +/// +/// +public void DotNetCorePack(System.String project, Cake.Common.Tools.DotNetCore.Pack.DotNetCorePackSettings settings) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCorePack(Context, project, settings); +} + +/// +/// Run all projects. +/// +/// The context. +/// +/// +/// DotNetCoreRun(); +/// +/// +public void DotNetCoreRun() +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreRun(Context); +} + +/// +/// Run project. +/// +/// The context. +/// The project path. +/// +/// +/// DotNetCoreRun("./src/Project"); +/// +/// +public void DotNetCoreRun(System.String project) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreRun(Context, project); +} + +/// +/// Run project with path and arguments. +/// +/// The context. +/// The project path. +/// The arguments. +/// +/// +/// DotNetCoreRun("./src/Project", "--args"); +/// +/// +public void DotNetCoreRun(System.String project, Cake.Core.IO.ProcessArgumentBuilder arguments) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreRun(Context, project, arguments); +} + +/// +/// Run project with settings. +/// +/// The context. +/// The project path. +/// The arguments. +/// The settings. +/// +/// +/// var settings = new DotNetCoreRunSettings +/// { +/// Framework = "netcoreapp1.0", +/// Configuration = "Release" +/// }; +/// +/// DotNetCoreRun("./src/Project", "--args", settings); +/// +/// +public void DotNetCoreRun(System.String project, Cake.Core.IO.ProcessArgumentBuilder arguments, Cake.Common.Tools.DotNetCore.Run.DotNetCoreRunSettings settings) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreRun(Context, project, arguments, settings); +} + +/// +/// Publish all projects. +/// +/// The context. +/// The projects path. +/// +/// +/// DotNetCorePublish("./src/*"); +/// +/// +public void DotNetCorePublish(System.String project) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCorePublish(Context, project); +} + +/// +/// Publish all projects. +/// +/// The context. +/// The projects path. +/// The settings. +/// +/// +/// var settings = new DotNetCorePublishSettings +/// { +/// Framework = "netcoreapp1.0", +/// Configuration = "Release", +/// OutputDirectory = "./artifacts/" +/// }; +/// +/// DotNetCorePublish("./src/*", settings); +/// +/// +public void DotNetCorePublish(System.String project, Cake.Common.Tools.DotNetCore.Publish.DotNetCorePublishSettings settings) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCorePublish(Context, project, settings); +} + +/// +/// Test project. +/// +/// The context. +/// +/// +/// DotNetCoreTest(); +/// +/// +public void DotNetCoreTest() +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreTest(Context); +} + +/// +/// Test project with path. +/// +/// The context. +/// The project path. +/// +/// Specify the path to the .csproj file in the test project +/// +/// DotNetCoreTest("./test/Project.Tests/Project.Tests.csproj"); +/// +/// You could also specify a task that runs multiple test projects. +/// Cake task: +/// +/// Task("Test") +/// .Does(() => +/// { +/// var projectFiles = GetFiles("./test/**/*.csproj"); +/// foreach(var file in projectFiles) +/// { +/// DotNetCoreTest(file.FullPath); +/// } +/// }); +/// +/// If your test project is using project.json, the project parameter should just be the directory path. +/// +/// DotNetCoreTest("./test/Project.Tests/"); +/// +/// +public void DotNetCoreTest(System.String project) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreTest(Context, project); +} + +/// +/// Test project with settings. +/// +/// The context. +/// The project path. +/// The settings. +/// +/// +/// var settings = new DotNetCoreTestSettings +/// { +/// Configuration = "Release" +/// }; +/// +/// DotNetCoreTest("./test/Project.Tests/Project.Tests.csproj", settings); +/// +/// You could also specify a task that runs multiple test projects. +/// Cake task: +/// +/// Task("Test") +/// .Does(() => +/// { +/// var settings = new DotNetCoreTestSettings +/// { +/// Configuration = "Release" +/// }; +/// +/// var projectFiles = GetFiles("./test/**/*.csproj"); +/// foreach(var file in projectFiles) +/// { +/// DotNetCoreTest(file.FullPath, settings); +/// } +/// }); +/// +/// If your test project is using project.json, the project parameter should just be the directory path. +/// +/// var settings = new DotNetCoreTestSettings +/// { +/// Configuration = "Release" +/// }; +/// +/// DotNetCoreTest("./test/Project.Tests/", settings); +/// +/// +public void DotNetCoreTest(System.String project, Cake.Common.Tools.DotNetCore.Test.DotNetCoreTestSettings settings) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreTest(Context, project, settings); +} + +/// +/// Cleans a project's output. +/// +/// The context. +/// The project's path. +/// +/// +/// DotNetCoreClean("./src/project"); +/// +/// +public void DotNetCoreClean(System.String project) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreClean(Context, project); +} + +/// +/// Cleans a project's output. +/// +/// The context. +/// The projects path. +/// The settings. +/// +/// +/// var settings = new DotNetCoreCleanSettings +/// { +/// Framework = "netcoreapp1.0", +/// Configuration = "Debug", +/// OutputDirectory = "./artifacts/" +/// }; +/// +/// DotNetCoreClean("./src/project", settings); +/// +/// +public void DotNetCoreClean(System.String project, Cake.Common.Tools.DotNetCore.Clean.DotNetCoreCleanSettings settings) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreClean(Context, project, settings); +} + +/// +/// Delete a NuGet Package from a server. +/// +/// The context. +/// +/// +/// DotNetCoreNuGetDelete(); +/// +/// +public void DotNetCoreNuGetDelete() +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreNuGetDelete(Context); +} + +/// +/// Deletes a package from the NuGet.org. +/// +/// The context. +/// Name of package to delete. +/// +/// +/// DotNetCoreNuGetDelete("Microsoft.AspNetCore.Mvc"); +/// +/// +public void DotNetCoreNuGetDelete(System.String packageName) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreNuGetDelete(Context, packageName); +} + +/// +/// Deletes a specific version of a package from the NuGet.org. +/// +/// The context. +/// Name of package to delete. +/// Version of package to delete. +/// +/// +/// DotNetCoreRestore("Microsoft.AspNetCore.Mvc", "1.0"); +/// +/// +public void DotNetCoreNuGetDelete(System.String packageName, System.String packageVersion) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreNuGetDelete(Context, packageName, packageVersion); +} + +/// +/// Deletes a package from a server +/// +/// The context. +/// Name of package to delete. +/// The settings. +/// +/// +/// var settings = new DotNetCoreNuGetDeleteSettings +/// { +/// Source = "https://www.example.com/nugetfeed", +/// NonInteractive = true +/// }; +/// +/// DotNetCoreNuGetDelete("Microsoft.AspNetCore.Mvc", settings); +/// +/// +public void DotNetCoreNuGetDelete(System.String packageName, Cake.Common.Tools.DotNetCore.NuGet.Delete.DotNetCoreNuGetDeleteSettings settings) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreNuGetDelete(Context, packageName, settings); +} + +/// +/// Deletes a package from a server using the specified settings. +/// +/// The context. +/// The settings. +/// +/// +/// var settings = new DotNetCoreNuGetDeleteSettings +/// { +/// Source = "https://www.example.com/nugetfeed", +/// NonInteractive = true +/// }; +/// +/// DotNetCoreNuGetDelete(settings); +/// +/// +public void DotNetCoreNuGetDelete(Cake.Common.Tools.DotNetCore.NuGet.Delete.DotNetCoreNuGetDeleteSettings settings) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreNuGetDelete(Context, settings); +} + +/// +/// Deletes a package from a server using the specified settings. +/// +/// The context. +/// Name of package to delete. +/// Version of package to delete. +/// The settings. +/// +/// +/// var settings = new DotNetCoreNuGetDeleteSettings +/// { +/// Source = "https://www.example.com/nugetfeed", +/// NonInteractive = true +/// }; +/// +/// DotNetCoreNuGetDelete("Microsoft.AspNetCore.Mvc", "1.0", settings); +/// +/// +public void DotNetCoreNuGetDelete(System.String packageName, System.String packageVersion, Cake.Common.Tools.DotNetCore.NuGet.Delete.DotNetCoreNuGetDeleteSettings settings) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreNuGetDelete(Context, packageName, packageVersion, settings); +} + +/// +/// Pushes one or more packages to a server. +/// +/// The context. +/// Name of package to push. +/// +/// +/// DotNetCoreNuGetPush("*.nupkg"); +/// +/// +public void DotNetCoreNuGetPush(System.String packageName) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreNuGetPush(Context, packageName); +} + +/// +/// Pushes one or more packages to a server using the specified settings. +/// +/// The context. +/// Name of package to push. +/// The settings. +/// +/// +/// var settings = new DotNetCoreNuGetPushSettings +/// { +/// Source = "https://www.example.com/nugetfeed", +/// ApiKey = "4003d786-cc37-4004-bfdf-c4f3e8ef9b3a" +/// }; +/// +/// DotNetCoreNuGetPush("foo*.nupkg", settings); +/// +/// +public void DotNetCoreNuGetPush(System.String packageName, Cake.Common.Tools.DotNetCore.NuGet.Push.DotNetCoreNuGetPushSettings settings) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreNuGetPush(Context, packageName, settings); +} + +/// +/// Builds the specified targets in a project file found in the current working directory. +/// +/// The context. +/// +/// +/// DotNetCoreMSBuild(); +/// +/// +public void DotNetCoreMSBuild() +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreMSBuild(Context); +} + +/// +/// Builds the specified targets in the project file. +/// +/// The context. +/// Project file or directory to search for project file. +/// +/// +/// DotNetCoreMSBuild("foobar.proj"); +/// +/// +/// +/// If a directory is specified, MSBuild searches that directory for a project file. +/// +public void DotNetCoreMSBuild(System.String projectOrDirectory) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreMSBuild(Context, projectOrDirectory); +} + +/// +/// Builds the specified targets in a project file found in the current working directory. +/// +/// The context. +/// The settings. +/// +/// +/// var settings = new DotNetCoreMSBuildSettings +/// { +/// NoLogo = true, +/// MaxCpuCount = -1 +/// }; +/// +/// DotNetCoreMSBuild(settings); +/// +/// +public void DotNetCoreMSBuild(Cake.Common.Tools.DotNetCore.MSBuild.DotNetCoreMSBuildSettings settings) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreMSBuild(Context, settings); +} + +/// +/// Builds the specified targets in the project file. +/// +/// The context. +/// Project file or directory to search for project file. +/// The settings. +/// +/// +/// var settings = new DotNetCoreMSBuildSettings +/// { +/// NoLogo = true, +/// MaxCpuCount = -1 +/// }; +/// +/// DotNetCoreMSBuild("foobar.proj", settings); +/// +/// +/// +/// If a project file is not specified, MSBuild searches the current working directory for a file that has a file +/// extension that ends in "proj" and uses that file. If a directory is specified, MSBuild searches that directory for a project file. +/// +public void DotNetCoreMSBuild(System.String projectOrDirectory, Cake.Common.Tools.DotNetCore.MSBuild.DotNetCoreMSBuildSettings settings) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreMSBuild(Context, projectOrDirectory, settings); +} + +/// +/// Test one or more projects specified by a path or glob pattern using the VS Test host runner. +/// +/// The context. +/// A path to the test file or glob for one or more test files. +/// +/// Specify the path to the .csproj file in the test project +/// +/// DotNetCoreTest("./test/Project.Tests/Project.Tests.csproj"); +/// +/// You could also specify a glob pattern to run multiple test projects. +/// +/// DotNetCoreTest("./**/*.Tests.csproj"); +/// +/// +public void DotNetCoreVSTest(System.String testFile) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreVSTest(Context, testFile); +} + +/// +/// Test one or more projects specified by a path or glob pattern with settings using the VS Test host runner. +/// +/// The context. +/// A path to the test file or glob for one or more test files. +/// The settings. +/// +/// Specify the path to the .csproj file in the test project +/// +/// var settings = new DotNetCoreTestSettings +/// { +/// Framework = "FrameworkCore10", +/// Platform = "x64" +/// }; +/// +/// DotNetCoreTest("./test/Project.Tests/Project.Tests.csproj", settings); +/// +/// You could also specify a glob pattern to run multiple test projects. +/// +/// var settings = new DotNetCoreTestSettings +/// { +/// Framework = "FrameworkCore10", +/// Platform = "x64", +/// Parallel = true +/// }; +/// +/// DotNetCoreTest("./**/*.Tests.csproj", settings); +/// +/// +public void DotNetCoreVSTest(System.String testFile, Cake.Common.Tools.DotNetCore.VSTest.DotNetCoreVSTestSettings settings) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreVSTest(Context, testFile, settings); +} + +/// +/// Test one or more specified projects with settings using the VS Test host runner. +/// +/// The context. +/// The project paths to test. +/// The settings. +/// +/// +/// var settings = new DotNetCoreTestSettings +/// { +/// Framework = "FrameworkCore10", +/// Platform = "x64" +/// }; +/// +/// DotNetCoreTest(new[] { (FilePath)"./Test/Cake.Common.Tests.csproj" }, settings); +/// +/// You could also specify a task that runs multiple test projects. +/// Cake task: +/// +/// Task("Test") +/// .Does(() => +/// { +/// var settings = new DotNetCoreTestSettings +/// { +/// Framework = "FrameworkCore10", +/// Platform = "x64", +/// Parallel = true +/// }; +/// +/// var projectFiles = GetFiles("./test/**/*.csproj"); +/// +/// DotNetCoreTest(projectFiles, settings); +/// }); +/// +/// +public void DotNetCoreVSTest(System.Collections.Generic.IEnumerable testFiles, Cake.Common.Tools.DotNetCore.VSTest.DotNetCoreVSTestSettings settings) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreVSTest(Context, testFiles, settings); +} + +/// +/// /// Execute an .NET Core Extensibility Tool. +/// +/// The context. +/// The project path. +/// The command to execute. +/// +/// +/// DotNetCoreTool("./src/project", "xunit", "-xml report.xml"); +/// +/// +public void DotNetCoreTool(Cake.Core.IO.FilePath projectPath, System.String command) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreTool(Context, projectPath, command); +} + +/// +/// Execute an .NET Core Extensibility Tool. +/// +/// The context. +/// The project path. +/// The command to execute. +/// The arguments. +/// +/// +/// DotNetCoreTool("./src/project", "xunit", "-xml report.xml"); +/// +/// +public void DotNetCoreTool(Cake.Core.IO.FilePath projectPath, System.String command, Cake.Core.IO.ProcessArgumentBuilder arguments) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreTool(Context, projectPath, command, arguments); +} + +/// +/// Execute an .NET Core Extensibility Tool. +/// +/// The context. +/// The project path. +/// The command to execute. +/// The arguments. +/// The settings. +/// +/// +/// DotNetCoreTool("./src/project", "xunit", "-xml report.xml"); +/// +/// +public void DotNetCoreTool(Cake.Core.IO.FilePath projectPath, System.String command, Cake.Core.IO.ProcessArgumentBuilder arguments, Cake.Common.Tools.DotNetCore.Tool.DotNetCoreToolSettings settings) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreTool(Context, projectPath, command, arguments, settings); +} + +/// +/// Runs DotCover Analyse +/// for the specified action and settings. +/// +/// The context. +/// The action to run DotCover for. +/// The DotCover output file. +/// The settings. +/// +/// +/// DotCoverAnalyse(tool => { +/// tool.XUnit2("./**/App.Tests.dll", +/// new XUnit2Settings { +/// ShadowCopy = false +/// }); +/// }, +/// new FilePath("./result.xml"), +/// new DotCoverAnalyseSettings() +/// .WithFilter("+:App") +/// .WithFilter("-:App.Tests")); +/// +/// +public void DotCoverAnalyse(System.Action action, Cake.Core.IO.FilePath outputFile, Cake.Common.Tools.DotCover.Analyse.DotCoverAnalyseSettings settings) +{ + Cake.Common.Tools.DotCover.DotCoverAliases.DotCoverAnalyse(Context, action, outputFile, settings); +} + +/// +/// Runs DotCover Cover +/// for the specified action and settings. +/// +/// The context. +/// The action to run DotCover for. +/// The DotCover output file. +/// The settings. +/// +/// +/// DotCoverCover(tool => { +/// tool.XUnit2("./**/App.Tests.dll", +/// new XUnit2Settings { +/// ShadowCopy = false +/// }); +/// }, +/// new FilePath("./result.dcvr"), +/// new DotCoverCoverSettings() +/// .WithFilter("+:App") +/// .WithFilter("-:App.Tests")); +/// +/// +public void DotCoverCover(System.Action action, Cake.Core.IO.FilePath outputFile, Cake.Common.Tools.DotCover.Cover.DotCoverCoverSettings settings) +{ + Cake.Common.Tools.DotCover.DotCoverAliases.DotCoverCover(Context, action, outputFile, settings); +} + +/// +/// Runs DotCover Report +/// for the specified action and settings. +/// +/// The context. +/// The DotCover coverage snapshot file name. +/// The DotCover output file. +/// The settings +/// +/// +/// DotCoverReport(new FilePath("./result.dcvr"), +/// new FilePath("./result.html"), +/// new DotCoverReportSettings { +/// ReportType = DotCoverReportType.HTML +/// }); +/// +/// +public void DotCoverReport(Cake.Core.IO.FilePath sourceFile, Cake.Core.IO.FilePath outputFile, Cake.Common.Tools.DotCover.Report.DotCoverReportSettings settings) +{ + Cake.Common.Tools.DotCover.DotCoverAliases.DotCoverReport(Context, sourceFile, outputFile, settings); +} + +/// +/// Runs DotCover Merge +/// for the specified action and settings. +/// +/// The context. +/// The list of DotCover coverage snapshot files. +/// The merged output file. +/// +/// +/// DotCoverMerge(new[] { +/// new FilePath("./result1.dcvr"), +/// new FilePath("./result2.dcvr") +/// }, +/// new FilePath("./merged.dcvr")); +/// +/// +public void DotCoverMerge(System.Collections.Generic.IEnumerable sourceFiles, Cake.Core.IO.FilePath outputFile) +{ + Cake.Common.Tools.DotCover.DotCoverAliases.DotCoverMerge(Context, sourceFiles, outputFile); +} + +/// +/// Runs DotCover Merge +/// for the specified action and settings. +/// +/// The context. +/// The list of DotCover coverage snapshot files. +/// The merged output file. +/// The settings +/// +/// +/// DotCoverMerge(new[] { +/// new FilePath("./result1.dcvr"), +/// new FilePath("./result2.dcvr") +/// }, +/// new FilePath("./merged.dcvr"), +/// new DotCoverMergeSettings { +/// LogFile = new FilePath("./log.txt") +/// }); +/// +/// +public void DotCoverMerge(System.Collections.Generic.IEnumerable sourceFiles, Cake.Core.IO.FilePath outputFile, Cake.Common.Tools.DotCover.Merge.DotCoverMergeSettings settings) +{ + Cake.Common.Tools.DotCover.DotCoverAliases.DotCoverMerge(Context, sourceFiles, outputFile, settings); +} + +/// +/// Creates a Chocolatey package using the specified Nuspec file. +/// +/// The context. +/// The nuspec file path. +/// The settings. +/// +/// +/// var chocolateyPackSettings = new ChocolateyPackSettings { +/// Id = "TestChocolatey", +/// Title = "The tile of the package", +/// Version = "0.0.0.1", +/// Authors = new[] {"John Doe"}, +/// Owners = new[] {"Contoso"}, +/// Summary = "Excellent summary of what the package does", +/// Description = "The description of the package", +/// ProjectUrl = new Uri("https://github.com/SomeUser/TestChocolatey/"), +/// PackageSourceUrl = new Uri("https://github.com/SomeUser/TestChocolatey/"), +/// ProjectSourceUrl = new Uri("https://github.com/SomeUser/TestChocolatey/"), +/// DocsUrl = new Uri("https://github.com/SomeUser/TestChocolatey/"), +/// MailingListUrl = new Uri("https://github.com/SomeUser/TestChocolatey/"), +/// BugTrackerUrl = new Uri("https://github.com/SomeUser/TestChocolatey/"), +/// Tags = new [] {"Cake", "Script", "Build"}, +/// Copyright = "Some company 2015", +/// LicenseUrl = new Uri("https://github.com/SomeUser/TestChocolatey/blob/master/LICENSE.md"), +/// RequireLicenseAcceptance= false, +/// IconUrl = new Uri("http://cdn.rawgit.com/SomeUser/TestChocolatey/master/icons/testchocolatey.png"), +/// ReleaseNotes = new [] {"Bug fixes", "Issue fixes", "Typos"}, +/// Files = new [] { +/// new ChocolateyNuSpecContent {Source = "bin/TestChocolatey.dll", Target = "bin"}, +/// }, +/// Debug = false, +/// Verbose = false, +/// Force = false, +/// Noop = false, +/// LimitOutput = false, +/// ExecutionTimeout = 13, +/// CacheLocation = @"C:\temp", +/// AllowUnofficial = false +/// }; +/// +/// ChocolateyPack("./nuspec/TestChocolatey.nuspec", chocolateyPackSettings); +/// +/// +public void ChocolateyPack(Cake.Core.IO.FilePath nuspecFilePath, Cake.Common.Tools.Chocolatey.Pack.ChocolateyPackSettings settings) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyPack(Context, nuspecFilePath, settings); +} + +/// +/// Creates Chocolatey packages using the specified Nuspec files. +/// +/// The context. +/// The nuspec file paths. +/// The settings. +/// +/// +/// var chocolateyPackSettings = new ChocolateyPackSettings { +/// Id = "TestChocolatey", +/// Title = "The tile of the package", +/// Version = "0.0.0.1", +/// Authors = new[] {"John Doe"}, +/// Owners = new[] {"Contoso"}, +/// Summary = "Excellent summary of what the package does", +/// Description = "The description of the package", +/// ProjectUrl = new Uri("https://github.com/SomeUser/TestChocolatey/"), +/// PackageSourceUrl = new Uri("https://github.com/SomeUser/TestChocolatey/"), +/// ProjectSourceUrl = new Uri("https://github.com/SomeUser/TestChocolatey/"), +/// DocsUrl = new Uri("https://github.com/SomeUser/TestChocolatey/"), +/// MailingListUrl = new Uri("https://github.com/SomeUser/TestChocolatey/"), +/// BugTrackerUrl = new Uri("https://github.com/SomeUser/TestChocolatey/"), +/// Tags = new [] {"Cake", "Script", "Build"}, +/// Copyright = "Some company 2015", +/// LicenseUrl = new Uri("https://github.com/SomeUser/TestChocolatey/blob/master/LICENSE.md"), +/// RequireLicenseAcceptance= false, +/// IconUrl = new Uri("http://cdn.rawgit.com/SomeUser/TestChocolatey/master/icons/testchocolatey.png"), +/// ReleaseNotes = new [] {"Bug fixes", "Issue fixes", "Typos"}, +/// Files = new [] { +/// new ChocolateyNuSpecContent {Source = "bin/TestChocolatey.dll", Target = "bin"}, +/// }, +/// Debug = false, +/// Verbose = false, +/// Force = false, +/// Noop = false, +/// LimitOutput = false, +/// ExecutionTimeout = 13, +/// CacheLocation = @"C:\temp", +/// AllowUnofficial = false +/// }; +/// +/// var nuspecFiles = GetFiles("./**/*.nuspec"); +/// ChocolateyPack(nuspecFiles, chocolateyPackSettings); +/// +/// +public void ChocolateyPack(System.Collections.Generic.IEnumerable filePaths, Cake.Common.Tools.Chocolatey.Pack.ChocolateyPackSettings settings) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyPack(Context, filePaths, settings); +} + +/// +/// Creates a Chocolatey package using the specified settings. +/// +/// The context. +/// The settings. +/// +/// +/// var chocolateyPackSettings = new ChocolateyPackSettings { +/// Id = "TestChocolatey", +/// Title = "The tile of the package", +/// Version = "0.0.0.1", +/// Authors = new[] {"John Doe"}, +/// Owners = new[] {"Contoso"}, +/// Summary = "Excellent summary of what the package does", +/// Description = "The description of the package", +/// ProjectUrl = new Uri("https://github.com/SomeUser/TestChocolatey/"), +/// PackageSourceUrl = new Uri("https://github.com/SomeUser/TestChocolatey/"), +/// ProjectSourceUrl = new Uri("https://github.com/SomeUser/TestChocolatey/"), +/// DocsUrl = new Uri("https://github.com/SomeUser/TestChocolatey/"), +/// MailingListUrl = new Uri("https://github.com/SomeUser/TestChocolatey/"), +/// BugTrackerUrl = new Uri("https://github.com/SomeUser/TestChocolatey/"), +/// Tags = new [] {"Cake", "Script", "Build"}, +/// Copyright = "Some company 2015", +/// LicenseUrl = new Uri("https://github.com/SomeUser/TestChocolatey/blob/master/LICENSE.md"), +/// RequireLicenseAcceptance= false, +/// IconUrl = new Uri("http://cdn.rawgit.com/SomeUser/TestChocolatey/master/icons/testchocolatey.png"), +/// ReleaseNotes = new [] {"Bug fixes", "Issue fixes", "Typos"}, +/// Files = new [] { +/// new ChocolateyNuSpecContent {Source = "bin/TestChocolatey.dll", Target = "bin"}, +/// }, +/// Debug = false, +/// Verbose = false, +/// Force = false, +/// Noop = false, +/// LimitOutput = false, +/// ExecutionTimeout = 13, +/// CacheLocation = @"C:\temp", +/// AllowUnofficial = false +/// }; +/// +/// ChocolateyPack(chocolateyPackSettings); +/// +/// +public void ChocolateyPack(Cake.Common.Tools.Chocolatey.Pack.ChocolateyPackSettings settings) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyPack(Context, settings); +} + +/// +/// Installs a Chocolatey package. +/// +/// The context. +/// The id of the package to install. +/// +/// +/// ChocolateyInstall("MyChocolateyPackage"); +/// +/// +public void ChocolateyInstall(System.String packageId) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyInstall(Context, packageId); +} + +/// +/// Installs a Chocolatey package using the specified settings. +/// +/// The context. +/// The id of the package to install. +/// The settings. +/// +/// +/// ChocolateyInstall("MyChocolateyPackage", new ChocolateyInstallSettings { +/// Source = true, +/// Version = "1.2.3", +/// Prerelease = false, +/// Forcex86 = false, +/// InstallArguments = "arg1", +/// OverrideArguments = false, +/// NotSilent = false, +/// PackageParameters = "param1", +/// AllowDowngrade = false, +/// SideBySide = false, +/// IgnoreDependencies = false, +/// ForceDependencies = false, +/// SkipPowerShell = false, +/// User = "user", +/// Password = "password", +/// IgnoreChecksums = false, +/// Debug = false, +/// Verbose = false, +/// Force = false, +/// Noop = false, +/// LimitOutput = false, +/// ExecutionTimeout = 13, +/// CacheLocation = @"C:\temp", +/// AllowUnofficial = false +/// }); +/// +/// +public void ChocolateyInstall(System.String packageId, Cake.Common.Tools.Chocolatey.Install.ChocolateyInstallSettings settings) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyInstall(Context, packageId, settings); +} + +/// +/// Installs Chocolatey packages using the specified package configuration. +/// +/// The context. +/// The package configuration to install. +/// +/// +/// ChocolateyInstallFromConfig("./tools/packages.config"); +/// +/// +public void ChocolateyInstallFromConfig(Cake.Core.IO.FilePath packageConfigPath) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyInstallFromConfig(Context, packageConfigPath); +} + +/// +/// Installs Chocolatey packages using the specified package configuration and settings. +/// +/// The context. +/// The package configuration to install. +/// The settings. +/// +/// +/// ChocolateyInstallFromConfig("./tools/packages.config", new ChocolateyInstallSettings { +/// Source = true, +/// Version = "1.2.3", +/// Prerelease = false, +/// Forcex86 = false, +/// InstallArguments = "arg1", +/// OverrideArguments = false, +/// NotSilent = false, +/// PackageParameters = "param1", +/// AllowDowngrade = false, +/// SideBySide = false, +/// IgnoreDependencies = false, +/// ForceDependencies = false, +/// SkipPowerShell = false, +/// User = "user", +/// Password = "password", +/// IgnoreChecksums = false, +/// Debug = false, +/// Verbose = false, +/// Force = false, +/// Noop = false, +/// LimitOutput = false, +/// ExecutionTimeout = 13, +/// CacheLocation = @"C:\temp", +/// AllowUnofficial = false +/// }); +/// +/// +public void ChocolateyInstallFromConfig(Cake.Core.IO.FilePath packageConfigPath, Cake.Common.Tools.Chocolatey.Install.ChocolateyInstallSettings settings) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyInstallFromConfig(Context, packageConfigPath, settings); +} + +/// +/// Uninstalls a Chocolatey package. +/// +/// The context. +/// The id of the package to uninstall. +/// +/// +/// ChocolateyUninstall("MyChocolateyPackage"); +/// +/// +public void ChocolateyUninstall(System.String packageId) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyUninstall(Context, packageId); +} + +/// +/// Uninstalls a Chocolatey package using the specified settings. +/// +/// The context. +/// The id of the package to uninstall. +/// The settings. +/// +/// +/// ChocolateyUninstall("MyChocolateyPackage", new ChocolateyUninstallSettings { +/// Source = true, +/// Version = "1.2.3", +/// UninstallArguments = "arg1", +/// OverrideArguments = false, +/// NotSilent = false, +/// PackageParameters = "param1", +/// SideBySide = false, +/// IgnoreDependencies = false, +/// ForceDependencies = false, +/// SkipPowerShell = false, +/// Debug = false, +/// Verbose = false, +/// FailOnStandardError = false, +/// UseSystemPowershell = false, +/// AllVersions = false, +/// Force = false, +/// Noop = false, +/// LimitOutput = false, +/// ExecutionTimeout = 13, +/// CacheLocation = @"C:\temp", +/// AllowUnofficial = false, +/// GlobalArguments = false, +/// GlobalPackageParameters = false, +/// IgnorePackageExitCodes = false, +/// UsePackageExitCodes = false, +/// UseAutoUninstaller = false, +/// SkipAutoUninstaller = false, +/// FailOnAutoUninstaller = false, +/// IgnoreAutoUninstaller = false +/// }); +/// +/// +public void ChocolateyUninstall(System.String packageId, Cake.Common.Tools.Chocolatey.Uninstall.ChocolateyUninstallSettings settings) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyUninstall(Context, packageId, settings); +} + +/// +/// Uninstalls a Chocolatey package. +/// +/// The context. +/// The ids of the packages to uninstall. +/// +/// +/// ChocolateyUninstall("MyChocolateyPackage"); +/// +/// +public void ChocolateyUninstall(System.Collections.Generic.IEnumerable packageIds) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyUninstall(Context, packageIds); +} + +/// +/// Uninstalls Chocolatey packages using the specified settings. +/// +/// The context. +/// The ids of the packages to uninstall. +/// The settings. +/// +/// +/// ChocolateyUninstall("MyChocolateyPackage", new ChocolateyUninstallSettings { +/// Source = true, +/// Version = "1.2.3", +/// UninstallArguments = "arg1", +/// OverrideArguments = false, +/// NotSilent = false, +/// PackageParameters = "param1", +/// SideBySide = false, +/// IgnoreDependencies = false, +/// ForceDependencies = false, +/// SkipPowerShell = false, +/// Debug = false, +/// Verbose = false, +/// FailOnStandardError = false, +/// UseSystemPowershell = false, +/// AllVersions = false, +/// Force = false, +/// Noop = false, +/// LimitOutput = false, +/// ExecutionTimeout = 13, +/// CacheLocation = @"C:\temp", +/// AllowUnofficial = false, +/// GlobalArguments = false, +/// GlobalPackageParameters = false, +/// IgnorePackageExitCodes = false, +/// UsePackageExitCodes = false, +/// UseAutoUninstaller = false, +/// SkipAutoUninstaller = false, +/// FailOnAutoUninstaller = false, +/// IgnoreAutoUninstaller = false +/// }); +/// +/// +public void ChocolateyUninstall(System.Collections.Generic.IEnumerable packageIds, Cake.Common.Tools.Chocolatey.Uninstall.ChocolateyUninstallSettings settings) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyUninstall(Context, packageIds, settings); +} + +/// +/// Pins a Chocolatey package using the specified settings. +/// +/// The context. +/// The name. +/// The settings. +/// +/// +/// ChocolateyPin("MyChocolateyPackage", new ChocolateyPinSettings { +/// Version = "1.2.3", +/// Debug = false, +/// Verbose = false, +/// Force = false, +/// Noop = false, +/// LimitOutput = false, +/// ExecutionTimeout = 13, +/// CacheLocation = @"C:\temp", +/// AllowUnofficial = false +/// }); +/// +/// +public void ChocolateyPin(System.String name, Cake.Common.Tools.Chocolatey.Pin.ChocolateyPinSettings settings) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyPin(Context, name, settings); +} + +/// +/// Sets the Api Key for a Chocolatey Source using the specified settings. +/// +/// The context. +/// The API Key. +/// The source. +/// The settings. +/// +/// +/// ChocolateyApiKey("myApiKey", "http://www.mysource.com", new ChocolateyApiKeySettings { +/// Debug = false, +/// Verbose = false, +/// Force = false, +/// Noop = false, +/// LimitOutput = false, +/// ExecutionTimeout = 13, +/// CacheLocation = @"C:\temp", +/// AllowUnofficial = false +/// }); +/// +/// +public void ChocolateyApiKey(System.String apiKey, System.String source, Cake.Common.Tools.Chocolatey.ApiKey.ChocolateyApiKeySettings settings) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyApiKey(Context, apiKey, source, settings); +} + +/// +/// Sets the config parameter using the specified settings. +/// +/// The context. +/// The name. +/// The value. +/// The settings. +/// +/// +/// ChocolateyConfig("cacheLocation", @"c:\temp", new ChocolateyConfigSettings { +/// Debug = false, +/// Verbose = false, +/// Force = false, +/// Noop = false, +/// LimitOutput = false, +/// ExecutionTimeout = 13, +/// CacheLocation = @"C:\temp", +/// AllowUnofficial = false +/// }); +/// +/// +public void ChocolateyConfig(System.String name, System.String value, Cake.Common.Tools.Chocolatey.Config.ChocolateyConfigSettings settings) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyConfig(Context, name, value, settings); +} + +/// +/// Enables a Chocolatey Feature using the specified name +/// +/// The context. +/// Name of the feature. +/// +/// +/// ChocolateyEnableFeature("checkSumFiles"); +/// +/// +public void ChocolateyEnableFeature(System.String name) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyEnableFeature(Context, name); +} + +/// +/// Enables a Chocolatey Feature using the specified name and settings +/// +/// The context. +/// Name of the feature. +/// The settings. +/// +/// +/// ChocolateyEnableFeature("checkSumFiles", new ChocolateyFeatureSettings { +/// Debug = false, +/// Verbose = false, +/// Force = false, +/// Noop = false, +/// LimitOutput = false, +/// ExecutionTimeout = 13, +/// CacheLocation = @"C:\temp", +/// AllowUnofficial = false +/// }); +/// +/// +public void ChocolateyEnableFeature(System.String name, Cake.Common.Tools.Chocolatey.Features.ChocolateyFeatureSettings settings) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyEnableFeature(Context, name, settings); +} + +/// +/// Disables a Chocolatey Feature using the specified name +/// +/// The context. +/// Name of the feature. +/// +/// +/// ChocolateyDisableFeature("checkSumFiles"); +/// +/// +public void ChocolateyDisableFeature(System.String name) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyDisableFeature(Context, name); +} + +/// +/// Disables a Chocolatey Feature using the specified name and settings +/// +/// The context. +/// Name of the feature. +/// The settings. +/// +/// +/// ChocolateyDisableFeature("checkSumFiles", new ChocolateyFeatureSettings { +/// Debug = false, +/// Verbose = false, +/// Force = false, +/// Noop = false, +/// LimitOutput = false, +/// ExecutionTimeout = 13, +/// CacheLocation = @"C:\temp", +/// AllowUnofficial = false +/// }); +/// +/// +public void ChocolateyDisableFeature(System.String name, Cake.Common.Tools.Chocolatey.Features.ChocolateyFeatureSettings settings) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyDisableFeature(Context, name, settings); +} + +/// +/// Adds Chocolatey package source using the specified name &source to global user config +/// +/// The context. +/// Name of the source. +/// Path to the package(s) source. +/// +/// +/// ChocolateyAddSource("MySource", "http://www.mysource.com"); +/// +/// +public void ChocolateyAddSource(System.String name, System.String source) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyAddSource(Context, name, source); +} + +/// +/// Adds Chocolatey package source using the specified name, source & settings to global user config +/// +/// The context. +/// Name of the source. +/// Path to the package(s) source. +/// The settings. +/// +/// +/// ChocolateyAddSource("MySource", "http://www.mysource.com", new ChocolateySourcesSettings { +/// UserName = "user", +/// Password = "password", +/// Priority = 13, +/// Debug = false, +/// Verbose = false, +/// Force = false, +/// Noop = false, +/// LimitOutput = false, +/// ExecutionTimeout = 13, +/// CacheLocation = @"C:\temp", +/// AllowUnofficial = false +/// }); +/// +/// +public void ChocolateyAddSource(System.String name, System.String source, Cake.Common.Tools.Chocolatey.Sources.ChocolateySourcesSettings settings) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyAddSource(Context, name, source, settings); +} + +/// +/// Removes Chocolatey package source using the specified name & source from global user config +/// +/// The context. +/// Name of the source. +/// +/// +/// ChocolateyRemoveSource("MySource"); +/// +/// +public void ChocolateyRemoveSource(System.String name) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyRemoveSource(Context, name); +} + +/// +/// Removes Chocolatey package source using the specified name, source & settings from global user config +/// +/// The context. +/// Name of the source. +/// The settings. +/// +/// +/// ChocolateyRemoveSource("MySource", new ChocolateySourcesSettings { +/// Debug = false, +/// Verbose = false, +/// Force = false, +/// Noop = false, +/// LimitOutput = false, +/// ExecutionTimeout = 13, +/// CacheLocation = @"C:\temp", +/// AllowUnofficial = false +/// }); +/// +/// +public void ChocolateyRemoveSource(System.String name, Cake.Common.Tools.Chocolatey.Sources.ChocolateySourcesSettings settings) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyRemoveSource(Context, name, settings); +} + +/// +/// Enables a Chocolatey Source using the specified name +/// +/// The context. +/// Name of the source. +/// +/// +/// ChocolateyEnableSource("MySource"); +/// +/// +public void ChocolateyEnableSource(System.String name) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyEnableSource(Context, name); +} + +/// +/// Enables a Chocolatey Source using the specified name and settings +/// +/// The context. +/// Name of the source. +/// The settings. +/// +/// +/// ChocolateyEnableSource("MySource", new ChocolateySourcesSettings { +/// Debug = false, +/// Verbose = false, +/// Force = false, +/// Noop = false, +/// LimitOutput = false, +/// ExecutionTimeout = 13, +/// CacheLocation = @"C:\temp", +/// AllowUnofficial = false +/// }); +/// +/// +public void ChocolateyEnableSource(System.String name, Cake.Common.Tools.Chocolatey.Sources.ChocolateySourcesSettings settings) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyEnableSource(Context, name, settings); +} + +/// +/// Disables a Chocolatey Source using the specified name +/// +/// The context. +/// Name of the source. +/// +/// +/// ChocolateyDisableSource("MySource"); +/// +/// +public void ChocolateyDisableSource(System.String name) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyDisableSource(Context, name); +} + +/// +/// Disables a Chocolatey Source using the specified name and settings +/// +/// The context. +/// Name of the source. +/// The settings. +/// +/// +/// ChocolateyDisableSource("MySource", new ChocolateySourcesSettings { +/// Debug = false, +/// Verbose = false, +/// Force = false, +/// Noop = false, +/// LimitOutput = false, +/// ExecutionTimeout = 13, +/// CacheLocation = @"C:\temp", +/// AllowUnofficial = false +/// }); +/// +/// +public void ChocolateyDisableSource(System.String name, Cake.Common.Tools.Chocolatey.Sources.ChocolateySourcesSettings settings) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyDisableSource(Context, name, settings); +} + +/// +/// Pushes a Chocolatey package to a Chocolatey server and publishes it. +/// +/// The context. +/// The .nupkg file path. +/// The settings. +/// +/// +/// // Get the path to the package. +/// var package = "./chocolatey/MyChocolateyPackage.0.0.1.nupkg"; +/// +/// // Push the package. +/// ChocolateyPush(package, new ChocolateyPushSettings { +/// Source = "http://example.com/chocolateyfeed", +/// ApiKey = "4003d786-cc37-4004-bfdf-c4f3e8ef9b3a" +/// Timeout = 300 +/// Debug = false, +/// Verbose = false, +/// Force = false, +/// Noop = false, +/// LimitOutput = false, +/// ExecutionTimeout = 13, +/// CacheLocation = @"C:\temp", +/// AllowUnofficial = false +/// }); +/// +/// +public void ChocolateyPush(Cake.Core.IO.FilePath packageFilePath, Cake.Common.Tools.Chocolatey.Push.ChocolateyPushSettings settings) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyPush(Context, packageFilePath, settings); +} + +/// +/// Pushes Chocolatey packages to a Chocolatey server and publishes them. +/// +/// The context. +/// The .nupkg file paths. +/// The settings. +/// +/// +/// // Get the paths to the packages. +/// var packages = GetFiles("./**/*.nupkg"); +/// +/// // Push the package. +/// ChocolateyPush(packages, new ChocolateyPushSettings { +/// Source = "http://example.com/chocolateyfeed", +/// ApiKey = "4003d786-cc37-4004-bfdf-c4f3e8ef9b3a" +/// Timeout = 300 +/// Debug = false, +/// Verbose = false, +/// Force = false, +/// Noop = false, +/// LimitOutput = false, +/// ExecutionTimeout = 13, +/// CacheLocation = @"C:\temp", +/// AllowUnofficial = false +/// }); +/// +/// +public void ChocolateyPush(System.Collections.Generic.IEnumerable packageFilePaths, Cake.Common.Tools.Chocolatey.Push.ChocolateyPushSettings settings) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyPush(Context, packageFilePaths, settings); +} + +/// +/// Upgrades Chocolatey package. +/// +/// The context. +/// The id of the package to upgrade. +/// +/// +/// ChocolateyUpgrade("MyChocolateyPackage"); +/// +/// +public void ChocolateyUpgrade(System.String packageId) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyUpgrade(Context, packageId); +} + +/// +/// Upgrades Chocolatey package using the specified settings. +/// +/// The context. +/// The id of the package to upgrade. +/// The settings. +/// +/// +/// ChocolateyUpgrade("MyChocolateyPackage", new ChocolateyUpgradeSettings { +/// Source = true, +/// Version = "1.2.3", +/// Prerelease = false, +/// Forcex86 = false, +/// InstallArguments = "arg1", +/// OverrideArguments = false, +/// NotSilent = false, +/// PackageParameters = "param1", +/// AllowDowngrade = false, +/// SideBySide = false, +/// IgnoreDependencies = false, +/// SkipPowerShell = false, +/// FailOnUnfound = false, +/// FailOnNotInstalled = false, +/// User = "user", +/// Password = "password", +/// IgnoreChecksums = false, +/// Debug = false, +/// Verbose = false, +/// Force = false, +/// Noop = false, +/// LimitOutput = false, +/// ExecutionTimeout = 13, +/// CacheLocation = @"C:\temp", +/// AllowUnofficial = false +/// }); +/// +/// +public void ChocolateyUpgrade(System.String packageId, Cake.Common.Tools.Chocolatey.Upgrade.ChocolateyUpgradeSettings settings) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyUpgrade(Context, packageId, settings); +} + +/// +/// Generate package specification files for a new package using the default settings. +/// +/// The context. +/// The id of the package to create. +/// +/// +/// ChocolateyNew("MyChocolateyPackage"); +/// +/// +public void ChocolateyNew(System.String packageId) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyNew(Context, packageId); +} + +/// +/// Generate package specification files for a new package using the specified settings. +/// +/// The context. +/// The id of the package to create. +/// The settings. +/// +/// +/// ChocolateyNew("MyChocolateyPackage", new ChocolateyNewSettings { +/// PackageVersion = "1.2.3", +/// MaintainerName = "John Doe", +/// MaintainerRepo = "johndoe" +/// }); +/// +/// +/// +/// +/// var settings = new ChocolateyNewSettings { +/// MaintainerName = "John Doe" +/// } +/// settings.AdditionalPropertyValues("Tags", "CustomPackage"); +/// ChocolateyNew("MyChocolateyPackage", settings); +/// +/// +public void ChocolateyNew(System.String packageId, Cake.Common.Tools.Chocolatey.New.ChocolateyNewSettings settings) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyNew(Context, packageId, settings); +} + +/// +/// Downloads a Chocolatey package to the current working directory. +/// +/// The context. +/// The id of the package to download. +/// +/// +/// ChocolateyDownload("MyChocolateyPackage"); +/// +/// +public void ChocolateyDownload(System.String packageId) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyDownload(Context, packageId); +} + +/// +/// Downloads a Chocolatey package using the specified settings. +/// +/// The context. +/// The id of the package to install. +/// The settings. +/// +/// Download a package to a specific folder: +/// +/// ChocolateyDownload( +/// "MyChocolateyPackage", +/// new ChocolateyDownloadSettings { +/// OutputDirectory = @"C:\download\" +/// }); +/// +/// Download and internalize a package: +/// +/// ChocolateyDownload( +/// "MyChocolateyPackage", +/// new ChocolateyDownloadSettings { +/// Internalize = true +/// }); +/// +/// +public void ChocolateyDownload(System.String packageId, Cake.Common.Tools.Chocolatey.Download.ChocolateyDownloadSettings settings) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyDownload(Context, packageId, settings); +} + +/// +/// Runs all xUnit.net v2 tests in the assemblies matching the specified pattern. +/// +/// The context. +/// The pattern. +/// +/// +/// XUnit2("./src/**/bin/Release/*.Tests.dll"); +/// +/// +public void XUnit2(System.String pattern) +{ + Cake.Common.Tools.XUnit.XUnit2Aliases.XUnit2(Context, pattern); +} + +/// +/// Runs all xUnit.net v2 tests in the assemblies matching the specified pattern. +/// +/// The context. +/// The pattern. +/// The settings. +/// +/// +/// XUnit2("./src/**/bin/Release/*.Tests.dll", +/// new XUnit2Settings { +/// Parallelism = ParallelismOption.All, +/// HtmlReport = true, +/// NoAppDomain = true, +/// OutputDirectory = "./build" +/// }); +/// +/// +public void XUnit2(System.String pattern, Cake.Common.Tools.XUnit.XUnit2Settings settings) +{ + Cake.Common.Tools.XUnit.XUnit2Aliases.XUnit2(Context, pattern, settings); +} + +/// +/// Runs all xUnit.net v2 tests in the specified assemblies. +/// +/// The context. +/// The assemblies. +/// +/// +/// XUnit2(new []{ +/// "./src/Cake.Common.Tests/bin/Release/Cake.Common.Tests.dll", +/// "./src/Cake.Core.Tests/bin/Release/Cake.Core.Tests.dll", +/// "./src/Cake.NuGet.Tests/bin/Release/Cake.NuGet.Tests.dll", +/// "./src/Cake.Tests/bin/Release/Cake.Tests.dll" +/// }); +/// +/// +public void XUnit2(System.Collections.Generic.IEnumerable assemblies) +{ + Cake.Common.Tools.XUnit.XUnit2Aliases.XUnit2(Context, assemblies); +} + +/// +/// Runs all xUnit.net tests in the specified assemblies. +/// +/// The context. +/// The assemblies. +/// +/// +/// var testAssemblies = GetFiles("./src/**/bin/Release/*.Tests.dll"); +/// XUnit2(testAssemblies); +/// +/// +public void XUnit2(System.Collections.Generic.IEnumerable assemblies) +{ + Cake.Common.Tools.XUnit.XUnit2Aliases.XUnit2(Context, assemblies); +} + +/// +/// Runs all xUnit.net v2 tests in the specified assemblies. +/// +/// The context. +/// The assemblies. +/// The settings. +/// +/// +/// XUnit2(new []{ +/// "./src/Cake.Common.Tests/bin/Release/Cake.Common.Tests.dll", +/// "./src/Cake.Core.Tests/bin/Release/Cake.Core.Tests.dll", +/// "./src/Cake.NuGet.Tests/bin/Release/Cake.NuGet.Tests.dll", +/// "./src/Cake.Tests/bin/Release/Cake.Tests.dll" +/// }, +/// new XUnit2Settings { +/// Parallelism = ParallelismOption.All, +/// HtmlReport = true, +/// NoAppDomain = true, +/// OutputDirectory = "./build" +/// }); +/// +/// +public void XUnit2(System.Collections.Generic.IEnumerable assemblies, Cake.Common.Tools.XUnit.XUnit2Settings settings) +{ + Cake.Common.Tools.XUnit.XUnit2Aliases.XUnit2(Context, assemblies, settings); +} + +/// +/// Runs all xUnit.net v2 tests in the specified assemblies. +/// +/// The context. +/// The assemblies. +/// The settings. +/// +/// +/// var testAssemblies = GetFiles("./src/**/bin/Release/*.Tests.dll"); +/// XUnit2(testAssemblies, +/// new XUnit2Settings { +/// Parallelism = ParallelismOption.All, +/// HtmlReport = true, +/// NoAppDomain = true, +/// OutputDirectory = "./build" +/// }); +/// +/// +public void XUnit2(System.Collections.Generic.IEnumerable assemblies, Cake.Common.Tools.XUnit.XUnit2Settings settings) +{ + Cake.Common.Tools.XUnit.XUnit2Aliases.XUnit2(Context, assemblies, settings); +} + +/// +/// Runs all xUnit.net tests in the assemblies matching the specified pattern. +/// +/// The context. +/// The pattern. +/// +/// +/// XUnit("./src/**/bin/Release/*.Tests.dll"); +/// +/// +public void XUnit(System.String pattern) +{ + Cake.Common.Tools.XUnit.XUnitAliases.XUnit(Context, pattern); +} + +/// +/// Runs all xUnit.net tests in the assemblies matching the specified pattern. +/// +/// The context. +/// The pattern. +/// The settings. +/// +/// +/// XUnit("./src/**/bin/Release/*.Tests.dll", +/// new XUnitSettings { +/// HtmlReport = true, +/// OutputDirectory = "./build" +/// }); +/// +/// +public void XUnit(System.String pattern, Cake.Common.Tools.XUnit.XUnitSettings settings) +{ + Cake.Common.Tools.XUnit.XUnitAliases.XUnit(Context, pattern, settings); +} + +/// +/// Runs all xUnit.net tests in the specified assemblies. +/// +/// The context. +/// The assemblies. +/// +/// +/// XUnit(new []{ +/// "./src/Cake.Common.Tests/bin/Release/Cake.Common.Tests.dll", +/// "./src/Cake.Core.Tests/bin/Release/Cake.Core.Tests.dll", +/// "./src/Cake.NuGet.Tests/bin/Release/Cake.NuGet.Tests.dll", +/// "./src/Cake.Tests/bin/Release/Cake.Tests.dll" +/// }); +/// +/// +public void XUnit(System.Collections.Generic.IEnumerable assemblies) +{ + Cake.Common.Tools.XUnit.XUnitAliases.XUnit(Context, assemblies); +} + +/// +/// Runs all xUnit.net tests in the specified assemblies. +/// +/// The context. +/// The assemblies. +/// +/// +/// var testAssemblies = GetFiles("./src/**/bin/Release/*.Tests.dll"); +/// XUnit(testAssemblies); +/// +/// +public void XUnit(System.Collections.Generic.IEnumerable assemblies) +{ + Cake.Common.Tools.XUnit.XUnitAliases.XUnit(Context, assemblies); +} + +/// +/// Runs all xUnit.net tests in the specified assemblies. +/// +/// The context. +/// The assemblies. +/// The settings. +/// +/// +/// XUnit(new []{ +/// "./src/Cake.Common.Tests/bin/Release/Cake.Common.Tests.dll", +/// "./src/Cake.Core.Tests/bin/Release/Cake.Core.Tests.dll", +/// "./src/Cake.NuGet.Tests/bin/Release/Cake.NuGet.Tests.dll", +/// "./src/Cake.Tests/bin/Release/Cake.Tests.dll" +/// }, +/// new XUnitSettings { +/// HtmlReport = true, +/// OutputDirectory = "./build" +/// }); +/// +/// +public void XUnit(System.Collections.Generic.IEnumerable assemblies, Cake.Common.Tools.XUnit.XUnitSettings settings) +{ + Cake.Common.Tools.XUnit.XUnitAliases.XUnit(Context, assemblies, settings); +} + +/// +/// Runs all xUnit.net tests in the specified assemblies. +/// +/// The context. +/// The assemblies. +/// The settings. +/// +/// +/// var testAssemblies = GetFiles("./src/**/bin/Release/*.Tests.dll"); +/// XUnit(testAssemblies, +/// new XUnitSettings { +/// HtmlReport = true, +/// OutputDirectory = "./build" +/// }); +/// +/// +public void XUnit(System.Collections.Generic.IEnumerable assemblies, Cake.Common.Tools.XUnit.XUnitSettings settings) +{ + Cake.Common.Tools.XUnit.XUnitAliases.XUnit(Context, assemblies, settings); +} + +/// +/// Builds the specified solution using XBuild. +/// +/// The context. +/// The solution to build. +/// +/// +/// XBuild("./src/Cake.sln"); +/// +/// +public void XBuild(Cake.Core.IO.FilePath solution) +{ + Cake.Common.Tools.XBuild.XBuildAliases.XBuild(Context, solution); +} + +/// +/// Builds the specified solution using XBuild. +/// +/// The context. +/// The solution to build. +/// The settings configurator. +/// +/// +/// XBuild("./src/Cake.sln", configurator => +/// configurator.SetConfiguration("Debug") +/// .SetVerbosity(Verbosity.Minimal) +/// .UseToolVersion(XBuildToolVersion.NET40)); +/// +/// +public void XBuild(Cake.Core.IO.FilePath solution, System.Action configurator) +{ + Cake.Common.Tools.XBuild.XBuildAliases.XBuild(Context, solution, configurator); +} + +/// +/// Builds the specified solution using XBuild. +/// +/// The context. +/// The solution to build. +/// The settings. +/// +/// +/// XBuild("./src/Cake.sln", new XBuildSettings { +/// Verbosity = Verbosity.Minimal, +/// ToolVersion = XBuildToolVersion.NET40, +/// Configuration = "Release" +/// }); +/// +/// +public void XBuild(Cake.Core.IO.FilePath solution, Cake.Common.Tools.XBuild.XBuildSettings settings) +{ + Cake.Common.Tools.XBuild.XBuildAliases.XBuild(Context, solution, settings); +} + +/// +/// Compiles all .wxs sources matching the specified pattern. +/// +/// +/// +/// CandleSettings settings = new CandleSettings { +/// Architecture = Architecture.X64, +/// Verbose = true +/// }; +/// WiXCandle("./src/*.wxs", settings); +/// +/// +/// The context. +/// The globbing pattern. +/// The settings. +public void WiXCandle(System.String pattern, Cake.Common.Tools.WiX.CandleSettings settings = null) +{ + Cake.Common.Tools.WiX.WiXAliases.WiXCandle(Context, pattern, settings); +} + +/// +/// Compiles all .wxs sources in the provided source files. +/// +/// +/// +/// var files = GetFiles("./src/*.wxs"); +/// CandleSettings settings = new CandleSettings { +/// Architecture = Architecture.X64, +/// Verbose = true +/// }; +/// WiXCandle(files, settings); +/// +/// +/// The context. +/// The source files. +/// The settings. +public void WiXCandle(System.Collections.Generic.IEnumerable sourceFiles, Cake.Common.Tools.WiX.CandleSettings settings = null) +{ + Cake.Common.Tools.WiX.WiXAliases.WiXCandle(Context, sourceFiles, settings); +} + +/// +/// Links all .wixobj files matching the specified pattern. +/// +/// +/// +/// LightSettings settings = new LightSettings { +/// RawArguments = "-O1 -pedantic -v" +/// }; +/// WiXLight("./src/*.wixobj", settings); +/// +/// +/// The context. +/// The globbing pattern. +/// The settings. +public void WiXLight(System.String pattern, Cake.Common.Tools.WiX.LightSettings settings = null) +{ + Cake.Common.Tools.WiX.WiXAliases.WiXLight(Context, pattern, settings); +} + +/// +/// Links all .wixobj files in the provided object files. +/// +/// +/// +/// var files = GetFiles("./src/*.wxs"); +/// LightSettings settings = new LightSettings { +/// RawArguments = "-O1 -pedantic -v" +/// }; +/// WiXLight(files, settings); +/// +/// +/// The context. +/// The object files. +/// The settings. +public void WiXLight(System.Collections.Generic.IEnumerable objectFiles, Cake.Common.Tools.WiX.LightSettings settings = null) +{ + Cake.Common.Tools.WiX.WiXAliases.WiXLight(Context, objectFiles, settings); +} + +/// +/// Harvests files in the provided object files. +/// +/// +/// +/// DirectoryPath harvestDirectory = Directory("./src"); +/// var filePath = new FilePath("Wix.Directory.wxs"); +/// WiXHeat(harvestDirectory, filePath, WiXHarvestType.Dir); +/// +/// +/// The context. +/// The object files. +/// The output file. +/// The WiX harvest type. +public void WiXHeat(Cake.Core.IO.DirectoryPath directoryPath, Cake.Core.IO.FilePath outputFile, Cake.Common.Tools.WiX.Heat.WiXHarvestType harvestType) +{ + Cake.Common.Tools.WiX.WiXAliases.WiXHeat(Context, directoryPath, outputFile, harvestType); +} + +/// +/// Harvests files in the provided directory path. +/// +/// +/// +/// DirectoryPath harvestDirectory = Directory("./src"); +/// var filePath = File("Wix.Directory.wxs"); +/// Information(MakeAbsolute(harvestDirectory).FullPath); +/// WiXHeat(harvestDirectory, filePath, WiXHarvestType.Dir, new HeatSettings { NoLogo = true }); +/// +/// +/// The context. +/// The directory path. +/// The output file. +/// The WiX harvest type. +/// The settings. +public void WiXHeat(Cake.Core.IO.DirectoryPath directoryPath, Cake.Core.IO.FilePath outputFile, Cake.Common.Tools.WiX.Heat.WiXHarvestType harvestType, Cake.Common.Tools.WiX.Heat.HeatSettings settings) +{ + Cake.Common.Tools.WiX.WiXAliases.WiXHeat(Context, directoryPath, outputFile, harvestType, settings); +} + +/// +/// Harvests from the desired files. +/// +/// +/// +/// var harvestFile = File("./tools/Cake/Cake.Core.dll"); +/// var filePath = File("Wix.File.wxs"); +/// WiXHeat(harvestFile, filePath, WiXHarvestType.File); +/// +/// +/// The context. +/// The object file. +/// The output file. +/// The WiX harvest type. +public void WiXHeat(Cake.Core.IO.FilePath objectFile, Cake.Core.IO.FilePath outputFile, Cake.Common.Tools.WiX.Heat.WiXHarvestType harvestType) +{ + Cake.Common.Tools.WiX.WiXAliases.WiXHeat(Context, objectFile, outputFile, harvestType); +} + +/// +/// Harvests from the desired files. +/// +/// +/// +/// var harvestFiles = File("./tools/Cake/*.dll"); +/// var filePath = File("Wix.File.wxs"); +/// WiXHeat(harvestFiles, filePath, WiXHarvestType.File, new HeatSettings { NoLogo = true }); +/// +/// +/// The context. +/// The object file. +/// The output file. +/// The WiX harvest type. +/// The settings. +public void WiXHeat(Cake.Core.IO.FilePath objectFile, Cake.Core.IO.FilePath outputFile, Cake.Common.Tools.WiX.Heat.WiXHarvestType harvestType, Cake.Common.Tools.WiX.Heat.HeatSettings settings) +{ + Cake.Common.Tools.WiX.WiXAliases.WiXHeat(Context, objectFile, outputFile, harvestType, settings); +} + +/// +/// Harvests files for a website or performance. +/// +/// +/// +/// var filePath = File("Wix.Website.wxs"); +/// WiXHeat("Default Web Site", filePath, WiXHarvestType.Website); +/// +/// +/// The context. +/// The harvest target. +/// The output file. +/// The WiX harvest type. +public void WiXHeat(System.String harvestTarget, Cake.Core.IO.FilePath outputFile, Cake.Common.Tools.WiX.Heat.WiXHarvestType harvestType) +{ + Cake.Common.Tools.WiX.WiXAliases.WiXHeat(Context, harvestTarget, outputFile, harvestType); +} + +/// +/// Harvests files for a website or performance. +/// +/// +/// +/// var filePath = File("Wix.Website.wxs"); +/// WiXHeat("Default Web Site", filePath, WiXHarvestType.Website, new HeatSettings { NoLogo = true }); +/// +/// +/// The context. +/// The harvest target. +/// The output file. +/// The WiX harvest type. +/// The settings. +public void WiXHeat(System.String harvestTarget, Cake.Core.IO.FilePath outputFile, Cake.Common.Tools.WiX.Heat.WiXHarvestType harvestType, Cake.Common.Tools.WiX.Heat.HeatSettings settings) +{ + Cake.Common.Tools.WiX.WiXAliases.WiXHeat(Context, harvestTarget, outputFile, harvestType, settings); +} + +/// +/// Signs the specified assembly. +/// +/// The context. +/// The target assembly. +/// The settings. +/// +/// +/// Task("Sign") +/// .IsDependentOn("Clean") +/// .IsDependentOn("Restore") +/// .IsDependentOn("Build") +/// .Does(() => +/// { +/// var file = "Core.dll"; +/// Sign(file, new SignToolSignSettings { +/// TimeStampUri = new Uri("http://timestamp.digicert.com"), +/// CertPath = "digitalcertificate.pfx", +/// Password = "TopSecret" +/// }); +/// }); +/// +/// +public void Sign(System.String assembly, Cake.Common.Tools.SignTool.SignToolSignSettings settings) +{ + Cake.Common.Tools.SignTool.SignToolSignAliases.Sign(Context, assembly, settings); +} + +/// +/// Signs the specified assembly. +/// +/// The context. +/// The target assembly. +/// The settings. +/// +/// +/// Task("Sign") +/// .IsDependentOn("Clean") +/// .IsDependentOn("Restore") +/// .IsDependentOn("Build") +/// .Does(() => +/// { +/// var file = new FilePath("Core.dll"); +/// Sign(file, new SignToolSignSettings { +/// TimeStampUri = new Uri("http://timestamp.digicert.com"), +/// CertPath = "digitalcertificate.pfx", +/// Password = "TopSecret" +/// }); +/// }); +/// +/// +public void Sign(Cake.Core.IO.FilePath assembly, Cake.Common.Tools.SignTool.SignToolSignSettings settings) +{ + Cake.Common.Tools.SignTool.SignToolSignAliases.Sign(Context, assembly, settings); +} + +/// +/// Signs the specified assemblies. +/// +/// The context. +/// The target assembly. +/// The settings. +/// +/// +/// Task("Sign") +/// .IsDependentOn("Clean") +/// .IsDependentOn("Restore") +/// .IsDependentOn("Build") +/// .Does(() => +/// { +/// var files = new string[] { "Core.dll", "Common.dll" }; +/// Sign(files, new SignToolSignSettings { +/// TimeStampUri = new Uri("http://timestamp.digicert.com"), +/// CertPath = "digitalcertificate.pfx", +/// Password = "TopSecret" +/// }); +/// }); +/// +/// +public void Sign(System.Collections.Generic.IEnumerable assemblies, Cake.Common.Tools.SignTool.SignToolSignSettings settings) +{ + Cake.Common.Tools.SignTool.SignToolSignAliases.Sign(Context, assemblies, settings); +} + +/// +/// Signs the specified assemblies. +/// +/// The context. +/// The target assembly. +/// The settings. +/// +/// +/// Task("Sign") +/// .IsDependentOn("Clean") +/// .IsDependentOn("Restore") +/// .IsDependentOn("Build") +/// .Does(() => +/// { +/// var files = GetFiles(solutionDir + "/**/bin/" + configuration + "/**/*.exe"); +/// Sign(files, new SignToolSignSettings { +/// TimeStampUri = new Uri("http://timestamp.digicert.com"), +/// CertPath = "digitalcertificate.pfx", +/// Password = "TopSecret" +/// }); +/// }); +/// +/// +public void Sign(System.Collections.Generic.IEnumerable assemblies, Cake.Common.Tools.SignTool.SignToolSignSettings settings) +{ + Cake.Common.Tools.SignTool.SignToolSignAliases.Sign(Context, assemblies, settings); +} + +/// +/// Executes Roundhouse with the given configured settings. +/// +/// The context. +/// The settings. +/// +/// +/// RoundhouseMigrate(new RoundhouseSettings{ +/// ServerName = "Sql2008R2", +/// DatabaseName = "AdventureWorks2008R2", +/// SqlFilesDirectory = "./src/sql" +/// }); +/// +/// +public void RoundhouseMigrate(Cake.Common.Tools.Roundhouse.RoundhouseSettings settings) +{ + Cake.Common.Tools.Roundhouse.RoundhouseAliases.RoundhouseMigrate(Context, settings); +} + +/// +/// Executes Roundhouse migration to drop the database using the provided settings. +/// +/// The context. +/// The settings. +/// +/// +/// RoundhouseDrop(new RoundhouseSettings{ +/// ServerName = "Sql2008R2", +/// DatabaseName = "AdventureWorks2008R2" +/// }); +/// +/// +public void RoundhouseDrop(Cake.Common.Tools.Roundhouse.RoundhouseSettings settings) +{ + Cake.Common.Tools.Roundhouse.RoundhouseAliases.RoundhouseDrop(Context, settings); +} + +/// +/// Creates a release for the specified Octopus Deploy Project. +/// +/// The cake context. +/// The name of the project. +/// The settings. +/// +/// +/// // Minimum required +/// OctoCreateRelease(projectNameOnServer, new CreateReleaseSettings { +/// Server = "http://octopus-deploy.example", +/// ApiKey = "API-XXXXXXXXXXXXXXXXXXXX" +/// }); +/// +/// OctoCreateRelease(projectNameOnServer, new CreateReleaseSettings { +/// Server = "http://octopus-deploy.example", +/// Username = "DeployUser", +/// Password = "a-very-secure-password" +/// }); +/// +/// OctoCreateRelease(projectNameOnServer, new CreateReleaseSettings { +/// ConfigurationFile = @"C:\OctopusDeploy.config" +/// }); +/// +/// // Additional Options +/// OctoCreateRelease(projectNameOnServer, new CreateReleaseSettings { +/// ToolPath = "./tools/OctopusTools/Octo.exe" +/// EnableDebugLogging = true, +/// IgnoreSslErrors = true, +/// EnableServiceMessages = true, // Enables teamcity services messages when logging +/// ReleaseNumber = "1.8.2", +/// DefaultPackageVersion = "1.0.0.0", // All packages in the release should be 1.0.0.0 +/// Packages = new Dictionary<string, string> +/// { +/// { "PackageOne", "1.0.2.3" }, +/// { "PackageTwo", "5.2.3" } +/// }, +/// PackagesFolder = @"C:\MyOtherNugetFeed", +/// +/// // One or the other +/// ReleaseNotes = "Version 2.0 \n What a milestone we have ...", +/// ReleaseNotesFile = "./ReleaseNotes.md", +/// +/// IgnoreExisting = true // if this release number already exists, ignore it +/// }); +/// +/// +public void OctoCreateRelease(System.String projectName, Cake.Common.Tools.OctopusDeploy.CreateReleaseSettings settings) +{ + Cake.Common.Tools.OctopusDeploy.OctopusDeployAliases.OctoCreateRelease(Context, projectName, settings); +} + +/// +/// Pushes the specified package to the Octopus Deploy repository +/// +/// The cake context +/// The Octopus server URL +/// The user's API key +/// Path to the package +/// The settings +public void OctoPush(System.String server, System.String apiKey, Cake.Core.IO.FilePath packagePath, Cake.Common.Tools.OctopusDeploy.OctopusPushSettings settings) +{ + Cake.Common.Tools.OctopusDeploy.OctopusDeployAliases.OctoPush(Context, server, apiKey, packagePath, settings); +} + +/// +/// Pushes the specified packages to the Octopus Deploy repository +/// +/// The cake context +/// The Octopus server URL +/// The user's API key +/// Paths to the packages +/// The settings +public void OctoPush(System.String server, System.String apiKey, System.Collections.Generic.IEnumerable packagePaths, Cake.Common.Tools.OctopusDeploy.OctopusPushSettings settings) +{ + Cake.Common.Tools.OctopusDeploy.OctopusDeployAliases.OctoPush(Context, server, apiKey, packagePaths, settings); +} + +/// +/// Packs the specified folder into an Octopus Deploy package. +/// +/// The cake context +/// The package ID. +public void OctoPack(System.String id) +{ + Cake.Common.Tools.OctopusDeploy.OctopusDeployAliases.OctoPack(Context, id); +} + +/// +/// Packs the specified folder into an Octopus Deploy package. +/// +/// The cake context +/// The package ID. +/// The settings +public void OctoPack(System.String id, Cake.Common.Tools.OctopusDeploy.OctopusPackSettings settings = null) +{ + Cake.Common.Tools.OctopusDeploy.OctopusDeployAliases.OctoPack(Context, id, settings); +} + +/// +/// Deploys the specified already existing release into a specified environment +/// See Octopus Documentation for more details. +/// +/// The cake context +/// The Octopus server URL +/// The user's API key +/// Name of the target project +/// Target environment name +/// Version number of the release to deploy. Specify "latest" for the latest release +/// Deployment settings +/// +/// +/// // bare minimum +/// OctoDeployRelease("http://octopus-deploy.example", "API-XXXXXXXXXXXXXXXXXXXX", "MyGreatProject", "Testing", "2.1.15-RC" new OctopusDeployReleaseDeploymentSettings()); +/// +/// // All of deployment arguments +/// OctoDeployRelease("http://octopus-deploy.example", "API-XXXXXXXXXXXXXXXXXXXX", "MyGreatProject", "Testing", "2.1.15-RC" new OctopusDeployReleaseDeploymentSettings { +/// ShowProgress = true, +/// ForcePackageDownload = true, +/// WaitForDeployment = true, +/// DeploymentTimeout = TimeSpan.FromMinutes(1), +/// CancelOnTimeout = true, +/// DeploymentChecksLeepCycle = TimeSpan.FromMinutes(77), +/// GuidedFailure = true, +/// SpecificMachines = new string[] { "Machine1", "Machine2" }, +/// Force = true, +/// SkipSteps = new[] { "Step1", "Step2" }, +/// NoRawLog = true, +/// RawLogFile = "someFile.txt", +/// DeployAt = new DateTime(2010, 6, 15).AddMinutes(1), +/// Tenant = new[] { "Tenant1", "Tenant2" }, +/// TenantTags = new[] { "Tag1", "Tag2" }, +/// }); +/// +/// +public void OctoDeployRelease(System.String server, System.String apiKey, System.String projectName, System.String deployTo, System.String releaseNumber, Cake.Common.Tools.OctopusDeploy.OctopusDeployReleaseDeploymentSettings settings) +{ + Cake.Common.Tools.OctopusDeploy.OctopusDeployAliases.OctoDeployRelease(Context, server, apiKey, projectName, deployTo, releaseNumber, settings); +} + +/// +/// Runs all NUnit unit tests in the assemblies matching the specified pattern. +/// +/// The context. +/// The pattern. +/// +/// +/// NUnit3("./src/**/bin/Release/*.Tests.dll"); +/// +/// +public void NUnit3(System.String pattern) +{ + Cake.Common.Tools.NUnit.NUnit3Aliases.NUnit3(Context, pattern); +} + +/// +/// Runs all NUnit unit tests in the assemblies matching the specified pattern, +/// using the specified settings. +/// +/// The context. +/// The pattern. +/// The settings. +/// +/// +/// NUnit3("./src/**/bin/Release/*.Tests.dll", new NUnit3Settings { +/// NoResults = true +/// }); +/// +/// +public void NUnit3(System.String pattern, Cake.Common.Tools.NUnit.NUnit3Settings settings) +{ + Cake.Common.Tools.NUnit.NUnit3Aliases.NUnit3(Context, pattern, settings); +} + +/// +/// Runs all NUnit unit tests in the specified assemblies. +/// +/// The context. +/// The assemblies. +/// +/// +/// NUnit3(new [] { "./src/Example.Tests/bin/Release/Example.Tests.dll" }); +/// +/// +public void NUnit3(System.Collections.Generic.IEnumerable assemblies) +{ + Cake.Common.Tools.NUnit.NUnit3Aliases.NUnit3(Context, assemblies); +} + +/// +/// Runs all NUnit unit tests in the specified assemblies. +/// +/// The context. +/// The assemblies. +/// +/// +/// var testAssemblies = GetFiles("./src/**/bin/Release/*.Tests.dll"); +/// NUnit3(testAssemblies); +/// +/// +public void NUnit3(System.Collections.Generic.IEnumerable assemblies) +{ + Cake.Common.Tools.NUnit.NUnit3Aliases.NUnit3(Context, assemblies); +} + +/// +/// Runs all NUnit unit tests in the specified assemblies, +/// using the specified settings. +/// +/// The context. +/// The assemblies. +/// The settings. +/// +/// +/// NUnit3(new [] { "./src/Example.Tests/bin/Release/Example.Tests.dll" }, new NUnit3Settings { +/// NoResults = true +/// }); +/// +/// +public void NUnit3(System.Collections.Generic.IEnumerable assemblies, Cake.Common.Tools.NUnit.NUnit3Settings settings) +{ + Cake.Common.Tools.NUnit.NUnit3Aliases.NUnit3(Context, assemblies, settings); +} + +/// +/// Runs all NUnit unit tests in the specified assemblies, +/// using the specified settings. +/// +/// The context. +/// The assemblies. +/// The settings. +/// +/// +/// var testAssemblies = GetFiles("./src/**/bin/Release/*.Tests.dll"); +/// NUnit3(testAssemblies, new NUnit3Settings { +/// NoResults = true +/// }); +/// +/// +public void NUnit3(System.Collections.Generic.IEnumerable assemblies, Cake.Common.Tools.NUnit.NUnit3Settings settings) +{ + Cake.Common.Tools.NUnit.NUnit3Aliases.NUnit3(Context, assemblies, settings); +} + +/// +/// Runs all NUnit unit tests in the assemblies matching the specified pattern. +/// +/// +/// +/// NUnit("./src/UnitTests/*.dll"); +/// +/// +/// The context. +/// The pattern. +public void NUnit(System.String pattern) +{ + Cake.Common.Tools.NUnit.NUnitAliases.NUnit(Context, pattern); +} + +/// +/// Runs all NUnit unit tests in the assemblies matching the specified pattern, +/// using the specified settings. +/// +/// +/// +/// NUnit("./src/UnitTests/*.dll", new NUnitSettings { +/// Timeout = 4000, +/// StopOnError = true +/// }); +/// +/// +/// The context. +/// The pattern. +/// The settings. +public void NUnit(System.String pattern, Cake.Common.Tools.NUnit.NUnitSettings settings) +{ + Cake.Common.Tools.NUnit.NUnitAliases.NUnit(Context, pattern, settings); +} + +/// +/// Runs all NUnit unit tests in the specified assemblies. +/// +/// +/// +/// var assemblies = new [] { +/// "UnitTests1.dll", +/// "UnitTests2.dll" +/// }; +/// NUnit(assemblies); +/// +/// +/// The context. +/// The assemblies. +public void NUnit(System.Collections.Generic.IEnumerable assemblies) +{ + Cake.Common.Tools.NUnit.NUnitAliases.NUnit(Context, assemblies); +} + +/// +/// Runs all NUnit unit tests in the specified assemblies. +/// +/// +/// +/// var assemblies = GetFiles("./src/UnitTests/*.dll"); +/// NUnit(assemblies); +/// +/// +/// The context. +/// The assemblies. +public void NUnit(System.Collections.Generic.IEnumerable assemblies) +{ + Cake.Common.Tools.NUnit.NUnitAliases.NUnit(Context, assemblies); +} + +/// +/// Runs all NUnit unit tests in the specified assemblies, +/// using the specified settings. +/// +/// +/// +/// var assemblies = new [] { +/// "UnitTests1.dll", +/// "UnitTests2.dll" +/// }; +/// NUnit(assemblies, new NUnitSettings { +/// Timeout = 4000, +/// StopOnError = true +/// }); +/// +/// +/// The context. +/// The assemblies. +/// The settings. +public void NUnit(System.Collections.Generic.IEnumerable assemblies, Cake.Common.Tools.NUnit.NUnitSettings settings) +{ + Cake.Common.Tools.NUnit.NUnitAliases.NUnit(Context, assemblies, settings); +} + +/// +/// Runs all NUnit unit tests in the specified assemblies, +/// using the specified settings. +/// +/// +/// +/// var assemblies = GetFiles(""./src/UnitTests/*.dll""); +/// NUnit(assemblies, new NUnitSettings { +/// Timeout = 4000, +/// StopOnError = true +/// }); +/// +/// +/// The context. +/// The assemblies. +/// The settings. +public void NUnit(System.Collections.Generic.IEnumerable assemblies, Cake.Common.Tools.NUnit.NUnitSettings settings) +{ + Cake.Common.Tools.NUnit.NUnitAliases.NUnit(Context, assemblies, settings); +} + +/// +/// Creates a NuGet package using the specified Nuspec or project file. +/// +/// The context. +/// The nuspec or project file path. +/// The settings. +/// +/// +/// var nuGetPackSettings = new NuGetPackSettings { +/// Id = "TestNuget", +/// Version = "0.0.0.1", +/// Title = "The tile of the package", +/// Authors = new[] {"John Doe"}, +/// Owners = new[] {"Contoso"}, +/// Description = "The description of the package", +/// Summary = "Excellent summary of what the package does", +/// ProjectUrl = new Uri("https://github.com/SomeUser/TestNuget/"), +/// IconUrl = new Uri("http://cdn.rawgit.com/SomeUser/TestNuget/master/icons/testnuget.png"), +/// LicenseUrl = new Uri("https://github.com/SomeUser/TestNuget/blob/master/LICENSE.md"), +/// Copyright = "Some company 2015", +/// ReleaseNotes = new [] {"Bug fixes", "Issue fixes", "Typos"}, +/// Tags = new [] {"Cake", "Script", "Build"}, +/// RequireLicenseAcceptance= false, +/// Symbols = false, +/// NoPackageAnalysis = true, +/// Files = new [] { +/// new NuSpecContent {Source = "bin/TestNuget.dll", Target = "bin"}, +/// }, +/// BasePath = "./src/TestNuget/bin/release", +/// OutputDirectory = "./nuget" +/// }; +/// +/// NuGetPack("./nuspec/TestNuget.nuspec", nuGetPackSettings); +/// +/// +public void NuGetPack(Cake.Core.IO.FilePath filePath, Cake.Common.Tools.NuGet.Pack.NuGetPackSettings settings) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetPack(Context, filePath, settings); +} + +/// +/// Creates NuGet packages using the specified Nuspec or project files. +/// +/// The context. +/// The nuspec or project file paths. +/// The settings. +/// +/// +/// var nuGetPackSettings = new NuGetPackSettings { +/// Id = "TestNuget", +/// Version = "0.0.0.1", +/// Title = "The tile of the package", +/// Authors = new[] {"John Doe"}, +/// Owners = new[] {"Contoso"}, +/// Description = "The description of the package", +/// Summary = "Excellent summary of what the package does", +/// ProjectUrl = new Uri("https://github.com/SomeUser/TestNuget/"), +/// IconUrl = new Uri("http://cdn.rawgit.com/SomeUser/TestNuget/master/icons/testnuget.png"), +/// LicenseUrl = new Uri("https://github.com/SomeUser/TestNuget/blob/master/LICENSE.md"), +/// Copyright = "Some company 2015", +/// ReleaseNotes = new [] {"Bug fixes", "Issue fixes", "Typos"}, +/// Tags = new [] {"Cake", "Script", "Build"}, +/// RequireLicenseAcceptance= false, +/// Symbols = false, +/// NoPackageAnalysis = true, +/// Files = new [] { +/// new NuSpecContent {Source = "bin/TestNuget.dll", Target = "bin"}, +/// }, +/// BasePath = "./src/TestNuget/bin/release", +/// OutputDirectory = "./nuget" +/// }; +/// +/// var nuspecFiles = GetFiles("./**/*.nuspec"); +/// NuGetPack(nuspecFiles, nuGetPackSettings); +/// +/// +public void NuGetPack(System.Collections.Generic.IEnumerable filePaths, Cake.Common.Tools.NuGet.Pack.NuGetPackSettings settings) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetPack(Context, filePaths, settings); +} + +/// +/// Creates a NuGet package using the specified settings. +/// +/// The context. +/// The settings. +/// +/// +/// var nuGetPackSettings = new NuGetPackSettings { +/// Id = "TestNuget", +/// Version = "0.0.0.1", +/// Title = "The tile of the package", +/// Authors = new[] {"John Doe"}, +/// Owners = new[] {"Contoso"}, +/// Description = "The description of the package", +/// Summary = "Excellent summary of what the package does", +/// ProjectUrl = new Uri("https://github.com/SomeUser/TestNuget/"), +/// IconUrl = new Uri("http://cdn.rawgit.com/SomeUser/TestNuget/master/icons/testnuget.png"), +/// LicenseUrl = new Uri("https://github.com/SomeUser/TestNuget/blob/master/LICENSE.md"), +/// Copyright = "Some company 2015", +/// ReleaseNotes = new [] {"Bug fixes", "Issue fixes", "Typos"}, +/// Tags = new [] {"Cake", "Script", "Build"}, +/// RequireLicenseAcceptance= false, +/// Symbols = false, +/// NoPackageAnalysis = true, +/// Files = new [] { +/// new NuSpecContent {Source = "bin/TestNuget.dll", Target = "bin"}, +/// }, +/// BasePath = "./src/TestNuget/bin/release", +/// OutputDirectory = "./nuget" +/// }; +/// +/// NuGetPack(nuGetPackSettings); +/// +/// +public void NuGetPack(Cake.Common.Tools.NuGet.Pack.NuGetPackSettings settings) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetPack(Context, settings); +} + +/// +/// Restores NuGet packages for the specified target. +/// +/// The context. +/// The target to restore. +/// +/// +/// var solutions = GetFiles("./**/*.sln"); +/// // Restore all NuGet packages. +/// foreach(var solution in solutions) +/// { +/// Information("Restoring {0}", solution); +/// NuGetRestore(solution); +/// } +/// +/// +public void NuGetRestore(Cake.Core.IO.FilePath targetFilePath) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetRestore(Context, targetFilePath); +} + +/// +/// Restores NuGet packages for the specified targets. +/// +/// The context. +/// The targets to restore. +/// +/// +/// var solutions = GetFiles("./**/*.sln"); +/// NuGetRestore(solutions); +/// +/// +public void NuGetRestore(System.Collections.Generic.IEnumerable targetFilePaths) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetRestore(Context, targetFilePaths); +} + +/// +/// Restores NuGet packages using the specified settings. +/// +/// The context. +/// The target to restore. +/// The settings. +/// +/// +/// var solutions = GetFiles("./**/*.sln"); +/// // Restore all NuGet packages. +/// foreach(var solution in solutions) +/// { +/// Information("Restoring {0}", solution); +/// NuGetRestore(solution, new NuGetRestoreSettings { NoCache = true }); +/// } +/// +/// +public void NuGetRestore(Cake.Core.IO.FilePath targetFilePath, Cake.Common.Tools.NuGet.Restore.NuGetRestoreSettings settings) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetRestore(Context, targetFilePath, settings); +} + +/// +/// Restores NuGet packages using the specified settings. +/// +/// The context. +/// The targets to restore. +/// The settings. +/// +/// +/// var solutions = GetFiles("./**/*.sln"); +/// NuGetRestore(solutions, new NuGetRestoreSettings { NoCache = true }); +/// +/// +public void NuGetRestore(System.Collections.Generic.IEnumerable targetFilePaths, Cake.Common.Tools.NuGet.Restore.NuGetRestoreSettings settings) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetRestore(Context, targetFilePaths, settings); +} + +/// +/// Pushes a NuGet package to a NuGet server and publishes it. +/// +/// The context. +/// The .nupkg file path. +/// The settings. +/// +/// NOTE: Starting with NuGet 3.4.2, the Source parameter is a mandatory parameter. +/// It is strongly recommended that you ALWAYS set the Source property within the instance. +/// +/// // Get the path to the package. +/// var package = "./nuget/SlackPRTGCommander.0.0.1.nupkg"; +/// +/// // Push the package. +/// NuGetPush(package, new NuGetPushSettings { +/// Source = "http://example.com/nugetfeed", +/// ApiKey = "4003d786-cc37-4004-bfdf-c4f3e8ef9b3a" +/// }); +/// +/// +public void NuGetPush(Cake.Core.IO.FilePath packageFilePath, Cake.Common.Tools.NuGet.Push.NuGetPushSettings settings) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetPush(Context, packageFilePath, settings); +} + +/// +/// Pushes NuGet packages to a NuGet server and publishes them. +/// +/// The context. +/// The .nupkg file paths. +/// The settings. +/// +/// NOTE: Starting with NuGet 3.4.2, the Source parameter is a mandatory parameter. +/// It is strongly recommended that you ALWAYS set the Source property within the instance. +/// +/// // Get the paths to the packages. +/// var packages = GetFiles("./**/*.nupkg"); +/// +/// // Push the package. +/// NuGetPush(packages, new NuGetPushSettings { +/// Source = "http://example.com/nugetfeed", +/// ApiKey = "4003d786-cc37-4004-bfdf-c4f3e8ef9b3a" +/// }); +/// +/// +public void NuGetPush(System.Collections.Generic.IEnumerable packageFilePaths, Cake.Common.Tools.NuGet.Push.NuGetPushSettings settings) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetPush(Context, packageFilePaths, settings); +} + +/// +/// Adds NuGet package source using the specified name &source to global user config +/// +/// The context. +/// Name of the source. +/// Path to the package(s) source. +/// +/// +/// var feed = new +/// { +/// Name = EnvironmentVariable("PUBLIC_FEED_NAME"), +/// Source = EnvironmentVariable("PUBLIC_FEED_SOURCE") +/// }; +/// +/// NuGetAddSource( +/// name:feed.Name, +/// source:feed.Source +/// ); +/// +/// +public void NuGetAddSource(System.String name, System.String source) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetAddSource(Context, name, source); +} + +/// +/// Adds NuGet package source using the specified name, source & settings to global user config +/// +/// The context. +/// Name of the source. +/// Path to the package(s) source. +/// The settings. +/// +/// +/// var nugetSourceSettings = new NuGetSourcesSettings +/// { +/// UserName = EnvironmentVariable("PRIVATE_FEED_USERNAME"), +/// Password = EnvironmentVariable("PRIVATE_FEED_PASSWORD"), +/// IsSensitiveSource = true, +/// Verbosity = NuGetVerbosity.Detailed +/// }; +/// +/// var feed = new +/// { +/// Name = EnvironmentVariable("PRIVATE_FEED_NAME"), +/// Source = EnvironmentVariable("PRIVATE_FEED_SOURCE") +/// }; +/// +/// NuGetAddSource( +/// name:feed.Name, +/// source:feed.Source, +/// settings:nugetSourceSettings +/// ); +/// +/// +public void NuGetAddSource(System.String name, System.String source, Cake.Common.Tools.NuGet.Sources.NuGetSourcesSettings settings) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetAddSource(Context, name, source, settings); +} + +/// +/// Removes NuGet package source using the specified name & source from global user config +/// +/// The context. +/// Name of the source. +/// Path to the package(s) source. +/// +/// +/// var feed = new +/// { +/// Name = EnvironmentVariable("PRIVATE_FEED_NAME"), +/// Source = EnvironmentVariable("PRIVATE_FEED_SOURCE") +/// }; +/// +/// NuGetRemoveSource( +/// name:feed.Name, +/// source:feed.Source +/// ); +/// +/// +public void NuGetRemoveSource(System.String name, System.String source) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetRemoveSource(Context, name, source); +} + +/// +/// Removes NuGet package source using the specified name, source & settings from global user config +/// +/// The context. +/// Name of the source. +/// Path to the package(s) source. +/// The settings. +/// +/// +/// var nugetSourceSettings = new NuGetSourcesSettings +/// { +/// UserName = EnvironmentVariable("PRIVATE_FEED_USERNAME"), +/// Password = EnvironmentVariable("PRIVATE_FEED_PASSWORD"), +/// IsSensitiveSource = true, +/// Verbosity = NuGetVerbosity.Detailed +/// }; +/// +/// var feed = new +/// { +/// Name = EnvironmentVariable("PRIVATE_FEED_NAME"), +/// Source = EnvironmentVariable("PRIVATE_FEED_SOURCE") +/// }; +/// +/// NuGetRemoveSource( +/// name:feed.Name, +/// source:feed.Source, +/// settings:nugetSourceSettings +/// ); +/// +/// +public void NuGetRemoveSource(System.String name, System.String source, Cake.Common.Tools.NuGet.Sources.NuGetSourcesSettings settings) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetRemoveSource(Context, name, source, settings); +} + +/// +/// Checks whether or not a NuGet package source exists in the global user configuration, using the specified source. +/// +/// The context. +/// Path to the package(s) source. +/// Whether or not the NuGet package source exists in the global user configuration. +/// +/// +/// var feed = new +/// { +/// Name = EnvironmentVariable("PRIVATE_FEED_NAME"), +/// Source = EnvironmentVariable("PRIVATE_FEED_SOURCE") +/// }; +/// if (!NuGetHasSource(source:feed.Source)) +/// { +/// Information("Source missing"); +/// } +/// else +/// { +/// Information("Source already exists"); +/// } +/// +/// +public System.Boolean NuGetHasSource(System.String source) +{ + return Cake.Common.Tools.NuGet.NuGetAliases.NuGetHasSource(Context, source); +} + +/// +/// Checks whether or not a NuGet package source exists in the global user configuration, using the specified source and settings. +/// +/// The context. +/// Path to the package(s) source. +/// The settings. +/// Whether the specified NuGet package source exist. +/// +/// +/// var nugetSourceSettings = new NuGetSourcesSettings +/// { +/// UserName = EnvironmentVariable("PRIVATE_FEED_USERNAME"), +/// Password = EnvironmentVariable("PRIVATE_FEED_PASSWORD"), +/// IsSensitiveSource = true, +/// Verbosity = NuGetVerbosity.Detailed +/// }; +/// var feed = new +/// { +/// Name = EnvironmentVariable("PRIVATE_FEED_NAME"), +/// Source = EnvironmentVariable("PRIVATE_FEED_SOURCE") +/// }; +/// if (!NuGetHasSource( +/// source:feed.Source, +/// settings:nugetSourceSettings)) +/// { +/// Information("Source missing"); +/// } +/// else +/// { +/// Information("Source already exists"); +/// } +/// +/// +public System.Boolean NuGetHasSource(System.String source, Cake.Common.Tools.NuGet.Sources.NuGetSourcesSettings settings) +{ + return Cake.Common.Tools.NuGet.NuGetAliases.NuGetHasSource(Context, source, settings); +} + +/// +/// Installs a NuGet package. +/// +/// The context. +/// The id of the package to install. +/// +/// +/// NuGetInstall("MyNugetPackage"); +/// +/// +public void NuGetInstall(System.String packageId) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetInstall(Context, packageId); +} + +/// +/// Installs NuGet packages. +/// +/// The context. +/// The id's of the package to install. +/// +/// +/// NuGetInstall(new[] { "MyNugetPackage", "OtherNugetPackage" }); +/// +/// +public void NuGetInstall(System.Collections.Generic.IEnumerable packageIds) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetInstall(Context, packageIds); +} + +/// +/// Installs a NuGet package using the specified settings. +/// +/// The context. +/// The id of the package to install. +/// The settings. +/// +/// +/// NuGetInstall("MyNugetPackage", new NuGetInstallSettings { +/// ExcludeVersion = true, +/// OutputDirectory = "./tools" +/// }); +/// +/// +public void NuGetInstall(System.String packageId, Cake.Common.Tools.NuGet.Install.NuGetInstallSettings settings) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetInstall(Context, packageId, settings); +} + +/// +/// Installs NuGet packages using the specified settings. +/// +/// The context. +/// The id's of the package to install. +/// The settings. +/// +/// +/// NuGetInstall(new[] { "MyNugetPackage", "OtherNugetPackage" }, new NuGetInstallSettings { +/// ExcludeVersion = true, +/// OutputDirectory = "./tools" +/// }); +/// +/// +public void NuGetInstall(System.Collections.Generic.IEnumerable packageIds, Cake.Common.Tools.NuGet.Install.NuGetInstallSettings settings) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetInstall(Context, packageIds, settings); +} + +/// +/// Installs NuGet packages using the specified package configuration. +/// +/// The context. +/// The package configuration to install. +/// +/// +/// NuGetInstallFromConfig("./tools/packages.config"); +/// +/// +public void NuGetInstallFromConfig(Cake.Core.IO.FilePath packageConfigPath) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetInstallFromConfig(Context, packageConfigPath); +} + +/// +/// Installs NuGet packages using the specified package configurations. +/// +/// The context. +/// The package configurations to install. +/// +/// +/// var packageConfigs = GetFiles("./**/packages.config"); +/// +/// NuGetInstallFromConfig(packageConfigs); +/// +/// +public void NuGetInstallFromConfig(System.Collections.Generic.IEnumerable packageConfigPaths) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetInstallFromConfig(Context, packageConfigPaths); +} + +/// +/// Installs NuGet packages using the specified package configuration and settings. +/// +/// The context. +/// The package configuration to install. +/// The settings. +/// +/// +/// NuGetInstallFromConfig("./tools/packages.config", new NuGetInstallSettings { +/// ExcludeVersion = true, +/// OutputDirectory = "./tools" +/// }); +/// +/// +public void NuGetInstallFromConfig(Cake.Core.IO.FilePath packageConfigPath, Cake.Common.Tools.NuGet.Install.NuGetInstallSettings settings) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetInstallFromConfig(Context, packageConfigPath, settings); +} + +/// +/// Installs NuGet packages using the specified package configurations and settings. +/// +/// The context. +/// The package configurations to install. +/// The settings. +/// +/// +/// var packageConfigs = GetFiles("./**/packages.config"); +/// +/// NuGetInstallFromConfig(packageConfigs, new NuGetInstallSettings { +/// ExcludeVersion = true, +/// OutputDirectory = "./tools" +/// }); +/// +/// +public void NuGetInstallFromConfig(System.Collections.Generic.IEnumerable packageConfigPaths, Cake.Common.Tools.NuGet.Install.NuGetInstallSettings settings) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetInstallFromConfig(Context, packageConfigPaths, settings); +} + +/// +/// Installs NuGet packages using the specified API key, source and settings. +/// +/// +/// +/// var setting = new NuGetSetApiKeySettings { +/// Verbosity = NuGetVerbosity.Detailed +/// }; +/// NuGetSetApiKey("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "https://nuget.org/api/v2/", setting); +/// +/// +/// The context. +/// The API key. +/// Server URL where the API key is valid. +/// The settings. +public void NuGetSetApiKey(System.String apiKey, System.String source, Cake.Common.Tools.NuGet.SetApiKey.NuGetSetApiKeySettings settings) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetSetApiKey(Context, apiKey, source, settings); +} + +/// +/// Installs NuGet packages using the specified API key and source. +/// +/// +/// +/// NuGetSetApiKey("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "https://nuget.org/api/v2/"); +/// +/// +/// The context. +/// The API key. +/// Server URL where the API key is valid. +public void NuGetSetApiKey(System.String apiKey, System.String source) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetSetApiKey(Context, apiKey, source); +} + +/// +/// Set the proxy settings to be used while connecting to your NuGet feed, including settings. +/// +/// +/// +/// var setting = new NuGetSetProxySettings { +/// Verbosity = NuGetVerbosity.Detailed +/// }; +/// NuGetSetProxy("127.0.0.1:8080", "proxyuser","Pa$$w0rd1", setting); +/// +/// +/// The context. +/// The url of the proxy. +/// The username used to access the proxy. +/// The password used to access the proxy. +/// The settings. +public void NuGetSetProxy(System.String proxy, System.String username, System.String password, Cake.Common.Tools.NuGet.SetProxy.NuGetSetProxySettings settings) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetSetProxy(Context, proxy, username, password, settings); +} + +/// +/// Set the proxy settings to be used while connecting to your NuGet feed. +/// +/// +/// +/// NuGetSetProxy("127.0.0.1:8080", "proxyuser","Pa$$w0rd1"); +/// +/// +/// The context. +/// The url of the proxy. +/// The username used to access the proxy. +/// The password used to access the proxy. +public void NuGetSetProxy(System.String proxy, System.String username, System.String password) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetSetProxy(Context, proxy, username, password); +} + +/// +/// Updates NuGet packages. +/// +/// The context. +/// The target to update. +/// +/// +/// NuGetUpdate("./tools/packages.config"); +/// +/// +public void NuGetUpdate(Cake.Core.IO.FilePath targetFile) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetUpdate(Context, targetFile); +} + +/// +/// Updates NuGet packages. +/// +/// The context. +/// The targets to update. +/// +/// +/// var targets = GetFiles("./**/packages.config"); +/// +/// NuGetUpdate(targets); +/// +/// +public void NuGetUpdate(System.Collections.Generic.IEnumerable targetFiles) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetUpdate(Context, targetFiles); +} + +/// +/// Updates NuGet packages using the specified settings. +/// +/// The context. +/// The target to update. +/// The settings. +/// +/// +/// NuGetUpdate("./tools/packages.config", new NuGetUpdateSettings { +/// Prerelease = true, +/// }); +/// +/// +public void NuGetUpdate(Cake.Core.IO.FilePath targetFile, Cake.Common.Tools.NuGet.Update.NuGetUpdateSettings settings) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetUpdate(Context, targetFile, settings); +} + +/// +/// Updates NuGet packages using the specified settings. +/// +/// The context. +/// The targets to update. +/// The settings. +/// +/// +/// var targets = GetFiles("./**/packages.config"); +/// +/// NuGetUpdate(targets, new NuGetUpdateSettings { +/// Prerelease = true, +/// }); +/// +/// +public void NuGetUpdate(System.Collections.Generic.IEnumerable targetFiles, Cake.Common.Tools.NuGet.Update.NuGetUpdateSettings settings) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetUpdate(Context, targetFiles, settings); +} + +/// +/// Adds a NuGet package using package id and source. +/// +/// The context. +/// The id of the package to add. +/// Path to the local feed source. +/// +/// +/// NuGetAdd("MyNugetPackage", "//bar/packages/"); +/// +/// +public void NuGetAdd(System.String packageId, System.String source) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetAdd(Context, packageId, source); +} + +/// +/// Adds a NuGet package using package id and source. +/// +/// The context. +/// The id of the package to add. +/// The settings. +/// +/// +/// NuGetAdd("MyNugetPackage", new NuGetAddSettings({ +/// Source = "//bar/packages/" +/// }); +/// +/// +public void NuGetAdd(System.String packageId, Cake.Common.Tools.NuGet.Add.NuGetAddSettings settings) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetAdd(Context, packageId, settings); +} + +/// +/// Adds all packages from source to destination. +/// +/// The context. +/// The local feed package source. +/// The local feed destination source. +/// +/// +/// NuGetInit("//foo/packages", "//bar/packages/"); +/// +/// +public void NuGetInit(System.String source, System.String destination) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetInit(Context, source, destination); +} + +/// +/// Adds all packages from source to destination using specified settings. +/// +/// The context. +/// The local feed package source. +/// The local feed destination source. +/// The settings. +/// +/// +/// NuGetInit("//foo/packages", "//bar/packages/", new NuGetInitSettings { +/// Expand = true +/// }); +/// +/// +public void NuGetInit(System.String source, System.String destination, Cake.Common.Tools.NuGet.Init.NuGetInitSettings settings) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetInit(Context, source, destination, settings); +} + +/// +/// Runs all MSTest unit tests in the assemblies matching the specified pattern. +/// +/// +/// +/// MSTest("./Tests/*.UnitTests.dll"); +/// +/// +/// The context. +/// The pattern. +public void MSTest(System.String pattern) +{ + Cake.Common.Tools.MSTest.MSTestAliases.MSTest(Context, pattern); +} + +/// +/// Runs all MSTest unit tests in the assemblies matching the specified pattern. +/// +/// +/// +/// MSTest("./Tests/*.UnitTests.dll", new MSTestSettings() { NoIsolation = false }); +/// +/// +/// The context. +/// The pattern. +/// The settings. +public void MSTest(System.String pattern, Cake.Common.Tools.MSTest.MSTestSettings settings) +{ + Cake.Common.Tools.MSTest.MSTestAliases.MSTest(Context, pattern, settings); +} + +/// +/// Runs all MSTest unit tests in the specified assemblies. +/// +/// +/// +/// var paths = new List<FilePath>() { "./assemblydir1", "./assemblydir2" }; +/// MSTest(paths); +/// +/// +/// The context. +/// The assembly paths. +public void MSTest(System.Collections.Generic.IEnumerable assemblyPaths) +{ + Cake.Common.Tools.MSTest.MSTestAliases.MSTest(Context, assemblyPaths); +} + +/// +/// Runs all MSTest unit tests in the specified assemblies. +/// +/// +/// +/// var paths = new List<FilePath>() { "./assemblydir1", "./assemblydir2" }; +/// MSTest(paths, new MSTestSettings() { NoIsolation = false }); +/// +/// +/// The context. +/// The assembly paths. +/// The settings. +public void MSTest(System.Collections.Generic.IEnumerable assemblyPaths, Cake.Common.Tools.MSTest.MSTestSettings settings) +{ + Cake.Common.Tools.MSTest.MSTestAliases.MSTest(Context, assemblyPaths, settings); +} + +/// +/// Builds the specified solution using MSBuild. +/// +/// The context. +/// The solution. +/// +/// +/// MSBuild("./src/Cake.sln"); +/// +/// +public void MSBuild(Cake.Core.IO.FilePath solution) +{ + Cake.Common.Tools.MSBuild.MSBuildAliases.MSBuild(Context, solution); +} + +/// +/// Builds the specified solution using MSBuild. +/// +/// The context. +/// The solution to build. +/// The settings configurator. +/// +/// +/// MSBuild("./src/Cake.sln", configurator => +/// configurator.SetConfiguration("Debug") +/// .SetVerbosity(Verbosity.Minimal) +/// .UseToolVersion(MSBuildToolVersion.VS2015) +/// .SetMSBuildPlatform(MSBuildPlatform.x86) +/// .SetPlatformTarget(PlatformTarget.MSIL)); +/// +/// +public void MSBuild(Cake.Core.IO.FilePath solution, System.Action configurator) +{ + Cake.Common.Tools.MSBuild.MSBuildAliases.MSBuild(Context, solution, configurator); +} + +/// +/// Builds the specified solution using MSBuild. +/// +/// The context. +/// The solution to build. +/// The settings. +/// +/// +/// MSBuild("./src/Cake.sln", new MSBuildSettings { +/// Verbosity = Verbosity.Minimal, +/// ToolVersion = MSBuildToolVersion.VS2015, +/// Configuration = "Release", +/// PlatformTarget = PlatformTarget.MSIL +/// }); +/// +/// +public void MSBuild(Cake.Core.IO.FilePath solution, Cake.Common.Tools.MSBuild.MSBuildSettings settings) +{ + Cake.Common.Tools.MSBuild.MSBuildAliases.MSBuild(Context, solution, settings); +} + +/// +/// Merges the specified assemblies. +/// +/// The context. +/// The output file. +/// The primary assembly. +/// The assembly paths. +/// +/// +/// var assemblyPaths = GetFiles("./**/Cake.*.dll"); +/// ILMerge("./MergedCake.exe", "./Cake.exe", assemblyPaths); +/// +/// +public void ILMerge(Cake.Core.IO.FilePath outputFile, Cake.Core.IO.FilePath primaryAssembly, System.Collections.Generic.IEnumerable assemblyPaths) +{ + Cake.Common.Tools.ILMerge.ILMergeAliases.ILMerge(Context, outputFile, primaryAssembly, assemblyPaths); +} + +/// +/// Merges the specified assemblies. +/// +/// The context. +/// The output file. +/// The primary assembly. +/// The assembly paths. +/// The settings. +/// +/// +/// var assemblyPaths = GetFiles("./**/Cake.*.dll"); +/// ILMerge( +/// "./MergedCake.exe", +/// "./Cake.exe", +/// assemblyPaths, +/// new ILMergeSettings { Internalize = true }); +/// +/// +public void ILMerge(Cake.Core.IO.FilePath outputFile, Cake.Core.IO.FilePath primaryAssembly, System.Collections.Generic.IEnumerable assemblyPaths, Cake.Common.Tools.ILMerge.ILMergeSettings settings) +{ + Cake.Common.Tools.ILMerge.ILMergeAliases.ILMerge(Context, outputFile, primaryAssembly, assemblyPaths, settings); +} + +/// +/// Executes cake script out of process +/// +/// The context. +/// The script file. +/// +/// +/// CakeExecuteScript("./helloworld.cake"); +/// +/// +public void CakeExecuteScript(Cake.Core.IO.FilePath cakeScriptPath) +{ + Cake.Common.Tools.Cake.CakeAliases.CakeExecuteScript(Context, cakeScriptPath); +} + +/// +/// Executes cake script out of process +/// +/// The context. +/// The script file. +/// The settings . +/// +/// +/// CakeExecuteScript("./helloworld.cake", new CakeSettings{ ToolPath="./Cake.exe" }); +/// +/// +public void CakeExecuteScript(Cake.Core.IO.FilePath cakeScriptPath, Cake.Common.Tools.Cake.CakeSettings settings) +{ + Cake.Common.Tools.Cake.CakeAliases.CakeExecuteScript(Context, cakeScriptPath, settings); +} + +/// +/// Executes Cake expression out of process +/// +/// The context. +/// The cake expression +/// +/// +/// CakeExecuteExpression("Information(\"Hello {0}\", \"World\");"); +/// +/// +public void CakeExecuteExpression(System.String cakeExpression) +{ + Cake.Common.Tools.Cake.CakeAliases.CakeExecuteExpression(Context, cakeExpression); +} + +/// +/// Executes Cake expression out of process +/// +/// The context. +/// The cake expression +/// The settings . +/// +/// +/// CakeExecuteExpression( +/// "Information(\"Hello {0}!\", Argument<string>(\"name\"));", +/// new CakeSettings { +/// ToolPath="./Cake.exe" , +/// Arguments = new Dictionary<string, string>{{"name", "World"}} +/// }); +/// +/// +public void CakeExecuteExpression(System.String cakeExpression, Cake.Common.Tools.Cake.CakeSettings settings) +{ + Cake.Common.Tools.Cake.CakeAliases.CakeExecuteExpression(Context, cakeExpression, settings); +} + +/// +/// Creates a text transformation from the provided template. +/// +/// The context. +/// The template. +/// A representing the provided template. +/// +/// This sample shows how to create a using +/// the specified template. +/// +/// string text = TransformText("Hello <%subject%>!") +/// .WithToken("subject", "world") +/// .ToString(); +/// +/// +public Cake.Common.Text.TextTransformation TransformText(System.String template) +{ + return Cake.Common.Text.TextTransformationAliases.TransformText(Context, template); +} + +/// +/// Creates a text transformation from the provided template, using the specified placeholder. +/// +/// The context. +/// The template. +/// The left placeholder. +/// The right placeholder. +/// A representing the provided template. +/// +/// This sample shows how to create a using +/// the specified template and placeholder. +/// +/// string text = TransformText("Hello {subject}!", "{", "}") +/// .WithToken("subject", "world") +/// .ToString(); +/// +/// +public Cake.Common.Text.TextTransformation TransformText(System.String template, System.String leftPlaceholder, System.String rightPlaceholder) +{ + return Cake.Common.Text.TextTransformationAliases.TransformText(Context, template, leftPlaceholder, rightPlaceholder); +} + +/// +/// Creates a text transformation from the provided template on disc. +/// +/// The context. +/// The template file path. +/// A representing the provided template. +/// +/// This sample shows how to create a using +/// the specified template file with the placeholder format <%key%>. +/// +/// string text = TransformTextFile("./template.txt") +/// .WithToken("subject", "world") +/// .ToString(); +/// +/// +public Cake.Common.Text.TextTransformation TransformTextFile(Cake.Core.IO.FilePath path) +{ + return Cake.Common.Text.TextTransformationAliases.TransformTextFile(Context, path); +} + +/// +/// Creates a text transformation from the provided template on disc, using the specified placeholder. +/// +/// The context. +/// The template file path. +/// The left placeholder. +/// The right placeholder. +/// A representing the provided template. +/// +/// This sample shows how to create a using +/// the specified template file and placeholder. +/// +/// string text = TransformTextFile("./template.txt", "{", "}") +/// .WithToken("subject", "world") +/// .ToString(); +/// +/// +public Cake.Common.Text.TextTransformation TransformTextFile(Cake.Core.IO.FilePath path, System.String leftPlaceholder, System.String rightPlaceholder) +{ + return Cake.Common.Text.TextTransformationAliases.TransformTextFile(Context, path, leftPlaceholder, rightPlaceholder); +} + +/// +/// Parses project information from a solution file. +/// +/// The context. +/// The solution path. +/// A parsed solution. +/// +/// +/// var solutionPath = "./src/Cake.sln"; +/// Information("Parsing {0}", solutionPath); +/// var parsedSolution = ParseSolution(solutionPath); +/// foreach(var project in parsedSolution.Projects) +/// { +/// Information( +/// @"Solution project file: +/// Name: {0} +/// Path: {1} +/// Id : {2} +/// Type: {3}", +/// project.Name, +/// project.Path, +/// project.Id, +/// project.Type +/// ); +/// } +/// +/// +public Cake.Common.Solution.SolutionParserResult ParseSolution(Cake.Core.IO.FilePath solutionPath) +{ + return Cake.Common.Solution.SolutionAliases.ParseSolution(Context, solutionPath); +} + +/// +/// Parses project information from project file +/// +/// The context. +/// The project file path. +/// A parsed project. +/// +/// +/// var parsedProject = ParseProject("./src/Cake/Cake.csproj"); +/// Information( +/// @" Parsed project file: +/// Configuration : {0} +/// Platform : {1} +/// OutputType : {2} +/// OutputPath : {3} +/// RootNameSpace : {4} +/// AssemblyName : {5} +/// TargetFrameworkVersion: {6} +/// Files : {7}", +/// parsedProject.Configuration, +/// parsedProject.Platform, +/// parsedProject.OutputType, +/// parsedProject.OutputPath, +/// parsedProject.RootNameSpace, +/// parsedProject.AssemblyName, +/// parsedProject.TargetFrameworkVersion, +/// string.Concat( +/// parsedProject +/// .Files +/// .Select( +/// file=> string.Format( +/// "\r\n {0}", +/// file.FilePath +/// ) +/// ) +/// ) +/// ); +/// +/// +public Cake.Common.Solution.Project.ProjectParserResult ParseProject(Cake.Core.IO.FilePath projectPath) +{ + return Cake.Common.Solution.Project.ProjectAliases.ParseProject(Context, projectPath); +} + +/// +/// Parses Xml documentation example code from given path. +/// +/// The context. +/// The Path to the file to parse. +/// Parsed example code. +/// +/// +/// var exampleCodes = ParseXmlDocExampleCode("./Cake.Common.xml"); +/// foreach(var exampleCode in exampleCodes) +/// { +/// Information( +/// "{0}\r\n{1}", +/// exampleCode.Name, +/// exampleCode.Code +/// ); +/// } +/// +/// +public System.Collections.Generic.IEnumerable ParseXmlDocExampleCode(Cake.Core.IO.FilePath xmlFilePath) +{ + return Cake.Common.Solution.Project.XmlDoc.XmlDocAliases.ParseXmlDocExampleCode(Context, xmlFilePath); +} + +/// +/// Parses Xml documentation example code from file(s) using given pattern. +/// +/// The context. +/// The globber file pattern. +/// Parsed example code. +/// +/// +/// var filesExampleCodes = ParseXmlDocFilesExampleCode("./Cake.*.xml"); +/// foreach(var exampleCode in filesExampleCodes) +/// { +/// Information( +/// "{0}\r\n{1}", +/// exampleCode.Name, +/// exampleCode.Code +/// ); +/// } +/// +/// +public System.Collections.Generic.IEnumerable ParseXmlDocFilesExampleCode(System.String pattern) +{ + return Cake.Common.Solution.Project.XmlDoc.XmlDocAliases.ParseXmlDocFilesExampleCode(Context, pattern); +} + +/// +/// Creates an assembly information file. +/// +/// The context. +/// The output path. +/// The settings. +/// +/// +/// var file = "./SolutionInfo.cs"; +/// var version = "0.0.1"; +/// var buildNo = "123"; +/// var semVersion = string.Concat(version + "-" + buildNo); +/// CreateAssemblyInfo(file, new AssemblyInfoSettings { +/// Product = "SampleProject", +/// Version = version, +/// FileVersion = version, +/// InformationalVersion = semVersion, +/// Copyright = string.Format("Copyright (c) Contoso 2014 - {0}", DateTime.Now.Year) +/// }); +/// +/// +public void CreateAssemblyInfo(Cake.Core.IO.FilePath outputPath, Cake.Common.Solution.Project.Properties.AssemblyInfoSettings settings) +{ + Cake.Common.Solution.Project.Properties.AssemblyInfoAliases.CreateAssemblyInfo(Context, outputPath, settings); +} + +/// +/// Parses an existing assembly information file. +/// +/// The context. +/// The assembly info path. +/// The content of the assembly info file. +/// +/// +/// var assemblyInfo = ParseAssemblyInfo("./SolutionInfo.cs"); +/// Information("Version: {0}", assemblyInfo.AssemblyVersion); +/// Information("File version: {0}", assemblyInfo.AssemblyFileVersion); +/// Information("Informational version: {0}", assemblyInfo.AssemblyInformationalVersion); +/// +/// +public Cake.Common.Solution.Project.Properties.AssemblyInfoParseResult ParseAssemblyInfo(Cake.Core.IO.FilePath assemblyInfoPath) +{ + return Cake.Common.Solution.Project.Properties.AssemblyInfoAliases.ParseAssemblyInfo(Context, assemblyInfoPath); +} + +/// +/// Downloads the specified resource over HTTP to a temporary file. +/// +/// +/// +/// var resource = DownloadFile("http://www.example.org/index.html"); +/// +/// +/// The context. +/// The URL of the resource to download. +/// The path to the downloaded file. +public Cake.Core.IO.FilePath DownloadFile(System.String address) +{ + return Cake.Common.Net.HttpAliases.DownloadFile(Context, address); +} + +/// +/// Downloads the specified resource over HTTP to a temporary file with specified settings. +/// +/// +/// +/// var resource = DownloadFile("http://www.example.org/index.html", new DownloadFileSettings() +/// { +/// Username = "bob", +/// Password = "builder" +/// }); +/// +/// +/// The context. +/// The URL of the resource to download. +/// The settings. +/// The path to the downloaded file. +public Cake.Core.IO.FilePath DownloadFile(System.String address, Cake.Common.Net.DownloadFileSettings settings) +{ + return Cake.Common.Net.HttpAliases.DownloadFile(Context, address, settings); +} + +/// +/// Downloads the specified resource over HTTP to a temporary file. +/// +/// +/// +/// var address = new Uri("http://www.example.org/index.html"); +/// var resource = DownloadFile(address); +/// +/// +/// The context. +/// The URL of file to download. +/// The path to the downloaded file. +public Cake.Core.IO.FilePath DownloadFile(System.Uri address) +{ + return Cake.Common.Net.HttpAliases.DownloadFile(Context, address); +} + +/// +/// Downloads the specified resource over HTTP to a temporary file with specified settings. +/// +/// +/// +/// var address = new Uri("http://www.example.org/index.html"); +/// var resource = DownloadFile(address, new DownloadFileSettings() +/// { +/// Username = "bob", +/// Password = "builder" +/// }); +/// +/// +/// The context. +/// The URL of file to download. +/// The settings. +/// The path to the downloaded file. +public Cake.Core.IO.FilePath DownloadFile(System.Uri address, Cake.Common.Net.DownloadFileSettings settings) +{ + return Cake.Common.Net.HttpAliases.DownloadFile(Context, address, settings); +} + +/// +/// Downloads the specified resource over HTTP to the specified output path. +/// +/// +/// +/// var outputPath = File("./index.html"); +/// DownloadFile("http://www.example.org/index.html", outputPath); +/// +/// +/// The context. +/// The URL of the resource to download. +/// The output path. +public void DownloadFile(System.String address, Cake.Core.IO.FilePath outputPath) +{ + Cake.Common.Net.HttpAliases.DownloadFile(Context, address, outputPath); +} + +/// +/// Downloads the specified resource over HTTP to the specified output path and settings. +/// +/// +/// +/// var outputPath = File("./index.html"); +/// DownloadFile("http://www.example.org/index.html", outputPath, new DownloadFileSettings() +/// { +/// Username = "bob", +/// Password = "builder" +/// }); +/// +/// +/// The context. +/// The URL of the resource to download. +/// The output path. +/// The settings. +public void DownloadFile(System.String address, Cake.Core.IO.FilePath outputPath, Cake.Common.Net.DownloadFileSettings settings) +{ + Cake.Common.Net.HttpAliases.DownloadFile(Context, address, outputPath, settings); +} + +/// +/// Downloads the specified resource over HTTP to the specified output path. +/// +/// +/// +/// var address = new Uri("http://www.example.org/index.html"); +/// var outputPath = File("./index.html"); +/// DownloadFile(address, outputPath, new DownloadFileSettings() +/// { +/// Username = "bob", +/// Password = "builder" +/// }); +/// +/// +/// The context. +/// The URL of the resource to download. +/// The output path. +/// The settings. +public void DownloadFile(System.Uri address, Cake.Core.IO.FilePath outputPath, Cake.Common.Net.DownloadFileSettings settings) +{ + Cake.Common.Net.HttpAliases.DownloadFile(Context, address, outputPath, settings); +} + +/// +/// Uploads the specified file via a HTTP POST to the specified uri using multipart/form-data. +/// +/// +/// +/// var address = new Uri("http://www.example.org/upload"); +/// UploadFile(address, @"path/to/file.txt"); +/// +/// +/// The context. +/// The URL of the upload resource. +/// The file to upload. +public void UploadFile(System.Uri address, Cake.Core.IO.FilePath filePath) +{ + Cake.Common.Net.HttpAliases.UploadFile(Context, address, filePath); +} + +/// +/// Uploads the specified file via a HTTP POST to the specified uri using multipart/form-data. +/// +/// +/// +/// var address = "http://www.example.org/upload"; +/// UploadFile(address, @"path/to/file.txt"); +/// +/// +/// The context. +/// The URL of the upload resource. +/// The file to upload. +public void UploadFile(System.String address, Cake.Core.IO.FilePath filePath) +{ + Cake.Common.Net.HttpAliases.UploadFile(Context, address, filePath); +} + +/// +/// Uploads the specified byte array via a HTTP POST to the specified uri using multipart/form-data. +/// +/// +/// +/// var address = new Uri("http://www.example.org/upload"); +/// UploadFile(address, @"path/to/file.txt"); +/// +/// +/// The context. +/// The URL of the upload resource. +/// The data to upload. +/// The filename to give the uploaded data +public void UploadFile(System.Uri address, System.Byte[] data, System.String fileName) +{ + Cake.Common.Net.HttpAliases.UploadFile(Context, address, data, fileName); +} + +/// +/// Uploads the specified byte array via a HTTP POST to the specified uri using multipart/form-data. +/// +/// +/// +/// var address = "http://www.example.org/upload"; +/// UploadFile(address, @"path/to/file.txt"); +/// +/// +/// The context. +/// The URL of the upload resource. +/// The data to upload. +/// The filename to give the uploaded data +public void UploadFile(System.String address, System.Byte[] data, System.String fileName) +{ + Cake.Common.Net.HttpAliases.UploadFile(Context, address, data, fileName); +} + +/// +/// Gets a directory path from string. +/// +/// +/// +/// // Get the temp directory. +/// var root = Directory("./"); +/// var temp = root + Directory("temp"); +/// +/// // Clean the directory. +/// CleanDirectory(temp); +/// +/// +/// The context. +/// The path. +/// A directory path. +public Cake.Common.IO.Paths.ConvertableDirectoryPath Directory(System.String path) +{ + return Cake.Common.IO.DirectoryAliases.Directory(Context, path); +} + +/// +/// Deletes the specified directories. +/// +/// +/// +/// var directoriesToDelete = new DirectoryPath[]{ +/// Directory("be"), +/// Directory("gone") +/// }; +/// DeleteDirectories(directoriesToDelete, recursive:true); +/// +/// +/// The context. +/// The directory paths. +/// Will perform a recursive delete if set to true. +public void DeleteDirectories(System.Collections.Generic.IEnumerable directories, System.Boolean recursive = false) +{ + Context.Log.Warning("Warning: The alias DeleteDirectories has been made obsolete. Use the overload that accepts DeleteDirectorySettings instead."); + #pragma warning disable 0618 + Cake.Common.IO.DirectoryAliases.DeleteDirectories(Context, directories, recursive); + #pragma warning restore 0618 +} + +/// +/// Deletes the specified directories. +/// +/// +/// +/// var directoriesToDelete = new DirectoryPath[]{ +/// Directory("be"), +/// Directory("gone") +/// }; +/// DeleteDirectories(directoriesToDelete, new DeleteDirectorySettings { +/// Recursive = true, +/// Force = true +/// }); +/// +/// +/// The context. +/// The directory paths. +/// The delete settings. +public void DeleteDirectories(System.Collections.Generic.IEnumerable directories, Cake.Common.IO.DeleteDirectorySettings settings) +{ + Cake.Common.IO.DirectoryAliases.DeleteDirectories(Context, directories, settings); +} + +/// +/// Deletes the specified directories. +/// +/// +/// +/// var directoriesToDelete = new []{ +/// "be", +/// "gone" +/// }; +/// DeleteDirectories(directoriesToDelete, recursive:true); +/// +/// +/// The context. +/// The directory paths. +/// Will perform a recursive delete if set to true. +public void DeleteDirectories(System.Collections.Generic.IEnumerable directories, System.Boolean recursive = false) +{ + Context.Log.Warning("Warning: The alias DeleteDirectories has been made obsolete. Use the overload that accepts DeleteDirectorySettings instead."); + #pragma warning disable 0618 + Cake.Common.IO.DirectoryAliases.DeleteDirectories(Context, directories, recursive); + #pragma warning restore 0618 +} + +/// +/// Deletes the specified directories. +/// +/// +/// +/// var directoriesToDelete = new []{ +/// "be", +/// "gone" +/// }; +/// DeleteDirectories(directoriesToDelete, new DeleteDirectorySettings { +/// Recursive = true, +/// Force = true +/// }); +/// +/// +/// The context. +/// The directory paths. +/// The delete settings. +public void DeleteDirectories(System.Collections.Generic.IEnumerable directories, Cake.Common.IO.DeleteDirectorySettings settings) +{ + Cake.Common.IO.DirectoryAliases.DeleteDirectories(Context, directories, settings); +} + +/// +/// Deletes the specified directory. +/// +/// +/// +/// DeleteDirectory("./be/gone", recursive:true); +/// +/// +/// The context. +/// The directory path. +/// Will perform a recursive delete if set to true. +public void DeleteDirectory(Cake.Core.IO.DirectoryPath path, System.Boolean recursive = false) +{ + Context.Log.Warning("Warning: The alias DeleteDirectory has been made obsolete. Use the overload that accepts DeleteDirectorySettings instead."); + #pragma warning disable 0618 + Cake.Common.IO.DirectoryAliases.DeleteDirectory(Context, path, recursive); + #pragma warning restore 0618 +} + +/// +/// Deletes the specified directory. +/// +/// +/// +/// DeleteDirectory("./be/gone", new DeleteDirectorySettings { +/// Recursive = true, +/// Force = true +/// }); +/// +/// +/// The context. +/// The directory path. +/// The delete settings. +public void DeleteDirectory(Cake.Core.IO.DirectoryPath path, Cake.Common.IO.DeleteDirectorySettings settings) +{ + Cake.Common.IO.DirectoryAliases.DeleteDirectory(Context, path, settings); +} + +/// +/// Cleans the directories matching the specified pattern. +/// Cleaning the directory will remove all its content but not the directory itself. +/// +/// +/// +/// CleanDirectories("./src/**/bin/debug"); +/// +/// +/// The context. +/// The pattern to match. +public void CleanDirectories(System.String pattern) +{ + Cake.Common.IO.DirectoryAliases.CleanDirectories(Context, pattern); +} + +/// +/// Cleans the directories matching the specified pattern. +/// Cleaning the directory will remove all its content but not the directory itself. +/// +/// +/// +/// Func<IFileSystemInfo, bool> exclude_node_modules = +/// fileSystemInfo=>!fileSystemInfo.Path.FullPath.EndsWith( +/// "node_modules", +/// StringComparison.OrdinalIgnoreCase); +/// CleanDirectories("./src/**/bin/debug", exclude_node_modules); +/// +/// +/// The context. +/// The pattern to match. +/// The predicate used to filter directories based on file system information. +public void CleanDirectories(System.String pattern, System.Func predicate) +{ + Cake.Common.IO.DirectoryAliases.CleanDirectories(Context, pattern, predicate); +} + +/// +/// Cleans the specified directories. +/// Cleaning a directory will remove all its content but not the directory itself. +/// +/// +/// +/// var directoriesToClean = GetDirectories("./src/**/bin/"); +/// CleanDirectories(directoriesToClean); +/// +/// +/// The context. +/// The directory paths. +public void CleanDirectories(System.Collections.Generic.IEnumerable directories) +{ + Cake.Common.IO.DirectoryAliases.CleanDirectories(Context, directories); +} + +/// +/// Cleans the specified directories. +/// Cleaning a directory will remove all its content but not the directory itself. +/// +/// +/// +/// var directoriesToClean = new []{ +/// "./src/Cake/obj", +/// "./src/Cake.Common/obj" +/// }; +/// CleanDirectories(directoriesToClean); +/// +/// +/// The context. +/// The directory paths. +public void CleanDirectories(System.Collections.Generic.IEnumerable directories) +{ + Cake.Common.IO.DirectoryAliases.CleanDirectories(Context, directories); +} + +/// +/// Cleans the specified directory. +/// +/// +/// +/// CleanDirectory("./src/Cake.Common/obj"); +/// +/// +/// The context. +/// The directory path. +public void CleanDirectory(Cake.Core.IO.DirectoryPath path) +{ + Cake.Common.IO.DirectoryAliases.CleanDirectory(Context, path); +} + +/// +/// Cleans the specified directory. +/// +/// +/// +/// CleanDirectory("./src/Cake.Common/obj", fileSystemInfo=>!fileSystemInfo.Hidden); +/// +/// +/// The context. +/// The directory path. +/// Predicate used to determine which files/directories should get deleted. +public void CleanDirectory(Cake.Core.IO.DirectoryPath path, System.Func predicate) +{ + Cake.Common.IO.DirectoryAliases.CleanDirectory(Context, path, predicate); +} + +/// +/// Creates the specified directory. +/// +/// +/// +/// CreateDirectory("publish"); +/// +/// +/// The context. +/// The directory path. +public void CreateDirectory(Cake.Core.IO.DirectoryPath path) +{ + Cake.Common.IO.DirectoryAliases.CreateDirectory(Context, path); +} + +/// +/// Creates the specified directory if it does not exist. +/// +/// +/// +/// EnsureDirectoryExists("publish"); +/// +/// +/// The context. +/// The directory path. +public void EnsureDirectoryExists(Cake.Core.IO.DirectoryPath path) +{ + Cake.Common.IO.DirectoryAliases.EnsureDirectoryExists(Context, path); +} + +/// +/// Copies the contents of a directory, including subdirectories to the specified location. +/// +/// +/// +/// CopyDirectory("source_path", "destination_path"); +/// +/// +/// The context. +/// The source directory path. +/// The destination directory path. +public void CopyDirectory(Cake.Core.IO.DirectoryPath source, Cake.Core.IO.DirectoryPath destination) +{ + Cake.Common.IO.DirectoryAliases.CopyDirectory(Context, source, destination); +} + +/// +/// Determines whether the given path refers to an existing directory. +/// +/// +/// +/// var dir = "publish"; +/// if (!DirectoryExists(dir)) +/// { +/// CreateDirectory(dir); +/// } +/// +/// +/// The context. +/// The to check. +/// +/// true if refers to an existing directory; +/// false if the directory does not exist or an error occurs when trying to +/// determine if the specified path exists. +public System.Boolean DirectoryExists(Cake.Core.IO.DirectoryPath path) +{ + return Cake.Common.IO.DirectoryAliases.DirectoryExists(Context, path); +} + +/// +/// Makes the path absolute (if relative) using the current working directory. +/// +/// +/// +/// var path = MakeAbsolute(Directory("./resources")); +/// +/// +/// The context. +/// The path. +/// An absolute directory path. +public Cake.Core.IO.DirectoryPath MakeAbsolute(Cake.Core.IO.DirectoryPath path) +{ + return Cake.Common.IO.DirectoryAliases.MakeAbsolute(Context, path); +} + +/// +/// Moves an existing directory to a new location, providing the option to specify a new directory name. +/// +/// The context. +/// The directory path. +/// The target directory path. +/// +/// +/// MoveDirectory("mydir", "newparent/newdir"); +/// +/// +public void MoveDirectory(Cake.Core.IO.DirectoryPath directoryPath, Cake.Core.IO.DirectoryPath targetDirectoryPath) +{ + Cake.Common.IO.DirectoryAliases.MoveDirectory(Context, directoryPath, targetDirectoryPath); +} + +/// +/// Gets a list of all the directories inside a directory. +/// +/// +/// +/// var directories = GetSubDirectories("some/dir"); +/// +/// +/// The context. +/// The directory path. +/// An absolute directory path. +public Cake.Core.IO.DirectoryPathCollection GetSubDirectories(Cake.Core.IO.DirectoryPath directoryPath) +{ + return Cake.Common.IO.DirectoryAliases.GetSubDirectories(Context, directoryPath); +} + +/// +/// Gets a file path from string. +/// +/// +/// +/// // Get the temp file. +/// var root = Directory("./"); +/// var temp = root + File("temp"); +/// +/// // Delete the file. +/// CleanDirectory(temp); +/// +/// +/// The context. +/// The path. +/// A file path. +public Cake.Common.IO.Paths.ConvertableFilePath File(System.String path) +{ + return Cake.Common.IO.FileAliases.File(Context, path); +} + +/// +/// Copies an existing file to a new location. +/// +/// The context. +/// The file path. +/// The target directory path. +/// +/// +/// CopyFileToDirectory("test.txt", "./targetdir"); +/// +/// +public void CopyFileToDirectory(Cake.Core.IO.FilePath filePath, Cake.Core.IO.DirectoryPath targetDirectoryPath) +{ + Cake.Common.IO.FileAliases.CopyFileToDirectory(Context, filePath, targetDirectoryPath); +} + +/// +/// Copies an existing file to a new file, providing the option to specify a new file name. +/// +/// The context. +/// The file path. +/// The target file path. +/// +/// +/// CopyFile("test.tmp", "test.txt"); +/// +/// +public void CopyFile(Cake.Core.IO.FilePath filePath, Cake.Core.IO.FilePath targetFilePath) +{ + Cake.Common.IO.FileAliases.CopyFile(Context, filePath, targetFilePath); +} + +/// +/// Copies all files matching the provided pattern to a new location. +/// +/// The context. +/// The pattern. +/// The target directory path. +/// +/// +/// CopyFiles("Cake.*", "./publish"); +/// +/// +public void CopyFiles(System.String pattern, Cake.Core.IO.DirectoryPath targetDirectoryPath) +{ + Cake.Common.IO.FileAliases.CopyFiles(Context, pattern, targetDirectoryPath); +} + +/// +/// Copies existing files to a new location. +/// +/// The context. +/// The file paths. +/// The target directory path. +/// +/// +/// var files = GetFiles("./**/Cake.*"); +/// CopyFiles(files, "destination"); +/// +/// +public void CopyFiles(System.Collections.Generic.IEnumerable filePaths, Cake.Core.IO.DirectoryPath targetDirectoryPath) +{ + Cake.Common.IO.FileAliases.CopyFiles(Context, filePaths, targetDirectoryPath); +} + +/// +/// Copies existing files to a new location. +/// +/// The context. +/// The file paths. +/// The target directory path. +/// +/// +/// CreateDirectory("destination"); +/// var files = new [] { +/// "Cake.exe", +/// "Cake.pdb" +/// }; +/// CopyFiles(files, "destination"); +/// +/// +public void CopyFiles(System.Collections.Generic.IEnumerable filePaths, Cake.Core.IO.DirectoryPath targetDirectoryPath) +{ + Cake.Common.IO.FileAliases.CopyFiles(Context, filePaths, targetDirectoryPath); +} + +/// +/// Copies all files matching the provided pattern to a new location. +/// +/// The context. +/// The pattern. +/// The target directory path. +/// Keep the folder structure. +/// +/// +/// CopyFiles("Cake.*", "./publish"); +/// +/// +public void CopyFiles(System.String pattern, Cake.Core.IO.DirectoryPath targetDirectoryPath, System.Boolean preserveFolderStructure) +{ + Cake.Common.IO.FileAliases.CopyFiles(Context, pattern, targetDirectoryPath, preserveFolderStructure); +} + +/// +/// Copies existing files to a new location. +/// +/// The context. +/// The file paths. +/// The target directory path. +/// Keep the folder structure. +/// +/// +/// var files = GetFiles("./**/Cake.*"); +/// CopyFiles(files, "destination"); +/// +/// +public void CopyFiles(System.Collections.Generic.IEnumerable filePaths, Cake.Core.IO.DirectoryPath targetDirectoryPath, System.Boolean preserveFolderStructure) +{ + Cake.Common.IO.FileAliases.CopyFiles(Context, filePaths, targetDirectoryPath, preserveFolderStructure); +} + +/// +/// Copies existing files to a new location. +/// +/// The context. +/// The file paths. +/// The target directory path. +/// Keep the folder structure. +/// +/// +/// CreateDirectory("destination"); +/// var files = new [] { +/// "Cake.exe", +/// "Cake.pdb" +/// }; +/// CopyFiles(files, "destination"); +/// +/// +public void CopyFiles(System.Collections.Generic.IEnumerable filePaths, Cake.Core.IO.DirectoryPath targetDirectoryPath, System.Boolean preserveFolderStructure) +{ + Cake.Common.IO.FileAliases.CopyFiles(Context, filePaths, targetDirectoryPath, preserveFolderStructure); +} + +/// +/// Moves an existing file to a new location. +/// +/// The context. +/// The file path. +/// The target directory path. +/// +/// +/// MoveFileToDirectory("test.txt", "./targetdir"); +/// +/// +public void MoveFileToDirectory(Cake.Core.IO.FilePath filePath, Cake.Core.IO.DirectoryPath targetDirectoryPath) +{ + Cake.Common.IO.FileAliases.MoveFileToDirectory(Context, filePath, targetDirectoryPath); +} + +/// +/// Moves existing files matching the specified pattern to a new location. +/// +/// The context. +/// The pattern. +/// The target directory path. +/// +/// +/// MoveFiles("./publish/Cake.*", "./destination"); +/// +/// +public void MoveFiles(System.String pattern, Cake.Core.IO.DirectoryPath targetDirectoryPath) +{ + Cake.Common.IO.FileAliases.MoveFiles(Context, pattern, targetDirectoryPath); +} + +/// +/// Moves existing files to a new location. +/// +/// The context. +/// The file paths. +/// The target directory path. +/// +/// +/// var files = GetFiles("./publish/Cake.*"); +/// MoveFiles(files, "destination"); +/// +/// +public void MoveFiles(System.Collections.Generic.IEnumerable filePaths, Cake.Core.IO.DirectoryPath targetDirectoryPath) +{ + Cake.Common.IO.FileAliases.MoveFiles(Context, filePaths, targetDirectoryPath); +} + +/// +/// Moves an existing file to a new location, providing the option to specify a new file name. +/// +/// The context. +/// The file path. +/// The target file path. +/// +/// +/// MoveFile("test.tmp", "test.txt"); +/// +/// +public void MoveFile(Cake.Core.IO.FilePath filePath, Cake.Core.IO.FilePath targetFilePath) +{ + Cake.Common.IO.FileAliases.MoveFile(Context, filePath, targetFilePath); +} + +/// +/// Deletes the specified files. +/// +/// The context. +/// The pattern. +/// +/// +/// DeleteFiles("./publish/Cake.*"); +/// +/// +public void DeleteFiles(System.String pattern) +{ + Cake.Common.IO.FileAliases.DeleteFiles(Context, pattern); +} + +/// +/// Deletes the specified files. +/// +/// The context. +/// The file paths. +/// +/// +/// var files = GetFiles("./destination/Cake.*"); +/// DeleteFiles(files); +/// +/// +public void DeleteFiles(System.Collections.Generic.IEnumerable filePaths) +{ + Cake.Common.IO.FileAliases.DeleteFiles(Context, filePaths); +} + +/// +/// Deletes the specified file. +/// +/// The context. +/// The file path. +/// +/// +/// DeleteFile("deleteme.txt"); +/// +/// +public void DeleteFile(Cake.Core.IO.FilePath filePath) +{ + Cake.Common.IO.FileAliases.DeleteFile(Context, filePath); +} + +/// +/// Determines whether the given path refers to an existing file. +/// +/// The context. +/// The to check. +/// +/// true if refers to an existing file; +/// false if the file does not exist or an error occurs when trying to +/// determine if the specified file exists. +/// +/// +/// if (FileExists("findme.txt")) +/// { +/// Information("File exists!"); +/// } +/// +/// +public System.Boolean FileExists(Cake.Core.IO.FilePath filePath) +{ + return Cake.Common.IO.FileAliases.FileExists(Context, filePath); +} + +/// +/// Makes the path absolute (if relative) using the current working directory. +/// +/// The context. +/// The path. +/// An absolute file path. +/// +/// +/// var path = MakeAbsolute(File("./resources")); +/// +/// +public Cake.Core.IO.FilePath MakeAbsolute(Cake.Core.IO.FilePath path) +{ + return Cake.Common.IO.FileAliases.MakeAbsolute(Context, path); +} + +/// +/// Gets the size of a file in bytes. +/// +/// The context. +/// The path. +/// Size of file in bytes or -1 if file doesn't exist. +/// +/// +/// Information("File size: {0}", FileSize("./build.cake")); +/// +/// +public System.Int64 FileSize(Cake.Core.IO.FilePath filePath) +{ + return Cake.Common.IO.FileAliases.FileSize(Context, filePath); +} + +/// +/// Gets all files matching the specified pattern. +/// +/// +/// +/// var files = GetFiles("./**/Cake.*.dll"); +/// foreach(var file in files) +/// { +/// Information("File: {0}", file); +/// } +/// +/// +/// The context. +/// The glob pattern to match. +/// A . +public Cake.Core.IO.FilePathCollection GetFiles(System.String pattern) +{ + return Cake.Common.IO.GlobbingAliases.GetFiles(Context, pattern); +} + +/// +/// Gets all files matching the specified pattern. +/// +/// +/// +/// Func<IFileSystemInfo, bool> exclude_node_modules = +/// fileSystemInfo => !fileSystemInfo.Path.FullPath.EndsWith( +/// "node_modules", StringComparison.OrdinalIgnoreCase); +/// +/// var files = GetFiles("./**/Cake.*.dll", exclude_node_modules); +/// foreach(var file in files) +/// { +/// Information("File: {0}", file); +/// } +/// +/// +/// The context. +/// The glob pattern to match. +/// The predicate used to filter directories based on file system information. +/// A . +public Cake.Core.IO.FilePathCollection GetFiles(System.String pattern, System.Func predicate) +{ + return Cake.Common.IO.GlobbingAliases.GetFiles(Context, pattern, predicate); +} + +/// +/// Gets all directory matching the specified pattern. +/// +/// +/// +/// var directories = GetDirectories("./src/**/obj/*"); +/// foreach(var directory in directories) +/// { +/// Information("Directory: {0}", directory); +/// } +/// +/// +/// The context. +/// The glob pattern to match. +/// A . +public Cake.Core.IO.DirectoryPathCollection GetDirectories(System.String pattern) +{ + return Cake.Common.IO.GlobbingAliases.GetDirectories(Context, pattern); +} + +/// +/// Gets all directory matching the specified pattern. +/// +/// +/// +/// Func<IFileSystemInfo, bool> exclude_node_modules = +/// fileSystemInfo => !fileSystemInfo.Path.FullPath.EndsWith( +/// "node_modules", StringComparison.OrdinalIgnoreCase); +/// +/// var directories = GetDirectories("./src/**/obj/*", exclude_node_modules); +/// foreach(var directory in directories) +/// { +/// Information("Directory: {0}", directory); +/// } +/// +/// +/// The context. +/// The glob pattern to match. +/// The predicate used to filter directories based on file system information. +/// A . +public Cake.Core.IO.DirectoryPathCollection GetDirectories(System.String pattern, System.Func predicate) +{ + return Cake.Common.IO.GlobbingAliases.GetDirectories(Context, pattern, predicate); +} + +/// +/// Zips the specified directory. +/// +/// The context. +/// The root path. +/// The output path. +/// +/// +/// Zip("./publish", "publish.zip"); +/// +/// +public void Zip(Cake.Core.IO.DirectoryPath rootPath, Cake.Core.IO.FilePath outputPath) +{ + Cake.Common.IO.ZipAliases.Zip(Context, rootPath, outputPath); +} + +/// +/// Zips the files matching the specified pattern. +/// +/// The context. +/// The root path. +/// The output path. +/// The pattern. +/// +/// +/// Zip("./", "xmlfiles.zip", "./*.xml"); +/// +/// +public void Zip(Cake.Core.IO.DirectoryPath rootPath, Cake.Core.IO.FilePath outputPath, System.String pattern) +{ + Cake.Common.IO.ZipAliases.Zip(Context, rootPath, outputPath, pattern); +} + +/// +/// Zips the specified files. +/// +/// The context. +/// The root path. +/// The output path. +/// The file paths. +/// +/// +/// var files = GetFiles("./**/Cake.*.dll"); +/// Zip("./", "cakeassemblies.zip", files); +/// +/// +public void Zip(Cake.Core.IO.DirectoryPath rootPath, Cake.Core.IO.FilePath outputPath, System.Collections.Generic.IEnumerable filePaths) +{ + Cake.Common.IO.ZipAliases.Zip(Context, rootPath, outputPath, filePaths); +} + +/// +/// Zips the specified files. +/// +/// The context. +/// The root path. +/// The output path. +/// The file paths. +/// +/// +/// var files = new [] { +/// "./src/Cake/bin/Debug/Autofac.dll", +/// "./src/Cake/bin/Debug/Cake.Common.dll", +/// "./src/Cake/bin/Debug/Cake.Core.dll", +/// "./src/Cake/bin/Debug/Cake.exe" +/// }; +/// Zip("./", "cakebinaries.zip", files); +/// +/// +public void Zip(Cake.Core.IO.DirectoryPath rootPath, Cake.Core.IO.FilePath outputPath, System.Collections.Generic.IEnumerable filePaths) +{ + Cake.Common.IO.ZipAliases.Zip(Context, rootPath, outputPath, filePaths); +} + +/// +/// Unzips the specified file +/// +/// The context. +/// Zip file to unzip. +/// Output path to unzip into. +/// +/// +/// Unzip("Cake.zip", "./cake"); +/// +/// +public void Unzip(Cake.Core.IO.FilePath zipFile, Cake.Core.IO.DirectoryPath outputPath) +{ + Cake.Common.IO.ZipAliases.Unzip(Context, zipFile, outputPath); +} + +/// +/// Writes an error message to the log using the specified format information. +/// +/// The context. +/// The format. +/// The arguments. +/// +/// +/// Error("Hello {0}! Today is an {1:dddd}", "World", DateTime.Now); +/// +/// +public void Error(System.String format, params System.Object[] args) +{ + Cake.Common.Diagnostics.LoggingAliases.Error(Context, format, args); +} + +/// +/// Writes an error message to the log using the specified log message action. +/// Evaluation message only if verbosity same or more verbose. +/// +/// the context. +/// The function called for message when logging. +/// +/// +/// Error(logAction=>logAction("Hello {0}! Today is an {1:dddd}", "World", DateTime.Now)); +/// +/// +public void Error(Cake.Core.Diagnostics.LogAction logAction) +{ + Cake.Common.Diagnostics.LoggingAliases.Error(Context, logAction); +} + +/// +/// Writes an error message to the log using the specified value. +/// +/// the context. +/// The value. +/// +/// +/// Error(new {FirstName = "John", LastName="Doe"}); +/// +/// +public void Error(System.Object value) +{ + Cake.Common.Diagnostics.LoggingAliases.Error(Context, value); +} + +/// +/// Writes an error message to the log using the specified string value. +/// +/// the context. +/// The value. +/// +/// +/// Error("{string}"); +/// +/// +public void Error(System.String value) +{ + Cake.Common.Diagnostics.LoggingAliases.Error(Context, value); +} + +/// +/// Writes a warning message to the log using the specified format information. +/// +/// The context. +/// The format. +/// The arguments. +/// +/// +/// Warning("Hello {0}! Today is an {1:dddd}", "World", DateTime.Now); +/// +/// +public void Warning(System.String format, params System.Object[] args) +{ + Cake.Common.Diagnostics.LoggingAliases.Warning(Context, format, args); +} + +/// +/// Writes a warning message to the log using the specified log message action. +/// Evaluation message only if verbosity same or more verbose. +/// +/// the context. +/// The function called for message when logging. +/// +/// +/// Warning(logAction=>logAction("Hello {0}! Today is an {1:dddd}", "World", DateTime.Now)); +/// +/// +public void Warning(Cake.Core.Diagnostics.LogAction logAction) +{ + Cake.Common.Diagnostics.LoggingAliases.Warning(Context, logAction); +} + +/// +/// Writes an warning message to the log using the specified value. +/// +/// the context. +/// The value. +/// +/// +/// Warning(new {FirstName = "John", LastName="Doe"}); +/// +/// +public void Warning(System.Object value) +{ + Cake.Common.Diagnostics.LoggingAliases.Warning(Context, value); +} + +/// +/// Writes an warning message to the log using the specified string value. +/// +/// the context. +/// The value. +/// +/// +/// Warning("{string}"); +/// +/// +public void Warning(System.String value) +{ + Cake.Common.Diagnostics.LoggingAliases.Warning(Context, value); +} + +/// +/// Writes an informational message to the log using the specified format information. +/// +/// The context. +/// The format. +/// The arguments. +/// +/// +/// Information("Hello {0}! Today is an {1:dddd}", "World", DateTime.Now); +/// +/// +public void Information(System.String format, params System.Object[] args) +{ + Cake.Common.Diagnostics.LoggingAliases.Information(Context, format, args); +} + +/// +/// Writes an informational message to the log using the specified log message action. +/// Evaluation message only if verbosity same or more verbose. +/// +/// the context. +/// The function called for message when logging. +/// +/// +/// Information(logAction=>logAction("Hello {0}! Today is an {1:dddd}", "World", DateTime.Now)); +/// +/// +public void Information(Cake.Core.Diagnostics.LogAction logAction) +{ + Cake.Common.Diagnostics.LoggingAliases.Information(Context, logAction); +} + +/// +/// Writes an informational message to the log using the specified value. +/// +/// The context. +/// The value. +/// +/// +/// Information(new {FirstName = "John", LastName="Doe"}); +/// +/// +public void Information(System.Object value) +{ + Cake.Common.Diagnostics.LoggingAliases.Information(Context, value); +} + +/// +/// Writes an informational message to the log using the specified string value. +/// +/// The context. +/// The value. +/// +/// +/// Information("{string}"); +/// +/// +public void Information(System.String value) +{ + Cake.Common.Diagnostics.LoggingAliases.Information(Context, value); +} + +/// +/// Writes a verbose message to the log using the specified format information. +/// +/// The context. +/// The format. +/// The arguments. +/// +/// +/// Verbose("Hello {0}! Today is an {1:dddd}", "World", DateTime.Now); +/// +/// +public void Verbose(System.String format, params System.Object[] args) +{ + Cake.Common.Diagnostics.LoggingAliases.Verbose(Context, format, args); +} + +/// +/// Writes a verbose message to the log using the specified log message action. +/// Evaluation message only if verbosity same or more verbose. +/// +/// the context. +/// The function called for message when logging. +/// +/// +/// Verbose(logAction=>logAction("Hello {0}! Today is an {1:dddd}", "World", DateTime.Now)); +/// +/// +public void Verbose(Cake.Core.Diagnostics.LogAction logAction) +{ + Cake.Common.Diagnostics.LoggingAliases.Verbose(Context, logAction); +} + +/// +/// Writes a verbose message to the log using the specified value. +/// +/// The context. +/// The value. +/// +/// +/// Verbose(new {FirstName = "John", LastName="Doe"}); +/// +/// +public void Verbose(System.Object value) +{ + Cake.Common.Diagnostics.LoggingAliases.Verbose(Context, value); +} + +/// +/// Writes a verbose message to the log using the specified string value. +/// +/// The context. +/// The value. +/// +/// +/// Verbose("{string}"); +/// +/// +public void Verbose(System.String value) +{ + Cake.Common.Diagnostics.LoggingAliases.Verbose(Context, value); +} + +/// +/// Writes a debug message to the log using the specified format information. +/// +/// The context. +/// The format. +/// The arguments. +/// +/// +/// Debug("Hello {0}! Today is an {1:dddd}", "World", DateTime.Now); +/// +/// +public void Debug(System.String format, params System.Object[] args) +{ + Cake.Common.Diagnostics.LoggingAliases.Debug(Context, format, args); +} + +/// +/// Writes a debug message to the log using the specified log message action. +/// Evaluation message only if verbosity same or more verbose. +/// +/// the context. +/// The function called for message when logging. +/// +/// +/// Debug(logAction=>logAction("Hello {0}! Today is an {1:dddd}", "World", DateTime.Now)); +/// +/// +public void Debug(Cake.Core.Diagnostics.LogAction logAction) +{ + Cake.Common.Diagnostics.LoggingAliases.Debug(Context, logAction); +} + +/// +/// Writes a debug message to the log using the specified value. +/// +/// the context. +/// The value. +/// +/// +/// Debug(new {FirstName = "John", LastName="Doe"}); +/// +/// +public void Debug(System.Object value) +{ + Cake.Common.Diagnostics.LoggingAliases.Debug(Context, value); +} + +/// +/// Writes a debug message to the log using the specified string value. +/// +/// the context. +/// The value. +/// +/// +/// Debug("{string}"); +/// +/// +public void Debug(System.String value) +{ + Cake.Common.Diagnostics.LoggingAliases.Debug(Context, value); +} + +/// +/// Gets a instance that can +/// be used to query for information about the current build system. +/// +/// +/// +/// var isLocal = BuildSystem.IsLocalBuild; +/// +/// +/// The context. +/// A instance. +private Cake.Common.Build.BuildSystem _BuildSystem; +public Cake.Common.Build.BuildSystem BuildSystem +{ + get + { + if (_BuildSystem==null) + { + _BuildSystem = Cake.Common.Build.BuildSystemAliases.BuildSystem(Context); + } + return _BuildSystem; + } +} + +/// +/// Gets a instance that can +/// be used to manipulate the AppVeyor environment. +/// +/// +/// +/// var isAppVeyorBuild = AppVeyor.IsRunningOnAppVeyor; +/// +/// +/// The context. +/// A instance. +private Cake.Common.Build.AppVeyor.IAppVeyorProvider _AppVeyor; +public Cake.Common.Build.AppVeyor.IAppVeyorProvider AppVeyor +{ + get + { + if (_AppVeyor==null) + { + _AppVeyor = Cake.Common.Build.BuildSystemAliases.AppVeyor(Context); + } + return _AppVeyor; + } +} + +/// +/// Gets a instance that can +/// be used to manipulate the TeamCity environment. +/// +/// +/// +/// var isTeamCityBuild = TeamCity.IsRunningOnTeamCity; +/// +/// +/// The context. +/// A instance. +private Cake.Common.Build.TeamCity.ITeamCityProvider _TeamCity; +public Cake.Common.Build.TeamCity.ITeamCityProvider TeamCity +{ + get + { + if (_TeamCity==null) + { + _TeamCity = Cake.Common.Build.BuildSystemAliases.TeamCity(Context); + } + return _TeamCity; + } +} + +/// +/// Gets a instance that can +/// be used to manipulate the MyGet environment. +/// +/// +/// +/// var isMyGetBuild = MyGet.IsRunningOnMyGet; +/// +/// +/// The context. +/// A instance. +private Cake.Common.Build.MyGet.IMyGetProvider _MyGet; +public Cake.Common.Build.MyGet.IMyGetProvider MyGet +{ + get + { + if (_MyGet==null) + { + _MyGet = Cake.Common.Build.BuildSystemAliases.MyGet(Context); + } + return _MyGet; + } +} + +/// +/// Gets a instance that can +/// be used to manipulate the Bamboo environment. +/// +/// +/// +/// var isBambooBuild = Bamboo.IsRunningOnBamboo; +/// +/// +/// The context. +/// A instance. +private Cake.Common.Build.Bamboo.IBambooProvider _Bamboo; +public Cake.Common.Build.Bamboo.IBambooProvider Bamboo +{ + get + { + if (_Bamboo==null) + { + _Bamboo = Cake.Common.Build.BuildSystemAliases.Bamboo(Context); + } + return _Bamboo; + } +} + +/// +/// Gets a instance that can +/// be used to manipulate the Continua CI environment. +/// +/// +/// +/// var isContinuaCIBuild = ContinuaCI.IsRunningContinuaCI; +/// +/// +/// The context. +/// A instance. +private Cake.Common.Build.ContinuaCI.IContinuaCIProvider _ContinuaCI; +public Cake.Common.Build.ContinuaCI.IContinuaCIProvider ContinuaCI +{ + get + { + if (_ContinuaCI==null) + { + _ContinuaCI = Cake.Common.Build.BuildSystemAliases.ContinuaCI(Context); + } + return _ContinuaCI; + } +} + +/// +/// Gets a instance that can be used to +/// obtain information from the Jenkins environment. +/// +/// +/// +/// var isJenkinsBuild = Jenkins.IsRunningOnJenkins; +/// +/// +/// The context. +/// A instance. +private Cake.Common.Build.Jenkins.IJenkinsProvider _Jenkins; +public Cake.Common.Build.Jenkins.IJenkinsProvider Jenkins +{ + get + { + if (_Jenkins==null) + { + _Jenkins = Cake.Common.Build.BuildSystemAliases.Jenkins(Context); + } + return _Jenkins; + } +} + +/// +/// Gets a instance that can be used to +/// obtain information from the Bitrise environment. +/// +/// +/// +/// var isBitriseBuild = Bitrise.IsRunningOnBitrise; +/// +/// +/// The context. +/// A instance. +private Cake.Common.Build.Bitrise.IBitriseProvider _Bitrise; +public Cake.Common.Build.Bitrise.IBitriseProvider Bitrise +{ + get + { + if (_Bitrise==null) + { + _Bitrise = Cake.Common.Build.BuildSystemAliases.Bitrise(Context); + } + return _Bitrise; + } +} + +/// +/// Gets a instance that can be used to +/// obtain information from the Travis CI environment. +/// +/// +/// +/// var isTravisCIBuild = TravisCI.IsRunningOnTravisCI; +/// +/// +/// The context. +/// A instance. +private Cake.Common.Build.TravisCI.ITravisCIProvider _TravisCI; +public Cake.Common.Build.TravisCI.ITravisCIProvider TravisCI +{ + get + { + if (_TravisCI==null) + { + _TravisCI = Cake.Common.Build.BuildSystemAliases.TravisCI(Context); + } + return _TravisCI; + } +} + +/// +/// Gets a instance that can be used to +/// obtain information from the Bitbucket Pipelines environment. +/// +/// +/// +/// var isBitbucketPipelinesBuild = BitbucketPipelines.IsRunningOnBitbucketPipelines; +/// +/// +/// The context. +/// A instance. +private Cake.Common.Build.BitbucketPipelines.IBitbucketPipelinesProvider _BitbucketPipelines; +public Cake.Common.Build.BitbucketPipelines.IBitbucketPipelinesProvider BitbucketPipelines +{ + get + { + if (_BitbucketPipelines==null) + { + _BitbucketPipelines = Cake.Common.Build.BuildSystemAliases.BitbucketPipelines(Context); + } + return _BitbucketPipelines; + } +} + +/// +/// Gets a instance that can be used to +/// obtain information from the Go.CD environment. +/// +/// +/// +/// var isGoCDBuild = GoCD.IsRunningOnGoCD; +/// +/// +/// The context. +/// A instance. +private Cake.Common.Build.GoCD.IGoCDProvider _GoCD; +public Cake.Common.Build.GoCD.IGoCDProvider GoCD +{ + get + { + if (_GoCD==null) + { + _GoCD = Cake.Common.Build.BuildSystemAliases.GoCD(Context); + } + return _GoCD; + } +} + +/// +/// Gets a instance that can be used to +/// obtain information from the GitLab CI environment. +/// +/// +/// +/// var isGitLabCIBuild = GitLabCI.IsRunningOnGitLabCI; +/// +/// +/// The context. +/// A instance. +private Cake.Common.Build.GitLabCI.IGitLabCIProvider _GitLabCI; +public Cake.Common.Build.GitLabCI.IGitLabCIProvider GitLabCI +{ + get + { + if (_GitLabCI==null) + { + _GitLabCI = Cake.Common.Build.BuildSystemAliases.GitLabCI(Context); + } + return _GitLabCI; + } +} + +/// +/// Gets a instance that can be used to +/// obtain information from the Team Foundation Build environment. +/// +/// +/// +/// var isTFSBuild = TFBuild.IsRunningOnTFS; +/// +/// +/// The context. +/// A instance. +private Cake.Common.Build.TFBuild.ITFBuildProvider _TFBuild; +public Cake.Common.Build.TFBuild.ITFBuildProvider TFBuild +{ + get + { + if (_TFBuild==null) + { + _TFBuild = Cake.Common.Build.BuildSystemAliases.TFBuild(Context); + } + return _TFBuild; + } +} + +#line 1 "C:/Work/multi.cake" +var target = Argument("target", "Default"); + +#line 1 "C:/Work/single.cake" +public class Foo +{ + public static Foo Create() + { + return new Foo(); + } + + public void Bar() + { + return; + } +} +#line 3 "C:/Work/multi.cake" +// #load single.cake + +Task("Default") + .Does(() => +{ + Foo + .Create() + .Bar(); + + Information("Hello World!"); +}); + +RunTarget(target); diff --git a/tests/OmniSharp.Cake.Tests/TestAssets/multi.cake.txt b/tests/OmniSharp.Cake.Tests/TestAssets/multi.cake.txt new file mode 100644 index 0000000000..288b9b694a --- /dev/null +++ b/tests/OmniSharp.Cake.Tests/TestAssets/multi.cake.txt @@ -0,0 +1,15 @@ +var target = Argument("target", "Default"); + +#load single.cake + +Task("Default") + .Does(() => +{ + Foo + .Create() + .Bar(); + + Information("Hello World!"); +}); + +RunTarget(target); diff --git a/tests/OmniSharp.Cake.Tests/TestAssets/single.cake.g.txt b/tests/OmniSharp.Cake.Tests/TestAssets/single.cake.g.txt new file mode 100644 index 0000000000..eca3996271 --- /dev/null +++ b/tests/OmniSharp.Cake.Tests/TestAssets/single.cake.g.txt @@ -0,0 +1,8220 @@ +/// +/// Determines whether or not the specified argument exist. +/// +/// The context. +/// The argument name. +/// Whether or not the specified argument exist. +/// +/// This sample shows how to call the method. +/// +/// var argumentName = "myArgument"; +/// //Cake.exe .\hasargument.cake -myArgument="is specified" +/// if (HasArgument(argumentName)) +/// { +/// Information("{0} is specified", argumentName); +/// } +/// //Cake.exe .\hasargument.cake +/// else +/// { +/// Warning("{0} not specified", argumentName); +/// } +/// +/// +public System.Boolean HasArgument(System.String name) +{ + return Cake.Common.ArgumentAliases.HasArgument(Context, name); +} + +/// +/// Gets an argument and throws if the argument is missing. +/// +/// The argument type. +/// The context. +/// The argument name. +/// The value of the argument. +/// +/// +/// //Cake.exe .\argument.cake -myArgument="is valid" -loopCount = 5 +/// Information("Argument {0}", Argument<string>("myArgument")); +/// var loopCount = Argument<int>("loopCount"); +/// for(var index = 0;index<loopCount; index++) +/// { +/// Information("Index {0}", index); +/// } +/// +/// +/// Argument value is null. +/// +/// is null. +public T Argument(System.String name) +{ + return Cake.Common.ArgumentAliases.Argument(Context, name); +} + +/// +/// Gets an argument and returns the provided if the argument is missing. +/// +/// The argument type. +/// The context. +/// The argument name. +/// The value to return if the argument is missing. +/// The value of the argument if it exist; otherwise . +/// +/// +/// //Cake.exe .\argument.cake -myArgument="is valid" -loopCount = 5 +/// Information("Argument {0}", Argument<string>("myArgument", "is NOT valid")); +/// var loopCount = Argument<int>("loopCount", 10); +/// for(var index = 0;index<loopCount; index++) +/// { +/// Information("Index {0}", index); +/// } +/// +/// +public T Argument(System.String name, T defaultValue) +{ + return Cake.Common.ArgumentAliases.Argument(Context, name, defaultValue); +} + +/// +/// Retrieves the value of the environment variable or null if the environment variable does not exist. +/// +/// +/// +/// Information(EnvironmentVariable("HOME") ?? "Unknown location"); +/// +/// +/// The context. +/// The environment variable. +/// The environment variable or null if the environment variable does not exist. +public System.String EnvironmentVariable(System.String variable) +{ + return Cake.Common.EnvironmentAliases.EnvironmentVariable(Context, variable); +} + +/// +/// Retrieves all environment variables +/// +/// +/// +/// var envVars = EnvironmentVariables(); +/// +/// string path; +/// if (envVars.TryGetValue("PATH", out path)) +/// { +/// Information("Path: {0}", path); +/// } +/// +/// foreach(var envVar in envVars) +/// { +/// Information( +/// "Key: {0}\tValue: \"{1}\"", +/// envVar.Key, +/// envVar.Value +/// ); +/// } +/// +/// +/// The context. +/// The environment variables +public System.Collections.Generic.IDictionary EnvironmentVariables() +{ + return Cake.Common.EnvironmentAliases.EnvironmentVariables(Context); +} + +/// +/// Checks for the existence of a value for a given environment variable. +/// +/// +/// +/// if (HasEnvironmentVariable("SOME_ENVIRONMENT_VARIABLE")) +/// { +/// Information("The environment variable was present."); +/// } +/// +/// +/// The context. +/// The environment variable. +/// +/// true if the environment variable exist; otherwise false. +/// +public System.Boolean HasEnvironmentVariable(System.String variable) +{ + return Cake.Common.EnvironmentAliases.HasEnvironmentVariable(Context, variable); +} + +/// +/// Determines whether the build script is running on Windows. +/// +/// +/// +/// if (IsRunningOnWindows()) +/// { +/// Information("Windows!"); +/// } +/// +/// +/// The context. +/// +/// true if the build script is running on Windows; otherwise false. +/// +public System.Boolean IsRunningOnWindows() +{ + return Cake.Common.EnvironmentAliases.IsRunningOnWindows(Context); +} + +/// +/// Determines whether the build script running on a Unix or Linux based system. +/// +/// +/// +/// if (IsRunningOnUnix()) +/// { +/// Information("Not Windows!"); +/// } +/// +/// +/// The context. +/// +/// true if the build script running on a Unix or Linux based system; otherwise false. +/// +public System.Boolean IsRunningOnUnix() +{ + return Cake.Common.EnvironmentAliases.IsRunningOnUnix(Context); +} + +/// +/// Starts the process resource that is specified by the filename. +/// +/// The context. +/// The file name. +/// The exit code that the started process specified when it terminated. +/// +/// +/// var exitCodeWithoutArguments = StartProcess("ping"); +/// // This should output 1 as argument is missing +/// Information("Exit code: {0}", exitCodeWithoutArguments); +/// +/// +public System.Int32 StartProcess(Cake.Core.IO.FilePath fileName) +{ + return Cake.Common.ProcessAliases.StartProcess(Context, fileName); +} + +/// +/// Starts the process resource that is specified by the filename and arguments +/// +/// The context. +/// Name of the file. +/// The arguments used in the process settings. +/// The exit code that the started process specified when it terminated. +/// +/// +/// var exitCodeWithArgument = StartProcess("ping", "localhost"); +/// // This should output 0 as valid arguments supplied +/// Information("Exit code: {0}", exitCodeWithArgument); +/// +/// +public System.Int32 StartProcess(Cake.Core.IO.FilePath fileName, System.String processArguments) +{ + return Cake.Common.ProcessAliases.StartProcess(Context, fileName, processArguments); +} + +/// +/// Starts the process resource that is specified by the filename and settings. +/// +/// The context. +/// Name of the file. +/// The settings. +/// The exit code that the started process specified when it terminated. +/// +/// +/// var exitCodeWithArgument = StartProcess("ping", new ProcessSettings{ Arguments = "localhost" }); +/// // This should output 0 as valid arguments supplied +/// Information("Exit code: {0}", exitCodeWithArgument); +/// +/// +public System.Int32 StartProcess(Cake.Core.IO.FilePath fileName, Cake.Core.IO.ProcessSettings settings) +{ + return Cake.Common.ProcessAliases.StartProcess(Context, fileName, settings); +} + +public System.Int32 StartProcess(Cake.Core.IO.FilePath fileName, Cake.Core.IO.ProcessSettings settings, out System.Collections.Generic.IEnumerable redirectedStandardOutput) +{ + return Cake.Common.ProcessAliases.StartProcess(Context, fileName, settings, out redirectedStandardOutput); +} + +public System.Int32 StartProcess(Cake.Core.IO.FilePath fileName, Cake.Core.IO.ProcessSettings settings, out System.Collections.Generic.IEnumerable redirectedStandardOutput, out System.Collections.Generic.IEnumerable redirectedErrorOutput) +{ + return Cake.Common.ProcessAliases.StartProcess(Context, fileName, settings, out redirectedStandardOutput, out redirectedErrorOutput); +} + +/// +/// Starts the process resource that is specified by the filename and settings. +/// +/// The context. +/// Name of the file. +/// The settings. +/// The newly started process. +/// +/// +/// using(var process = StartAndReturnProcess("ping", new ProcessSettings{ Arguments = "localhost" })) +/// { +/// process.WaitForExit(); +/// // This should output 0 as valid arguments supplied +/// Information("Exit code: {0}", process.GetExitCode()); +/// } +/// +/// +/// +/// , , or is null. +public Cake.Core.IO.IProcess StartAndReturnProcess(Cake.Core.IO.FilePath fileName, Cake.Core.IO.ProcessSettings settings) +{ + return Cake.Common.ProcessAliases.StartAndReturnProcess(Context, fileName, settings); +} + +/// +/// Starts the process resource that is specified by the filename. +/// +/// The context. +/// Name of the file. +/// The newly started process. +/// +/// +/// using(var process = StartAndReturnProcess("ping")) +/// { +/// process.WaitForExit(); +/// // This should output 0 as valid arguments supplied +/// Information("Exit code: {0}", process.GetExitCode()); +/// } +/// +/// +/// +/// , is null. +public Cake.Core.IO.IProcess StartAndReturnProcess(Cake.Core.IO.FilePath fileName) +{ + return Cake.Common.ProcessAliases.StartAndReturnProcess(Context, fileName); +} + +/// +/// Parses all release notes. +/// +/// The context. +/// The file path. +/// All release notes. +/// +/// +/// var releaseNotes = ParseAllReleaseNotes("./ReleaseNotes.md"); +/// foreach(var releaseNote in releaseNotes) +/// { +/// Information("Version: {0}", releaseNote.Version); +/// foreach(var note in releaseNote.Notes) +/// { +/// Information("\t{0}", note); +/// } +/// } +/// +/// +public System.Collections.Generic.IReadOnlyList ParseAllReleaseNotes(Cake.Core.IO.FilePath filePath) +{ + return Cake.Common.ReleaseNotesAliases.ParseAllReleaseNotes(Context, filePath); +} + +/// +/// Parses the latest release notes. +/// +/// The context. +/// The file path. +/// The latest release notes. +/// +/// +/// var releaseNote = ParseReleaseNotes("./ReleaseNotes.md"); +/// Information("Version: {0}", releaseNote.Version); +/// foreach(var note in releaseNote.Notes) +/// { +/// Information("\t{0}", note); +/// } +/// +/// +public Cake.Common.ReleaseNotes ParseReleaseNotes(Cake.Core.IO.FilePath filePath) +{ + return Cake.Common.ReleaseNotesAliases.ParseReleaseNotes(Context, filePath); +} + +/// +/// Gets the value of a target node. +/// +/// The value found at the given XPath query. +/// The context. +/// The target file. +/// The xpath of the node to get. +/// +/// +/// string autoFacVersion = XmlPeek("./src/Cake/packages.config", "/packages/package[@id='Autofac']/@version"); +/// +/// +public System.String XmlPeek(Cake.Core.IO.FilePath filePath, System.String xpath) +{ + return Cake.Common.Xml.XmlPeekAliases.XmlPeek(Context, filePath, xpath); +} + +/// +/// Get the value of a target node. +/// +/// The value found at the given XPath query. +/// The context. +/// The target file. +/// The xpath of the nodes to set. +/// Additional settings to tweak Xml Peek behavior. +/// +/// +/// XML document: +/// +/// +/// +/// +/// ]]> +/// +/// XmlPeek usage: +/// +/// string version = XmlPeek("./pastery.xml", "/pastery:pastery/pastery:cake/@price", +/// new XmlPeekSettings { +/// Namespaces = new Dictionary<string, string> {{ "pastery", "https://cakebuild.net/pastery" }} +/// }); +/// string unknown = XmlPeek("./pastery.xml", "/pastery:pastery/pastery:cake/@recipe", +/// new XmlPeekSettings { +/// Namespaces = new Dictionary<string, string> {{ "pastery", "https://cakebuild.net/pastery" }}, +/// SuppressWarning = true +/// }); +/// +/// +public System.String XmlPeek(Cake.Core.IO.FilePath filePath, System.String xpath, Cake.Common.Xml.XmlPeekSettings settings) +{ + return Cake.Common.Xml.XmlPeekAliases.XmlPeek(Context, filePath, xpath, settings); +} + +/// +/// Set the value of, or remove, target nodes. +/// +/// The context. +/// The target file. +/// The xpath of the nodes to set. +/// The value to set too. Leave blank to remove the selected nodes. +/// +/// +/// Change the server setting in the configuration from testhost.somecompany.com +/// to productionhost.somecompany.com. +/// +/// XML file: +/// +/// +/// +/// +/// +/// +/// +/// ]]> +/// +/// Cake Task: +/// +/// +/// { +/// var file = File("test.xml"); +/// XmlPoke(file, "/configuration/appSettings/add[@key = 'server']/@value", "productionhost.somecompany.com"); +/// }); +/// ]]> +/// +/// +/// +/// +/// Modify the noNamespaceSchemaLocation in an XML file. +/// +/// XML file: +/// +/// +/// +/// +/// ]]> +/// +/// Cake Task: +/// +/// +/// { +/// var file = File("test.xml"); +/// XmlPoke(file, "/Commands/@xsi:noNamespaceSchemaLocation", "d:\\Commands.xsd", new XmlPokeSettings { +/// Namespaces = new Dictionary { +/// { /* Prefix */ "xsi", /* URI */ "http://www.w3.org/2001/XMLSchema-instance" } +/// } +/// }); +/// }); +/// ]]> +/// +/// +/// +/// Remove an app setting from a config file. +/// +/// XML file: +/// +/// +/// +/// +/// +/// +/// +/// +/// ]]> +/// +/// Cake Task: +/// +/// +/// { +/// var file = File("test.xml"); +/// XmlPoke(file, "/configuration/appSettings/add[@testing]", null); +/// }); +/// ]]> +/// +/// +/// +/// Credit to NAnt for the original example. +/// http://nant.sourceforge.net/release/latest/help/tasks/xmlpoke.html +/// +/// +public void XmlPoke(Cake.Core.IO.FilePath filePath, System.String xpath, System.String value) +{ + Cake.Common.Xml.XmlPokeAliases.XmlPoke(Context, filePath, xpath, value); +} + +/// +/// Set the value of, or remove, target nodes. +/// +/// The context. +/// The target file. +/// The xpath of the nodes to set. +/// The value to set too. Leave blank to remove the selected nodes. +/// Additional settings to tweak Xml Poke behavior. +/// +/// +/// Change the server setting in the configuration from testhost.somecompany.com +/// to productionhost.somecompany.com. +/// +/// XML file: +/// +/// +/// +/// +/// +/// +/// +/// ]]> +/// +/// Cake Task: +/// +/// +/// { +/// var file = File("test.xml"); +/// XmlPoke(file, "/configuration/appSettings/add[@key = 'server']/@value", "productionhost.somecompany.com"); +/// }); +/// ]]> +/// +/// +/// +/// +/// Modify the noNamespaceSchemaLocation in an XML file. +/// +/// XML file: +/// +/// +/// +/// +/// ]]> +/// +/// Cake Task: +/// +/// +/// { +/// var file = File("test.xml"); +/// XmlPoke(file, "/Commands/@xsi:noNamespaceSchemaLocation", "d:\\Commands.xsd", new XmlPokeSettings { +/// Namespaces = new Dictionary { +/// { /* Prefix */ "xsi", /* URI */ "http://www.w3.org/2001/XMLSchema-instance" } +/// } +/// }); +/// }); +/// ]]> +/// +/// +/// +/// Remove an app setting from a config file. +/// +/// XML file: +/// +/// +/// +/// +/// +/// +/// +/// +/// ]]> +/// +/// Cake Task: +/// +/// +/// { +/// var file = File("test.xml"); +/// XmlPoke(file, "/configuration/appSettings/add[@testing]", null); +/// }); +/// ]]> +/// +/// +/// +/// Credit to NAnt for the original example. +/// http://nant.sourceforge.net/release/latest/help/tasks/xmlpoke.html +/// +/// +public void XmlPoke(Cake.Core.IO.FilePath filePath, System.String xpath, System.String value, Cake.Common.Xml.XmlPokeSettings settings) +{ + Cake.Common.Xml.XmlPokeAliases.XmlPoke(Context, filePath, xpath, value, settings); +} + +/// +/// Set the value of, or remove, target nodes. +/// +/// The context. +/// The source xml to transform. +/// The xpath of the nodes to set. +/// The value to set too. Leave blank to remove the selected nodes. +/// Resulting XML. +/// +/// +/// Change the server setting in the configuration from testhost.somecompany.com +/// to productionhost.somecompany.com. +/// +/// XML string: +/// +/// +/// +/// +/// +/// +/// +/// ]]> +/// +/// Cake Task: +/// +/// +/// { +/// var result = XmlPokeString(xmlString, "/configuration/appSettings/add[@key = 'server']/@value", "productionhost.somecompany.com"); +/// }); +/// ]]> +/// +/// +/// +/// +/// Modify the noNamespaceSchemaLocation in an XML file. +/// +/// XML string: +/// +/// +/// +/// +/// ]]> +/// +/// Cake Task: +/// +/// +/// { +/// var result = XmlPokeString(xmlString, "/Commands/@xsi:noNamespaceSchemaLocation", "d:\\Commands.xsd", new XmlPokeSettings { +/// Namespaces = new Dictionary { +/// { /* Prefix */ "xsi", /* URI */ "http://www.w3.org/2001/XMLSchema-instance" } +/// } +/// }); +/// }); +/// ]]> +/// +/// +/// +/// Remove an app setting from a config file. +/// +/// XML string: +/// +/// +/// +/// +/// +/// +/// +/// +/// ]]> +/// +/// Cake Task: +/// +/// +/// { +/// var result = XmlPokeString(xmlString, "/configuration/appSettings/add[@testing]", null); +/// }); +/// ]]> +/// +/// +/// +/// Credit to NAnt for the original example. +/// http://nant.sourceforge.net/release/latest/help/tasks/xmlpoke.html +/// +/// +public System.String XmlPokeString(System.String sourceXml, System.String xpath, System.String value) +{ + return Cake.Common.Xml.XmlPokeAliases.XmlPokeString(Context, sourceXml, xpath, value); +} + +/// +/// Set the value of, or remove, target nodes. +/// +/// The context. +/// The source xml to transform. +/// The xpath of the nodes to set. +/// The value to set too. Leave blank to remove the selected nodes. +/// Additional settings to tweak Xml Poke behavior. +/// Resulting XML. +/// +/// +/// Change the server setting in the configuration from testhost.somecompany.com +/// to productionhost.somecompany.com. +/// +/// XML string: +/// +/// +/// +/// +/// +/// +/// +/// ]]> +/// +/// Cake Task: +/// +/// +/// { +/// var result = XmlPokeString(xmlString, "/configuration/appSettings/add[@key = 'server']/@value", "productionhost.somecompany.com"); +/// }); +/// ]]> +/// +/// +/// +/// +/// Modify the noNamespaceSchemaLocation in an XML file. +/// +/// XML string: +/// +/// +/// +/// +/// ]]> +/// +/// Cake Task: +/// +/// +/// { +/// var result = XmlPokeString(xmlString, "/Commands/@xsi:noNamespaceSchemaLocation", "d:\\Commands.xsd", new XmlPokeSettings { +/// Namespaces = new Dictionary { +/// { /* Prefix */ "xsi", /* URI */ "http://www.w3.org/2001/XMLSchema-instance" } +/// } +/// }); +/// }); +/// ]]> +/// +/// +/// +/// Remove an app setting from a config file. +/// +/// XML string: +/// +/// +/// +/// +/// +/// +/// +/// +/// ]]> +/// +/// Cake Task: +/// +/// +/// { +/// var result = XmlPokeString(xmlString, "/configuration/appSettings/add[@testing]", null); +/// }); +/// ]]> +/// +/// +/// +/// Credit to NAnt for the original example. +/// http://nant.sourceforge.net/release/latest/help/tasks/xmlpoke.html +/// +/// +public System.String XmlPokeString(System.String sourceXml, System.String xpath, System.String value, Cake.Common.Xml.XmlPokeSettings settings) +{ + return Cake.Common.Xml.XmlPokeAliases.XmlPokeString(Context, sourceXml, xpath, value, settings); +} + +/// +/// Performs XML XSL transformation +/// +/// The context. +/// XML style sheet. +/// XML data. +/// Transformed XML string. +/// +/// +/// This example code will convert xml to a new xml strucure using XmlTransform alias. +/// +/// +/// +/// +/// +/// +/// +/// "; +/// +/// string xml = @" +/// +/// +/// "; +/// +/// var priceTag = XmlTransform(xsl, xml); +/// ]]> +/// +/// Result: +/// +/// 1.62]]> +/// +/// +public System.String XmlTransform(System.String xsl, System.String xml) +{ + return Cake.Common.Xml.XmlTransformationAlias.XmlTransform(Context, xsl, xml); +} + +/// +/// Performs XML XSL transformation +/// +/// The context. +/// XML style sheet. +/// XML data. +/// Optional settings for result file xml writer +/// Transformed XML string. +/// +/// +/// This example code will convert specific part of xml to plaintext using XmlTransform alias. +/// +/// +/// +/// +/// "; +/// +/// string xml = @" +/// +/// +/// "; +/// +/// var text = XmlTransform(xsl, xml, new XmlTransformationSettings { +/// ConformanceLevel = System.Xml.ConformanceLevel.Fragment, Encoding = Encoding.ASCII }); +/// ]]> +/// +/// +public System.String XmlTransform(System.String xsl, System.String xml, Cake.Common.Xml.XmlTransformationSettings settings) +{ + return Cake.Common.Xml.XmlTransformationAlias.XmlTransform(Context, xsl, xml, settings); +} + +/// +/// Performs XML XSL transformation +/// +/// The context. +/// Path to xml style sheet. +/// Path xml data. +/// Transformation result path, will overwrite if exists. +/// +/// +/// This example code will convert the Cake nuspec into html using the XmlTransform alias. +/// XML stylesheet: +/// +/// +/// +/// +/// +/// +/// +/// <xsl:for-each select="package/p:metadata"> +/// <xsl:value-of select="p:id"/> +/// </xsl:for-each> +/// +/// +/// +/// +///

+/// +///

+///

Description

+/// +///
+///

Files

+///
    +/// +///
  • +///
    +///
+/// +/// +///
+///
+/// ]]> +///
+/// XmlTransform usage: +/// +/// XmlTransform("./nuspec.xsl", "./nuspec/Cake.nuspec", "./Cake.htm"); +/// +///
+public void XmlTransform(Cake.Core.IO.FilePath xslPath, Cake.Core.IO.FilePath xmlPath, Cake.Core.IO.FilePath resultPath) +{ + Cake.Common.Xml.XmlTransformationAlias.XmlTransform(Context, xslPath, xmlPath, resultPath); +} + +/// +/// Performs XML XSL transformation +/// +/// The context. +/// Path to xml style sheet. +/// Path xml data. +/// Transformation result path. +/// Optional settings for result file xml writer +/// +/// +/// This example code will convert the Cake nuspec into html using the XmlTransform alias, +/// specifying that result should be indented and using Unicode encoding. +/// XML stylesheet: +/// +/// +/// +/// +/// +/// +/// +/// <xsl:for-each select="package/p:metadata"> +/// <xsl:value-of select="p:id"/> +/// </xsl:for-each> +/// +/// +/// +/// +///

+/// +///

+///

Description

+/// +///
+///

Files

+///
    +/// +///
  • +///
    +///
+/// +/// +///
+///
+/// ]]> +///
+/// XmlTransform usage: +/// +/// XmlTransform("./nuspec.xsl", "./nuspec/Cake.nuspec", "./Cake.htm", +/// new XmlTransformationSettings { Indent = true, Encoding = Encoding.Unicode}); +/// +///
+public void XmlTransform(Cake.Core.IO.FilePath xslPath, Cake.Core.IO.FilePath xmlPath, Cake.Core.IO.FilePath resultPath, Cake.Common.Xml.XmlTransformationSettings settings) +{ + Cake.Common.Xml.XmlTransformationAlias.XmlTransform(Context, xslPath, xmlPath, resultPath, settings); +} + +/// +/// Calculates the hash for a given file using the default (SHA256) algorithm. +/// +/// The context. +/// The file path. +/// A instance representing the calculated hash. +/// +/// +/// Information( +/// "Cake executable file SHA256 hash: {0}", +/// CalculateFileHash("Cake.exe").ToHex()); +/// +/// +public Cake.Common.Security.FileHash CalculateFileHash(Cake.Core.IO.FilePath filePath) +{ + return Cake.Common.Security.SecurityAliases.CalculateFileHash(Context, filePath); +} + +/// +/// Calculates the hash for a given file. +/// +/// The context. +/// The file path. +/// The hash algorithm to use. +/// A instance representing the calculated hash. +/// +/// +/// Information( +/// "Cake executable file MD5 hash: {0}", +/// CalculateFileHash("Cake.exe", HashAlgorithm.MD5).ToHex()); +/// +/// +public Cake.Common.Security.FileHash CalculateFileHash(Cake.Core.IO.FilePath filePath, Cake.Common.Security.HashAlgorithm hashAlgorithm) +{ + return Cake.Common.Security.SecurityAliases.CalculateFileHash(Context, filePath, hashAlgorithm); +} + +/// +/// Builds the specified solution using MSBuild or XBuild. +/// +/// +/// +/// DotNetBuild("./project/project.sln"); +/// +/// +/// The context. +/// The solution. +public void DotNetBuild(Cake.Core.IO.FilePath solution) +{ + Cake.Common.Tools.DotNetBuildAliases.DotNetBuild(Context, solution); +} + +/// +/// Builds the specified solution using MSBuild or XBuild. +/// +/// +/// +/// DotNetBuild("./project/project.sln", settings => +/// settings.SetConfiguration("Debug") +/// .SetVerbosity(Core.Diagnostics.Verbosity.Minimal) +/// .WithTarget("Build") +/// .WithProperty("TreatWarningsAsErrors","true")); +/// +/// +/// The context. +/// The solution. +/// The configurator. +public void DotNetBuild(Cake.Core.IO.FilePath solution, System.Action configurator) +{ + Cake.Common.Tools.DotNetBuildAliases.DotNetBuild(Context, solution, configurator); +} + +/// +/// Gets the legacy Visual Studio product installation paths. +/// +/// The context. +/// Get the latest version. +/// The Visual Studio installation path. +/// +/// +/// var legacyInstallationPath = VSWhereLegacy(true); +/// +/// +public Cake.Core.IO.DirectoryPath VSWhereLegacy(System.Boolean latest) +{ + return Cake.Common.Tools.VSWhere.VSWhereAliases.VSWhereLegacy(Context, latest); +} + +/// +/// Gets the legacy Visual Studio product installation paths. +/// +/// The context. +/// The settings. +/// The Visual Studio installation paths. +/// +/// +/// var legacyInstallationPaths = VSWhereLegacy(new VSWhereLegacySettings()); +/// +/// +public Cake.Core.IO.DirectoryPathCollection VSWhereLegacy(Cake.Common.Tools.VSWhere.Legacy.VSWhereLegacySettings settings) +{ + return Cake.Common.Tools.VSWhere.VSWhereAliases.VSWhereLegacy(Context, settings); +} + +/// +/// Gets the latest Visual Studio product installation path. +/// +/// The context. +/// The Visual Studio installation path. +/// +/// +/// var latestInstallationPath = VSWhereLatest(); +/// +/// +public Cake.Core.IO.DirectoryPath VSWhereLatest() +{ + return Cake.Common.Tools.VSWhere.VSWhereAliases.VSWhereLatest(Context); +} + +/// +/// Gets the latest Visual Studio product installation path. +/// +/// The context. +/// The settings. +/// The Visual Studio installation path. +/// +/// +/// var latestInstallationPath = VSWhereLatest(new VSWhereLatestSettings { Requires = "'Microsoft.Component.MSBuild" }); +/// +/// +public Cake.Core.IO.DirectoryPath VSWhereLatest(Cake.Common.Tools.VSWhere.Latest.VSWhereLatestSettings settings) +{ + return Cake.Common.Tools.VSWhere.VSWhereAliases.VSWhereLatest(Context, settings); +} + +/// +/// Gets all Visual Studio product installation paths. +/// +/// The context. +/// The Visual Studio installation paths. +/// +/// +/// var latestInstallationPaths = VSWhereAll(); +/// +/// +public Cake.Core.IO.DirectoryPathCollection VSWhereAll() +{ + return Cake.Common.Tools.VSWhere.VSWhereAliases.VSWhereAll(Context); +} + +/// +/// Gets all Visual Studio product installation paths. +/// +/// The context. +/// The settings. +/// The Visual Studio installation paths. +/// +/// +/// var latestInstallationPaths = VSWhereAll(new VSWhereAllSettings { Requires = "'Microsoft.Component.MSBuild" }); +/// +/// +public Cake.Core.IO.DirectoryPathCollection VSWhereAll(Cake.Common.Tools.VSWhere.All.VSWhereAllSettings settings) +{ + return Cake.Common.Tools.VSWhere.VSWhereAliases.VSWhereAll(Context, settings); +} + +/// +/// Gets Visual Studio product installation paths. +/// +/// The context. +/// The products to find. +/// The Visual Studio installation paths. +/// +/// +/// var latestInstallationPaths = VSWhereProducts("Microsoft.VisualStudio.Product.BuildTools"); +/// +/// +public Cake.Core.IO.DirectoryPathCollection VSWhereProducts(System.String products) +{ + return Cake.Common.Tools.VSWhere.VSWhereAliases.VSWhereProducts(Context, products); +} + +/// +/// Gets Visual Studio product installation paths. +/// +/// The context. +/// The products to find. +/// The settings. +/// The Visual Studio installation paths. +/// +/// +/// var latestInstallationPaths = VSWhereProducts("Microsoft.VisualStudio.Product.BuildTools", new VSWhereProductSettings { Requires = "'Microsoft.Component.MSBuild" }); +/// +/// +public Cake.Core.IO.DirectoryPathCollection VSWhereProducts(System.String products, Cake.Common.Tools.VSWhere.Product.VSWhereProductSettings settings) +{ + return Cake.Common.Tools.VSWhere.VSWhereAliases.VSWhereProducts(Context, products, settings); +} + +/// +/// Runs all VSTest unit tests in the assemblies matching the specified pattern. +/// +/// +/// +/// VSTest("./Tests/*.UnitTests.dll"); +/// +/// +/// The context. +/// The pattern. +public void VSTest(System.String pattern) +{ + Cake.Common.Tools.VSTest.VSTestAliases.VSTest(Context, pattern); +} + +/// +/// Runs all VSTest unit tests in the assemblies matching the specified pattern. +/// +/// +/// +/// VSTest("./Tests/*.UnitTests.dll", new VSTestSettings() { Logger = VSTestLogger.Trx }); +/// +/// +/// The context. +/// The pattern. +/// The settings. +public void VSTest(System.String pattern, Cake.Common.Tools.VSTest.VSTestSettings settings) +{ + Cake.Common.Tools.VSTest.VSTestAliases.VSTest(Context, pattern, settings); +} + +/// +/// Runs all VSTest unit tests in the specified assemblies. +/// +/// +/// +/// var paths = new List<FilePath>() { "./assemblydir1", "./assemblydir2" }; +/// VSTest(paths); +/// +/// +/// The context. +/// The assembly paths. +public void VSTest(System.Collections.Generic.IEnumerable assemblyPaths) +{ + Cake.Common.Tools.VSTest.VSTestAliases.VSTest(Context, assemblyPaths); +} + +/// +/// Runs all VSTest unit tests in the specified assemblies. +/// +/// +/// +/// var paths = new List<FilePath>() { "./assemblydir1", "./assemblydir2" }; +/// VSTest(paths, new VSTestSettings() { InIsolation = true }); +/// +/// +/// The context. +/// The assembly paths. +/// The settings. +public void VSTest(System.Collections.Generic.IEnumerable assemblyPaths, Cake.Common.Tools.VSTest.VSTestSettings settings) +{ + Cake.Common.Tools.VSTest.VSTestAliases.VSTest(Context, assemblyPaths, settings); +} + +/// +/// Transform a text template. +/// +/// +/// +/// // Transform a .tt template. +/// var transform = File("./src/Cake/Transform.tt"); +/// TransformTemplate(transform); +/// +/// +/// The context. +/// The source file. +public void TransformTemplate(Cake.Core.IO.FilePath sourceFile) +{ + Cake.Common.Tools.TextTransform.TextTransformAliases.TransformTemplate(Context, sourceFile); +} + +/// +/// Transform a text template. +/// +/// +/// +/// // Transform a .tt template. +/// var transform = File("./src/Cake/Transform.tt"); +/// TransformTemplate(transform, new TextTransformSettings { OutputFile="./src/Cake/Transform.cs" }); +/// +/// +/// The context. +/// The source file. +/// The settings. +public void TransformTemplate(Cake.Core.IO.FilePath sourceFile, Cake.Common.Tools.TextTransform.TextTransformSettings settings) +{ + Cake.Common.Tools.TextTransform.TextTransformAliases.TransformTemplate(Context, sourceFile, settings); +} + +/// +/// Creates a report that shows the usage and binding status of the steps for the entire project. +/// You can use this report to find both unused code in the automation layer and scenario steps that have no definition yet. +/// See SpecFlow Documentation for more information. +/// +/// The context. +/// The path of the project file containing the feature files. +public void SpecFlowStepDefinitionReport(Cake.Core.IO.FilePath projectFile) +{ + Cake.Common.Tools.SpecFlow.SpecFlowAliases.SpecFlowStepDefinitionReport(Context, projectFile); +} + +/// +/// Creates a report that shows the usage and binding status of the steps for the entire project. +/// You can use this report to find both unused code in the automation layer and scenario steps that have no definition yet. +/// See SpecFlow Documentation for more information. +/// +/// The context. +/// The path of the project file containing the feature files. +/// The settings. +public void SpecFlowStepDefinitionReport(Cake.Core.IO.FilePath projectFile, Cake.Common.Tools.SpecFlow.StepDefinitionReport.SpecFlowStepDefinitionReportSettings settings) +{ + Cake.Common.Tools.SpecFlow.SpecFlowAliases.SpecFlowStepDefinitionReport(Context, projectFile, settings); +} + +/// +/// Creates a formatted HTML report of a test execution. +/// The report contains a summary about the executed tests and the result and also a detailed report for the individual scenario executions. +/// See SpecFlow Documentation for more information. +/// +/// The context. +/// The action to run SpecFlow for. Supported actions are: MSTest, NUnit3 and XUnit2 +/// The path of the project file containing the feature files. +public void SpecFlowTestExecutionReport(System.Action action, Cake.Core.IO.FilePath projectFile) +{ + Cake.Common.Tools.SpecFlow.SpecFlowAliases.SpecFlowTestExecutionReport(Context, action, projectFile); +} + +/// +/// Creates a formatted HTML report of a test execution. +/// The report contains a summary about the executed tests and the result and also a detailed report for the individual scenario executions. +/// See SpecFlow Documentation for more information. +/// +/// The context. +/// The action to run SpecFlow for. Supported actions are: MSTest, NUNit, NUNit3, XUnit and XUnit2 +/// The path of the project file containing the feature files. +/// The settings. +public void SpecFlowTestExecutionReport(System.Action action, Cake.Core.IO.FilePath projectFile, Cake.Common.Tools.SpecFlow.TestExecutionReport.SpecFlowTestExecutionReportSettings settings) +{ + Cake.Common.Tools.SpecFlow.SpecFlowAliases.SpecFlowTestExecutionReport(Context, action, projectFile, settings); +} + +/// +/// Converts the reports in the specified directory into human readable form. +/// +/// The context. +/// The input folder. +/// +/// Provide only an input folder, which will causes ReportUnit to search entire directory for report files. +/// Cake task: +/// +/// ReportUnit("c:/temp"); +/// +/// +public void ReportUnit(Cake.Core.IO.DirectoryPath inputFolder) +{ + Cake.Common.Tools.ReportUnit.ReportUnitAliases.ReportUnit(Context, inputFolder); +} + +/// +/// Converts the reports in the specified directory into human readable form. +/// +/// The context. +/// The input folder. +/// The ReportUnit settings. +/// +/// Provide an input folder and custom ToolPath, which will causes ReportUnit to search entire directory for report files. +/// Cake task: +/// +/// ReportUnit("c:/temp", new ReportUnitSettings(){ +/// ToolPath = "c:/tools/reportunit.exe" +/// }); +/// +/// +public void ReportUnit(Cake.Core.IO.DirectoryPath inputFolder, Cake.Common.Tools.ReportUnit.ReportUnitSettings settings) +{ + Cake.Common.Tools.ReportUnit.ReportUnitAliases.ReportUnit(Context, inputFolder, settings); +} + +/// +/// Converts the reports in the specified directory into human readable form and outputs to specified folder. +/// +/// The context. +/// The input folder. +/// The output folder. +/// The ReportUnit settings. +/// +/// Provide both input and output folder, which will causes ReportUnit to search entire directory for report files, and output the results to specified location. +/// Cake task: +/// +/// ReportUnit("c:/temp/input", "c:/temp/output"); +/// +/// +public void ReportUnit(Cake.Core.IO.DirectoryPath inputFolder, Cake.Core.IO.DirectoryPath outputFolder, Cake.Common.Tools.ReportUnit.ReportUnitSettings settings) +{ + Cake.Common.Tools.ReportUnit.ReportUnitAliases.ReportUnit(Context, inputFolder, outputFolder, settings); +} + +/// +/// Converts the single specified report into human readable form and outputs to specified file. +/// +/// The context. +/// The input file. +/// The output file. +/// +/// Provide both input and output file, which will causes ReportUnit to transform only the specific file, and output to the specified location. +/// Cake task: +/// +/// ReportUnit("c:/temp/input", "c:/temp/output"); +/// +/// +public void ReportUnit(Cake.Core.IO.FilePath inputFile, Cake.Core.IO.FilePath outputFile) +{ + Cake.Common.Tools.ReportUnit.ReportUnitAliases.ReportUnit(Context, inputFile, outputFile); +} + +/// +/// Converts the single specified report into human readable form and outputs to specified file. +/// +/// The context. +/// The input file. +/// The output file. +/// The ReportUnit settings. +/// +/// Provide both input and output file, which will causes ReportUnit to transform only the specific file, and output to the specified location. Also use a custom path for the reportunit.exe. +/// Cake task: +/// +/// ReportUnit("c:/temp/input", "c:/temp/output", new ReportUnitSettings(){ +/// ToolPath = "c:/tools/reportunit.exe" +/// }); +/// +/// +public void ReportUnit(Cake.Core.IO.FilePath inputFile, Cake.Core.IO.FilePath outputFile, Cake.Common.Tools.ReportUnit.ReportUnitSettings settings) +{ + Cake.Common.Tools.ReportUnit.ReportUnitAliases.ReportUnit(Context, inputFile, outputFile, settings); +} + +/// +/// Converts the coverage report specified by the glob pattern into human readable form. +/// +/// The context. +/// The glob pattern. +/// The output directory. +/// +/// +/// ReportGenerator("c:/temp/coverage/*.xml", "c:/temp/output"); +/// +/// +public void ReportGenerator(System.String pattern, Cake.Core.IO.DirectoryPath targetDir) +{ + Cake.Common.Tools.ReportGenerator.ReportGeneratorAliases.ReportGenerator(Context, pattern, targetDir); +} + +/// +/// Converts the coverage report specified by the glob pattern into human readable form using the specified settings. +/// +/// The context. +/// The glob pattern. +/// The output directory. +/// The settings. +/// +/// +/// ReportGenerator("c:/temp/coverage/*.xml", "c:/temp/output", new ReportGeneratorSettings(){ +/// ToolPath = "c:/tools/reportgenerator.exe" +/// }); +/// +/// +public void ReportGenerator(System.String pattern, Cake.Core.IO.DirectoryPath targetDir, Cake.Common.Tools.ReportGenerator.ReportGeneratorSettings settings) +{ + Cake.Common.Tools.ReportGenerator.ReportGeneratorAliases.ReportGenerator(Context, pattern, targetDir, settings); +} + +/// +/// Converts the specified coverage report into human readable form. +/// +/// The context. +/// The coverage report. +/// The output directory. +/// +/// +/// ReportGenerator("c:/temp/coverage/report.xml", "c:/temp/output"); +/// +/// +public void ReportGenerator(Cake.Core.IO.FilePath report, Cake.Core.IO.DirectoryPath targetDir) +{ + Cake.Common.Tools.ReportGenerator.ReportGeneratorAliases.ReportGenerator(Context, report, targetDir); +} + +/// +/// Converts the specified coverage report into human readable form using the specified settings. +/// +/// The context. +/// The coverage report. +/// The output directory. +/// The settings. +/// +/// +/// ReportGenerator("c:/temp/coverage.xml", "c:/temp/output", new ReportGeneratorSettings(){ +/// ToolPath = "c:/tools/reportgenerator.exe" +/// }); +/// +/// +public void ReportGenerator(Cake.Core.IO.FilePath report, Cake.Core.IO.DirectoryPath targetDir, Cake.Common.Tools.ReportGenerator.ReportGeneratorSettings settings) +{ + Cake.Common.Tools.ReportGenerator.ReportGeneratorAliases.ReportGenerator(Context, report, targetDir, settings); +} + +/// +/// Converts the specified coverage reports into human readable form. +/// +/// The context. +/// The coverage reports. +/// The output directory. +/// +/// +/// ReportGenerator(new[] { "c:/temp/coverage1.xml", "c:/temp/coverage2.xml" }, "c:/temp/output"); +/// +/// +public void ReportGenerator(System.Collections.Generic.IEnumerable reports, Cake.Core.IO.DirectoryPath targetDir) +{ + Cake.Common.Tools.ReportGenerator.ReportGeneratorAliases.ReportGenerator(Context, reports, targetDir); +} + +/// +/// Converts the specified coverage reports into human readable form using the specified settings. +/// +/// The context. +/// The coverage reports. +/// The output directory. +/// The settings. +/// +/// +/// ReportGenerator(new[] { "c:/temp/coverage1.xml", "c:/temp/coverage2.xml" }, "c:/temp/output", new ReportGeneratorSettings(){ +/// ToolPath = "c:/tools/reportgenerator.exe" +/// }); +/// +/// +public void ReportGenerator(System.Collections.Generic.IEnumerable reports, Cake.Core.IO.DirectoryPath targetDir, Cake.Common.Tools.ReportGenerator.ReportGeneratorSettings settings) +{ + Cake.Common.Tools.ReportGenerator.ReportGeneratorAliases.ReportGenerator(Context, reports, targetDir, settings); +} + +/// +/// Runs OpenCover +/// for the specified action and settings. +/// +/// The context. +/// The action to run OpenCover for. +/// The OpenCover output file. +/// The settings. +/// +/// +/// OpenCover(tool => { +/// tool.XUnit2("./**/App.Tests.dll", +/// new XUnit2Settings { +/// ShadowCopy = false +/// }); +/// }, +/// new FilePath("./result.xml"), +/// new OpenCoverSettings() +/// .WithFilter("+[App]*") +/// .WithFilter("-[App.Tests]*")); +/// +/// +public void OpenCover(System.Action action, Cake.Core.IO.FilePath outputFile, Cake.Common.Tools.OpenCover.OpenCoverSettings settings) +{ + Cake.Common.Tools.OpenCover.OpenCoverAliases.OpenCover(Context, action, outputFile, settings); +} + +/// +/// Compiles the given NSIS script using the default settings. +/// +/// The context. +/// The path to the .nsi script file to compile. +/// +/// +/// MakeNSIS("./src/Cake.nsi"); +/// +/// +public void MakeNSIS(Cake.Core.IO.FilePath scriptFile) +{ + Cake.Common.Tools.NSIS.NSISAliases.MakeNSIS(Context, scriptFile); +} + +/// +/// Compiles the given NSIS script using the given . +/// +/// The context. +/// The path to the .nsi script file to compile. +/// The to use. +/// +/// +/// MakeNSIS("./src/Cake.nsi", new MakeNSISSettings { +/// NoConfig = true +/// }); +/// +/// +public void MakeNSIS(Cake.Core.IO.FilePath scriptFile, Cake.Common.Tools.NSIS.MakeNSISSettings settings) +{ + Cake.Common.Tools.NSIS.NSISAliases.MakeNSIS(Context, scriptFile, settings); +} + +/// +/// Analyses the specified solution with Resharper's InspectCode. +/// +/// The context. +/// The solution. +/// +/// +/// InspectCode("./src/MySolution.sln"); +/// +/// +public void InspectCode(Cake.Core.IO.FilePath solution) +{ + Cake.Common.Tools.InspectCode.InspectCodeAliases.InspectCode(Context, solution); +} + +/// +/// Analyses the specified solution with Resharper's InspectCode, +/// using the specified settings. +/// +/// The context. +/// The solution. +/// The settings. +/// +/// +/// var buildOutputDirectory = Directory("./.build"); +/// var resharperReportsDirectory = buildOutputDirectory + Directory("_ReSharperReports"); +/// +/// var msBuildProperties = new Dictionary<string, string>(); +/// msBuildProperties.Add("configuration", configuration); +/// msBuildProperties.Add("platform", "AnyCPU"); +/// +/// InspectCode("./MySolution.sln", new InspectCodeSettings { +/// SolutionWideAnalysis = true, +/// Profile = "./MySolution.sln.DotSettings", +/// MsBuildProperties = msBuildProperties, +/// OutputFile = resharperReportsDirectory + File("inspectcode-output.xml"), +/// ThrowExceptionOnFindingViolations = true +/// }); +/// +/// +public void InspectCode(Cake.Core.IO.FilePath solution, Cake.Common.Tools.InspectCode.InspectCodeSettings settings) +{ + Cake.Common.Tools.InspectCode.InspectCodeAliases.InspectCode(Context, solution, settings); +} + +/// +/// Runs ReSharper's InspectCode using the specified config file. +/// +/// The context. +/// The config file. +/// +/// +/// InspectCodeFromConfig("./src/inspectcode.config"); +/// +/// +public void InspectCodeFromConfig(Cake.Core.IO.FilePath configFile) +{ + Cake.Common.Tools.InspectCode.InspectCodeAliases.InspectCodeFromConfig(Context, configFile); +} + +/// +/// Compiles the given Inno Setup script using the default settings. +/// +/// The context. +/// The path to the .iss script file to compile. +/// +/// +/// InnoSetup("./src/Cake.iss"); +/// +/// +public void InnoSetup(Cake.Core.IO.FilePath scriptFile) +{ + Cake.Common.Tools.InnoSetup.InnoSetupAliases.InnoSetup(Context, scriptFile); +} + +/// +/// Compiles the given Inno Setup script using the given . +/// +/// The context. +/// The path to the .iss script file to compile. +/// The to use. +/// +/// +/// InnoSetup("./src/Cake.iss", new InnoSetupSettings { +/// OutputDir = outputDirectory +/// }); +/// +/// +public void InnoSetup(Cake.Core.IO.FilePath scriptFile, Cake.Common.Tools.InnoSetup.InnoSetupSettings settings) +{ + Cake.Common.Tools.InnoSetup.InnoSetupAliases.InnoSetup(Context, scriptFile, settings); +} + +/// +/// Merges the specified assemblies. +/// +/// The context. +/// The output file. +/// The primary assembly. +/// The assembly paths. +/// +/// +/// var assemblyPaths = GetFiles("./**/Cake.*.dll"); +/// ILRepack("./MergedCake.exe", "./Cake.exe", assemblyPaths); +/// +/// +public void ILRepack(Cake.Core.IO.FilePath outputFile, Cake.Core.IO.FilePath primaryAssembly, System.Collections.Generic.IEnumerable assemblyPaths) +{ + Cake.Common.Tools.ILRepack.ILRepackAliases.ILRepack(Context, outputFile, primaryAssembly, assemblyPaths); +} + +/// +/// Merges the specified assemblies. +/// +/// The context. +/// The output file. +/// The primary assembly. +/// The assembly paths. +/// The settings. +/// +/// +/// var assemblyPaths = GetFiles("./**/Cake.*.dll"); +/// ILRepack( +/// "./MergedCake.exe", +/// "./Cake.exe", +/// assemblyPaths, +/// new ILRepackSettings { Internalize = true }); +/// +/// +public void ILRepack(Cake.Core.IO.FilePath outputFile, Cake.Core.IO.FilePath primaryAssembly, System.Collections.Generic.IEnumerable assemblyPaths, Cake.Common.Tools.ILRepack.ILRepackSettings settings) +{ + Cake.Common.Tools.ILRepack.ILRepackAliases.ILRepack(Context, outputFile, primaryAssembly, assemblyPaths, settings); +} + +/// +/// Retrieves the GitVersion output. +/// +/// The context. +/// The git version info. +/// +/// Update the assembly info files for the project. +/// Cake task: +/// +/// +/// { +/// GitVersion(new GitVersionSettings { +/// UpdateAssemblyInfo = true +/// }); +/// }); +/// ]]> +/// +/// Get the git version info for the project using a dynamic repository. +/// Cake task: +/// +/// +/// { +/// var result = GitVersion(new GitVersionSettings { +/// UserName = "MyUser", +/// Password = "MyPassword, +/// Url = "http://git.myhost.com/myproject.git" +/// Branch = "develop" +/// Commit = EnviromentVariable("MY_COMMIT") +/// }); +/// // Use result for building nuget packages, setting build server version, etc... +/// }); +/// ]]> +/// +/// +public Cake.Common.Tools.GitVersion.GitVersion GitVersion() +{ + return Cake.Common.Tools.GitVersion.GitVersionAliases.GitVersion(Context); +} + +/// +/// Retrieves the GitVersion output. +/// +/// The context. +/// The GitVersion settings. +/// The git version info. +/// +/// Update the assembly info files for the project. +/// Cake task: +/// +/// +/// { +/// GitVersion(new GitVersionSettings { +/// UpdateAssemblyInfo = true +/// }); +/// }); +/// ]]> +/// +/// Get the git version info for the project using a dynamic repository. +/// Cake task: +/// +/// +/// { +/// var result = GitVersion(new GitVersionSettings { +/// UserName = "MyUser", +/// Password = "MyPassword, +/// Url = "http://git.myhost.com/myproject.git" +/// Branch = "develop" +/// Commit = EnviromentVariable("MY_COMMIT") +/// }); +/// // Use result for building nuget packages, setting build server version, etc... +/// }); +/// ]]> +/// +/// +public Cake.Common.Tools.GitVersion.GitVersion GitVersion(Cake.Common.Tools.GitVersion.GitVersionSettings settings) +{ + return Cake.Common.Tools.GitVersion.GitVersionAliases.GitVersion(Context, settings); +} + +/// +/// Generates a set of release notes based on the commit history of the repository and specified settings. +/// +/// The context. +/// The output file. +/// The settings. +/// +/// +/// GitReleaseNotes("c:/temp/releasenotes.md", new GitReleaseNotesSettings { +/// WorkingDirectory = "c:/temp", +/// Verbose = true, +/// IssueTracker = IssueTracker.GitHub, +/// AllTags = true, +/// RepoUserName = "bob", +/// RepoPassword = "password", +/// RepoUrl = "http://myrepo.co.uk", +/// RepoBranch = "master", +/// IssueTrackerUrl = "http://myissuetracker.co.uk", +/// IssueTrackerUserName = "bob", +/// IssueTrackerPassword = "password", +/// IssueTrackerProjectId = "1234", +/// Categories = "Category1", +/// Version = "1.2.3.4", +/// AllLabels = true +/// }); +/// +/// +public void GitReleaseNotes(Cake.Core.IO.FilePath outputFile, Cake.Common.Tools.GitReleaseNotes.GitReleaseNotesSettings settings) +{ + Cake.Common.Tools.GitReleaseNotes.GitReleaseNotesAliases.GitReleaseNotes(Context, outputFile, settings); +} + +/// +/// Creates a Package Release. +/// +/// The context. +/// The user name. +/// The password. +/// The owner. +/// The repository. +/// +/// +/// GitReleaseManagerCreate("user", "password", "owner", "repo"); +/// +/// +/// +/// +/// GitReleaseManagerCreate("user", "password", "owner", "repo"); +/// +/// +public void GitReleaseManagerCreate(System.String userName, System.String password, System.String owner, System.String repository) +{ + Cake.Common.Tools.GitReleaseManager.GitReleaseManagerAliases.GitReleaseManagerCreate(Context, userName, password, owner, repository); +} + +/// +/// Creates a Package Release using the specified settings. +/// +/// The context. +/// The user name. +/// The password. +/// The owner. +/// The repository. +/// The settings. +/// +/// +/// GitReleaseManagerCreate("user", "password", "owner", "repo", new GitReleaseManagerCreateSettings { +/// Milestone = "0.1.0", +/// Prerelease = false, +/// Assets = "c:/temp/asset1.txt,c:/temp/asset2.txt", +/// TargetCommitish = "master", +/// TargetDirectory = "c:/repo", +/// LogFilePath = "c:/temp/grm.log" +/// }); +/// +/// +/// +/// +/// GitReleaseManagerCreate("user", "password", "owner", "repo", new GitReleaseManagerCreateSettings { +/// Name = "0.1.0", +/// InputFilePath = "c:/repo/releasenotes.md", +/// Prerelease = false, +/// Assets = "c:/temp/asset1.txt,c:/temp/asset2.txt", +/// TargetCommitish = "master", +/// TargetDirectory = "c:/repo", +/// LogFilePath = "c:/temp/grm.log" +/// }); +/// +/// +public void GitReleaseManagerCreate(System.String userName, System.String password, System.String owner, System.String repository, Cake.Common.Tools.GitReleaseManager.Create.GitReleaseManagerCreateSettings settings) +{ + Cake.Common.Tools.GitReleaseManager.GitReleaseManagerAliases.GitReleaseManagerCreate(Context, userName, password, owner, repository, settings); +} + +/// +/// Add Assets to an existing release. +/// +/// The context. +/// The user name. +/// The password. +/// The owner. +/// The repository. +/// The tag name. +/// The assets. +/// +/// +/// GitReleaseManagerAddAssets("user", "password", "owner", "repo", "0.1.0", "c:/temp/asset1.txt,c:/temp/asset2.txt"); +/// +/// +public void GitReleaseManagerAddAssets(System.String userName, System.String password, System.String owner, System.String repository, System.String tagName, System.String assets) +{ + Cake.Common.Tools.GitReleaseManager.GitReleaseManagerAliases.GitReleaseManagerAddAssets(Context, userName, password, owner, repository, tagName, assets); +} + +/// +/// Add Assets to an existing release using the specified settings. +/// +/// The context. +/// The user name. +/// The password. +/// The owner. +/// The repository. +/// The tag name. +/// The assets. +/// The settings. +/// +/// +/// GitReleaseManagerAddAssets("user", "password", "owner", "repo", "0.1.0", "c:/temp/asset1.txt,c:/temp/asset2.txt" new GitReleaseManagerAddAssetsSettings { +/// TargetDirectory = "c:/repo", +/// LogFilePath = "c:/temp/grm.log" +/// }); +/// +/// +public void GitReleaseManagerAddAssets(System.String userName, System.String password, System.String owner, System.String repository, System.String tagName, System.String assets, Cake.Common.Tools.GitReleaseManager.AddAssets.GitReleaseManagerAddAssetsSettings settings) +{ + Cake.Common.Tools.GitReleaseManager.GitReleaseManagerAliases.GitReleaseManagerAddAssets(Context, userName, password, owner, repository, tagName, assets, settings); +} + +/// +/// Closes the milestone associated with a release. +/// +/// The context. +/// The user name. +/// The password. +/// The owner. +/// The repository. +/// The milestone. +/// +/// +/// GitReleaseManagerClose("user", "password", "owner", "repo", "0.1.0"); +/// +/// +public void GitReleaseManagerClose(System.String userName, System.String password, System.String owner, System.String repository, System.String milestone) +{ + Cake.Common.Tools.GitReleaseManager.GitReleaseManagerAliases.GitReleaseManagerClose(Context, userName, password, owner, repository, milestone); +} + +/// +/// Closes the milestone associated with a release using the specified settings. +/// +/// The context. +/// The user name. +/// The password. +/// The owner. +/// The repository. +/// The milestone. +/// The settings. +/// +/// +/// GitReleaseManagerClose("user", "password", "owner", "repo", "0.1.0", new GitReleaseManagerCloseMilestoneSettings { +/// TargetDirectory = "c:/repo", +/// LogFilePath = "c:/temp/grm.log" +/// }); +/// +/// +public void GitReleaseManagerClose(System.String userName, System.String password, System.String owner, System.String repository, System.String milestone, Cake.Common.Tools.GitReleaseManager.Close.GitReleaseManagerCloseMilestoneSettings settings) +{ + Cake.Common.Tools.GitReleaseManager.GitReleaseManagerAliases.GitReleaseManagerClose(Context, userName, password, owner, repository, milestone, settings); +} + +/// +/// Publishes the release. +/// +/// The context. +/// The user name. +/// The password. +/// The owner. +/// The repository. +/// The tag name. +/// +/// +/// GitReleaseManagerPublish("user", "password", "owner", "repo", "0.1.0"); +/// +/// +public void GitReleaseManagerPublish(System.String userName, System.String password, System.String owner, System.String repository, System.String tagName) +{ + Cake.Common.Tools.GitReleaseManager.GitReleaseManagerAliases.GitReleaseManagerPublish(Context, userName, password, owner, repository, tagName); +} + +/// +/// Publishes the release using the specified settings. +/// +/// The context. +/// The user name. +/// The password. +/// The owner. +/// The repository. +/// The tag name. +/// The settings. +/// +/// +/// GitReleaseManagerPublish("user", "password", "owner", "repo", "0.1.0", new GitReleaseManagerPublishSettings { +/// TargetDirectory = "c:/repo", +/// LogFilePath = "c:/temp/grm.log" +/// }); +/// +/// +public void GitReleaseManagerPublish(System.String userName, System.String password, System.String owner, System.String repository, System.String tagName, Cake.Common.Tools.GitReleaseManager.Publish.GitReleaseManagerPublishSettings settings) +{ + Cake.Common.Tools.GitReleaseManager.GitReleaseManagerAliases.GitReleaseManagerPublish(Context, userName, password, owner, repository, tagName, settings); +} + +/// +/// Exports the release notes. +/// +/// The context. +/// The user name. +/// The password. +/// The owner. +/// The repository. +/// The output file path. +/// +/// +/// GitReleaseManagerExport("user", "password", "owner", "repo", "c:/temp/releasenotes.md") +/// }); +/// +/// +public void GitReleaseManagerExport(System.String userName, System.String password, System.String owner, System.String repository, Cake.Core.IO.FilePath fileOutputPath) +{ + Cake.Common.Tools.GitReleaseManager.GitReleaseManagerAliases.GitReleaseManagerExport(Context, userName, password, owner, repository, fileOutputPath); +} + +/// +/// Exports the release notes using the specified settings. +/// +/// The context. +/// The user name. +/// The password. +/// The owner. +/// The repository. +/// The output file path. +/// The settings. +/// +/// +/// GitReleaseManagerExport("user", "password", "owner", "repo", "c:/temp/releasenotes.md", new GitReleaseManagerExportSettings { +/// TagName = "0.1.0", +/// TargetDirectory = "c:/repo", +/// LogFilePath = "c:/temp/grm.log" +/// }); +/// +/// +public void GitReleaseManagerExport(System.String userName, System.String password, System.String owner, System.String repository, Cake.Core.IO.FilePath fileOutputPath, Cake.Common.Tools.GitReleaseManager.Export.GitReleaseManagerExportSettings settings) +{ + Cake.Common.Tools.GitReleaseManager.GitReleaseManagerAliases.GitReleaseManagerExport(Context, userName, password, owner, repository, fileOutputPath, settings); +} + +/// +/// Update pdb files to link all sources. +/// This will allow anyone to step through the source code while debugging without a symbol source server. +/// +/// The context. +/// The Solution File to analyze. +/// +/// +/// GitLink("C:/temp/solution"); +/// +/// +public void GitLink(Cake.Core.IO.DirectoryPath repositoryRootPath) +{ + Cake.Common.Tools.GitLink.GitLinkAliases.GitLink(Context, repositoryRootPath); +} + +/// +/// Update pdb files to link all sources, using specified settings. +/// This will allow anyone to step through the source code while debugging without a symbol source server. +/// +/// The context. +/// The path to the Root of the Repository to analyze. +/// The settings. +/// +/// +/// GitLink("C:/temp/solution", new GitLinkSettings { +/// RepositoryUrl = "http://mydomain.com", +/// Branch = "master", +/// ShaHash = "abcdef", +/// }); +/// +/// +public void GitLink(Cake.Core.IO.DirectoryPath repositoryRootPath, Cake.Common.Tools.GitLink.GitLinkSettings settings) +{ + Cake.Common.Tools.GitLink.GitLinkAliases.GitLink(Context, repositoryRootPath, settings); +} + +/// +/// Runs all Fixie tests in the assemblies matching the specified pattern. +/// +/// +/// +/// Fixie("./src/UnitTests/*.dll"); +/// +/// +/// The context. +/// The pattern. +public void Fixie(System.String pattern) +{ + Cake.Common.Tools.Fixie.FixieAliases.Fixie(Context, pattern); +} + +/// +/// Runs all Fixie tests in the assemblies matching the specified pattern, +/// using the specified settings. +/// +/// +/// +/// Fixie("./src/UnitTests/*.dll", new FixieSettings { +/// NUnitXml = TestResult.xml +/// }); +/// +/// +/// The context. +/// The pattern. +/// The settings. +public void Fixie(System.String pattern, Cake.Common.Tools.Fixie.FixieSettings settings) +{ + Cake.Common.Tools.Fixie.FixieAliases.Fixie(Context, pattern, settings); +} + +/// +/// Runs all Fixie tests in the specified assemblies. +/// +/// +/// +/// var assemblies = new [] { +/// "UnitTests1.dll", +/// "UnitTests2.dll" +/// }; +/// Fixie(assemblies); +/// +/// +/// The context. +/// The assemblies. +public void Fixie(System.Collections.Generic.IEnumerable assemblies) +{ + Cake.Common.Tools.Fixie.FixieAliases.Fixie(Context, assemblies); +} + +/// +/// Runs all Fixie tests in the specified assemblies. +/// +/// +/// +/// var assemblies = GetFiles("./src/UnitTests/*.dll"); +/// Fixie(assemblies); +/// +/// +/// The context. +/// The assemblies. +public void Fixie(System.Collections.Generic.IEnumerable assemblies) +{ + Cake.Common.Tools.Fixie.FixieAliases.Fixie(Context, assemblies); +} + +/// +/// Runs all Fixie tests in the specified assemblies, +/// using the specified settings. +/// +/// +/// +/// var assemblies = new [] { +/// "UnitTests1.dll", +/// "UnitTests2.dll" +/// }; +/// Fixie(assemblies, new FixieSettings { +/// NUnitXml = TestResult.xml +/// }); +/// +/// +/// The context. +/// The assemblies. +/// The settings. +public void Fixie(System.Collections.Generic.IEnumerable assemblies, Cake.Common.Tools.Fixie.FixieSettings settings) +{ + Cake.Common.Tools.Fixie.FixieAliases.Fixie(Context, assemblies, settings); +} + +/// +/// Runs all Fixie tests in the specified assemblies, +/// using the specified settings. +/// +/// +/// +/// var assemblies = GetFiles("./src/UnitTests/*.dll"); +/// Fixie(assemblies, new FixieSettings { +/// NUnitXml = TestResult.xml +/// }); +/// +/// +/// The context. +/// The assemblies. +/// The settings. +public void Fixie(System.Collections.Generic.IEnumerable assemblies, Cake.Common.Tools.Fixie.FixieSettings settings) +{ + Cake.Common.Tools.Fixie.FixieAliases.Fixie(Context, assemblies, settings); +} + +/// +/// Analyses the specified file with ReSharper's DupFinder. +/// The file can either be a solution/project or a source file. +/// +/// The context. +/// The file to analyze. +/// +/// +/// DupFinder("./src/MySolution.sln"); +/// +/// +public void DupFinder(Cake.Core.IO.FilePath file) +{ + Cake.Common.Tools.DupFinder.DupFinderAliases.DupFinder(Context, file); +} + +/// +/// Analyses the specified file with ReSharper's DupFinder using the specified settings. +/// The file can either be a solution/project or a source file. +/// +/// The context. +/// The file to analyze. +/// The settings. +/// +/// +/// var buildOutputDirectory = Directory("./.build"); +/// var resharperReportsDirectory = buildOutputDirectory + Directory("_ReSharperReports"); +/// var rootDirectoryPath = MakeAbsolute(Context.Environment.WorkingDirectory); +/// +/// DupFinder("./src/MySolution.sln", new DupFinderSettings { +/// ShowStats = true, +/// ShowText = true, +/// ExcludePattern = new String[] +/// { +/// rootDirectoryPath + "/**/*Designer.cs", +/// }, +/// OutputFile = resharperReportsDirectory + File("dupfinder-output.xml"), +/// ThrowExceptionOnFindingDuplicates = true +/// }); +/// +/// +public void DupFinder(Cake.Core.IO.FilePath file, Cake.Common.Tools.DupFinder.DupFinderSettings settings) +{ + Cake.Common.Tools.DupFinder.DupFinderAliases.DupFinder(Context, file, settings); +} + +/// +/// Analyses the specified projects with ReSharper's DupFinder. +/// The files can either be solutions and projects or a source files. +/// +/// The context. +/// The files to analyze. +/// +/// +/// var projects = GetFiles("./src/**/*.csproj"); +/// DupFinder(projects); +/// +/// +public void DupFinder(System.Collections.Generic.IEnumerable files) +{ + Cake.Common.Tools.DupFinder.DupFinderAliases.DupFinder(Context, files); +} + +/// +/// Analyses the specified projects with ReSharper's DupFinder using the specified settings. +/// The files can either be solutions and projects or a source files. +/// +/// The context. +/// The files to analyze. +/// The settings. +/// +/// +/// var buildOutputDirectory = Directory("./.build"); +/// var resharperReportsDirectory = buildOutputDirectory + Directory("_ReSharperReports"); +/// var rootDirectoryPath = MakeAbsolute(Context.Environment.WorkingDirectory); +/// +/// var projects = GetFiles("./src/**/*.csproj"); +/// DupFinder(projects, new DupFinderSettings { +/// ShowStats = true, +/// ShowText = true, +/// ExcludePattern = new String[] +/// { +/// rootDirectoryPath + "/**/*Designer.cs", +/// }, +/// OutputFile = resharperReportsDirectory + File("dupfinder-output.xml"), +/// ThrowExceptionOnFindingDuplicates = true +/// }); +/// +/// +public void DupFinder(System.Collections.Generic.IEnumerable files, Cake.Common.Tools.DupFinder.DupFinderSettings settings) +{ + Cake.Common.Tools.DupFinder.DupFinderAliases.DupFinder(Context, files, settings); +} + +/// +/// Analyses all files matching the specified pattern with ReSharper's DupFinder. +/// +/// The context. +/// The pattern. +/// +/// +/// DupFinder("*.cs"); +/// +/// +public void DupFinder(System.String pattern) +{ + Cake.Common.Tools.DupFinder.DupFinderAliases.DupFinder(Context, pattern); +} + +/// +/// Analyses all files matching the specified pattern with ReSharper's DupFinder, +/// using the specified settings. +/// +/// The context. +/// The pattern. +/// The settings. +/// +/// +/// var buildOutputDirectory = Directory("./.build"); +/// var resharperReportsDirectory = buildOutputDirectory + Directory("_ReSharperReports"); +/// +/// DupFinder("*.cs", new DupFinderSettings { +/// OutputFile = resharperReportsDirectory + File("dupfinder-output.xml"), +/// }); +/// +/// +public void DupFinder(System.String pattern, Cake.Common.Tools.DupFinder.DupFinderSettings settings) +{ + Cake.Common.Tools.DupFinder.DupFinderAliases.DupFinder(Context, pattern, settings); +} + +/// +/// Runs ReSharper's DupFinder using the provided config file. +/// +/// The context. +/// The config file. +/// +/// +/// DupFinderFromConfig("./src/dupfinder.config"); +/// +/// +public void DupFinderFromConfig(Cake.Core.IO.FilePath configFile) +{ + Cake.Common.Tools.DupFinder.DupFinderAliases.DupFinderFromConfig(Context, configFile); +} + +/// +/// Execute an assembly. +/// +/// The context. +/// The assembly path. +/// +/// +/// DotNetCoreExecute("./bin/Debug/app.dll"); +/// +/// +public void DotNetCoreExecute(Cake.Core.IO.FilePath assemblyPath) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreExecute(Context, assemblyPath); +} + +/// +/// Execute an assembly with arguments in the specific path. +/// +/// The context. +/// The assembly path. +/// The arguments. +/// +/// +/// DotNetCoreExecute("./bin/Debug/app.dll", "--arg"); +/// +/// +public void DotNetCoreExecute(Cake.Core.IO.FilePath assemblyPath, Cake.Core.IO.ProcessArgumentBuilder arguments) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreExecute(Context, assemblyPath, arguments); +} + +/// +/// Execute an assembly with arguments in the specific path with settings. +/// +/// The context. +/// The assembly path. +/// The arguments. +/// The settings. +/// +/// +/// var settings = new DotNetCoreExecuteSettings +/// { +/// FrameworkVersion = "1.0.3" +/// }; +/// +/// DotNetCoreExecute("./bin/Debug/app.dll", "--arg", settings); +/// +/// +public void DotNetCoreExecute(Cake.Core.IO.FilePath assemblyPath, Cake.Core.IO.ProcessArgumentBuilder arguments, Cake.Common.Tools.DotNetCore.Execute.DotNetCoreExecuteSettings settings) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreExecute(Context, assemblyPath, arguments, settings); +} + +/// +/// Restore all NuGet Packages. +/// +/// The context. +/// +/// +/// DotNetCoreRestore(); +/// +/// +public void DotNetCoreRestore() +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreRestore(Context); +} + +/// +/// Restore all NuGet Packages in the specified path. +/// +/// The context. +/// List of projects and project folders to restore. Each value can be: a path to a project.json or global.json file, or a folder to recursively search for project.json files. +/// +/// +/// DotNetCoreRestore("./src/*"); +/// +/// +public void DotNetCoreRestore(System.String root) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreRestore(Context, root); +} + +/// +/// Restore all NuGet Packages with the settings. +/// +/// The context. +/// The settings. +/// +/// +/// var settings = new DotNetCoreRestoreSettings +/// { +/// Sources = new[] {"https://www.example.com/nugetfeed", "https://www.example.com/nugetfeed2"}, +/// FallbackSources = new[] {"https://www.example.com/fallbacknugetfeed"}, +/// PackagesDirectory = "./packages", +/// Verbosity = Information, +/// DisableParallel = true, +/// InferRuntimes = new[] {"runtime1", "runtime2"} +/// }; +/// +/// DotNetCoreRestore(settings); +/// +/// +public void DotNetCoreRestore(Cake.Common.Tools.DotNetCore.Restore.DotNetCoreRestoreSettings settings) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreRestore(Context, settings); +} + +/// +/// Restore all NuGet Packages in the specified path with settings. +/// +/// The context. +/// List of projects and project folders to restore. Each value can be: a path to a project.json or global.json file, or a folder to recursively search for project.json files. +/// The settings. +/// +/// +/// var settings = new DotNetCoreRestoreSettings +/// { +/// Sources = new[] {"https://www.example.com/nugetfeed", "https://www.example.com/nugetfeed2"}, +/// FallbackSources = new[] {"https://www.example.com/fallbacknugetfeed"}, +/// PackagesDirectory = "./packages", +/// Verbosity = Information, +/// DisableParallel = true, +/// InferRuntimes = new[] {"runtime1", "runtime2"} +/// }; +/// +/// DotNetCoreRestore("./src/*", settings); +/// +/// +public void DotNetCoreRestore(System.String root, Cake.Common.Tools.DotNetCore.Restore.DotNetCoreRestoreSettings settings) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreRestore(Context, root, settings); +} + +/// +/// Build all projects. +/// +/// The context. +/// The projects path. +/// +/// +/// DotNetCoreBuild("./src/*"); +/// +/// +public void DotNetCoreBuild(System.String project) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreBuild(Context, project); +} + +/// +/// Build all projects. +/// +/// The context. +/// The projects path. +/// The settings. +/// +/// +/// var settings = new DotNetCoreBuildSettings +/// { +/// Framework = "netcoreapp1.0", +/// Configuration = "Debug", +/// OutputDirectory = "./artifacts/" +/// }; +/// +/// DotNetCoreBuild("./src/*", settings); +/// +/// +public void DotNetCoreBuild(System.String project, Cake.Common.Tools.DotNetCore.Build.DotNetCoreBuildSettings settings) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreBuild(Context, project, settings); +} + +/// +/// Package all projects. +/// +/// The context. +/// The projects path. +/// +/// +/// DotNetCorePack("./src/*"); +/// +/// +public void DotNetCorePack(System.String project) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCorePack(Context, project); +} + +/// +/// Package all projects. +/// +/// The context. +/// The projects path. +/// The settings. +/// +/// +/// var settings = new DotNetCorePackSettings +/// { +/// Configuration = "Release", +/// OutputDirectory = "./artifacts/" +/// }; +/// +/// DotNetCorePack("./src/*", settings); +/// +/// +public void DotNetCorePack(System.String project, Cake.Common.Tools.DotNetCore.Pack.DotNetCorePackSettings settings) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCorePack(Context, project, settings); +} + +/// +/// Run all projects. +/// +/// The context. +/// +/// +/// DotNetCoreRun(); +/// +/// +public void DotNetCoreRun() +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreRun(Context); +} + +/// +/// Run project. +/// +/// The context. +/// The project path. +/// +/// +/// DotNetCoreRun("./src/Project"); +/// +/// +public void DotNetCoreRun(System.String project) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreRun(Context, project); +} + +/// +/// Run project with path and arguments. +/// +/// The context. +/// The project path. +/// The arguments. +/// +/// +/// DotNetCoreRun("./src/Project", "--args"); +/// +/// +public void DotNetCoreRun(System.String project, Cake.Core.IO.ProcessArgumentBuilder arguments) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreRun(Context, project, arguments); +} + +/// +/// Run project with settings. +/// +/// The context. +/// The project path. +/// The arguments. +/// The settings. +/// +/// +/// var settings = new DotNetCoreRunSettings +/// { +/// Framework = "netcoreapp1.0", +/// Configuration = "Release" +/// }; +/// +/// DotNetCoreRun("./src/Project", "--args", settings); +/// +/// +public void DotNetCoreRun(System.String project, Cake.Core.IO.ProcessArgumentBuilder arguments, Cake.Common.Tools.DotNetCore.Run.DotNetCoreRunSettings settings) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreRun(Context, project, arguments, settings); +} + +/// +/// Publish all projects. +/// +/// The context. +/// The projects path. +/// +/// +/// DotNetCorePublish("./src/*"); +/// +/// +public void DotNetCorePublish(System.String project) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCorePublish(Context, project); +} + +/// +/// Publish all projects. +/// +/// The context. +/// The projects path. +/// The settings. +/// +/// +/// var settings = new DotNetCorePublishSettings +/// { +/// Framework = "netcoreapp1.0", +/// Configuration = "Release", +/// OutputDirectory = "./artifacts/" +/// }; +/// +/// DotNetCorePublish("./src/*", settings); +/// +/// +public void DotNetCorePublish(System.String project, Cake.Common.Tools.DotNetCore.Publish.DotNetCorePublishSettings settings) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCorePublish(Context, project, settings); +} + +/// +/// Test project. +/// +/// The context. +/// +/// +/// DotNetCoreTest(); +/// +/// +public void DotNetCoreTest() +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreTest(Context); +} + +/// +/// Test project with path. +/// +/// The context. +/// The project path. +/// +/// Specify the path to the .csproj file in the test project +/// +/// DotNetCoreTest("./test/Project.Tests/Project.Tests.csproj"); +/// +/// You could also specify a task that runs multiple test projects. +/// Cake task: +/// +/// Task("Test") +/// .Does(() => +/// { +/// var projectFiles = GetFiles("./test/**/*.csproj"); +/// foreach(var file in projectFiles) +/// { +/// DotNetCoreTest(file.FullPath); +/// } +/// }); +/// +/// If your test project is using project.json, the project parameter should just be the directory path. +/// +/// DotNetCoreTest("./test/Project.Tests/"); +/// +/// +public void DotNetCoreTest(System.String project) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreTest(Context, project); +} + +/// +/// Test project with settings. +/// +/// The context. +/// The project path. +/// The settings. +/// +/// +/// var settings = new DotNetCoreTestSettings +/// { +/// Configuration = "Release" +/// }; +/// +/// DotNetCoreTest("./test/Project.Tests/Project.Tests.csproj", settings); +/// +/// You could also specify a task that runs multiple test projects. +/// Cake task: +/// +/// Task("Test") +/// .Does(() => +/// { +/// var settings = new DotNetCoreTestSettings +/// { +/// Configuration = "Release" +/// }; +/// +/// var projectFiles = GetFiles("./test/**/*.csproj"); +/// foreach(var file in projectFiles) +/// { +/// DotNetCoreTest(file.FullPath, settings); +/// } +/// }); +/// +/// If your test project is using project.json, the project parameter should just be the directory path. +/// +/// var settings = new DotNetCoreTestSettings +/// { +/// Configuration = "Release" +/// }; +/// +/// DotNetCoreTest("./test/Project.Tests/", settings); +/// +/// +public void DotNetCoreTest(System.String project, Cake.Common.Tools.DotNetCore.Test.DotNetCoreTestSettings settings) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreTest(Context, project, settings); +} + +/// +/// Cleans a project's output. +/// +/// The context. +/// The project's path. +/// +/// +/// DotNetCoreClean("./src/project"); +/// +/// +public void DotNetCoreClean(System.String project) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreClean(Context, project); +} + +/// +/// Cleans a project's output. +/// +/// The context. +/// The projects path. +/// The settings. +/// +/// +/// var settings = new DotNetCoreCleanSettings +/// { +/// Framework = "netcoreapp1.0", +/// Configuration = "Debug", +/// OutputDirectory = "./artifacts/" +/// }; +/// +/// DotNetCoreClean("./src/project", settings); +/// +/// +public void DotNetCoreClean(System.String project, Cake.Common.Tools.DotNetCore.Clean.DotNetCoreCleanSettings settings) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreClean(Context, project, settings); +} + +/// +/// Delete a NuGet Package from a server. +/// +/// The context. +/// +/// +/// DotNetCoreNuGetDelete(); +/// +/// +public void DotNetCoreNuGetDelete() +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreNuGetDelete(Context); +} + +/// +/// Deletes a package from the NuGet.org. +/// +/// The context. +/// Name of package to delete. +/// +/// +/// DotNetCoreNuGetDelete("Microsoft.AspNetCore.Mvc"); +/// +/// +public void DotNetCoreNuGetDelete(System.String packageName) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreNuGetDelete(Context, packageName); +} + +/// +/// Deletes a specific version of a package from the NuGet.org. +/// +/// The context. +/// Name of package to delete. +/// Version of package to delete. +/// +/// +/// DotNetCoreRestore("Microsoft.AspNetCore.Mvc", "1.0"); +/// +/// +public void DotNetCoreNuGetDelete(System.String packageName, System.String packageVersion) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreNuGetDelete(Context, packageName, packageVersion); +} + +/// +/// Deletes a package from a server +/// +/// The context. +/// Name of package to delete. +/// The settings. +/// +/// +/// var settings = new DotNetCoreNuGetDeleteSettings +/// { +/// Source = "https://www.example.com/nugetfeed", +/// NonInteractive = true +/// }; +/// +/// DotNetCoreNuGetDelete("Microsoft.AspNetCore.Mvc", settings); +/// +/// +public void DotNetCoreNuGetDelete(System.String packageName, Cake.Common.Tools.DotNetCore.NuGet.Delete.DotNetCoreNuGetDeleteSettings settings) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreNuGetDelete(Context, packageName, settings); +} + +/// +/// Deletes a package from a server using the specified settings. +/// +/// The context. +/// The settings. +/// +/// +/// var settings = new DotNetCoreNuGetDeleteSettings +/// { +/// Source = "https://www.example.com/nugetfeed", +/// NonInteractive = true +/// }; +/// +/// DotNetCoreNuGetDelete(settings); +/// +/// +public void DotNetCoreNuGetDelete(Cake.Common.Tools.DotNetCore.NuGet.Delete.DotNetCoreNuGetDeleteSettings settings) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreNuGetDelete(Context, settings); +} + +/// +/// Deletes a package from a server using the specified settings. +/// +/// The context. +/// Name of package to delete. +/// Version of package to delete. +/// The settings. +/// +/// +/// var settings = new DotNetCoreNuGetDeleteSettings +/// { +/// Source = "https://www.example.com/nugetfeed", +/// NonInteractive = true +/// }; +/// +/// DotNetCoreNuGetDelete("Microsoft.AspNetCore.Mvc", "1.0", settings); +/// +/// +public void DotNetCoreNuGetDelete(System.String packageName, System.String packageVersion, Cake.Common.Tools.DotNetCore.NuGet.Delete.DotNetCoreNuGetDeleteSettings settings) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreNuGetDelete(Context, packageName, packageVersion, settings); +} + +/// +/// Pushes one or more packages to a server. +/// +/// The context. +/// Name of package to push. +/// +/// +/// DotNetCoreNuGetPush("*.nupkg"); +/// +/// +public void DotNetCoreNuGetPush(System.String packageName) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreNuGetPush(Context, packageName); +} + +/// +/// Pushes one or more packages to a server using the specified settings. +/// +/// The context. +/// Name of package to push. +/// The settings. +/// +/// +/// var settings = new DotNetCoreNuGetPushSettings +/// { +/// Source = "https://www.example.com/nugetfeed", +/// ApiKey = "4003d786-cc37-4004-bfdf-c4f3e8ef9b3a" +/// }; +/// +/// DotNetCoreNuGetPush("foo*.nupkg", settings); +/// +/// +public void DotNetCoreNuGetPush(System.String packageName, Cake.Common.Tools.DotNetCore.NuGet.Push.DotNetCoreNuGetPushSettings settings) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreNuGetPush(Context, packageName, settings); +} + +/// +/// Builds the specified targets in a project file found in the current working directory. +/// +/// The context. +/// +/// +/// DotNetCoreMSBuild(); +/// +/// +public void DotNetCoreMSBuild() +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreMSBuild(Context); +} + +/// +/// Builds the specified targets in the project file. +/// +/// The context. +/// Project file or directory to search for project file. +/// +/// +/// DotNetCoreMSBuild("foobar.proj"); +/// +/// +/// +/// If a directory is specified, MSBuild searches that directory for a project file. +/// +public void DotNetCoreMSBuild(System.String projectOrDirectory) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreMSBuild(Context, projectOrDirectory); +} + +/// +/// Builds the specified targets in a project file found in the current working directory. +/// +/// The context. +/// The settings. +/// +/// +/// var settings = new DotNetCoreMSBuildSettings +/// { +/// NoLogo = true, +/// MaxCpuCount = -1 +/// }; +/// +/// DotNetCoreMSBuild(settings); +/// +/// +public void DotNetCoreMSBuild(Cake.Common.Tools.DotNetCore.MSBuild.DotNetCoreMSBuildSettings settings) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreMSBuild(Context, settings); +} + +/// +/// Builds the specified targets in the project file. +/// +/// The context. +/// Project file or directory to search for project file. +/// The settings. +/// +/// +/// var settings = new DotNetCoreMSBuildSettings +/// { +/// NoLogo = true, +/// MaxCpuCount = -1 +/// }; +/// +/// DotNetCoreMSBuild("foobar.proj", settings); +/// +/// +/// +/// If a project file is not specified, MSBuild searches the current working directory for a file that has a file +/// extension that ends in "proj" and uses that file. If a directory is specified, MSBuild searches that directory for a project file. +/// +public void DotNetCoreMSBuild(System.String projectOrDirectory, Cake.Common.Tools.DotNetCore.MSBuild.DotNetCoreMSBuildSettings settings) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreMSBuild(Context, projectOrDirectory, settings); +} + +/// +/// Test one or more projects specified by a path or glob pattern using the VS Test host runner. +/// +/// The context. +/// A path to the test file or glob for one or more test files. +/// +/// Specify the path to the .csproj file in the test project +/// +/// DotNetCoreTest("./test/Project.Tests/Project.Tests.csproj"); +/// +/// You could also specify a glob pattern to run multiple test projects. +/// +/// DotNetCoreTest("./**/*.Tests.csproj"); +/// +/// +public void DotNetCoreVSTest(System.String testFile) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreVSTest(Context, testFile); +} + +/// +/// Test one or more projects specified by a path or glob pattern with settings using the VS Test host runner. +/// +/// The context. +/// A path to the test file or glob for one or more test files. +/// The settings. +/// +/// Specify the path to the .csproj file in the test project +/// +/// var settings = new DotNetCoreTestSettings +/// { +/// Framework = "FrameworkCore10", +/// Platform = "x64" +/// }; +/// +/// DotNetCoreTest("./test/Project.Tests/Project.Tests.csproj", settings); +/// +/// You could also specify a glob pattern to run multiple test projects. +/// +/// var settings = new DotNetCoreTestSettings +/// { +/// Framework = "FrameworkCore10", +/// Platform = "x64", +/// Parallel = true +/// }; +/// +/// DotNetCoreTest("./**/*.Tests.csproj", settings); +/// +/// +public void DotNetCoreVSTest(System.String testFile, Cake.Common.Tools.DotNetCore.VSTest.DotNetCoreVSTestSettings settings) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreVSTest(Context, testFile, settings); +} + +/// +/// Test one or more specified projects with settings using the VS Test host runner. +/// +/// The context. +/// The project paths to test. +/// The settings. +/// +/// +/// var settings = new DotNetCoreTestSettings +/// { +/// Framework = "FrameworkCore10", +/// Platform = "x64" +/// }; +/// +/// DotNetCoreTest(new[] { (FilePath)"./Test/Cake.Common.Tests.csproj" }, settings); +/// +/// You could also specify a task that runs multiple test projects. +/// Cake task: +/// +/// Task("Test") +/// .Does(() => +/// { +/// var settings = new DotNetCoreTestSettings +/// { +/// Framework = "FrameworkCore10", +/// Platform = "x64", +/// Parallel = true +/// }; +/// +/// var projectFiles = GetFiles("./test/**/*.csproj"); +/// +/// DotNetCoreTest(projectFiles, settings); +/// }); +/// +/// +public void DotNetCoreVSTest(System.Collections.Generic.IEnumerable testFiles, Cake.Common.Tools.DotNetCore.VSTest.DotNetCoreVSTestSettings settings) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreVSTest(Context, testFiles, settings); +} + +/// +/// /// Execute an .NET Core Extensibility Tool. +/// +/// The context. +/// The project path. +/// The command to execute. +/// +/// +/// DotNetCoreTool("./src/project", "xunit", "-xml report.xml"); +/// +/// +public void DotNetCoreTool(Cake.Core.IO.FilePath projectPath, System.String command) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreTool(Context, projectPath, command); +} + +/// +/// Execute an .NET Core Extensibility Tool. +/// +/// The context. +/// The project path. +/// The command to execute. +/// The arguments. +/// +/// +/// DotNetCoreTool("./src/project", "xunit", "-xml report.xml"); +/// +/// +public void DotNetCoreTool(Cake.Core.IO.FilePath projectPath, System.String command, Cake.Core.IO.ProcessArgumentBuilder arguments) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreTool(Context, projectPath, command, arguments); +} + +/// +/// Execute an .NET Core Extensibility Tool. +/// +/// The context. +/// The project path. +/// The command to execute. +/// The arguments. +/// The settings. +/// +/// +/// DotNetCoreTool("./src/project", "xunit", "-xml report.xml"); +/// +/// +public void DotNetCoreTool(Cake.Core.IO.FilePath projectPath, System.String command, Cake.Core.IO.ProcessArgumentBuilder arguments, Cake.Common.Tools.DotNetCore.Tool.DotNetCoreToolSettings settings) +{ + Cake.Common.Tools.DotNetCore.DotNetCoreAliases.DotNetCoreTool(Context, projectPath, command, arguments, settings); +} + +/// +/// Runs DotCover Analyse +/// for the specified action and settings. +/// +/// The context. +/// The action to run DotCover for. +/// The DotCover output file. +/// The settings. +/// +/// +/// DotCoverAnalyse(tool => { +/// tool.XUnit2("./**/App.Tests.dll", +/// new XUnit2Settings { +/// ShadowCopy = false +/// }); +/// }, +/// new FilePath("./result.xml"), +/// new DotCoverAnalyseSettings() +/// .WithFilter("+:App") +/// .WithFilter("-:App.Tests")); +/// +/// +public void DotCoverAnalyse(System.Action action, Cake.Core.IO.FilePath outputFile, Cake.Common.Tools.DotCover.Analyse.DotCoverAnalyseSettings settings) +{ + Cake.Common.Tools.DotCover.DotCoverAliases.DotCoverAnalyse(Context, action, outputFile, settings); +} + +/// +/// Runs DotCover Cover +/// for the specified action and settings. +/// +/// The context. +/// The action to run DotCover for. +/// The DotCover output file. +/// The settings. +/// +/// +/// DotCoverCover(tool => { +/// tool.XUnit2("./**/App.Tests.dll", +/// new XUnit2Settings { +/// ShadowCopy = false +/// }); +/// }, +/// new FilePath("./result.dcvr"), +/// new DotCoverCoverSettings() +/// .WithFilter("+:App") +/// .WithFilter("-:App.Tests")); +/// +/// +public void DotCoverCover(System.Action action, Cake.Core.IO.FilePath outputFile, Cake.Common.Tools.DotCover.Cover.DotCoverCoverSettings settings) +{ + Cake.Common.Tools.DotCover.DotCoverAliases.DotCoverCover(Context, action, outputFile, settings); +} + +/// +/// Runs DotCover Report +/// for the specified action and settings. +/// +/// The context. +/// The DotCover coverage snapshot file name. +/// The DotCover output file. +/// The settings +/// +/// +/// DotCoverReport(new FilePath("./result.dcvr"), +/// new FilePath("./result.html"), +/// new DotCoverReportSettings { +/// ReportType = DotCoverReportType.HTML +/// }); +/// +/// +public void DotCoverReport(Cake.Core.IO.FilePath sourceFile, Cake.Core.IO.FilePath outputFile, Cake.Common.Tools.DotCover.Report.DotCoverReportSettings settings) +{ + Cake.Common.Tools.DotCover.DotCoverAliases.DotCoverReport(Context, sourceFile, outputFile, settings); +} + +/// +/// Runs DotCover Merge +/// for the specified action and settings. +/// +/// The context. +/// The list of DotCover coverage snapshot files. +/// The merged output file. +/// +/// +/// DotCoverMerge(new[] { +/// new FilePath("./result1.dcvr"), +/// new FilePath("./result2.dcvr") +/// }, +/// new FilePath("./merged.dcvr")); +/// +/// +public void DotCoverMerge(System.Collections.Generic.IEnumerable sourceFiles, Cake.Core.IO.FilePath outputFile) +{ + Cake.Common.Tools.DotCover.DotCoverAliases.DotCoverMerge(Context, sourceFiles, outputFile); +} + +/// +/// Runs DotCover Merge +/// for the specified action and settings. +/// +/// The context. +/// The list of DotCover coverage snapshot files. +/// The merged output file. +/// The settings +/// +/// +/// DotCoverMerge(new[] { +/// new FilePath("./result1.dcvr"), +/// new FilePath("./result2.dcvr") +/// }, +/// new FilePath("./merged.dcvr"), +/// new DotCoverMergeSettings { +/// LogFile = new FilePath("./log.txt") +/// }); +/// +/// +public void DotCoverMerge(System.Collections.Generic.IEnumerable sourceFiles, Cake.Core.IO.FilePath outputFile, Cake.Common.Tools.DotCover.Merge.DotCoverMergeSettings settings) +{ + Cake.Common.Tools.DotCover.DotCoverAliases.DotCoverMerge(Context, sourceFiles, outputFile, settings); +} + +/// +/// Creates a Chocolatey package using the specified Nuspec file. +/// +/// The context. +/// The nuspec file path. +/// The settings. +/// +/// +/// var chocolateyPackSettings = new ChocolateyPackSettings { +/// Id = "TestChocolatey", +/// Title = "The tile of the package", +/// Version = "0.0.0.1", +/// Authors = new[] {"John Doe"}, +/// Owners = new[] {"Contoso"}, +/// Summary = "Excellent summary of what the package does", +/// Description = "The description of the package", +/// ProjectUrl = new Uri("https://github.com/SomeUser/TestChocolatey/"), +/// PackageSourceUrl = new Uri("https://github.com/SomeUser/TestChocolatey/"), +/// ProjectSourceUrl = new Uri("https://github.com/SomeUser/TestChocolatey/"), +/// DocsUrl = new Uri("https://github.com/SomeUser/TestChocolatey/"), +/// MailingListUrl = new Uri("https://github.com/SomeUser/TestChocolatey/"), +/// BugTrackerUrl = new Uri("https://github.com/SomeUser/TestChocolatey/"), +/// Tags = new [] {"Cake", "Script", "Build"}, +/// Copyright = "Some company 2015", +/// LicenseUrl = new Uri("https://github.com/SomeUser/TestChocolatey/blob/master/LICENSE.md"), +/// RequireLicenseAcceptance= false, +/// IconUrl = new Uri("http://cdn.rawgit.com/SomeUser/TestChocolatey/master/icons/testchocolatey.png"), +/// ReleaseNotes = new [] {"Bug fixes", "Issue fixes", "Typos"}, +/// Files = new [] { +/// new ChocolateyNuSpecContent {Source = "bin/TestChocolatey.dll", Target = "bin"}, +/// }, +/// Debug = false, +/// Verbose = false, +/// Force = false, +/// Noop = false, +/// LimitOutput = false, +/// ExecutionTimeout = 13, +/// CacheLocation = @"C:\temp", +/// AllowUnofficial = false +/// }; +/// +/// ChocolateyPack("./nuspec/TestChocolatey.nuspec", chocolateyPackSettings); +/// +/// +public void ChocolateyPack(Cake.Core.IO.FilePath nuspecFilePath, Cake.Common.Tools.Chocolatey.Pack.ChocolateyPackSettings settings) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyPack(Context, nuspecFilePath, settings); +} + +/// +/// Creates Chocolatey packages using the specified Nuspec files. +/// +/// The context. +/// The nuspec file paths. +/// The settings. +/// +/// +/// var chocolateyPackSettings = new ChocolateyPackSettings { +/// Id = "TestChocolatey", +/// Title = "The tile of the package", +/// Version = "0.0.0.1", +/// Authors = new[] {"John Doe"}, +/// Owners = new[] {"Contoso"}, +/// Summary = "Excellent summary of what the package does", +/// Description = "The description of the package", +/// ProjectUrl = new Uri("https://github.com/SomeUser/TestChocolatey/"), +/// PackageSourceUrl = new Uri("https://github.com/SomeUser/TestChocolatey/"), +/// ProjectSourceUrl = new Uri("https://github.com/SomeUser/TestChocolatey/"), +/// DocsUrl = new Uri("https://github.com/SomeUser/TestChocolatey/"), +/// MailingListUrl = new Uri("https://github.com/SomeUser/TestChocolatey/"), +/// BugTrackerUrl = new Uri("https://github.com/SomeUser/TestChocolatey/"), +/// Tags = new [] {"Cake", "Script", "Build"}, +/// Copyright = "Some company 2015", +/// LicenseUrl = new Uri("https://github.com/SomeUser/TestChocolatey/blob/master/LICENSE.md"), +/// RequireLicenseAcceptance= false, +/// IconUrl = new Uri("http://cdn.rawgit.com/SomeUser/TestChocolatey/master/icons/testchocolatey.png"), +/// ReleaseNotes = new [] {"Bug fixes", "Issue fixes", "Typos"}, +/// Files = new [] { +/// new ChocolateyNuSpecContent {Source = "bin/TestChocolatey.dll", Target = "bin"}, +/// }, +/// Debug = false, +/// Verbose = false, +/// Force = false, +/// Noop = false, +/// LimitOutput = false, +/// ExecutionTimeout = 13, +/// CacheLocation = @"C:\temp", +/// AllowUnofficial = false +/// }; +/// +/// var nuspecFiles = GetFiles("./**/*.nuspec"); +/// ChocolateyPack(nuspecFiles, chocolateyPackSettings); +/// +/// +public void ChocolateyPack(System.Collections.Generic.IEnumerable filePaths, Cake.Common.Tools.Chocolatey.Pack.ChocolateyPackSettings settings) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyPack(Context, filePaths, settings); +} + +/// +/// Creates a Chocolatey package using the specified settings. +/// +/// The context. +/// The settings. +/// +/// +/// var chocolateyPackSettings = new ChocolateyPackSettings { +/// Id = "TestChocolatey", +/// Title = "The tile of the package", +/// Version = "0.0.0.1", +/// Authors = new[] {"John Doe"}, +/// Owners = new[] {"Contoso"}, +/// Summary = "Excellent summary of what the package does", +/// Description = "The description of the package", +/// ProjectUrl = new Uri("https://github.com/SomeUser/TestChocolatey/"), +/// PackageSourceUrl = new Uri("https://github.com/SomeUser/TestChocolatey/"), +/// ProjectSourceUrl = new Uri("https://github.com/SomeUser/TestChocolatey/"), +/// DocsUrl = new Uri("https://github.com/SomeUser/TestChocolatey/"), +/// MailingListUrl = new Uri("https://github.com/SomeUser/TestChocolatey/"), +/// BugTrackerUrl = new Uri("https://github.com/SomeUser/TestChocolatey/"), +/// Tags = new [] {"Cake", "Script", "Build"}, +/// Copyright = "Some company 2015", +/// LicenseUrl = new Uri("https://github.com/SomeUser/TestChocolatey/blob/master/LICENSE.md"), +/// RequireLicenseAcceptance= false, +/// IconUrl = new Uri("http://cdn.rawgit.com/SomeUser/TestChocolatey/master/icons/testchocolatey.png"), +/// ReleaseNotes = new [] {"Bug fixes", "Issue fixes", "Typos"}, +/// Files = new [] { +/// new ChocolateyNuSpecContent {Source = "bin/TestChocolatey.dll", Target = "bin"}, +/// }, +/// Debug = false, +/// Verbose = false, +/// Force = false, +/// Noop = false, +/// LimitOutput = false, +/// ExecutionTimeout = 13, +/// CacheLocation = @"C:\temp", +/// AllowUnofficial = false +/// }; +/// +/// ChocolateyPack(chocolateyPackSettings); +/// +/// +public void ChocolateyPack(Cake.Common.Tools.Chocolatey.Pack.ChocolateyPackSettings settings) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyPack(Context, settings); +} + +/// +/// Installs a Chocolatey package. +/// +/// The context. +/// The id of the package to install. +/// +/// +/// ChocolateyInstall("MyChocolateyPackage"); +/// +/// +public void ChocolateyInstall(System.String packageId) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyInstall(Context, packageId); +} + +/// +/// Installs a Chocolatey package using the specified settings. +/// +/// The context. +/// The id of the package to install. +/// The settings. +/// +/// +/// ChocolateyInstall("MyChocolateyPackage", new ChocolateyInstallSettings { +/// Source = true, +/// Version = "1.2.3", +/// Prerelease = false, +/// Forcex86 = false, +/// InstallArguments = "arg1", +/// OverrideArguments = false, +/// NotSilent = false, +/// PackageParameters = "param1", +/// AllowDowngrade = false, +/// SideBySide = false, +/// IgnoreDependencies = false, +/// ForceDependencies = false, +/// SkipPowerShell = false, +/// User = "user", +/// Password = "password", +/// IgnoreChecksums = false, +/// Debug = false, +/// Verbose = false, +/// Force = false, +/// Noop = false, +/// LimitOutput = false, +/// ExecutionTimeout = 13, +/// CacheLocation = @"C:\temp", +/// AllowUnofficial = false +/// }); +/// +/// +public void ChocolateyInstall(System.String packageId, Cake.Common.Tools.Chocolatey.Install.ChocolateyInstallSettings settings) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyInstall(Context, packageId, settings); +} + +/// +/// Installs Chocolatey packages using the specified package configuration. +/// +/// The context. +/// The package configuration to install. +/// +/// +/// ChocolateyInstallFromConfig("./tools/packages.config"); +/// +/// +public void ChocolateyInstallFromConfig(Cake.Core.IO.FilePath packageConfigPath) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyInstallFromConfig(Context, packageConfigPath); +} + +/// +/// Installs Chocolatey packages using the specified package configuration and settings. +/// +/// The context. +/// The package configuration to install. +/// The settings. +/// +/// +/// ChocolateyInstallFromConfig("./tools/packages.config", new ChocolateyInstallSettings { +/// Source = true, +/// Version = "1.2.3", +/// Prerelease = false, +/// Forcex86 = false, +/// InstallArguments = "arg1", +/// OverrideArguments = false, +/// NotSilent = false, +/// PackageParameters = "param1", +/// AllowDowngrade = false, +/// SideBySide = false, +/// IgnoreDependencies = false, +/// ForceDependencies = false, +/// SkipPowerShell = false, +/// User = "user", +/// Password = "password", +/// IgnoreChecksums = false, +/// Debug = false, +/// Verbose = false, +/// Force = false, +/// Noop = false, +/// LimitOutput = false, +/// ExecutionTimeout = 13, +/// CacheLocation = @"C:\temp", +/// AllowUnofficial = false +/// }); +/// +/// +public void ChocolateyInstallFromConfig(Cake.Core.IO.FilePath packageConfigPath, Cake.Common.Tools.Chocolatey.Install.ChocolateyInstallSettings settings) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyInstallFromConfig(Context, packageConfigPath, settings); +} + +/// +/// Uninstalls a Chocolatey package. +/// +/// The context. +/// The id of the package to uninstall. +/// +/// +/// ChocolateyUninstall("MyChocolateyPackage"); +/// +/// +public void ChocolateyUninstall(System.String packageId) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyUninstall(Context, packageId); +} + +/// +/// Uninstalls a Chocolatey package using the specified settings. +/// +/// The context. +/// The id of the package to uninstall. +/// The settings. +/// +/// +/// ChocolateyUninstall("MyChocolateyPackage", new ChocolateyUninstallSettings { +/// Source = true, +/// Version = "1.2.3", +/// UninstallArguments = "arg1", +/// OverrideArguments = false, +/// NotSilent = false, +/// PackageParameters = "param1", +/// SideBySide = false, +/// IgnoreDependencies = false, +/// ForceDependencies = false, +/// SkipPowerShell = false, +/// Debug = false, +/// Verbose = false, +/// FailOnStandardError = false, +/// UseSystemPowershell = false, +/// AllVersions = false, +/// Force = false, +/// Noop = false, +/// LimitOutput = false, +/// ExecutionTimeout = 13, +/// CacheLocation = @"C:\temp", +/// AllowUnofficial = false, +/// GlobalArguments = false, +/// GlobalPackageParameters = false, +/// IgnorePackageExitCodes = false, +/// UsePackageExitCodes = false, +/// UseAutoUninstaller = false, +/// SkipAutoUninstaller = false, +/// FailOnAutoUninstaller = false, +/// IgnoreAutoUninstaller = false +/// }); +/// +/// +public void ChocolateyUninstall(System.String packageId, Cake.Common.Tools.Chocolatey.Uninstall.ChocolateyUninstallSettings settings) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyUninstall(Context, packageId, settings); +} + +/// +/// Uninstalls a Chocolatey package. +/// +/// The context. +/// The ids of the packages to uninstall. +/// +/// +/// ChocolateyUninstall("MyChocolateyPackage"); +/// +/// +public void ChocolateyUninstall(System.Collections.Generic.IEnumerable packageIds) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyUninstall(Context, packageIds); +} + +/// +/// Uninstalls Chocolatey packages using the specified settings. +/// +/// The context. +/// The ids of the packages to uninstall. +/// The settings. +/// +/// +/// ChocolateyUninstall("MyChocolateyPackage", new ChocolateyUninstallSettings { +/// Source = true, +/// Version = "1.2.3", +/// UninstallArguments = "arg1", +/// OverrideArguments = false, +/// NotSilent = false, +/// PackageParameters = "param1", +/// SideBySide = false, +/// IgnoreDependencies = false, +/// ForceDependencies = false, +/// SkipPowerShell = false, +/// Debug = false, +/// Verbose = false, +/// FailOnStandardError = false, +/// UseSystemPowershell = false, +/// AllVersions = false, +/// Force = false, +/// Noop = false, +/// LimitOutput = false, +/// ExecutionTimeout = 13, +/// CacheLocation = @"C:\temp", +/// AllowUnofficial = false, +/// GlobalArguments = false, +/// GlobalPackageParameters = false, +/// IgnorePackageExitCodes = false, +/// UsePackageExitCodes = false, +/// UseAutoUninstaller = false, +/// SkipAutoUninstaller = false, +/// FailOnAutoUninstaller = false, +/// IgnoreAutoUninstaller = false +/// }); +/// +/// +public void ChocolateyUninstall(System.Collections.Generic.IEnumerable packageIds, Cake.Common.Tools.Chocolatey.Uninstall.ChocolateyUninstallSettings settings) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyUninstall(Context, packageIds, settings); +} + +/// +/// Pins a Chocolatey package using the specified settings. +/// +/// The context. +/// The name. +/// The settings. +/// +/// +/// ChocolateyPin("MyChocolateyPackage", new ChocolateyPinSettings { +/// Version = "1.2.3", +/// Debug = false, +/// Verbose = false, +/// Force = false, +/// Noop = false, +/// LimitOutput = false, +/// ExecutionTimeout = 13, +/// CacheLocation = @"C:\temp", +/// AllowUnofficial = false +/// }); +/// +/// +public void ChocolateyPin(System.String name, Cake.Common.Tools.Chocolatey.Pin.ChocolateyPinSettings settings) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyPin(Context, name, settings); +} + +/// +/// Sets the Api Key for a Chocolatey Source using the specified settings. +/// +/// The context. +/// The API Key. +/// The source. +/// The settings. +/// +/// +/// ChocolateyApiKey("myApiKey", "http://www.mysource.com", new ChocolateyApiKeySettings { +/// Debug = false, +/// Verbose = false, +/// Force = false, +/// Noop = false, +/// LimitOutput = false, +/// ExecutionTimeout = 13, +/// CacheLocation = @"C:\temp", +/// AllowUnofficial = false +/// }); +/// +/// +public void ChocolateyApiKey(System.String apiKey, System.String source, Cake.Common.Tools.Chocolatey.ApiKey.ChocolateyApiKeySettings settings) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyApiKey(Context, apiKey, source, settings); +} + +/// +/// Sets the config parameter using the specified settings. +/// +/// The context. +/// The name. +/// The value. +/// The settings. +/// +/// +/// ChocolateyConfig("cacheLocation", @"c:\temp", new ChocolateyConfigSettings { +/// Debug = false, +/// Verbose = false, +/// Force = false, +/// Noop = false, +/// LimitOutput = false, +/// ExecutionTimeout = 13, +/// CacheLocation = @"C:\temp", +/// AllowUnofficial = false +/// }); +/// +/// +public void ChocolateyConfig(System.String name, System.String value, Cake.Common.Tools.Chocolatey.Config.ChocolateyConfigSettings settings) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyConfig(Context, name, value, settings); +} + +/// +/// Enables a Chocolatey Feature using the specified name +/// +/// The context. +/// Name of the feature. +/// +/// +/// ChocolateyEnableFeature("checkSumFiles"); +/// +/// +public void ChocolateyEnableFeature(System.String name) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyEnableFeature(Context, name); +} + +/// +/// Enables a Chocolatey Feature using the specified name and settings +/// +/// The context. +/// Name of the feature. +/// The settings. +/// +/// +/// ChocolateyEnableFeature("checkSumFiles", new ChocolateyFeatureSettings { +/// Debug = false, +/// Verbose = false, +/// Force = false, +/// Noop = false, +/// LimitOutput = false, +/// ExecutionTimeout = 13, +/// CacheLocation = @"C:\temp", +/// AllowUnofficial = false +/// }); +/// +/// +public void ChocolateyEnableFeature(System.String name, Cake.Common.Tools.Chocolatey.Features.ChocolateyFeatureSettings settings) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyEnableFeature(Context, name, settings); +} + +/// +/// Disables a Chocolatey Feature using the specified name +/// +/// The context. +/// Name of the feature. +/// +/// +/// ChocolateyDisableFeature("checkSumFiles"); +/// +/// +public void ChocolateyDisableFeature(System.String name) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyDisableFeature(Context, name); +} + +/// +/// Disables a Chocolatey Feature using the specified name and settings +/// +/// The context. +/// Name of the feature. +/// The settings. +/// +/// +/// ChocolateyDisableFeature("checkSumFiles", new ChocolateyFeatureSettings { +/// Debug = false, +/// Verbose = false, +/// Force = false, +/// Noop = false, +/// LimitOutput = false, +/// ExecutionTimeout = 13, +/// CacheLocation = @"C:\temp", +/// AllowUnofficial = false +/// }); +/// +/// +public void ChocolateyDisableFeature(System.String name, Cake.Common.Tools.Chocolatey.Features.ChocolateyFeatureSettings settings) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyDisableFeature(Context, name, settings); +} + +/// +/// Adds Chocolatey package source using the specified name &source to global user config +/// +/// The context. +/// Name of the source. +/// Path to the package(s) source. +/// +/// +/// ChocolateyAddSource("MySource", "http://www.mysource.com"); +/// +/// +public void ChocolateyAddSource(System.String name, System.String source) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyAddSource(Context, name, source); +} + +/// +/// Adds Chocolatey package source using the specified name, source & settings to global user config +/// +/// The context. +/// Name of the source. +/// Path to the package(s) source. +/// The settings. +/// +/// +/// ChocolateyAddSource("MySource", "http://www.mysource.com", new ChocolateySourcesSettings { +/// UserName = "user", +/// Password = "password", +/// Priority = 13, +/// Debug = false, +/// Verbose = false, +/// Force = false, +/// Noop = false, +/// LimitOutput = false, +/// ExecutionTimeout = 13, +/// CacheLocation = @"C:\temp", +/// AllowUnofficial = false +/// }); +/// +/// +public void ChocolateyAddSource(System.String name, System.String source, Cake.Common.Tools.Chocolatey.Sources.ChocolateySourcesSettings settings) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyAddSource(Context, name, source, settings); +} + +/// +/// Removes Chocolatey package source using the specified name & source from global user config +/// +/// The context. +/// Name of the source. +/// +/// +/// ChocolateyRemoveSource("MySource"); +/// +/// +public void ChocolateyRemoveSource(System.String name) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyRemoveSource(Context, name); +} + +/// +/// Removes Chocolatey package source using the specified name, source & settings from global user config +/// +/// The context. +/// Name of the source. +/// The settings. +/// +/// +/// ChocolateyRemoveSource("MySource", new ChocolateySourcesSettings { +/// Debug = false, +/// Verbose = false, +/// Force = false, +/// Noop = false, +/// LimitOutput = false, +/// ExecutionTimeout = 13, +/// CacheLocation = @"C:\temp", +/// AllowUnofficial = false +/// }); +/// +/// +public void ChocolateyRemoveSource(System.String name, Cake.Common.Tools.Chocolatey.Sources.ChocolateySourcesSettings settings) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyRemoveSource(Context, name, settings); +} + +/// +/// Enables a Chocolatey Source using the specified name +/// +/// The context. +/// Name of the source. +/// +/// +/// ChocolateyEnableSource("MySource"); +/// +/// +public void ChocolateyEnableSource(System.String name) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyEnableSource(Context, name); +} + +/// +/// Enables a Chocolatey Source using the specified name and settings +/// +/// The context. +/// Name of the source. +/// The settings. +/// +/// +/// ChocolateyEnableSource("MySource", new ChocolateySourcesSettings { +/// Debug = false, +/// Verbose = false, +/// Force = false, +/// Noop = false, +/// LimitOutput = false, +/// ExecutionTimeout = 13, +/// CacheLocation = @"C:\temp", +/// AllowUnofficial = false +/// }); +/// +/// +public void ChocolateyEnableSource(System.String name, Cake.Common.Tools.Chocolatey.Sources.ChocolateySourcesSettings settings) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyEnableSource(Context, name, settings); +} + +/// +/// Disables a Chocolatey Source using the specified name +/// +/// The context. +/// Name of the source. +/// +/// +/// ChocolateyDisableSource("MySource"); +/// +/// +public void ChocolateyDisableSource(System.String name) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyDisableSource(Context, name); +} + +/// +/// Disables a Chocolatey Source using the specified name and settings +/// +/// The context. +/// Name of the source. +/// The settings. +/// +/// +/// ChocolateyDisableSource("MySource", new ChocolateySourcesSettings { +/// Debug = false, +/// Verbose = false, +/// Force = false, +/// Noop = false, +/// LimitOutput = false, +/// ExecutionTimeout = 13, +/// CacheLocation = @"C:\temp", +/// AllowUnofficial = false +/// }); +/// +/// +public void ChocolateyDisableSource(System.String name, Cake.Common.Tools.Chocolatey.Sources.ChocolateySourcesSettings settings) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyDisableSource(Context, name, settings); +} + +/// +/// Pushes a Chocolatey package to a Chocolatey server and publishes it. +/// +/// The context. +/// The .nupkg file path. +/// The settings. +/// +/// +/// // Get the path to the package. +/// var package = "./chocolatey/MyChocolateyPackage.0.0.1.nupkg"; +/// +/// // Push the package. +/// ChocolateyPush(package, new ChocolateyPushSettings { +/// Source = "http://example.com/chocolateyfeed", +/// ApiKey = "4003d786-cc37-4004-bfdf-c4f3e8ef9b3a" +/// Timeout = 300 +/// Debug = false, +/// Verbose = false, +/// Force = false, +/// Noop = false, +/// LimitOutput = false, +/// ExecutionTimeout = 13, +/// CacheLocation = @"C:\temp", +/// AllowUnofficial = false +/// }); +/// +/// +public void ChocolateyPush(Cake.Core.IO.FilePath packageFilePath, Cake.Common.Tools.Chocolatey.Push.ChocolateyPushSettings settings) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyPush(Context, packageFilePath, settings); +} + +/// +/// Pushes Chocolatey packages to a Chocolatey server and publishes them. +/// +/// The context. +/// The .nupkg file paths. +/// The settings. +/// +/// +/// // Get the paths to the packages. +/// var packages = GetFiles("./**/*.nupkg"); +/// +/// // Push the package. +/// ChocolateyPush(packages, new ChocolateyPushSettings { +/// Source = "http://example.com/chocolateyfeed", +/// ApiKey = "4003d786-cc37-4004-bfdf-c4f3e8ef9b3a" +/// Timeout = 300 +/// Debug = false, +/// Verbose = false, +/// Force = false, +/// Noop = false, +/// LimitOutput = false, +/// ExecutionTimeout = 13, +/// CacheLocation = @"C:\temp", +/// AllowUnofficial = false +/// }); +/// +/// +public void ChocolateyPush(System.Collections.Generic.IEnumerable packageFilePaths, Cake.Common.Tools.Chocolatey.Push.ChocolateyPushSettings settings) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyPush(Context, packageFilePaths, settings); +} + +/// +/// Upgrades Chocolatey package. +/// +/// The context. +/// The id of the package to upgrade. +/// +/// +/// ChocolateyUpgrade("MyChocolateyPackage"); +/// +/// +public void ChocolateyUpgrade(System.String packageId) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyUpgrade(Context, packageId); +} + +/// +/// Upgrades Chocolatey package using the specified settings. +/// +/// The context. +/// The id of the package to upgrade. +/// The settings. +/// +/// +/// ChocolateyUpgrade("MyChocolateyPackage", new ChocolateyUpgradeSettings { +/// Source = true, +/// Version = "1.2.3", +/// Prerelease = false, +/// Forcex86 = false, +/// InstallArguments = "arg1", +/// OverrideArguments = false, +/// NotSilent = false, +/// PackageParameters = "param1", +/// AllowDowngrade = false, +/// SideBySide = false, +/// IgnoreDependencies = false, +/// SkipPowerShell = false, +/// FailOnUnfound = false, +/// FailOnNotInstalled = false, +/// User = "user", +/// Password = "password", +/// IgnoreChecksums = false, +/// Debug = false, +/// Verbose = false, +/// Force = false, +/// Noop = false, +/// LimitOutput = false, +/// ExecutionTimeout = 13, +/// CacheLocation = @"C:\temp", +/// AllowUnofficial = false +/// }); +/// +/// +public void ChocolateyUpgrade(System.String packageId, Cake.Common.Tools.Chocolatey.Upgrade.ChocolateyUpgradeSettings settings) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyUpgrade(Context, packageId, settings); +} + +/// +/// Generate package specification files for a new package using the default settings. +/// +/// The context. +/// The id of the package to create. +/// +/// +/// ChocolateyNew("MyChocolateyPackage"); +/// +/// +public void ChocolateyNew(System.String packageId) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyNew(Context, packageId); +} + +/// +/// Generate package specification files for a new package using the specified settings. +/// +/// The context. +/// The id of the package to create. +/// The settings. +/// +/// +/// ChocolateyNew("MyChocolateyPackage", new ChocolateyNewSettings { +/// PackageVersion = "1.2.3", +/// MaintainerName = "John Doe", +/// MaintainerRepo = "johndoe" +/// }); +/// +/// +/// +/// +/// var settings = new ChocolateyNewSettings { +/// MaintainerName = "John Doe" +/// } +/// settings.AdditionalPropertyValues("Tags", "CustomPackage"); +/// ChocolateyNew("MyChocolateyPackage", settings); +/// +/// +public void ChocolateyNew(System.String packageId, Cake.Common.Tools.Chocolatey.New.ChocolateyNewSettings settings) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyNew(Context, packageId, settings); +} + +/// +/// Downloads a Chocolatey package to the current working directory. +/// +/// The context. +/// The id of the package to download. +/// +/// +/// ChocolateyDownload("MyChocolateyPackage"); +/// +/// +public void ChocolateyDownload(System.String packageId) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyDownload(Context, packageId); +} + +/// +/// Downloads a Chocolatey package using the specified settings. +/// +/// The context. +/// The id of the package to install. +/// The settings. +/// +/// Download a package to a specific folder: +/// +/// ChocolateyDownload( +/// "MyChocolateyPackage", +/// new ChocolateyDownloadSettings { +/// OutputDirectory = @"C:\download\" +/// }); +/// +/// Download and internalize a package: +/// +/// ChocolateyDownload( +/// "MyChocolateyPackage", +/// new ChocolateyDownloadSettings { +/// Internalize = true +/// }); +/// +/// +public void ChocolateyDownload(System.String packageId, Cake.Common.Tools.Chocolatey.Download.ChocolateyDownloadSettings settings) +{ + Cake.Common.Tools.Chocolatey.ChocolateyAliases.ChocolateyDownload(Context, packageId, settings); +} + +/// +/// Runs all xUnit.net v2 tests in the assemblies matching the specified pattern. +/// +/// The context. +/// The pattern. +/// +/// +/// XUnit2("./src/**/bin/Release/*.Tests.dll"); +/// +/// +public void XUnit2(System.String pattern) +{ + Cake.Common.Tools.XUnit.XUnit2Aliases.XUnit2(Context, pattern); +} + +/// +/// Runs all xUnit.net v2 tests in the assemblies matching the specified pattern. +/// +/// The context. +/// The pattern. +/// The settings. +/// +/// +/// XUnit2("./src/**/bin/Release/*.Tests.dll", +/// new XUnit2Settings { +/// Parallelism = ParallelismOption.All, +/// HtmlReport = true, +/// NoAppDomain = true, +/// OutputDirectory = "./build" +/// }); +/// +/// +public void XUnit2(System.String pattern, Cake.Common.Tools.XUnit.XUnit2Settings settings) +{ + Cake.Common.Tools.XUnit.XUnit2Aliases.XUnit2(Context, pattern, settings); +} + +/// +/// Runs all xUnit.net v2 tests in the specified assemblies. +/// +/// The context. +/// The assemblies. +/// +/// +/// XUnit2(new []{ +/// "./src/Cake.Common.Tests/bin/Release/Cake.Common.Tests.dll", +/// "./src/Cake.Core.Tests/bin/Release/Cake.Core.Tests.dll", +/// "./src/Cake.NuGet.Tests/bin/Release/Cake.NuGet.Tests.dll", +/// "./src/Cake.Tests/bin/Release/Cake.Tests.dll" +/// }); +/// +/// +public void XUnit2(System.Collections.Generic.IEnumerable assemblies) +{ + Cake.Common.Tools.XUnit.XUnit2Aliases.XUnit2(Context, assemblies); +} + +/// +/// Runs all xUnit.net tests in the specified assemblies. +/// +/// The context. +/// The assemblies. +/// +/// +/// var testAssemblies = GetFiles("./src/**/bin/Release/*.Tests.dll"); +/// XUnit2(testAssemblies); +/// +/// +public void XUnit2(System.Collections.Generic.IEnumerable assemblies) +{ + Cake.Common.Tools.XUnit.XUnit2Aliases.XUnit2(Context, assemblies); +} + +/// +/// Runs all xUnit.net v2 tests in the specified assemblies. +/// +/// The context. +/// The assemblies. +/// The settings. +/// +/// +/// XUnit2(new []{ +/// "./src/Cake.Common.Tests/bin/Release/Cake.Common.Tests.dll", +/// "./src/Cake.Core.Tests/bin/Release/Cake.Core.Tests.dll", +/// "./src/Cake.NuGet.Tests/bin/Release/Cake.NuGet.Tests.dll", +/// "./src/Cake.Tests/bin/Release/Cake.Tests.dll" +/// }, +/// new XUnit2Settings { +/// Parallelism = ParallelismOption.All, +/// HtmlReport = true, +/// NoAppDomain = true, +/// OutputDirectory = "./build" +/// }); +/// +/// +public void XUnit2(System.Collections.Generic.IEnumerable assemblies, Cake.Common.Tools.XUnit.XUnit2Settings settings) +{ + Cake.Common.Tools.XUnit.XUnit2Aliases.XUnit2(Context, assemblies, settings); +} + +/// +/// Runs all xUnit.net v2 tests in the specified assemblies. +/// +/// The context. +/// The assemblies. +/// The settings. +/// +/// +/// var testAssemblies = GetFiles("./src/**/bin/Release/*.Tests.dll"); +/// XUnit2(testAssemblies, +/// new XUnit2Settings { +/// Parallelism = ParallelismOption.All, +/// HtmlReport = true, +/// NoAppDomain = true, +/// OutputDirectory = "./build" +/// }); +/// +/// +public void XUnit2(System.Collections.Generic.IEnumerable assemblies, Cake.Common.Tools.XUnit.XUnit2Settings settings) +{ + Cake.Common.Tools.XUnit.XUnit2Aliases.XUnit2(Context, assemblies, settings); +} + +/// +/// Runs all xUnit.net tests in the assemblies matching the specified pattern. +/// +/// The context. +/// The pattern. +/// +/// +/// XUnit("./src/**/bin/Release/*.Tests.dll"); +/// +/// +public void XUnit(System.String pattern) +{ + Cake.Common.Tools.XUnit.XUnitAliases.XUnit(Context, pattern); +} + +/// +/// Runs all xUnit.net tests in the assemblies matching the specified pattern. +/// +/// The context. +/// The pattern. +/// The settings. +/// +/// +/// XUnit("./src/**/bin/Release/*.Tests.dll", +/// new XUnitSettings { +/// HtmlReport = true, +/// OutputDirectory = "./build" +/// }); +/// +/// +public void XUnit(System.String pattern, Cake.Common.Tools.XUnit.XUnitSettings settings) +{ + Cake.Common.Tools.XUnit.XUnitAliases.XUnit(Context, pattern, settings); +} + +/// +/// Runs all xUnit.net tests in the specified assemblies. +/// +/// The context. +/// The assemblies. +/// +/// +/// XUnit(new []{ +/// "./src/Cake.Common.Tests/bin/Release/Cake.Common.Tests.dll", +/// "./src/Cake.Core.Tests/bin/Release/Cake.Core.Tests.dll", +/// "./src/Cake.NuGet.Tests/bin/Release/Cake.NuGet.Tests.dll", +/// "./src/Cake.Tests/bin/Release/Cake.Tests.dll" +/// }); +/// +/// +public void XUnit(System.Collections.Generic.IEnumerable assemblies) +{ + Cake.Common.Tools.XUnit.XUnitAliases.XUnit(Context, assemblies); +} + +/// +/// Runs all xUnit.net tests in the specified assemblies. +/// +/// The context. +/// The assemblies. +/// +/// +/// var testAssemblies = GetFiles("./src/**/bin/Release/*.Tests.dll"); +/// XUnit(testAssemblies); +/// +/// +public void XUnit(System.Collections.Generic.IEnumerable assemblies) +{ + Cake.Common.Tools.XUnit.XUnitAliases.XUnit(Context, assemblies); +} + +/// +/// Runs all xUnit.net tests in the specified assemblies. +/// +/// The context. +/// The assemblies. +/// The settings. +/// +/// +/// XUnit(new []{ +/// "./src/Cake.Common.Tests/bin/Release/Cake.Common.Tests.dll", +/// "./src/Cake.Core.Tests/bin/Release/Cake.Core.Tests.dll", +/// "./src/Cake.NuGet.Tests/bin/Release/Cake.NuGet.Tests.dll", +/// "./src/Cake.Tests/bin/Release/Cake.Tests.dll" +/// }, +/// new XUnitSettings { +/// HtmlReport = true, +/// OutputDirectory = "./build" +/// }); +/// +/// +public void XUnit(System.Collections.Generic.IEnumerable assemblies, Cake.Common.Tools.XUnit.XUnitSettings settings) +{ + Cake.Common.Tools.XUnit.XUnitAliases.XUnit(Context, assemblies, settings); +} + +/// +/// Runs all xUnit.net tests in the specified assemblies. +/// +/// The context. +/// The assemblies. +/// The settings. +/// +/// +/// var testAssemblies = GetFiles("./src/**/bin/Release/*.Tests.dll"); +/// XUnit(testAssemblies, +/// new XUnitSettings { +/// HtmlReport = true, +/// OutputDirectory = "./build" +/// }); +/// +/// +public void XUnit(System.Collections.Generic.IEnumerable assemblies, Cake.Common.Tools.XUnit.XUnitSettings settings) +{ + Cake.Common.Tools.XUnit.XUnitAliases.XUnit(Context, assemblies, settings); +} + +/// +/// Builds the specified solution using XBuild. +/// +/// The context. +/// The solution to build. +/// +/// +/// XBuild("./src/Cake.sln"); +/// +/// +public void XBuild(Cake.Core.IO.FilePath solution) +{ + Cake.Common.Tools.XBuild.XBuildAliases.XBuild(Context, solution); +} + +/// +/// Builds the specified solution using XBuild. +/// +/// The context. +/// The solution to build. +/// The settings configurator. +/// +/// +/// XBuild("./src/Cake.sln", configurator => +/// configurator.SetConfiguration("Debug") +/// .SetVerbosity(Verbosity.Minimal) +/// .UseToolVersion(XBuildToolVersion.NET40)); +/// +/// +public void XBuild(Cake.Core.IO.FilePath solution, System.Action configurator) +{ + Cake.Common.Tools.XBuild.XBuildAliases.XBuild(Context, solution, configurator); +} + +/// +/// Builds the specified solution using XBuild. +/// +/// The context. +/// The solution to build. +/// The settings. +/// +/// +/// XBuild("./src/Cake.sln", new XBuildSettings { +/// Verbosity = Verbosity.Minimal, +/// ToolVersion = XBuildToolVersion.NET40, +/// Configuration = "Release" +/// }); +/// +/// +public void XBuild(Cake.Core.IO.FilePath solution, Cake.Common.Tools.XBuild.XBuildSettings settings) +{ + Cake.Common.Tools.XBuild.XBuildAliases.XBuild(Context, solution, settings); +} + +/// +/// Compiles all .wxs sources matching the specified pattern. +/// +/// +/// +/// CandleSettings settings = new CandleSettings { +/// Architecture = Architecture.X64, +/// Verbose = true +/// }; +/// WiXCandle("./src/*.wxs", settings); +/// +/// +/// The context. +/// The globbing pattern. +/// The settings. +public void WiXCandle(System.String pattern, Cake.Common.Tools.WiX.CandleSettings settings = null) +{ + Cake.Common.Tools.WiX.WiXAliases.WiXCandle(Context, pattern, settings); +} + +/// +/// Compiles all .wxs sources in the provided source files. +/// +/// +/// +/// var files = GetFiles("./src/*.wxs"); +/// CandleSettings settings = new CandleSettings { +/// Architecture = Architecture.X64, +/// Verbose = true +/// }; +/// WiXCandle(files, settings); +/// +/// +/// The context. +/// The source files. +/// The settings. +public void WiXCandle(System.Collections.Generic.IEnumerable sourceFiles, Cake.Common.Tools.WiX.CandleSettings settings = null) +{ + Cake.Common.Tools.WiX.WiXAliases.WiXCandle(Context, sourceFiles, settings); +} + +/// +/// Links all .wixobj files matching the specified pattern. +/// +/// +/// +/// LightSettings settings = new LightSettings { +/// RawArguments = "-O1 -pedantic -v" +/// }; +/// WiXLight("./src/*.wixobj", settings); +/// +/// +/// The context. +/// The globbing pattern. +/// The settings. +public void WiXLight(System.String pattern, Cake.Common.Tools.WiX.LightSettings settings = null) +{ + Cake.Common.Tools.WiX.WiXAliases.WiXLight(Context, pattern, settings); +} + +/// +/// Links all .wixobj files in the provided object files. +/// +/// +/// +/// var files = GetFiles("./src/*.wxs"); +/// LightSettings settings = new LightSettings { +/// RawArguments = "-O1 -pedantic -v" +/// }; +/// WiXLight(files, settings); +/// +/// +/// The context. +/// The object files. +/// The settings. +public void WiXLight(System.Collections.Generic.IEnumerable objectFiles, Cake.Common.Tools.WiX.LightSettings settings = null) +{ + Cake.Common.Tools.WiX.WiXAliases.WiXLight(Context, objectFiles, settings); +} + +/// +/// Harvests files in the provided object files. +/// +/// +/// +/// DirectoryPath harvestDirectory = Directory("./src"); +/// var filePath = new FilePath("Wix.Directory.wxs"); +/// WiXHeat(harvestDirectory, filePath, WiXHarvestType.Dir); +/// +/// +/// The context. +/// The object files. +/// The output file. +/// The WiX harvest type. +public void WiXHeat(Cake.Core.IO.DirectoryPath directoryPath, Cake.Core.IO.FilePath outputFile, Cake.Common.Tools.WiX.Heat.WiXHarvestType harvestType) +{ + Cake.Common.Tools.WiX.WiXAliases.WiXHeat(Context, directoryPath, outputFile, harvestType); +} + +/// +/// Harvests files in the provided directory path. +/// +/// +/// +/// DirectoryPath harvestDirectory = Directory("./src"); +/// var filePath = File("Wix.Directory.wxs"); +/// Information(MakeAbsolute(harvestDirectory).FullPath); +/// WiXHeat(harvestDirectory, filePath, WiXHarvestType.Dir, new HeatSettings { NoLogo = true }); +/// +/// +/// The context. +/// The directory path. +/// The output file. +/// The WiX harvest type. +/// The settings. +public void WiXHeat(Cake.Core.IO.DirectoryPath directoryPath, Cake.Core.IO.FilePath outputFile, Cake.Common.Tools.WiX.Heat.WiXHarvestType harvestType, Cake.Common.Tools.WiX.Heat.HeatSettings settings) +{ + Cake.Common.Tools.WiX.WiXAliases.WiXHeat(Context, directoryPath, outputFile, harvestType, settings); +} + +/// +/// Harvests from the desired files. +/// +/// +/// +/// var harvestFile = File("./tools/Cake/Cake.Core.dll"); +/// var filePath = File("Wix.File.wxs"); +/// WiXHeat(harvestFile, filePath, WiXHarvestType.File); +/// +/// +/// The context. +/// The object file. +/// The output file. +/// The WiX harvest type. +public void WiXHeat(Cake.Core.IO.FilePath objectFile, Cake.Core.IO.FilePath outputFile, Cake.Common.Tools.WiX.Heat.WiXHarvestType harvestType) +{ + Cake.Common.Tools.WiX.WiXAliases.WiXHeat(Context, objectFile, outputFile, harvestType); +} + +/// +/// Harvests from the desired files. +/// +/// +/// +/// var harvestFiles = File("./tools/Cake/*.dll"); +/// var filePath = File("Wix.File.wxs"); +/// WiXHeat(harvestFiles, filePath, WiXHarvestType.File, new HeatSettings { NoLogo = true }); +/// +/// +/// The context. +/// The object file. +/// The output file. +/// The WiX harvest type. +/// The settings. +public void WiXHeat(Cake.Core.IO.FilePath objectFile, Cake.Core.IO.FilePath outputFile, Cake.Common.Tools.WiX.Heat.WiXHarvestType harvestType, Cake.Common.Tools.WiX.Heat.HeatSettings settings) +{ + Cake.Common.Tools.WiX.WiXAliases.WiXHeat(Context, objectFile, outputFile, harvestType, settings); +} + +/// +/// Harvests files for a website or performance. +/// +/// +/// +/// var filePath = File("Wix.Website.wxs"); +/// WiXHeat("Default Web Site", filePath, WiXHarvestType.Website); +/// +/// +/// The context. +/// The harvest target. +/// The output file. +/// The WiX harvest type. +public void WiXHeat(System.String harvestTarget, Cake.Core.IO.FilePath outputFile, Cake.Common.Tools.WiX.Heat.WiXHarvestType harvestType) +{ + Cake.Common.Tools.WiX.WiXAliases.WiXHeat(Context, harvestTarget, outputFile, harvestType); +} + +/// +/// Harvests files for a website or performance. +/// +/// +/// +/// var filePath = File("Wix.Website.wxs"); +/// WiXHeat("Default Web Site", filePath, WiXHarvestType.Website, new HeatSettings { NoLogo = true }); +/// +/// +/// The context. +/// The harvest target. +/// The output file. +/// The WiX harvest type. +/// The settings. +public void WiXHeat(System.String harvestTarget, Cake.Core.IO.FilePath outputFile, Cake.Common.Tools.WiX.Heat.WiXHarvestType harvestType, Cake.Common.Tools.WiX.Heat.HeatSettings settings) +{ + Cake.Common.Tools.WiX.WiXAliases.WiXHeat(Context, harvestTarget, outputFile, harvestType, settings); +} + +/// +/// Signs the specified assembly. +/// +/// The context. +/// The target assembly. +/// The settings. +/// +/// +/// Task("Sign") +/// .IsDependentOn("Clean") +/// .IsDependentOn("Restore") +/// .IsDependentOn("Build") +/// .Does(() => +/// { +/// var file = "Core.dll"; +/// Sign(file, new SignToolSignSettings { +/// TimeStampUri = new Uri("http://timestamp.digicert.com"), +/// CertPath = "digitalcertificate.pfx", +/// Password = "TopSecret" +/// }); +/// }); +/// +/// +public void Sign(System.String assembly, Cake.Common.Tools.SignTool.SignToolSignSettings settings) +{ + Cake.Common.Tools.SignTool.SignToolSignAliases.Sign(Context, assembly, settings); +} + +/// +/// Signs the specified assembly. +/// +/// The context. +/// The target assembly. +/// The settings. +/// +/// +/// Task("Sign") +/// .IsDependentOn("Clean") +/// .IsDependentOn("Restore") +/// .IsDependentOn("Build") +/// .Does(() => +/// { +/// var file = new FilePath("Core.dll"); +/// Sign(file, new SignToolSignSettings { +/// TimeStampUri = new Uri("http://timestamp.digicert.com"), +/// CertPath = "digitalcertificate.pfx", +/// Password = "TopSecret" +/// }); +/// }); +/// +/// +public void Sign(Cake.Core.IO.FilePath assembly, Cake.Common.Tools.SignTool.SignToolSignSettings settings) +{ + Cake.Common.Tools.SignTool.SignToolSignAliases.Sign(Context, assembly, settings); +} + +/// +/// Signs the specified assemblies. +/// +/// The context. +/// The target assembly. +/// The settings. +/// +/// +/// Task("Sign") +/// .IsDependentOn("Clean") +/// .IsDependentOn("Restore") +/// .IsDependentOn("Build") +/// .Does(() => +/// { +/// var files = new string[] { "Core.dll", "Common.dll" }; +/// Sign(files, new SignToolSignSettings { +/// TimeStampUri = new Uri("http://timestamp.digicert.com"), +/// CertPath = "digitalcertificate.pfx", +/// Password = "TopSecret" +/// }); +/// }); +/// +/// +public void Sign(System.Collections.Generic.IEnumerable assemblies, Cake.Common.Tools.SignTool.SignToolSignSettings settings) +{ + Cake.Common.Tools.SignTool.SignToolSignAliases.Sign(Context, assemblies, settings); +} + +/// +/// Signs the specified assemblies. +/// +/// The context. +/// The target assembly. +/// The settings. +/// +/// +/// Task("Sign") +/// .IsDependentOn("Clean") +/// .IsDependentOn("Restore") +/// .IsDependentOn("Build") +/// .Does(() => +/// { +/// var files = GetFiles(solutionDir + "/**/bin/" + configuration + "/**/*.exe"); +/// Sign(files, new SignToolSignSettings { +/// TimeStampUri = new Uri("http://timestamp.digicert.com"), +/// CertPath = "digitalcertificate.pfx", +/// Password = "TopSecret" +/// }); +/// }); +/// +/// +public void Sign(System.Collections.Generic.IEnumerable assemblies, Cake.Common.Tools.SignTool.SignToolSignSettings settings) +{ + Cake.Common.Tools.SignTool.SignToolSignAliases.Sign(Context, assemblies, settings); +} + +/// +/// Executes Roundhouse with the given configured settings. +/// +/// The context. +/// The settings. +/// +/// +/// RoundhouseMigrate(new RoundhouseSettings{ +/// ServerName = "Sql2008R2", +/// DatabaseName = "AdventureWorks2008R2", +/// SqlFilesDirectory = "./src/sql" +/// }); +/// +/// +public void RoundhouseMigrate(Cake.Common.Tools.Roundhouse.RoundhouseSettings settings) +{ + Cake.Common.Tools.Roundhouse.RoundhouseAliases.RoundhouseMigrate(Context, settings); +} + +/// +/// Executes Roundhouse migration to drop the database using the provided settings. +/// +/// The context. +/// The settings. +/// +/// +/// RoundhouseDrop(new RoundhouseSettings{ +/// ServerName = "Sql2008R2", +/// DatabaseName = "AdventureWorks2008R2" +/// }); +/// +/// +public void RoundhouseDrop(Cake.Common.Tools.Roundhouse.RoundhouseSettings settings) +{ + Cake.Common.Tools.Roundhouse.RoundhouseAliases.RoundhouseDrop(Context, settings); +} + +/// +/// Creates a release for the specified Octopus Deploy Project. +/// +/// The cake context. +/// The name of the project. +/// The settings. +/// +/// +/// // Minimum required +/// OctoCreateRelease(projectNameOnServer, new CreateReleaseSettings { +/// Server = "http://octopus-deploy.example", +/// ApiKey = "API-XXXXXXXXXXXXXXXXXXXX" +/// }); +/// +/// OctoCreateRelease(projectNameOnServer, new CreateReleaseSettings { +/// Server = "http://octopus-deploy.example", +/// Username = "DeployUser", +/// Password = "a-very-secure-password" +/// }); +/// +/// OctoCreateRelease(projectNameOnServer, new CreateReleaseSettings { +/// ConfigurationFile = @"C:\OctopusDeploy.config" +/// }); +/// +/// // Additional Options +/// OctoCreateRelease(projectNameOnServer, new CreateReleaseSettings { +/// ToolPath = "./tools/OctopusTools/Octo.exe" +/// EnableDebugLogging = true, +/// IgnoreSslErrors = true, +/// EnableServiceMessages = true, // Enables teamcity services messages when logging +/// ReleaseNumber = "1.8.2", +/// DefaultPackageVersion = "1.0.0.0", // All packages in the release should be 1.0.0.0 +/// Packages = new Dictionary<string, string> +/// { +/// { "PackageOne", "1.0.2.3" }, +/// { "PackageTwo", "5.2.3" } +/// }, +/// PackagesFolder = @"C:\MyOtherNugetFeed", +/// +/// // One or the other +/// ReleaseNotes = "Version 2.0 \n What a milestone we have ...", +/// ReleaseNotesFile = "./ReleaseNotes.md", +/// +/// IgnoreExisting = true // if this release number already exists, ignore it +/// }); +/// +/// +public void OctoCreateRelease(System.String projectName, Cake.Common.Tools.OctopusDeploy.CreateReleaseSettings settings) +{ + Cake.Common.Tools.OctopusDeploy.OctopusDeployAliases.OctoCreateRelease(Context, projectName, settings); +} + +/// +/// Pushes the specified package to the Octopus Deploy repository +/// +/// The cake context +/// The Octopus server URL +/// The user's API key +/// Path to the package +/// The settings +public void OctoPush(System.String server, System.String apiKey, Cake.Core.IO.FilePath packagePath, Cake.Common.Tools.OctopusDeploy.OctopusPushSettings settings) +{ + Cake.Common.Tools.OctopusDeploy.OctopusDeployAliases.OctoPush(Context, server, apiKey, packagePath, settings); +} + +/// +/// Pushes the specified packages to the Octopus Deploy repository +/// +/// The cake context +/// The Octopus server URL +/// The user's API key +/// Paths to the packages +/// The settings +public void OctoPush(System.String server, System.String apiKey, System.Collections.Generic.IEnumerable packagePaths, Cake.Common.Tools.OctopusDeploy.OctopusPushSettings settings) +{ + Cake.Common.Tools.OctopusDeploy.OctopusDeployAliases.OctoPush(Context, server, apiKey, packagePaths, settings); +} + +/// +/// Packs the specified folder into an Octopus Deploy package. +/// +/// The cake context +/// The package ID. +public void OctoPack(System.String id) +{ + Cake.Common.Tools.OctopusDeploy.OctopusDeployAliases.OctoPack(Context, id); +} + +/// +/// Packs the specified folder into an Octopus Deploy package. +/// +/// The cake context +/// The package ID. +/// The settings +public void OctoPack(System.String id, Cake.Common.Tools.OctopusDeploy.OctopusPackSettings settings = null) +{ + Cake.Common.Tools.OctopusDeploy.OctopusDeployAliases.OctoPack(Context, id, settings); +} + +/// +/// Deploys the specified already existing release into a specified environment +/// See Octopus Documentation for more details. +/// +/// The cake context +/// The Octopus server URL +/// The user's API key +/// Name of the target project +/// Target environment name +/// Version number of the release to deploy. Specify "latest" for the latest release +/// Deployment settings +/// +/// +/// // bare minimum +/// OctoDeployRelease("http://octopus-deploy.example", "API-XXXXXXXXXXXXXXXXXXXX", "MyGreatProject", "Testing", "2.1.15-RC" new OctopusDeployReleaseDeploymentSettings()); +/// +/// // All of deployment arguments +/// OctoDeployRelease("http://octopus-deploy.example", "API-XXXXXXXXXXXXXXXXXXXX", "MyGreatProject", "Testing", "2.1.15-RC" new OctopusDeployReleaseDeploymentSettings { +/// ShowProgress = true, +/// ForcePackageDownload = true, +/// WaitForDeployment = true, +/// DeploymentTimeout = TimeSpan.FromMinutes(1), +/// CancelOnTimeout = true, +/// DeploymentChecksLeepCycle = TimeSpan.FromMinutes(77), +/// GuidedFailure = true, +/// SpecificMachines = new string[] { "Machine1", "Machine2" }, +/// Force = true, +/// SkipSteps = new[] { "Step1", "Step2" }, +/// NoRawLog = true, +/// RawLogFile = "someFile.txt", +/// DeployAt = new DateTime(2010, 6, 15).AddMinutes(1), +/// Tenant = new[] { "Tenant1", "Tenant2" }, +/// TenantTags = new[] { "Tag1", "Tag2" }, +/// }); +/// +/// +public void OctoDeployRelease(System.String server, System.String apiKey, System.String projectName, System.String deployTo, System.String releaseNumber, Cake.Common.Tools.OctopusDeploy.OctopusDeployReleaseDeploymentSettings settings) +{ + Cake.Common.Tools.OctopusDeploy.OctopusDeployAliases.OctoDeployRelease(Context, server, apiKey, projectName, deployTo, releaseNumber, settings); +} + +/// +/// Runs all NUnit unit tests in the assemblies matching the specified pattern. +/// +/// The context. +/// The pattern. +/// +/// +/// NUnit3("./src/**/bin/Release/*.Tests.dll"); +/// +/// +public void NUnit3(System.String pattern) +{ + Cake.Common.Tools.NUnit.NUnit3Aliases.NUnit3(Context, pattern); +} + +/// +/// Runs all NUnit unit tests in the assemblies matching the specified pattern, +/// using the specified settings. +/// +/// The context. +/// The pattern. +/// The settings. +/// +/// +/// NUnit3("./src/**/bin/Release/*.Tests.dll", new NUnit3Settings { +/// NoResults = true +/// }); +/// +/// +public void NUnit3(System.String pattern, Cake.Common.Tools.NUnit.NUnit3Settings settings) +{ + Cake.Common.Tools.NUnit.NUnit3Aliases.NUnit3(Context, pattern, settings); +} + +/// +/// Runs all NUnit unit tests in the specified assemblies. +/// +/// The context. +/// The assemblies. +/// +/// +/// NUnit3(new [] { "./src/Example.Tests/bin/Release/Example.Tests.dll" }); +/// +/// +public void NUnit3(System.Collections.Generic.IEnumerable assemblies) +{ + Cake.Common.Tools.NUnit.NUnit3Aliases.NUnit3(Context, assemblies); +} + +/// +/// Runs all NUnit unit tests in the specified assemblies. +/// +/// The context. +/// The assemblies. +/// +/// +/// var testAssemblies = GetFiles("./src/**/bin/Release/*.Tests.dll"); +/// NUnit3(testAssemblies); +/// +/// +public void NUnit3(System.Collections.Generic.IEnumerable assemblies) +{ + Cake.Common.Tools.NUnit.NUnit3Aliases.NUnit3(Context, assemblies); +} + +/// +/// Runs all NUnit unit tests in the specified assemblies, +/// using the specified settings. +/// +/// The context. +/// The assemblies. +/// The settings. +/// +/// +/// NUnit3(new [] { "./src/Example.Tests/bin/Release/Example.Tests.dll" }, new NUnit3Settings { +/// NoResults = true +/// }); +/// +/// +public void NUnit3(System.Collections.Generic.IEnumerable assemblies, Cake.Common.Tools.NUnit.NUnit3Settings settings) +{ + Cake.Common.Tools.NUnit.NUnit3Aliases.NUnit3(Context, assemblies, settings); +} + +/// +/// Runs all NUnit unit tests in the specified assemblies, +/// using the specified settings. +/// +/// The context. +/// The assemblies. +/// The settings. +/// +/// +/// var testAssemblies = GetFiles("./src/**/bin/Release/*.Tests.dll"); +/// NUnit3(testAssemblies, new NUnit3Settings { +/// NoResults = true +/// }); +/// +/// +public void NUnit3(System.Collections.Generic.IEnumerable assemblies, Cake.Common.Tools.NUnit.NUnit3Settings settings) +{ + Cake.Common.Tools.NUnit.NUnit3Aliases.NUnit3(Context, assemblies, settings); +} + +/// +/// Runs all NUnit unit tests in the assemblies matching the specified pattern. +/// +/// +/// +/// NUnit("./src/UnitTests/*.dll"); +/// +/// +/// The context. +/// The pattern. +public void NUnit(System.String pattern) +{ + Cake.Common.Tools.NUnit.NUnitAliases.NUnit(Context, pattern); +} + +/// +/// Runs all NUnit unit tests in the assemblies matching the specified pattern, +/// using the specified settings. +/// +/// +/// +/// NUnit("./src/UnitTests/*.dll", new NUnitSettings { +/// Timeout = 4000, +/// StopOnError = true +/// }); +/// +/// +/// The context. +/// The pattern. +/// The settings. +public void NUnit(System.String pattern, Cake.Common.Tools.NUnit.NUnitSettings settings) +{ + Cake.Common.Tools.NUnit.NUnitAliases.NUnit(Context, pattern, settings); +} + +/// +/// Runs all NUnit unit tests in the specified assemblies. +/// +/// +/// +/// var assemblies = new [] { +/// "UnitTests1.dll", +/// "UnitTests2.dll" +/// }; +/// NUnit(assemblies); +/// +/// +/// The context. +/// The assemblies. +public void NUnit(System.Collections.Generic.IEnumerable assemblies) +{ + Cake.Common.Tools.NUnit.NUnitAliases.NUnit(Context, assemblies); +} + +/// +/// Runs all NUnit unit tests in the specified assemblies. +/// +/// +/// +/// var assemblies = GetFiles("./src/UnitTests/*.dll"); +/// NUnit(assemblies); +/// +/// +/// The context. +/// The assemblies. +public void NUnit(System.Collections.Generic.IEnumerable assemblies) +{ + Cake.Common.Tools.NUnit.NUnitAliases.NUnit(Context, assemblies); +} + +/// +/// Runs all NUnit unit tests in the specified assemblies, +/// using the specified settings. +/// +/// +/// +/// var assemblies = new [] { +/// "UnitTests1.dll", +/// "UnitTests2.dll" +/// }; +/// NUnit(assemblies, new NUnitSettings { +/// Timeout = 4000, +/// StopOnError = true +/// }); +/// +/// +/// The context. +/// The assemblies. +/// The settings. +public void NUnit(System.Collections.Generic.IEnumerable assemblies, Cake.Common.Tools.NUnit.NUnitSettings settings) +{ + Cake.Common.Tools.NUnit.NUnitAliases.NUnit(Context, assemblies, settings); +} + +/// +/// Runs all NUnit unit tests in the specified assemblies, +/// using the specified settings. +/// +/// +/// +/// var assemblies = GetFiles(""./src/UnitTests/*.dll""); +/// NUnit(assemblies, new NUnitSettings { +/// Timeout = 4000, +/// StopOnError = true +/// }); +/// +/// +/// The context. +/// The assemblies. +/// The settings. +public void NUnit(System.Collections.Generic.IEnumerable assemblies, Cake.Common.Tools.NUnit.NUnitSettings settings) +{ + Cake.Common.Tools.NUnit.NUnitAliases.NUnit(Context, assemblies, settings); +} + +/// +/// Creates a NuGet package using the specified Nuspec or project file. +/// +/// The context. +/// The nuspec or project file path. +/// The settings. +/// +/// +/// var nuGetPackSettings = new NuGetPackSettings { +/// Id = "TestNuget", +/// Version = "0.0.0.1", +/// Title = "The tile of the package", +/// Authors = new[] {"John Doe"}, +/// Owners = new[] {"Contoso"}, +/// Description = "The description of the package", +/// Summary = "Excellent summary of what the package does", +/// ProjectUrl = new Uri("https://github.com/SomeUser/TestNuget/"), +/// IconUrl = new Uri("http://cdn.rawgit.com/SomeUser/TestNuget/master/icons/testnuget.png"), +/// LicenseUrl = new Uri("https://github.com/SomeUser/TestNuget/blob/master/LICENSE.md"), +/// Copyright = "Some company 2015", +/// ReleaseNotes = new [] {"Bug fixes", "Issue fixes", "Typos"}, +/// Tags = new [] {"Cake", "Script", "Build"}, +/// RequireLicenseAcceptance= false, +/// Symbols = false, +/// NoPackageAnalysis = true, +/// Files = new [] { +/// new NuSpecContent {Source = "bin/TestNuget.dll", Target = "bin"}, +/// }, +/// BasePath = "./src/TestNuget/bin/release", +/// OutputDirectory = "./nuget" +/// }; +/// +/// NuGetPack("./nuspec/TestNuget.nuspec", nuGetPackSettings); +/// +/// +public void NuGetPack(Cake.Core.IO.FilePath filePath, Cake.Common.Tools.NuGet.Pack.NuGetPackSettings settings) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetPack(Context, filePath, settings); +} + +/// +/// Creates NuGet packages using the specified Nuspec or project files. +/// +/// The context. +/// The nuspec or project file paths. +/// The settings. +/// +/// +/// var nuGetPackSettings = new NuGetPackSettings { +/// Id = "TestNuget", +/// Version = "0.0.0.1", +/// Title = "The tile of the package", +/// Authors = new[] {"John Doe"}, +/// Owners = new[] {"Contoso"}, +/// Description = "The description of the package", +/// Summary = "Excellent summary of what the package does", +/// ProjectUrl = new Uri("https://github.com/SomeUser/TestNuget/"), +/// IconUrl = new Uri("http://cdn.rawgit.com/SomeUser/TestNuget/master/icons/testnuget.png"), +/// LicenseUrl = new Uri("https://github.com/SomeUser/TestNuget/blob/master/LICENSE.md"), +/// Copyright = "Some company 2015", +/// ReleaseNotes = new [] {"Bug fixes", "Issue fixes", "Typos"}, +/// Tags = new [] {"Cake", "Script", "Build"}, +/// RequireLicenseAcceptance= false, +/// Symbols = false, +/// NoPackageAnalysis = true, +/// Files = new [] { +/// new NuSpecContent {Source = "bin/TestNuget.dll", Target = "bin"}, +/// }, +/// BasePath = "./src/TestNuget/bin/release", +/// OutputDirectory = "./nuget" +/// }; +/// +/// var nuspecFiles = GetFiles("./**/*.nuspec"); +/// NuGetPack(nuspecFiles, nuGetPackSettings); +/// +/// +public void NuGetPack(System.Collections.Generic.IEnumerable filePaths, Cake.Common.Tools.NuGet.Pack.NuGetPackSettings settings) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetPack(Context, filePaths, settings); +} + +/// +/// Creates a NuGet package using the specified settings. +/// +/// The context. +/// The settings. +/// +/// +/// var nuGetPackSettings = new NuGetPackSettings { +/// Id = "TestNuget", +/// Version = "0.0.0.1", +/// Title = "The tile of the package", +/// Authors = new[] {"John Doe"}, +/// Owners = new[] {"Contoso"}, +/// Description = "The description of the package", +/// Summary = "Excellent summary of what the package does", +/// ProjectUrl = new Uri("https://github.com/SomeUser/TestNuget/"), +/// IconUrl = new Uri("http://cdn.rawgit.com/SomeUser/TestNuget/master/icons/testnuget.png"), +/// LicenseUrl = new Uri("https://github.com/SomeUser/TestNuget/blob/master/LICENSE.md"), +/// Copyright = "Some company 2015", +/// ReleaseNotes = new [] {"Bug fixes", "Issue fixes", "Typos"}, +/// Tags = new [] {"Cake", "Script", "Build"}, +/// RequireLicenseAcceptance= false, +/// Symbols = false, +/// NoPackageAnalysis = true, +/// Files = new [] { +/// new NuSpecContent {Source = "bin/TestNuget.dll", Target = "bin"}, +/// }, +/// BasePath = "./src/TestNuget/bin/release", +/// OutputDirectory = "./nuget" +/// }; +/// +/// NuGetPack(nuGetPackSettings); +/// +/// +public void NuGetPack(Cake.Common.Tools.NuGet.Pack.NuGetPackSettings settings) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetPack(Context, settings); +} + +/// +/// Restores NuGet packages for the specified target. +/// +/// The context. +/// The target to restore. +/// +/// +/// var solutions = GetFiles("./**/*.sln"); +/// // Restore all NuGet packages. +/// foreach(var solution in solutions) +/// { +/// Information("Restoring {0}", solution); +/// NuGetRestore(solution); +/// } +/// +/// +public void NuGetRestore(Cake.Core.IO.FilePath targetFilePath) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetRestore(Context, targetFilePath); +} + +/// +/// Restores NuGet packages for the specified targets. +/// +/// The context. +/// The targets to restore. +/// +/// +/// var solutions = GetFiles("./**/*.sln"); +/// NuGetRestore(solutions); +/// +/// +public void NuGetRestore(System.Collections.Generic.IEnumerable targetFilePaths) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetRestore(Context, targetFilePaths); +} + +/// +/// Restores NuGet packages using the specified settings. +/// +/// The context. +/// The target to restore. +/// The settings. +/// +/// +/// var solutions = GetFiles("./**/*.sln"); +/// // Restore all NuGet packages. +/// foreach(var solution in solutions) +/// { +/// Information("Restoring {0}", solution); +/// NuGetRestore(solution, new NuGetRestoreSettings { NoCache = true }); +/// } +/// +/// +public void NuGetRestore(Cake.Core.IO.FilePath targetFilePath, Cake.Common.Tools.NuGet.Restore.NuGetRestoreSettings settings) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetRestore(Context, targetFilePath, settings); +} + +/// +/// Restores NuGet packages using the specified settings. +/// +/// The context. +/// The targets to restore. +/// The settings. +/// +/// +/// var solutions = GetFiles("./**/*.sln"); +/// NuGetRestore(solutions, new NuGetRestoreSettings { NoCache = true }); +/// +/// +public void NuGetRestore(System.Collections.Generic.IEnumerable targetFilePaths, Cake.Common.Tools.NuGet.Restore.NuGetRestoreSettings settings) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetRestore(Context, targetFilePaths, settings); +} + +/// +/// Pushes a NuGet package to a NuGet server and publishes it. +/// +/// The context. +/// The .nupkg file path. +/// The settings. +/// +/// NOTE: Starting with NuGet 3.4.2, the Source parameter is a mandatory parameter. +/// It is strongly recommended that you ALWAYS set the Source property within the instance. +/// +/// // Get the path to the package. +/// var package = "./nuget/SlackPRTGCommander.0.0.1.nupkg"; +/// +/// // Push the package. +/// NuGetPush(package, new NuGetPushSettings { +/// Source = "http://example.com/nugetfeed", +/// ApiKey = "4003d786-cc37-4004-bfdf-c4f3e8ef9b3a" +/// }); +/// +/// +public void NuGetPush(Cake.Core.IO.FilePath packageFilePath, Cake.Common.Tools.NuGet.Push.NuGetPushSettings settings) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetPush(Context, packageFilePath, settings); +} + +/// +/// Pushes NuGet packages to a NuGet server and publishes them. +/// +/// The context. +/// The .nupkg file paths. +/// The settings. +/// +/// NOTE: Starting with NuGet 3.4.2, the Source parameter is a mandatory parameter. +/// It is strongly recommended that you ALWAYS set the Source property within the instance. +/// +/// // Get the paths to the packages. +/// var packages = GetFiles("./**/*.nupkg"); +/// +/// // Push the package. +/// NuGetPush(packages, new NuGetPushSettings { +/// Source = "http://example.com/nugetfeed", +/// ApiKey = "4003d786-cc37-4004-bfdf-c4f3e8ef9b3a" +/// }); +/// +/// +public void NuGetPush(System.Collections.Generic.IEnumerable packageFilePaths, Cake.Common.Tools.NuGet.Push.NuGetPushSettings settings) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetPush(Context, packageFilePaths, settings); +} + +/// +/// Adds NuGet package source using the specified name &source to global user config +/// +/// The context. +/// Name of the source. +/// Path to the package(s) source. +/// +/// +/// var feed = new +/// { +/// Name = EnvironmentVariable("PUBLIC_FEED_NAME"), +/// Source = EnvironmentVariable("PUBLIC_FEED_SOURCE") +/// }; +/// +/// NuGetAddSource( +/// name:feed.Name, +/// source:feed.Source +/// ); +/// +/// +public void NuGetAddSource(System.String name, System.String source) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetAddSource(Context, name, source); +} + +/// +/// Adds NuGet package source using the specified name, source & settings to global user config +/// +/// The context. +/// Name of the source. +/// Path to the package(s) source. +/// The settings. +/// +/// +/// var nugetSourceSettings = new NuGetSourcesSettings +/// { +/// UserName = EnvironmentVariable("PRIVATE_FEED_USERNAME"), +/// Password = EnvironmentVariable("PRIVATE_FEED_PASSWORD"), +/// IsSensitiveSource = true, +/// Verbosity = NuGetVerbosity.Detailed +/// }; +/// +/// var feed = new +/// { +/// Name = EnvironmentVariable("PRIVATE_FEED_NAME"), +/// Source = EnvironmentVariable("PRIVATE_FEED_SOURCE") +/// }; +/// +/// NuGetAddSource( +/// name:feed.Name, +/// source:feed.Source, +/// settings:nugetSourceSettings +/// ); +/// +/// +public void NuGetAddSource(System.String name, System.String source, Cake.Common.Tools.NuGet.Sources.NuGetSourcesSettings settings) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetAddSource(Context, name, source, settings); +} + +/// +/// Removes NuGet package source using the specified name & source from global user config +/// +/// The context. +/// Name of the source. +/// Path to the package(s) source. +/// +/// +/// var feed = new +/// { +/// Name = EnvironmentVariable("PRIVATE_FEED_NAME"), +/// Source = EnvironmentVariable("PRIVATE_FEED_SOURCE") +/// }; +/// +/// NuGetRemoveSource( +/// name:feed.Name, +/// source:feed.Source +/// ); +/// +/// +public void NuGetRemoveSource(System.String name, System.String source) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetRemoveSource(Context, name, source); +} + +/// +/// Removes NuGet package source using the specified name, source & settings from global user config +/// +/// The context. +/// Name of the source. +/// Path to the package(s) source. +/// The settings. +/// +/// +/// var nugetSourceSettings = new NuGetSourcesSettings +/// { +/// UserName = EnvironmentVariable("PRIVATE_FEED_USERNAME"), +/// Password = EnvironmentVariable("PRIVATE_FEED_PASSWORD"), +/// IsSensitiveSource = true, +/// Verbosity = NuGetVerbosity.Detailed +/// }; +/// +/// var feed = new +/// { +/// Name = EnvironmentVariable("PRIVATE_FEED_NAME"), +/// Source = EnvironmentVariable("PRIVATE_FEED_SOURCE") +/// }; +/// +/// NuGetRemoveSource( +/// name:feed.Name, +/// source:feed.Source, +/// settings:nugetSourceSettings +/// ); +/// +/// +public void NuGetRemoveSource(System.String name, System.String source, Cake.Common.Tools.NuGet.Sources.NuGetSourcesSettings settings) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetRemoveSource(Context, name, source, settings); +} + +/// +/// Checks whether or not a NuGet package source exists in the global user configuration, using the specified source. +/// +/// The context. +/// Path to the package(s) source. +/// Whether or not the NuGet package source exists in the global user configuration. +/// +/// +/// var feed = new +/// { +/// Name = EnvironmentVariable("PRIVATE_FEED_NAME"), +/// Source = EnvironmentVariable("PRIVATE_FEED_SOURCE") +/// }; +/// if (!NuGetHasSource(source:feed.Source)) +/// { +/// Information("Source missing"); +/// } +/// else +/// { +/// Information("Source already exists"); +/// } +/// +/// +public System.Boolean NuGetHasSource(System.String source) +{ + return Cake.Common.Tools.NuGet.NuGetAliases.NuGetHasSource(Context, source); +} + +/// +/// Checks whether or not a NuGet package source exists in the global user configuration, using the specified source and settings. +/// +/// The context. +/// Path to the package(s) source. +/// The settings. +/// Whether the specified NuGet package source exist. +/// +/// +/// var nugetSourceSettings = new NuGetSourcesSettings +/// { +/// UserName = EnvironmentVariable("PRIVATE_FEED_USERNAME"), +/// Password = EnvironmentVariable("PRIVATE_FEED_PASSWORD"), +/// IsSensitiveSource = true, +/// Verbosity = NuGetVerbosity.Detailed +/// }; +/// var feed = new +/// { +/// Name = EnvironmentVariable("PRIVATE_FEED_NAME"), +/// Source = EnvironmentVariable("PRIVATE_FEED_SOURCE") +/// }; +/// if (!NuGetHasSource( +/// source:feed.Source, +/// settings:nugetSourceSettings)) +/// { +/// Information("Source missing"); +/// } +/// else +/// { +/// Information("Source already exists"); +/// } +/// +/// +public System.Boolean NuGetHasSource(System.String source, Cake.Common.Tools.NuGet.Sources.NuGetSourcesSettings settings) +{ + return Cake.Common.Tools.NuGet.NuGetAliases.NuGetHasSource(Context, source, settings); +} + +/// +/// Installs a NuGet package. +/// +/// The context. +/// The id of the package to install. +/// +/// +/// NuGetInstall("MyNugetPackage"); +/// +/// +public void NuGetInstall(System.String packageId) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetInstall(Context, packageId); +} + +/// +/// Installs NuGet packages. +/// +/// The context. +/// The id's of the package to install. +/// +/// +/// NuGetInstall(new[] { "MyNugetPackage", "OtherNugetPackage" }); +/// +/// +public void NuGetInstall(System.Collections.Generic.IEnumerable packageIds) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetInstall(Context, packageIds); +} + +/// +/// Installs a NuGet package using the specified settings. +/// +/// The context. +/// The id of the package to install. +/// The settings. +/// +/// +/// NuGetInstall("MyNugetPackage", new NuGetInstallSettings { +/// ExcludeVersion = true, +/// OutputDirectory = "./tools" +/// }); +/// +/// +public void NuGetInstall(System.String packageId, Cake.Common.Tools.NuGet.Install.NuGetInstallSettings settings) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetInstall(Context, packageId, settings); +} + +/// +/// Installs NuGet packages using the specified settings. +/// +/// The context. +/// The id's of the package to install. +/// The settings. +/// +/// +/// NuGetInstall(new[] { "MyNugetPackage", "OtherNugetPackage" }, new NuGetInstallSettings { +/// ExcludeVersion = true, +/// OutputDirectory = "./tools" +/// }); +/// +/// +public void NuGetInstall(System.Collections.Generic.IEnumerable packageIds, Cake.Common.Tools.NuGet.Install.NuGetInstallSettings settings) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetInstall(Context, packageIds, settings); +} + +/// +/// Installs NuGet packages using the specified package configuration. +/// +/// The context. +/// The package configuration to install. +/// +/// +/// NuGetInstallFromConfig("./tools/packages.config"); +/// +/// +public void NuGetInstallFromConfig(Cake.Core.IO.FilePath packageConfigPath) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetInstallFromConfig(Context, packageConfigPath); +} + +/// +/// Installs NuGet packages using the specified package configurations. +/// +/// The context. +/// The package configurations to install. +/// +/// +/// var packageConfigs = GetFiles("./**/packages.config"); +/// +/// NuGetInstallFromConfig(packageConfigs); +/// +/// +public void NuGetInstallFromConfig(System.Collections.Generic.IEnumerable packageConfigPaths) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetInstallFromConfig(Context, packageConfigPaths); +} + +/// +/// Installs NuGet packages using the specified package configuration and settings. +/// +/// The context. +/// The package configuration to install. +/// The settings. +/// +/// +/// NuGetInstallFromConfig("./tools/packages.config", new NuGetInstallSettings { +/// ExcludeVersion = true, +/// OutputDirectory = "./tools" +/// }); +/// +/// +public void NuGetInstallFromConfig(Cake.Core.IO.FilePath packageConfigPath, Cake.Common.Tools.NuGet.Install.NuGetInstallSettings settings) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetInstallFromConfig(Context, packageConfigPath, settings); +} + +/// +/// Installs NuGet packages using the specified package configurations and settings. +/// +/// The context. +/// The package configurations to install. +/// The settings. +/// +/// +/// var packageConfigs = GetFiles("./**/packages.config"); +/// +/// NuGetInstallFromConfig(packageConfigs, new NuGetInstallSettings { +/// ExcludeVersion = true, +/// OutputDirectory = "./tools" +/// }); +/// +/// +public void NuGetInstallFromConfig(System.Collections.Generic.IEnumerable packageConfigPaths, Cake.Common.Tools.NuGet.Install.NuGetInstallSettings settings) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetInstallFromConfig(Context, packageConfigPaths, settings); +} + +/// +/// Installs NuGet packages using the specified API key, source and settings. +/// +/// +/// +/// var setting = new NuGetSetApiKeySettings { +/// Verbosity = NuGetVerbosity.Detailed +/// }; +/// NuGetSetApiKey("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "https://nuget.org/api/v2/", setting); +/// +/// +/// The context. +/// The API key. +/// Server URL where the API key is valid. +/// The settings. +public void NuGetSetApiKey(System.String apiKey, System.String source, Cake.Common.Tools.NuGet.SetApiKey.NuGetSetApiKeySettings settings) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetSetApiKey(Context, apiKey, source, settings); +} + +/// +/// Installs NuGet packages using the specified API key and source. +/// +/// +/// +/// NuGetSetApiKey("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "https://nuget.org/api/v2/"); +/// +/// +/// The context. +/// The API key. +/// Server URL where the API key is valid. +public void NuGetSetApiKey(System.String apiKey, System.String source) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetSetApiKey(Context, apiKey, source); +} + +/// +/// Set the proxy settings to be used while connecting to your NuGet feed, including settings. +/// +/// +/// +/// var setting = new NuGetSetProxySettings { +/// Verbosity = NuGetVerbosity.Detailed +/// }; +/// NuGetSetProxy("127.0.0.1:8080", "proxyuser","Pa$$w0rd1", setting); +/// +/// +/// The context. +/// The url of the proxy. +/// The username used to access the proxy. +/// The password used to access the proxy. +/// The settings. +public void NuGetSetProxy(System.String proxy, System.String username, System.String password, Cake.Common.Tools.NuGet.SetProxy.NuGetSetProxySettings settings) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetSetProxy(Context, proxy, username, password, settings); +} + +/// +/// Set the proxy settings to be used while connecting to your NuGet feed. +/// +/// +/// +/// NuGetSetProxy("127.0.0.1:8080", "proxyuser","Pa$$w0rd1"); +/// +/// +/// The context. +/// The url of the proxy. +/// The username used to access the proxy. +/// The password used to access the proxy. +public void NuGetSetProxy(System.String proxy, System.String username, System.String password) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetSetProxy(Context, proxy, username, password); +} + +/// +/// Updates NuGet packages. +/// +/// The context. +/// The target to update. +/// +/// +/// NuGetUpdate("./tools/packages.config"); +/// +/// +public void NuGetUpdate(Cake.Core.IO.FilePath targetFile) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetUpdate(Context, targetFile); +} + +/// +/// Updates NuGet packages. +/// +/// The context. +/// The targets to update. +/// +/// +/// var targets = GetFiles("./**/packages.config"); +/// +/// NuGetUpdate(targets); +/// +/// +public void NuGetUpdate(System.Collections.Generic.IEnumerable targetFiles) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetUpdate(Context, targetFiles); +} + +/// +/// Updates NuGet packages using the specified settings. +/// +/// The context. +/// The target to update. +/// The settings. +/// +/// +/// NuGetUpdate("./tools/packages.config", new NuGetUpdateSettings { +/// Prerelease = true, +/// }); +/// +/// +public void NuGetUpdate(Cake.Core.IO.FilePath targetFile, Cake.Common.Tools.NuGet.Update.NuGetUpdateSettings settings) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetUpdate(Context, targetFile, settings); +} + +/// +/// Updates NuGet packages using the specified settings. +/// +/// The context. +/// The targets to update. +/// The settings. +/// +/// +/// var targets = GetFiles("./**/packages.config"); +/// +/// NuGetUpdate(targets, new NuGetUpdateSettings { +/// Prerelease = true, +/// }); +/// +/// +public void NuGetUpdate(System.Collections.Generic.IEnumerable targetFiles, Cake.Common.Tools.NuGet.Update.NuGetUpdateSettings settings) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetUpdate(Context, targetFiles, settings); +} + +/// +/// Adds a NuGet package using package id and source. +/// +/// The context. +/// The id of the package to add. +/// Path to the local feed source. +/// +/// +/// NuGetAdd("MyNugetPackage", "//bar/packages/"); +/// +/// +public void NuGetAdd(System.String packageId, System.String source) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetAdd(Context, packageId, source); +} + +/// +/// Adds a NuGet package using package id and source. +/// +/// The context. +/// The id of the package to add. +/// The settings. +/// +/// +/// NuGetAdd("MyNugetPackage", new NuGetAddSettings({ +/// Source = "//bar/packages/" +/// }); +/// +/// +public void NuGetAdd(System.String packageId, Cake.Common.Tools.NuGet.Add.NuGetAddSettings settings) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetAdd(Context, packageId, settings); +} + +/// +/// Adds all packages from source to destination. +/// +/// The context. +/// The local feed package source. +/// The local feed destination source. +/// +/// +/// NuGetInit("//foo/packages", "//bar/packages/"); +/// +/// +public void NuGetInit(System.String source, System.String destination) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetInit(Context, source, destination); +} + +/// +/// Adds all packages from source to destination using specified settings. +/// +/// The context. +/// The local feed package source. +/// The local feed destination source. +/// The settings. +/// +/// +/// NuGetInit("//foo/packages", "//bar/packages/", new NuGetInitSettings { +/// Expand = true +/// }); +/// +/// +public void NuGetInit(System.String source, System.String destination, Cake.Common.Tools.NuGet.Init.NuGetInitSettings settings) +{ + Cake.Common.Tools.NuGet.NuGetAliases.NuGetInit(Context, source, destination, settings); +} + +/// +/// Runs all MSTest unit tests in the assemblies matching the specified pattern. +/// +/// +/// +/// MSTest("./Tests/*.UnitTests.dll"); +/// +/// +/// The context. +/// The pattern. +public void MSTest(System.String pattern) +{ + Cake.Common.Tools.MSTest.MSTestAliases.MSTest(Context, pattern); +} + +/// +/// Runs all MSTest unit tests in the assemblies matching the specified pattern. +/// +/// +/// +/// MSTest("./Tests/*.UnitTests.dll", new MSTestSettings() { NoIsolation = false }); +/// +/// +/// The context. +/// The pattern. +/// The settings. +public void MSTest(System.String pattern, Cake.Common.Tools.MSTest.MSTestSettings settings) +{ + Cake.Common.Tools.MSTest.MSTestAliases.MSTest(Context, pattern, settings); +} + +/// +/// Runs all MSTest unit tests in the specified assemblies. +/// +/// +/// +/// var paths = new List<FilePath>() { "./assemblydir1", "./assemblydir2" }; +/// MSTest(paths); +/// +/// +/// The context. +/// The assembly paths. +public void MSTest(System.Collections.Generic.IEnumerable assemblyPaths) +{ + Cake.Common.Tools.MSTest.MSTestAliases.MSTest(Context, assemblyPaths); +} + +/// +/// Runs all MSTest unit tests in the specified assemblies. +/// +/// +/// +/// var paths = new List<FilePath>() { "./assemblydir1", "./assemblydir2" }; +/// MSTest(paths, new MSTestSettings() { NoIsolation = false }); +/// +/// +/// The context. +/// The assembly paths. +/// The settings. +public void MSTest(System.Collections.Generic.IEnumerable assemblyPaths, Cake.Common.Tools.MSTest.MSTestSettings settings) +{ + Cake.Common.Tools.MSTest.MSTestAliases.MSTest(Context, assemblyPaths, settings); +} + +/// +/// Builds the specified solution using MSBuild. +/// +/// The context. +/// The solution. +/// +/// +/// MSBuild("./src/Cake.sln"); +/// +/// +public void MSBuild(Cake.Core.IO.FilePath solution) +{ + Cake.Common.Tools.MSBuild.MSBuildAliases.MSBuild(Context, solution); +} + +/// +/// Builds the specified solution using MSBuild. +/// +/// The context. +/// The solution to build. +/// The settings configurator. +/// +/// +/// MSBuild("./src/Cake.sln", configurator => +/// configurator.SetConfiguration("Debug") +/// .SetVerbosity(Verbosity.Minimal) +/// .UseToolVersion(MSBuildToolVersion.VS2015) +/// .SetMSBuildPlatform(MSBuildPlatform.x86) +/// .SetPlatformTarget(PlatformTarget.MSIL)); +/// +/// +public void MSBuild(Cake.Core.IO.FilePath solution, System.Action configurator) +{ + Cake.Common.Tools.MSBuild.MSBuildAliases.MSBuild(Context, solution, configurator); +} + +/// +/// Builds the specified solution using MSBuild. +/// +/// The context. +/// The solution to build. +/// The settings. +/// +/// +/// MSBuild("./src/Cake.sln", new MSBuildSettings { +/// Verbosity = Verbosity.Minimal, +/// ToolVersion = MSBuildToolVersion.VS2015, +/// Configuration = "Release", +/// PlatformTarget = PlatformTarget.MSIL +/// }); +/// +/// +public void MSBuild(Cake.Core.IO.FilePath solution, Cake.Common.Tools.MSBuild.MSBuildSettings settings) +{ + Cake.Common.Tools.MSBuild.MSBuildAliases.MSBuild(Context, solution, settings); +} + +/// +/// Merges the specified assemblies. +/// +/// The context. +/// The output file. +/// The primary assembly. +/// The assembly paths. +/// +/// +/// var assemblyPaths = GetFiles("./**/Cake.*.dll"); +/// ILMerge("./MergedCake.exe", "./Cake.exe", assemblyPaths); +/// +/// +public void ILMerge(Cake.Core.IO.FilePath outputFile, Cake.Core.IO.FilePath primaryAssembly, System.Collections.Generic.IEnumerable assemblyPaths) +{ + Cake.Common.Tools.ILMerge.ILMergeAliases.ILMerge(Context, outputFile, primaryAssembly, assemblyPaths); +} + +/// +/// Merges the specified assemblies. +/// +/// The context. +/// The output file. +/// The primary assembly. +/// The assembly paths. +/// The settings. +/// +/// +/// var assemblyPaths = GetFiles("./**/Cake.*.dll"); +/// ILMerge( +/// "./MergedCake.exe", +/// "./Cake.exe", +/// assemblyPaths, +/// new ILMergeSettings { Internalize = true }); +/// +/// +public void ILMerge(Cake.Core.IO.FilePath outputFile, Cake.Core.IO.FilePath primaryAssembly, System.Collections.Generic.IEnumerable assemblyPaths, Cake.Common.Tools.ILMerge.ILMergeSettings settings) +{ + Cake.Common.Tools.ILMerge.ILMergeAliases.ILMerge(Context, outputFile, primaryAssembly, assemblyPaths, settings); +} + +/// +/// Executes cake script out of process +/// +/// The context. +/// The script file. +/// +/// +/// CakeExecuteScript("./helloworld.cake"); +/// +/// +public void CakeExecuteScript(Cake.Core.IO.FilePath cakeScriptPath) +{ + Cake.Common.Tools.Cake.CakeAliases.CakeExecuteScript(Context, cakeScriptPath); +} + +/// +/// Executes cake script out of process +/// +/// The context. +/// The script file. +/// The settings . +/// +/// +/// CakeExecuteScript("./helloworld.cake", new CakeSettings{ ToolPath="./Cake.exe" }); +/// +/// +public void CakeExecuteScript(Cake.Core.IO.FilePath cakeScriptPath, Cake.Common.Tools.Cake.CakeSettings settings) +{ + Cake.Common.Tools.Cake.CakeAliases.CakeExecuteScript(Context, cakeScriptPath, settings); +} + +/// +/// Executes Cake expression out of process +/// +/// The context. +/// The cake expression +/// +/// +/// CakeExecuteExpression("Information(\"Hello {0}\", \"World\");"); +/// +/// +public void CakeExecuteExpression(System.String cakeExpression) +{ + Cake.Common.Tools.Cake.CakeAliases.CakeExecuteExpression(Context, cakeExpression); +} + +/// +/// Executes Cake expression out of process +/// +/// The context. +/// The cake expression +/// The settings . +/// +/// +/// CakeExecuteExpression( +/// "Information(\"Hello {0}!\", Argument<string>(\"name\"));", +/// new CakeSettings { +/// ToolPath="./Cake.exe" , +/// Arguments = new Dictionary<string, string>{{"name", "World"}} +/// }); +/// +/// +public void CakeExecuteExpression(System.String cakeExpression, Cake.Common.Tools.Cake.CakeSettings settings) +{ + Cake.Common.Tools.Cake.CakeAliases.CakeExecuteExpression(Context, cakeExpression, settings); +} + +/// +/// Creates a text transformation from the provided template. +/// +/// The context. +/// The template. +/// A representing the provided template. +/// +/// This sample shows how to create a using +/// the specified template. +/// +/// string text = TransformText("Hello <%subject%>!") +/// .WithToken("subject", "world") +/// .ToString(); +/// +/// +public Cake.Common.Text.TextTransformation TransformText(System.String template) +{ + return Cake.Common.Text.TextTransformationAliases.TransformText(Context, template); +} + +/// +/// Creates a text transformation from the provided template, using the specified placeholder. +/// +/// The context. +/// The template. +/// The left placeholder. +/// The right placeholder. +/// A representing the provided template. +/// +/// This sample shows how to create a using +/// the specified template and placeholder. +/// +/// string text = TransformText("Hello {subject}!", "{", "}") +/// .WithToken("subject", "world") +/// .ToString(); +/// +/// +public Cake.Common.Text.TextTransformation TransformText(System.String template, System.String leftPlaceholder, System.String rightPlaceholder) +{ + return Cake.Common.Text.TextTransformationAliases.TransformText(Context, template, leftPlaceholder, rightPlaceholder); +} + +/// +/// Creates a text transformation from the provided template on disc. +/// +/// The context. +/// The template file path. +/// A representing the provided template. +/// +/// This sample shows how to create a using +/// the specified template file with the placeholder format <%key%>. +/// +/// string text = TransformTextFile("./template.txt") +/// .WithToken("subject", "world") +/// .ToString(); +/// +/// +public Cake.Common.Text.TextTransformation TransformTextFile(Cake.Core.IO.FilePath path) +{ + return Cake.Common.Text.TextTransformationAliases.TransformTextFile(Context, path); +} + +/// +/// Creates a text transformation from the provided template on disc, using the specified placeholder. +/// +/// The context. +/// The template file path. +/// The left placeholder. +/// The right placeholder. +/// A representing the provided template. +/// +/// This sample shows how to create a using +/// the specified template file and placeholder. +/// +/// string text = TransformTextFile("./template.txt", "{", "}") +/// .WithToken("subject", "world") +/// .ToString(); +/// +/// +public Cake.Common.Text.TextTransformation TransformTextFile(Cake.Core.IO.FilePath path, System.String leftPlaceholder, System.String rightPlaceholder) +{ + return Cake.Common.Text.TextTransformationAliases.TransformTextFile(Context, path, leftPlaceholder, rightPlaceholder); +} + +/// +/// Parses project information from a solution file. +/// +/// The context. +/// The solution path. +/// A parsed solution. +/// +/// +/// var solutionPath = "./src/Cake.sln"; +/// Information("Parsing {0}", solutionPath); +/// var parsedSolution = ParseSolution(solutionPath); +/// foreach(var project in parsedSolution.Projects) +/// { +/// Information( +/// @"Solution project file: +/// Name: {0} +/// Path: {1} +/// Id : {2} +/// Type: {3}", +/// project.Name, +/// project.Path, +/// project.Id, +/// project.Type +/// ); +/// } +/// +/// +public Cake.Common.Solution.SolutionParserResult ParseSolution(Cake.Core.IO.FilePath solutionPath) +{ + return Cake.Common.Solution.SolutionAliases.ParseSolution(Context, solutionPath); +} + +/// +/// Parses project information from project file +/// +/// The context. +/// The project file path. +/// A parsed project. +/// +/// +/// var parsedProject = ParseProject("./src/Cake/Cake.csproj"); +/// Information( +/// @" Parsed project file: +/// Configuration : {0} +/// Platform : {1} +/// OutputType : {2} +/// OutputPath : {3} +/// RootNameSpace : {4} +/// AssemblyName : {5} +/// TargetFrameworkVersion: {6} +/// Files : {7}", +/// parsedProject.Configuration, +/// parsedProject.Platform, +/// parsedProject.OutputType, +/// parsedProject.OutputPath, +/// parsedProject.RootNameSpace, +/// parsedProject.AssemblyName, +/// parsedProject.TargetFrameworkVersion, +/// string.Concat( +/// parsedProject +/// .Files +/// .Select( +/// file=> string.Format( +/// "\r\n {0}", +/// file.FilePath +/// ) +/// ) +/// ) +/// ); +/// +/// +public Cake.Common.Solution.Project.ProjectParserResult ParseProject(Cake.Core.IO.FilePath projectPath) +{ + return Cake.Common.Solution.Project.ProjectAliases.ParseProject(Context, projectPath); +} + +/// +/// Parses Xml documentation example code from given path. +/// +/// The context. +/// The Path to the file to parse. +/// Parsed example code. +/// +/// +/// var exampleCodes = ParseXmlDocExampleCode("./Cake.Common.xml"); +/// foreach(var exampleCode in exampleCodes) +/// { +/// Information( +/// "{0}\r\n{1}", +/// exampleCode.Name, +/// exampleCode.Code +/// ); +/// } +/// +/// +public System.Collections.Generic.IEnumerable ParseXmlDocExampleCode(Cake.Core.IO.FilePath xmlFilePath) +{ + return Cake.Common.Solution.Project.XmlDoc.XmlDocAliases.ParseXmlDocExampleCode(Context, xmlFilePath); +} + +/// +/// Parses Xml documentation example code from file(s) using given pattern. +/// +/// The context. +/// The globber file pattern. +/// Parsed example code. +/// +/// +/// var filesExampleCodes = ParseXmlDocFilesExampleCode("./Cake.*.xml"); +/// foreach(var exampleCode in filesExampleCodes) +/// { +/// Information( +/// "{0}\r\n{1}", +/// exampleCode.Name, +/// exampleCode.Code +/// ); +/// } +/// +/// +public System.Collections.Generic.IEnumerable ParseXmlDocFilesExampleCode(System.String pattern) +{ + return Cake.Common.Solution.Project.XmlDoc.XmlDocAliases.ParseXmlDocFilesExampleCode(Context, pattern); +} + +/// +/// Creates an assembly information file. +/// +/// The context. +/// The output path. +/// The settings. +/// +/// +/// var file = "./SolutionInfo.cs"; +/// var version = "0.0.1"; +/// var buildNo = "123"; +/// var semVersion = string.Concat(version + "-" + buildNo); +/// CreateAssemblyInfo(file, new AssemblyInfoSettings { +/// Product = "SampleProject", +/// Version = version, +/// FileVersion = version, +/// InformationalVersion = semVersion, +/// Copyright = string.Format("Copyright (c) Contoso 2014 - {0}", DateTime.Now.Year) +/// }); +/// +/// +public void CreateAssemblyInfo(Cake.Core.IO.FilePath outputPath, Cake.Common.Solution.Project.Properties.AssemblyInfoSettings settings) +{ + Cake.Common.Solution.Project.Properties.AssemblyInfoAliases.CreateAssemblyInfo(Context, outputPath, settings); +} + +/// +/// Parses an existing assembly information file. +/// +/// The context. +/// The assembly info path. +/// The content of the assembly info file. +/// +/// +/// var assemblyInfo = ParseAssemblyInfo("./SolutionInfo.cs"); +/// Information("Version: {0}", assemblyInfo.AssemblyVersion); +/// Information("File version: {0}", assemblyInfo.AssemblyFileVersion); +/// Information("Informational version: {0}", assemblyInfo.AssemblyInformationalVersion); +/// +/// +public Cake.Common.Solution.Project.Properties.AssemblyInfoParseResult ParseAssemblyInfo(Cake.Core.IO.FilePath assemblyInfoPath) +{ + return Cake.Common.Solution.Project.Properties.AssemblyInfoAliases.ParseAssemblyInfo(Context, assemblyInfoPath); +} + +/// +/// Downloads the specified resource over HTTP to a temporary file. +/// +/// +/// +/// var resource = DownloadFile("http://www.example.org/index.html"); +/// +/// +/// The context. +/// The URL of the resource to download. +/// The path to the downloaded file. +public Cake.Core.IO.FilePath DownloadFile(System.String address) +{ + return Cake.Common.Net.HttpAliases.DownloadFile(Context, address); +} + +/// +/// Downloads the specified resource over HTTP to a temporary file with specified settings. +/// +/// +/// +/// var resource = DownloadFile("http://www.example.org/index.html", new DownloadFileSettings() +/// { +/// Username = "bob", +/// Password = "builder" +/// }); +/// +/// +/// The context. +/// The URL of the resource to download. +/// The settings. +/// The path to the downloaded file. +public Cake.Core.IO.FilePath DownloadFile(System.String address, Cake.Common.Net.DownloadFileSettings settings) +{ + return Cake.Common.Net.HttpAliases.DownloadFile(Context, address, settings); +} + +/// +/// Downloads the specified resource over HTTP to a temporary file. +/// +/// +/// +/// var address = new Uri("http://www.example.org/index.html"); +/// var resource = DownloadFile(address); +/// +/// +/// The context. +/// The URL of file to download. +/// The path to the downloaded file. +public Cake.Core.IO.FilePath DownloadFile(System.Uri address) +{ + return Cake.Common.Net.HttpAliases.DownloadFile(Context, address); +} + +/// +/// Downloads the specified resource over HTTP to a temporary file with specified settings. +/// +/// +/// +/// var address = new Uri("http://www.example.org/index.html"); +/// var resource = DownloadFile(address, new DownloadFileSettings() +/// { +/// Username = "bob", +/// Password = "builder" +/// }); +/// +/// +/// The context. +/// The URL of file to download. +/// The settings. +/// The path to the downloaded file. +public Cake.Core.IO.FilePath DownloadFile(System.Uri address, Cake.Common.Net.DownloadFileSettings settings) +{ + return Cake.Common.Net.HttpAliases.DownloadFile(Context, address, settings); +} + +/// +/// Downloads the specified resource over HTTP to the specified output path. +/// +/// +/// +/// var outputPath = File("./index.html"); +/// DownloadFile("http://www.example.org/index.html", outputPath); +/// +/// +/// The context. +/// The URL of the resource to download. +/// The output path. +public void DownloadFile(System.String address, Cake.Core.IO.FilePath outputPath) +{ + Cake.Common.Net.HttpAliases.DownloadFile(Context, address, outputPath); +} + +/// +/// Downloads the specified resource over HTTP to the specified output path and settings. +/// +/// +/// +/// var outputPath = File("./index.html"); +/// DownloadFile("http://www.example.org/index.html", outputPath, new DownloadFileSettings() +/// { +/// Username = "bob", +/// Password = "builder" +/// }); +/// +/// +/// The context. +/// The URL of the resource to download. +/// The output path. +/// The settings. +public void DownloadFile(System.String address, Cake.Core.IO.FilePath outputPath, Cake.Common.Net.DownloadFileSettings settings) +{ + Cake.Common.Net.HttpAliases.DownloadFile(Context, address, outputPath, settings); +} + +/// +/// Downloads the specified resource over HTTP to the specified output path. +/// +/// +/// +/// var address = new Uri("http://www.example.org/index.html"); +/// var outputPath = File("./index.html"); +/// DownloadFile(address, outputPath, new DownloadFileSettings() +/// { +/// Username = "bob", +/// Password = "builder" +/// }); +/// +/// +/// The context. +/// The URL of the resource to download. +/// The output path. +/// The settings. +public void DownloadFile(System.Uri address, Cake.Core.IO.FilePath outputPath, Cake.Common.Net.DownloadFileSettings settings) +{ + Cake.Common.Net.HttpAliases.DownloadFile(Context, address, outputPath, settings); +} + +/// +/// Uploads the specified file via a HTTP POST to the specified uri using multipart/form-data. +/// +/// +/// +/// var address = new Uri("http://www.example.org/upload"); +/// UploadFile(address, @"path/to/file.txt"); +/// +/// +/// The context. +/// The URL of the upload resource. +/// The file to upload. +public void UploadFile(System.Uri address, Cake.Core.IO.FilePath filePath) +{ + Cake.Common.Net.HttpAliases.UploadFile(Context, address, filePath); +} + +/// +/// Uploads the specified file via a HTTP POST to the specified uri using multipart/form-data. +/// +/// +/// +/// var address = "http://www.example.org/upload"; +/// UploadFile(address, @"path/to/file.txt"); +/// +/// +/// The context. +/// The URL of the upload resource. +/// The file to upload. +public void UploadFile(System.String address, Cake.Core.IO.FilePath filePath) +{ + Cake.Common.Net.HttpAliases.UploadFile(Context, address, filePath); +} + +/// +/// Uploads the specified byte array via a HTTP POST to the specified uri using multipart/form-data. +/// +/// +/// +/// var address = new Uri("http://www.example.org/upload"); +/// UploadFile(address, @"path/to/file.txt"); +/// +/// +/// The context. +/// The URL of the upload resource. +/// The data to upload. +/// The filename to give the uploaded data +public void UploadFile(System.Uri address, System.Byte[] data, System.String fileName) +{ + Cake.Common.Net.HttpAliases.UploadFile(Context, address, data, fileName); +} + +/// +/// Uploads the specified byte array via a HTTP POST to the specified uri using multipart/form-data. +/// +/// +/// +/// var address = "http://www.example.org/upload"; +/// UploadFile(address, @"path/to/file.txt"); +/// +/// +/// The context. +/// The URL of the upload resource. +/// The data to upload. +/// The filename to give the uploaded data +public void UploadFile(System.String address, System.Byte[] data, System.String fileName) +{ + Cake.Common.Net.HttpAliases.UploadFile(Context, address, data, fileName); +} + +/// +/// Gets a directory path from string. +/// +/// +/// +/// // Get the temp directory. +/// var root = Directory("./"); +/// var temp = root + Directory("temp"); +/// +/// // Clean the directory. +/// CleanDirectory(temp); +/// +/// +/// The context. +/// The path. +/// A directory path. +public Cake.Common.IO.Paths.ConvertableDirectoryPath Directory(System.String path) +{ + return Cake.Common.IO.DirectoryAliases.Directory(Context, path); +} + +/// +/// Deletes the specified directories. +/// +/// +/// +/// var directoriesToDelete = new DirectoryPath[]{ +/// Directory("be"), +/// Directory("gone") +/// }; +/// DeleteDirectories(directoriesToDelete, recursive:true); +/// +/// +/// The context. +/// The directory paths. +/// Will perform a recursive delete if set to true. +public void DeleteDirectories(System.Collections.Generic.IEnumerable directories, System.Boolean recursive = false) +{ + Context.Log.Warning("Warning: The alias DeleteDirectories has been made obsolete. Use the overload that accepts DeleteDirectorySettings instead."); + #pragma warning disable 0618 + Cake.Common.IO.DirectoryAliases.DeleteDirectories(Context, directories, recursive); + #pragma warning restore 0618 +} + +/// +/// Deletes the specified directories. +/// +/// +/// +/// var directoriesToDelete = new DirectoryPath[]{ +/// Directory("be"), +/// Directory("gone") +/// }; +/// DeleteDirectories(directoriesToDelete, new DeleteDirectorySettings { +/// Recursive = true, +/// Force = true +/// }); +/// +/// +/// The context. +/// The directory paths. +/// The delete settings. +public void DeleteDirectories(System.Collections.Generic.IEnumerable directories, Cake.Common.IO.DeleteDirectorySettings settings) +{ + Cake.Common.IO.DirectoryAliases.DeleteDirectories(Context, directories, settings); +} + +/// +/// Deletes the specified directories. +/// +/// +/// +/// var directoriesToDelete = new []{ +/// "be", +/// "gone" +/// }; +/// DeleteDirectories(directoriesToDelete, recursive:true); +/// +/// +/// The context. +/// The directory paths. +/// Will perform a recursive delete if set to true. +public void DeleteDirectories(System.Collections.Generic.IEnumerable directories, System.Boolean recursive = false) +{ + Context.Log.Warning("Warning: The alias DeleteDirectories has been made obsolete. Use the overload that accepts DeleteDirectorySettings instead."); + #pragma warning disable 0618 + Cake.Common.IO.DirectoryAliases.DeleteDirectories(Context, directories, recursive); + #pragma warning restore 0618 +} + +/// +/// Deletes the specified directories. +/// +/// +/// +/// var directoriesToDelete = new []{ +/// "be", +/// "gone" +/// }; +/// DeleteDirectories(directoriesToDelete, new DeleteDirectorySettings { +/// Recursive = true, +/// Force = true +/// }); +/// +/// +/// The context. +/// The directory paths. +/// The delete settings. +public void DeleteDirectories(System.Collections.Generic.IEnumerable directories, Cake.Common.IO.DeleteDirectorySettings settings) +{ + Cake.Common.IO.DirectoryAliases.DeleteDirectories(Context, directories, settings); +} + +/// +/// Deletes the specified directory. +/// +/// +/// +/// DeleteDirectory("./be/gone", recursive:true); +/// +/// +/// The context. +/// The directory path. +/// Will perform a recursive delete if set to true. +public void DeleteDirectory(Cake.Core.IO.DirectoryPath path, System.Boolean recursive = false) +{ + Context.Log.Warning("Warning: The alias DeleteDirectory has been made obsolete. Use the overload that accepts DeleteDirectorySettings instead."); + #pragma warning disable 0618 + Cake.Common.IO.DirectoryAliases.DeleteDirectory(Context, path, recursive); + #pragma warning restore 0618 +} + +/// +/// Deletes the specified directory. +/// +/// +/// +/// DeleteDirectory("./be/gone", new DeleteDirectorySettings { +/// Recursive = true, +/// Force = true +/// }); +/// +/// +/// The context. +/// The directory path. +/// The delete settings. +public void DeleteDirectory(Cake.Core.IO.DirectoryPath path, Cake.Common.IO.DeleteDirectorySettings settings) +{ + Cake.Common.IO.DirectoryAliases.DeleteDirectory(Context, path, settings); +} + +/// +/// Cleans the directories matching the specified pattern. +/// Cleaning the directory will remove all its content but not the directory itself. +/// +/// +/// +/// CleanDirectories("./src/**/bin/debug"); +/// +/// +/// The context. +/// The pattern to match. +public void CleanDirectories(System.String pattern) +{ + Cake.Common.IO.DirectoryAliases.CleanDirectories(Context, pattern); +} + +/// +/// Cleans the directories matching the specified pattern. +/// Cleaning the directory will remove all its content but not the directory itself. +/// +/// +/// +/// Func<IFileSystemInfo, bool> exclude_node_modules = +/// fileSystemInfo=>!fileSystemInfo.Path.FullPath.EndsWith( +/// "node_modules", +/// StringComparison.OrdinalIgnoreCase); +/// CleanDirectories("./src/**/bin/debug", exclude_node_modules); +/// +/// +/// The context. +/// The pattern to match. +/// The predicate used to filter directories based on file system information. +public void CleanDirectories(System.String pattern, System.Func predicate) +{ + Cake.Common.IO.DirectoryAliases.CleanDirectories(Context, pattern, predicate); +} + +/// +/// Cleans the specified directories. +/// Cleaning a directory will remove all its content but not the directory itself. +/// +/// +/// +/// var directoriesToClean = GetDirectories("./src/**/bin/"); +/// CleanDirectories(directoriesToClean); +/// +/// +/// The context. +/// The directory paths. +public void CleanDirectories(System.Collections.Generic.IEnumerable directories) +{ + Cake.Common.IO.DirectoryAliases.CleanDirectories(Context, directories); +} + +/// +/// Cleans the specified directories. +/// Cleaning a directory will remove all its content but not the directory itself. +/// +/// +/// +/// var directoriesToClean = new []{ +/// "./src/Cake/obj", +/// "./src/Cake.Common/obj" +/// }; +/// CleanDirectories(directoriesToClean); +/// +/// +/// The context. +/// The directory paths. +public void CleanDirectories(System.Collections.Generic.IEnumerable directories) +{ + Cake.Common.IO.DirectoryAliases.CleanDirectories(Context, directories); +} + +/// +/// Cleans the specified directory. +/// +/// +/// +/// CleanDirectory("./src/Cake.Common/obj"); +/// +/// +/// The context. +/// The directory path. +public void CleanDirectory(Cake.Core.IO.DirectoryPath path) +{ + Cake.Common.IO.DirectoryAliases.CleanDirectory(Context, path); +} + +/// +/// Cleans the specified directory. +/// +/// +/// +/// CleanDirectory("./src/Cake.Common/obj", fileSystemInfo=>!fileSystemInfo.Hidden); +/// +/// +/// The context. +/// The directory path. +/// Predicate used to determine which files/directories should get deleted. +public void CleanDirectory(Cake.Core.IO.DirectoryPath path, System.Func predicate) +{ + Cake.Common.IO.DirectoryAliases.CleanDirectory(Context, path, predicate); +} + +/// +/// Creates the specified directory. +/// +/// +/// +/// CreateDirectory("publish"); +/// +/// +/// The context. +/// The directory path. +public void CreateDirectory(Cake.Core.IO.DirectoryPath path) +{ + Cake.Common.IO.DirectoryAliases.CreateDirectory(Context, path); +} + +/// +/// Creates the specified directory if it does not exist. +/// +/// +/// +/// EnsureDirectoryExists("publish"); +/// +/// +/// The context. +/// The directory path. +public void EnsureDirectoryExists(Cake.Core.IO.DirectoryPath path) +{ + Cake.Common.IO.DirectoryAliases.EnsureDirectoryExists(Context, path); +} + +/// +/// Copies the contents of a directory, including subdirectories to the specified location. +/// +/// +/// +/// CopyDirectory("source_path", "destination_path"); +/// +/// +/// The context. +/// The source directory path. +/// The destination directory path. +public void CopyDirectory(Cake.Core.IO.DirectoryPath source, Cake.Core.IO.DirectoryPath destination) +{ + Cake.Common.IO.DirectoryAliases.CopyDirectory(Context, source, destination); +} + +/// +/// Determines whether the given path refers to an existing directory. +/// +/// +/// +/// var dir = "publish"; +/// if (!DirectoryExists(dir)) +/// { +/// CreateDirectory(dir); +/// } +/// +/// +/// The context. +/// The to check. +/// +/// true if refers to an existing directory; +/// false if the directory does not exist or an error occurs when trying to +/// determine if the specified path exists. +public System.Boolean DirectoryExists(Cake.Core.IO.DirectoryPath path) +{ + return Cake.Common.IO.DirectoryAliases.DirectoryExists(Context, path); +} + +/// +/// Makes the path absolute (if relative) using the current working directory. +/// +/// +/// +/// var path = MakeAbsolute(Directory("./resources")); +/// +/// +/// The context. +/// The path. +/// An absolute directory path. +public Cake.Core.IO.DirectoryPath MakeAbsolute(Cake.Core.IO.DirectoryPath path) +{ + return Cake.Common.IO.DirectoryAliases.MakeAbsolute(Context, path); +} + +/// +/// Moves an existing directory to a new location, providing the option to specify a new directory name. +/// +/// The context. +/// The directory path. +/// The target directory path. +/// +/// +/// MoveDirectory("mydir", "newparent/newdir"); +/// +/// +public void MoveDirectory(Cake.Core.IO.DirectoryPath directoryPath, Cake.Core.IO.DirectoryPath targetDirectoryPath) +{ + Cake.Common.IO.DirectoryAliases.MoveDirectory(Context, directoryPath, targetDirectoryPath); +} + +/// +/// Gets a list of all the directories inside a directory. +/// +/// +/// +/// var directories = GetSubDirectories("some/dir"); +/// +/// +/// The context. +/// The directory path. +/// An absolute directory path. +public Cake.Core.IO.DirectoryPathCollection GetSubDirectories(Cake.Core.IO.DirectoryPath directoryPath) +{ + return Cake.Common.IO.DirectoryAliases.GetSubDirectories(Context, directoryPath); +} + +/// +/// Gets a file path from string. +/// +/// +/// +/// // Get the temp file. +/// var root = Directory("./"); +/// var temp = root + File("temp"); +/// +/// // Delete the file. +/// CleanDirectory(temp); +/// +/// +/// The context. +/// The path. +/// A file path. +public Cake.Common.IO.Paths.ConvertableFilePath File(System.String path) +{ + return Cake.Common.IO.FileAliases.File(Context, path); +} + +/// +/// Copies an existing file to a new location. +/// +/// The context. +/// The file path. +/// The target directory path. +/// +/// +/// CopyFileToDirectory("test.txt", "./targetdir"); +/// +/// +public void CopyFileToDirectory(Cake.Core.IO.FilePath filePath, Cake.Core.IO.DirectoryPath targetDirectoryPath) +{ + Cake.Common.IO.FileAliases.CopyFileToDirectory(Context, filePath, targetDirectoryPath); +} + +/// +/// Copies an existing file to a new file, providing the option to specify a new file name. +/// +/// The context. +/// The file path. +/// The target file path. +/// +/// +/// CopyFile("test.tmp", "test.txt"); +/// +/// +public void CopyFile(Cake.Core.IO.FilePath filePath, Cake.Core.IO.FilePath targetFilePath) +{ + Cake.Common.IO.FileAliases.CopyFile(Context, filePath, targetFilePath); +} + +/// +/// Copies all files matching the provided pattern to a new location. +/// +/// The context. +/// The pattern. +/// The target directory path. +/// +/// +/// CopyFiles("Cake.*", "./publish"); +/// +/// +public void CopyFiles(System.String pattern, Cake.Core.IO.DirectoryPath targetDirectoryPath) +{ + Cake.Common.IO.FileAliases.CopyFiles(Context, pattern, targetDirectoryPath); +} + +/// +/// Copies existing files to a new location. +/// +/// The context. +/// The file paths. +/// The target directory path. +/// +/// +/// var files = GetFiles("./**/Cake.*"); +/// CopyFiles(files, "destination"); +/// +/// +public void CopyFiles(System.Collections.Generic.IEnumerable filePaths, Cake.Core.IO.DirectoryPath targetDirectoryPath) +{ + Cake.Common.IO.FileAliases.CopyFiles(Context, filePaths, targetDirectoryPath); +} + +/// +/// Copies existing files to a new location. +/// +/// The context. +/// The file paths. +/// The target directory path. +/// +/// +/// CreateDirectory("destination"); +/// var files = new [] { +/// "Cake.exe", +/// "Cake.pdb" +/// }; +/// CopyFiles(files, "destination"); +/// +/// +public void CopyFiles(System.Collections.Generic.IEnumerable filePaths, Cake.Core.IO.DirectoryPath targetDirectoryPath) +{ + Cake.Common.IO.FileAliases.CopyFiles(Context, filePaths, targetDirectoryPath); +} + +/// +/// Copies all files matching the provided pattern to a new location. +/// +/// The context. +/// The pattern. +/// The target directory path. +/// Keep the folder structure. +/// +/// +/// CopyFiles("Cake.*", "./publish"); +/// +/// +public void CopyFiles(System.String pattern, Cake.Core.IO.DirectoryPath targetDirectoryPath, System.Boolean preserveFolderStructure) +{ + Cake.Common.IO.FileAliases.CopyFiles(Context, pattern, targetDirectoryPath, preserveFolderStructure); +} + +/// +/// Copies existing files to a new location. +/// +/// The context. +/// The file paths. +/// The target directory path. +/// Keep the folder structure. +/// +/// +/// var files = GetFiles("./**/Cake.*"); +/// CopyFiles(files, "destination"); +/// +/// +public void CopyFiles(System.Collections.Generic.IEnumerable filePaths, Cake.Core.IO.DirectoryPath targetDirectoryPath, System.Boolean preserveFolderStructure) +{ + Cake.Common.IO.FileAliases.CopyFiles(Context, filePaths, targetDirectoryPath, preserveFolderStructure); +} + +/// +/// Copies existing files to a new location. +/// +/// The context. +/// The file paths. +/// The target directory path. +/// Keep the folder structure. +/// +/// +/// CreateDirectory("destination"); +/// var files = new [] { +/// "Cake.exe", +/// "Cake.pdb" +/// }; +/// CopyFiles(files, "destination"); +/// +/// +public void CopyFiles(System.Collections.Generic.IEnumerable filePaths, Cake.Core.IO.DirectoryPath targetDirectoryPath, System.Boolean preserveFolderStructure) +{ + Cake.Common.IO.FileAliases.CopyFiles(Context, filePaths, targetDirectoryPath, preserveFolderStructure); +} + +/// +/// Moves an existing file to a new location. +/// +/// The context. +/// The file path. +/// The target directory path. +/// +/// +/// MoveFileToDirectory("test.txt", "./targetdir"); +/// +/// +public void MoveFileToDirectory(Cake.Core.IO.FilePath filePath, Cake.Core.IO.DirectoryPath targetDirectoryPath) +{ + Cake.Common.IO.FileAliases.MoveFileToDirectory(Context, filePath, targetDirectoryPath); +} + +/// +/// Moves existing files matching the specified pattern to a new location. +/// +/// The context. +/// The pattern. +/// The target directory path. +/// +/// +/// MoveFiles("./publish/Cake.*", "./destination"); +/// +/// +public void MoveFiles(System.String pattern, Cake.Core.IO.DirectoryPath targetDirectoryPath) +{ + Cake.Common.IO.FileAliases.MoveFiles(Context, pattern, targetDirectoryPath); +} + +/// +/// Moves existing files to a new location. +/// +/// The context. +/// The file paths. +/// The target directory path. +/// +/// +/// var files = GetFiles("./publish/Cake.*"); +/// MoveFiles(files, "destination"); +/// +/// +public void MoveFiles(System.Collections.Generic.IEnumerable filePaths, Cake.Core.IO.DirectoryPath targetDirectoryPath) +{ + Cake.Common.IO.FileAliases.MoveFiles(Context, filePaths, targetDirectoryPath); +} + +/// +/// Moves an existing file to a new location, providing the option to specify a new file name. +/// +/// The context. +/// The file path. +/// The target file path. +/// +/// +/// MoveFile("test.tmp", "test.txt"); +/// +/// +public void MoveFile(Cake.Core.IO.FilePath filePath, Cake.Core.IO.FilePath targetFilePath) +{ + Cake.Common.IO.FileAliases.MoveFile(Context, filePath, targetFilePath); +} + +/// +/// Deletes the specified files. +/// +/// The context. +/// The pattern. +/// +/// +/// DeleteFiles("./publish/Cake.*"); +/// +/// +public void DeleteFiles(System.String pattern) +{ + Cake.Common.IO.FileAliases.DeleteFiles(Context, pattern); +} + +/// +/// Deletes the specified files. +/// +/// The context. +/// The file paths. +/// +/// +/// var files = GetFiles("./destination/Cake.*"); +/// DeleteFiles(files); +/// +/// +public void DeleteFiles(System.Collections.Generic.IEnumerable filePaths) +{ + Cake.Common.IO.FileAliases.DeleteFiles(Context, filePaths); +} + +/// +/// Deletes the specified file. +/// +/// The context. +/// The file path. +/// +/// +/// DeleteFile("deleteme.txt"); +/// +/// +public void DeleteFile(Cake.Core.IO.FilePath filePath) +{ + Cake.Common.IO.FileAliases.DeleteFile(Context, filePath); +} + +/// +/// Determines whether the given path refers to an existing file. +/// +/// The context. +/// The to check. +/// +/// true if refers to an existing file; +/// false if the file does not exist or an error occurs when trying to +/// determine if the specified file exists. +/// +/// +/// if (FileExists("findme.txt")) +/// { +/// Information("File exists!"); +/// } +/// +/// +public System.Boolean FileExists(Cake.Core.IO.FilePath filePath) +{ + return Cake.Common.IO.FileAliases.FileExists(Context, filePath); +} + +/// +/// Makes the path absolute (if relative) using the current working directory. +/// +/// The context. +/// The path. +/// An absolute file path. +/// +/// +/// var path = MakeAbsolute(File("./resources")); +/// +/// +public Cake.Core.IO.FilePath MakeAbsolute(Cake.Core.IO.FilePath path) +{ + return Cake.Common.IO.FileAliases.MakeAbsolute(Context, path); +} + +/// +/// Gets the size of a file in bytes. +/// +/// The context. +/// The path. +/// Size of file in bytes or -1 if file doesn't exist. +/// +/// +/// Information("File size: {0}", FileSize("./build.cake")); +/// +/// +public System.Int64 FileSize(Cake.Core.IO.FilePath filePath) +{ + return Cake.Common.IO.FileAliases.FileSize(Context, filePath); +} + +/// +/// Gets all files matching the specified pattern. +/// +/// +/// +/// var files = GetFiles("./**/Cake.*.dll"); +/// foreach(var file in files) +/// { +/// Information("File: {0}", file); +/// } +/// +/// +/// The context. +/// The glob pattern to match. +/// A . +public Cake.Core.IO.FilePathCollection GetFiles(System.String pattern) +{ + return Cake.Common.IO.GlobbingAliases.GetFiles(Context, pattern); +} + +/// +/// Gets all files matching the specified pattern. +/// +/// +/// +/// Func<IFileSystemInfo, bool> exclude_node_modules = +/// fileSystemInfo => !fileSystemInfo.Path.FullPath.EndsWith( +/// "node_modules", StringComparison.OrdinalIgnoreCase); +/// +/// var files = GetFiles("./**/Cake.*.dll", exclude_node_modules); +/// foreach(var file in files) +/// { +/// Information("File: {0}", file); +/// } +/// +/// +/// The context. +/// The glob pattern to match. +/// The predicate used to filter directories based on file system information. +/// A . +public Cake.Core.IO.FilePathCollection GetFiles(System.String pattern, System.Func predicate) +{ + return Cake.Common.IO.GlobbingAliases.GetFiles(Context, pattern, predicate); +} + +/// +/// Gets all directory matching the specified pattern. +/// +/// +/// +/// var directories = GetDirectories("./src/**/obj/*"); +/// foreach(var directory in directories) +/// { +/// Information("Directory: {0}", directory); +/// } +/// +/// +/// The context. +/// The glob pattern to match. +/// A . +public Cake.Core.IO.DirectoryPathCollection GetDirectories(System.String pattern) +{ + return Cake.Common.IO.GlobbingAliases.GetDirectories(Context, pattern); +} + +/// +/// Gets all directory matching the specified pattern. +/// +/// +/// +/// Func<IFileSystemInfo, bool> exclude_node_modules = +/// fileSystemInfo => !fileSystemInfo.Path.FullPath.EndsWith( +/// "node_modules", StringComparison.OrdinalIgnoreCase); +/// +/// var directories = GetDirectories("./src/**/obj/*", exclude_node_modules); +/// foreach(var directory in directories) +/// { +/// Information("Directory: {0}", directory); +/// } +/// +/// +/// The context. +/// The glob pattern to match. +/// The predicate used to filter directories based on file system information. +/// A . +public Cake.Core.IO.DirectoryPathCollection GetDirectories(System.String pattern, System.Func predicate) +{ + return Cake.Common.IO.GlobbingAliases.GetDirectories(Context, pattern, predicate); +} + +/// +/// Zips the specified directory. +/// +/// The context. +/// The root path. +/// The output path. +/// +/// +/// Zip("./publish", "publish.zip"); +/// +/// +public void Zip(Cake.Core.IO.DirectoryPath rootPath, Cake.Core.IO.FilePath outputPath) +{ + Cake.Common.IO.ZipAliases.Zip(Context, rootPath, outputPath); +} + +/// +/// Zips the files matching the specified pattern. +/// +/// The context. +/// The root path. +/// The output path. +/// The pattern. +/// +/// +/// Zip("./", "xmlfiles.zip", "./*.xml"); +/// +/// +public void Zip(Cake.Core.IO.DirectoryPath rootPath, Cake.Core.IO.FilePath outputPath, System.String pattern) +{ + Cake.Common.IO.ZipAliases.Zip(Context, rootPath, outputPath, pattern); +} + +/// +/// Zips the specified files. +/// +/// The context. +/// The root path. +/// The output path. +/// The file paths. +/// +/// +/// var files = GetFiles("./**/Cake.*.dll"); +/// Zip("./", "cakeassemblies.zip", files); +/// +/// +public void Zip(Cake.Core.IO.DirectoryPath rootPath, Cake.Core.IO.FilePath outputPath, System.Collections.Generic.IEnumerable filePaths) +{ + Cake.Common.IO.ZipAliases.Zip(Context, rootPath, outputPath, filePaths); +} + +/// +/// Zips the specified files. +/// +/// The context. +/// The root path. +/// The output path. +/// The file paths. +/// +/// +/// var files = new [] { +/// "./src/Cake/bin/Debug/Autofac.dll", +/// "./src/Cake/bin/Debug/Cake.Common.dll", +/// "./src/Cake/bin/Debug/Cake.Core.dll", +/// "./src/Cake/bin/Debug/Cake.exe" +/// }; +/// Zip("./", "cakebinaries.zip", files); +/// +/// +public void Zip(Cake.Core.IO.DirectoryPath rootPath, Cake.Core.IO.FilePath outputPath, System.Collections.Generic.IEnumerable filePaths) +{ + Cake.Common.IO.ZipAliases.Zip(Context, rootPath, outputPath, filePaths); +} + +/// +/// Unzips the specified file +/// +/// The context. +/// Zip file to unzip. +/// Output path to unzip into. +/// +/// +/// Unzip("Cake.zip", "./cake"); +/// +/// +public void Unzip(Cake.Core.IO.FilePath zipFile, Cake.Core.IO.DirectoryPath outputPath) +{ + Cake.Common.IO.ZipAliases.Unzip(Context, zipFile, outputPath); +} + +/// +/// Writes an error message to the log using the specified format information. +/// +/// The context. +/// The format. +/// The arguments. +/// +/// +/// Error("Hello {0}! Today is an {1:dddd}", "World", DateTime.Now); +/// +/// +public void Error(System.String format, params System.Object[] args) +{ + Cake.Common.Diagnostics.LoggingAliases.Error(Context, format, args); +} + +/// +/// Writes an error message to the log using the specified log message action. +/// Evaluation message only if verbosity same or more verbose. +/// +/// the context. +/// The function called for message when logging. +/// +/// +/// Error(logAction=>logAction("Hello {0}! Today is an {1:dddd}", "World", DateTime.Now)); +/// +/// +public void Error(Cake.Core.Diagnostics.LogAction logAction) +{ + Cake.Common.Diagnostics.LoggingAliases.Error(Context, logAction); +} + +/// +/// Writes an error message to the log using the specified value. +/// +/// the context. +/// The value. +/// +/// +/// Error(new {FirstName = "John", LastName="Doe"}); +/// +/// +public void Error(System.Object value) +{ + Cake.Common.Diagnostics.LoggingAliases.Error(Context, value); +} + +/// +/// Writes an error message to the log using the specified string value. +/// +/// the context. +/// The value. +/// +/// +/// Error("{string}"); +/// +/// +public void Error(System.String value) +{ + Cake.Common.Diagnostics.LoggingAliases.Error(Context, value); +} + +/// +/// Writes a warning message to the log using the specified format information. +/// +/// The context. +/// The format. +/// The arguments. +/// +/// +/// Warning("Hello {0}! Today is an {1:dddd}", "World", DateTime.Now); +/// +/// +public void Warning(System.String format, params System.Object[] args) +{ + Cake.Common.Diagnostics.LoggingAliases.Warning(Context, format, args); +} + +/// +/// Writes a warning message to the log using the specified log message action. +/// Evaluation message only if verbosity same or more verbose. +/// +/// the context. +/// The function called for message when logging. +/// +/// +/// Warning(logAction=>logAction("Hello {0}! Today is an {1:dddd}", "World", DateTime.Now)); +/// +/// +public void Warning(Cake.Core.Diagnostics.LogAction logAction) +{ + Cake.Common.Diagnostics.LoggingAliases.Warning(Context, logAction); +} + +/// +/// Writes an warning message to the log using the specified value. +/// +/// the context. +/// The value. +/// +/// +/// Warning(new {FirstName = "John", LastName="Doe"}); +/// +/// +public void Warning(System.Object value) +{ + Cake.Common.Diagnostics.LoggingAliases.Warning(Context, value); +} + +/// +/// Writes an warning message to the log using the specified string value. +/// +/// the context. +/// The value. +/// +/// +/// Warning("{string}"); +/// +/// +public void Warning(System.String value) +{ + Cake.Common.Diagnostics.LoggingAliases.Warning(Context, value); +} + +/// +/// Writes an informational message to the log using the specified format information. +/// +/// The context. +/// The format. +/// The arguments. +/// +/// +/// Information("Hello {0}! Today is an {1:dddd}", "World", DateTime.Now); +/// +/// +public void Information(System.String format, params System.Object[] args) +{ + Cake.Common.Diagnostics.LoggingAliases.Information(Context, format, args); +} + +/// +/// Writes an informational message to the log using the specified log message action. +/// Evaluation message only if verbosity same or more verbose. +/// +/// the context. +/// The function called for message when logging. +/// +/// +/// Information(logAction=>logAction("Hello {0}! Today is an {1:dddd}", "World", DateTime.Now)); +/// +/// +public void Information(Cake.Core.Diagnostics.LogAction logAction) +{ + Cake.Common.Diagnostics.LoggingAliases.Information(Context, logAction); +} + +/// +/// Writes an informational message to the log using the specified value. +/// +/// The context. +/// The value. +/// +/// +/// Information(new {FirstName = "John", LastName="Doe"}); +/// +/// +public void Information(System.Object value) +{ + Cake.Common.Diagnostics.LoggingAliases.Information(Context, value); +} + +/// +/// Writes an informational message to the log using the specified string value. +/// +/// The context. +/// The value. +/// +/// +/// Information("{string}"); +/// +/// +public void Information(System.String value) +{ + Cake.Common.Diagnostics.LoggingAliases.Information(Context, value); +} + +/// +/// Writes a verbose message to the log using the specified format information. +/// +/// The context. +/// The format. +/// The arguments. +/// +/// +/// Verbose("Hello {0}! Today is an {1:dddd}", "World", DateTime.Now); +/// +/// +public void Verbose(System.String format, params System.Object[] args) +{ + Cake.Common.Diagnostics.LoggingAliases.Verbose(Context, format, args); +} + +/// +/// Writes a verbose message to the log using the specified log message action. +/// Evaluation message only if verbosity same or more verbose. +/// +/// the context. +/// The function called for message when logging. +/// +/// +/// Verbose(logAction=>logAction("Hello {0}! Today is an {1:dddd}", "World", DateTime.Now)); +/// +/// +public void Verbose(Cake.Core.Diagnostics.LogAction logAction) +{ + Cake.Common.Diagnostics.LoggingAliases.Verbose(Context, logAction); +} + +/// +/// Writes a verbose message to the log using the specified value. +/// +/// The context. +/// The value. +/// +/// +/// Verbose(new {FirstName = "John", LastName="Doe"}); +/// +/// +public void Verbose(System.Object value) +{ + Cake.Common.Diagnostics.LoggingAliases.Verbose(Context, value); +} + +/// +/// Writes a verbose message to the log using the specified string value. +/// +/// The context. +/// The value. +/// +/// +/// Verbose("{string}"); +/// +/// +public void Verbose(System.String value) +{ + Cake.Common.Diagnostics.LoggingAliases.Verbose(Context, value); +} + +/// +/// Writes a debug message to the log using the specified format information. +/// +/// The context. +/// The format. +/// The arguments. +/// +/// +/// Debug("Hello {0}! Today is an {1:dddd}", "World", DateTime.Now); +/// +/// +public void Debug(System.String format, params System.Object[] args) +{ + Cake.Common.Diagnostics.LoggingAliases.Debug(Context, format, args); +} + +/// +/// Writes a debug message to the log using the specified log message action. +/// Evaluation message only if verbosity same or more verbose. +/// +/// the context. +/// The function called for message when logging. +/// +/// +/// Debug(logAction=>logAction("Hello {0}! Today is an {1:dddd}", "World", DateTime.Now)); +/// +/// +public void Debug(Cake.Core.Diagnostics.LogAction logAction) +{ + Cake.Common.Diagnostics.LoggingAliases.Debug(Context, logAction); +} + +/// +/// Writes a debug message to the log using the specified value. +/// +/// the context. +/// The value. +/// +/// +/// Debug(new {FirstName = "John", LastName="Doe"}); +/// +/// +public void Debug(System.Object value) +{ + Cake.Common.Diagnostics.LoggingAliases.Debug(Context, value); +} + +/// +/// Writes a debug message to the log using the specified string value. +/// +/// the context. +/// The value. +/// +/// +/// Debug("{string}"); +/// +/// +public void Debug(System.String value) +{ + Cake.Common.Diagnostics.LoggingAliases.Debug(Context, value); +} + +/// +/// Gets a instance that can +/// be used to query for information about the current build system. +/// +/// +/// +/// var isLocal = BuildSystem.IsLocalBuild; +/// +/// +/// The context. +/// A instance. +private Cake.Common.Build.BuildSystem _BuildSystem; +public Cake.Common.Build.BuildSystem BuildSystem +{ + get + { + if (_BuildSystem==null) + { + _BuildSystem = Cake.Common.Build.BuildSystemAliases.BuildSystem(Context); + } + return _BuildSystem; + } +} + +/// +/// Gets a instance that can +/// be used to manipulate the AppVeyor environment. +/// +/// +/// +/// var isAppVeyorBuild = AppVeyor.IsRunningOnAppVeyor; +/// +/// +/// The context. +/// A instance. +private Cake.Common.Build.AppVeyor.IAppVeyorProvider _AppVeyor; +public Cake.Common.Build.AppVeyor.IAppVeyorProvider AppVeyor +{ + get + { + if (_AppVeyor==null) + { + _AppVeyor = Cake.Common.Build.BuildSystemAliases.AppVeyor(Context); + } + return _AppVeyor; + } +} + +/// +/// Gets a instance that can +/// be used to manipulate the TeamCity environment. +/// +/// +/// +/// var isTeamCityBuild = TeamCity.IsRunningOnTeamCity; +/// +/// +/// The context. +/// A instance. +private Cake.Common.Build.TeamCity.ITeamCityProvider _TeamCity; +public Cake.Common.Build.TeamCity.ITeamCityProvider TeamCity +{ + get + { + if (_TeamCity==null) + { + _TeamCity = Cake.Common.Build.BuildSystemAliases.TeamCity(Context); + } + return _TeamCity; + } +} + +/// +/// Gets a instance that can +/// be used to manipulate the MyGet environment. +/// +/// +/// +/// var isMyGetBuild = MyGet.IsRunningOnMyGet; +/// +/// +/// The context. +/// A instance. +private Cake.Common.Build.MyGet.IMyGetProvider _MyGet; +public Cake.Common.Build.MyGet.IMyGetProvider MyGet +{ + get + { + if (_MyGet==null) + { + _MyGet = Cake.Common.Build.BuildSystemAliases.MyGet(Context); + } + return _MyGet; + } +} + +/// +/// Gets a instance that can +/// be used to manipulate the Bamboo environment. +/// +/// +/// +/// var isBambooBuild = Bamboo.IsRunningOnBamboo; +/// +/// +/// The context. +/// A instance. +private Cake.Common.Build.Bamboo.IBambooProvider _Bamboo; +public Cake.Common.Build.Bamboo.IBambooProvider Bamboo +{ + get + { + if (_Bamboo==null) + { + _Bamboo = Cake.Common.Build.BuildSystemAliases.Bamboo(Context); + } + return _Bamboo; + } +} + +/// +/// Gets a instance that can +/// be used to manipulate the Continua CI environment. +/// +/// +/// +/// var isContinuaCIBuild = ContinuaCI.IsRunningContinuaCI; +/// +/// +/// The context. +/// A instance. +private Cake.Common.Build.ContinuaCI.IContinuaCIProvider _ContinuaCI; +public Cake.Common.Build.ContinuaCI.IContinuaCIProvider ContinuaCI +{ + get + { + if (_ContinuaCI==null) + { + _ContinuaCI = Cake.Common.Build.BuildSystemAliases.ContinuaCI(Context); + } + return _ContinuaCI; + } +} + +/// +/// Gets a instance that can be used to +/// obtain information from the Jenkins environment. +/// +/// +/// +/// var isJenkinsBuild = Jenkins.IsRunningOnJenkins; +/// +/// +/// The context. +/// A instance. +private Cake.Common.Build.Jenkins.IJenkinsProvider _Jenkins; +public Cake.Common.Build.Jenkins.IJenkinsProvider Jenkins +{ + get + { + if (_Jenkins==null) + { + _Jenkins = Cake.Common.Build.BuildSystemAliases.Jenkins(Context); + } + return _Jenkins; + } +} + +/// +/// Gets a instance that can be used to +/// obtain information from the Bitrise environment. +/// +/// +/// +/// var isBitriseBuild = Bitrise.IsRunningOnBitrise; +/// +/// +/// The context. +/// A instance. +private Cake.Common.Build.Bitrise.IBitriseProvider _Bitrise; +public Cake.Common.Build.Bitrise.IBitriseProvider Bitrise +{ + get + { + if (_Bitrise==null) + { + _Bitrise = Cake.Common.Build.BuildSystemAliases.Bitrise(Context); + } + return _Bitrise; + } +} + +/// +/// Gets a instance that can be used to +/// obtain information from the Travis CI environment. +/// +/// +/// +/// var isTravisCIBuild = TravisCI.IsRunningOnTravisCI; +/// +/// +/// The context. +/// A instance. +private Cake.Common.Build.TravisCI.ITravisCIProvider _TravisCI; +public Cake.Common.Build.TravisCI.ITravisCIProvider TravisCI +{ + get + { + if (_TravisCI==null) + { + _TravisCI = Cake.Common.Build.BuildSystemAliases.TravisCI(Context); + } + return _TravisCI; + } +} + +/// +/// Gets a instance that can be used to +/// obtain information from the Bitbucket Pipelines environment. +/// +/// +/// +/// var isBitbucketPipelinesBuild = BitbucketPipelines.IsRunningOnBitbucketPipelines; +/// +/// +/// The context. +/// A instance. +private Cake.Common.Build.BitbucketPipelines.IBitbucketPipelinesProvider _BitbucketPipelines; +public Cake.Common.Build.BitbucketPipelines.IBitbucketPipelinesProvider BitbucketPipelines +{ + get + { + if (_BitbucketPipelines==null) + { + _BitbucketPipelines = Cake.Common.Build.BuildSystemAliases.BitbucketPipelines(Context); + } + return _BitbucketPipelines; + } +} + +/// +/// Gets a instance that can be used to +/// obtain information from the Go.CD environment. +/// +/// +/// +/// var isGoCDBuild = GoCD.IsRunningOnGoCD; +/// +/// +/// The context. +/// A instance. +private Cake.Common.Build.GoCD.IGoCDProvider _GoCD; +public Cake.Common.Build.GoCD.IGoCDProvider GoCD +{ + get + { + if (_GoCD==null) + { + _GoCD = Cake.Common.Build.BuildSystemAliases.GoCD(Context); + } + return _GoCD; + } +} + +/// +/// Gets a instance that can be used to +/// obtain information from the GitLab CI environment. +/// +/// +/// +/// var isGitLabCIBuild = GitLabCI.IsRunningOnGitLabCI; +/// +/// +/// The context. +/// A instance. +private Cake.Common.Build.GitLabCI.IGitLabCIProvider _GitLabCI; +public Cake.Common.Build.GitLabCI.IGitLabCIProvider GitLabCI +{ + get + { + if (_GitLabCI==null) + { + _GitLabCI = Cake.Common.Build.BuildSystemAliases.GitLabCI(Context); + } + return _GitLabCI; + } +} + +/// +/// Gets a instance that can be used to +/// obtain information from the Team Foundation Build environment. +/// +/// +/// +/// var isTFSBuild = TFBuild.IsRunningOnTFS; +/// +/// +/// The context. +/// A instance. +private Cake.Common.Build.TFBuild.ITFBuildProvider _TFBuild; +public Cake.Common.Build.TFBuild.ITFBuildProvider TFBuild +{ + get + { + if (_TFBuild==null) + { + _TFBuild = Cake.Common.Build.BuildSystemAliases.TFBuild(Context); + } + return _TFBuild; + } +} + +#line 1 "C:/Work/single.cake" +public class Foo +{ + public static Foo Create() + { + return new Foo(); + } + + public void Bar() + { + return; + } +} diff --git a/tests/OmniSharp.Cake.Tests/TestAssets/single.cake.txt b/tests/OmniSharp.Cake.Tests/TestAssets/single.cake.txt new file mode 100644 index 0000000000..abe74d291e --- /dev/null +++ b/tests/OmniSharp.Cake.Tests/TestAssets/single.cake.txt @@ -0,0 +1,12 @@ +public class Foo +{ + public static Foo Create() + { + return new Foo(); + } + + public void Bar() + { + return; + } +} \ No newline at end of file From 3f61d568d117ab43a88cf6adec0951c9fb0138fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Bj=C3=B6rkstr=C3=B6m?= Date: Fri, 25 Aug 2017 16:10:49 +0300 Subject: [PATCH 21/38] Support method and property aliases in gotodefinition handler. --- src/OmniSharp.Cake/Constants.cs | 6 + .../Services/CakeScriptService.cs | 3 + .../Navigation/GotoDefinitionHandler.cs | 113 +++++++++++++++++- 3 files changed, 118 insertions(+), 4 deletions(-) diff --git a/src/OmniSharp.Cake/Constants.cs b/src/OmniSharp.Cake/Constants.cs index a5ec4fc44d..ec1c4a8614 100644 --- a/src/OmniSharp.Cake/Constants.cs +++ b/src/OmniSharp.Cake/Constants.cs @@ -10,6 +10,12 @@ public static class LanguageNames public static class Paths { public const string Tools = "Paths_Tools"; + public const string Generated = "B3437BF2-8AE3-4281-8726-B926BB9DF75D"; + } + + public static class Directive + { + public const string Generated = "#line 1 \""+Paths.Generated+"\""; } } } diff --git a/src/OmniSharp.Cake/Services/CakeScriptService.cs b/src/OmniSharp.Cake/Services/CakeScriptService.cs index 3efafd58ab..0e2ee300f4 100644 --- a/src/OmniSharp.Cake/Services/CakeScriptService.cs +++ b/src/OmniSharp.Cake/Services/CakeScriptService.cs @@ -51,6 +51,9 @@ public CakeScript Generate(FileChange fileChange) { var cakeScript = _generationService.Generate(fileChange); + // Set line processor for generated aliases. TODO: Move to Cake.Bakery + cakeScript.Source = cakeScript.Source.Insert(0, $"{Constants.Directive.Generated}\n"); + // Check if references changed if (!_cachedReferences.TryGetValue(fileChange.FileName, out var references)) { diff --git a/src/OmniSharp.Cake/Services/RequestHandlers/Navigation/GotoDefinitionHandler.cs b/src/OmniSharp.Cake/Services/RequestHandlers/Navigation/GotoDefinitionHandler.cs index 231f8a8455..98165412fb 100644 --- a/src/OmniSharp.Cake/Services/RequestHandlers/Navigation/GotoDefinitionHandler.cs +++ b/src/OmniSharp.Cake/Services/RequestHandlers/Navigation/GotoDefinitionHandler.cs @@ -1,25 +1,130 @@ +using System; using System.Composition; +using System.Linq; +using System.Threading; using System.Threading.Tasks; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.FindSymbols; +using Microsoft.CodeAnalysis.Text; using OmniSharp.Cake.Extensions; using OmniSharp.Mef; using OmniSharp.Models.GotoDefinition; +using OmniSharp.Models.Metadata; +using OmniSharp.Roslyn; namespace OmniSharp.Cake.Services.RequestHandlers.Navigation { [OmniSharpHandler(OmniSharpEndpoints.GotoDefinition, Constants.LanguageNames.Cake), Shared] public class GotoDefinitionHandler : CakeRequestHandler { + private readonly MetadataHelper _metadataHelper; + [ImportingConstructor] public GotoDefinitionHandler( - OmniSharpWorkspace workspace) + OmniSharpWorkspace workspace, + MetadataHelper metadataHelper) : base(workspace) { + _metadataHelper = metadataHelper ?? throw new ArgumentNullException(nameof(metadataHelper)); } - protected override Task TranslateResponse(GotoDefinitionResponse response, GotoDefinitionRequest request) + protected override async Task TranslateResponse(GotoDefinitionResponse response, GotoDefinitionRequest request) { - // TODO: If outside range, it's an alias. Then fetch metadata. - return Task.FromResult(response); + if (string.IsNullOrEmpty(response.FileName) || + !response.FileName.Equals(Constants.Paths.Generated)) + { + return response; + } + + if (!request.WantMetadata) + { + return new GotoDefinitionResponse(); + } + + return await GetAliasFromMetadataAsync(new GotoDefinitionRequest + { + Line = response.Line, + Column = response.Column, + FileName = request.FileName, + Timeout = request.Timeout, + WantMetadata = true + }); + } + + private async Task GetAliasFromMetadataAsync(GotoDefinitionRequest request) + { + var document = Workspace.GetDocument(request.FileName); + var response = new GotoDefinitionResponse(); + var lineIndex = request.Line + 3; + var column = 0; + + if (document == null) + { + return response; + } + + var semanticModel = await document.GetSemanticModelAsync(); + var sourceText = await document.GetTextAsync(); + var sourceLine = sourceText.Lines[lineIndex].ToString(); + if (sourceLine.Contains("(Context")) + { + column = sourceLine.IndexOf("(Context", StringComparison.Ordinal); + } + else + { + lineIndex = request.Line + 7; + sourceLine = sourceText.Lines[lineIndex].ToString(); + if (sourceLine.Contains("(Context")) + { + column = sourceLine.IndexOf("(Context", StringComparison.Ordinal); + } + else + { + return response; + } + } + var position = sourceText.Lines.GetPosition(new LinePosition(lineIndex, column)); + var symbol = await SymbolFinder.FindSymbolAtPositionAsync(semanticModel, position, Workspace); + + if (symbol == null || symbol is INamespaceSymbol) + { + return response; + } + if (symbol is IMethodSymbol method) + { + symbol = method.PartialImplementationPart ?? symbol; + } + + var location = symbol.Locations.First(); + + if (!location.IsInMetadata) + { + return response; + } + var cancellationSource = new CancellationTokenSource(TimeSpan.FromMilliseconds(request.Timeout)); + var (metadataDocument, _) = await _metadataHelper.GetAndAddDocumentFromMetadata(document.Project, symbol, cancellationSource.Token); + if (metadataDocument == null) + { + return response; + } + + cancellationSource = new CancellationTokenSource(TimeSpan.FromMilliseconds(request.Timeout)); + var metadataLocation = await _metadataHelper.GetSymbolLocationFromMetadata(symbol, metadataDocument, cancellationSource.Token); + var lineSpan = metadataLocation.GetMappedLineSpan(); + + response = new GotoDefinitionResponse + { + Line = lineSpan.StartLinePosition.Line, + Column = lineSpan.StartLinePosition.Character, + MetadataSource = new MetadataSource() + { + AssemblyName = symbol.ContainingAssembly.Name, + ProjectName = document.Project.Name, + TypeName = _metadataHelper.GetSymbolName(symbol) + }, + }; + + return response; } } } From 729914908d76ba7a82cef51075b737ef8b1f1fcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Bj=C3=B6rkstr=C3=B6m?= Date: Sat, 23 Sep 2017 23:00:49 +0300 Subject: [PATCH 22/38] Git ignore launchSettings.json --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index d8cdcb14c2..c9027fa0b5 100644 --- a/.gitignore +++ b/.gitignore @@ -47,3 +47,6 @@ tools/* # VS Code /.vscode/settings.json /.vscode/launch.json + +# VS +launchSettings.json From 7340b9f0c5a4fb39ae2a7d0b573fc88a2ad466d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Bj=C3=B6rkstr=C3=B6m?= Date: Fri, 6 Oct 2017 01:26:25 +0300 Subject: [PATCH 23/38] Git ignore Rider stuff --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index c9027fa0b5..6475828809 100644 --- a/.gitignore +++ b/.gitignore @@ -50,3 +50,6 @@ tools/* # VS launchSettings.json + +# Rider +.idea/ From 753ebfe43399efab8832863ba14df54ed784bdc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Bj=C3=B6rkstr=C3=B6m?= Date: Fri, 6 Oct 2017 01:31:24 +0300 Subject: [PATCH 24/38] Initial tests for Cake handlers. --- .gitignore | 4 + build.cake | 19 +++ build.json | 6 +- scripts/common.cake | 1 + .../Services/CakeScriptService.cs | 9 +- .../test-projects/CakeProject/build.cake | 15 +++ .../test-projects/CakeProject/foo.cake | 12 ++ .../CakeProject/tools/packages.config | 4 + .../OmniSharp.Cake.Tests/AutoCompleteFacts.cs | 124 ++++++++++++++++++ .../CakeProjectSystemFacts.cs | 48 +++++++ .../CakeSingleRequestHandlerTestFixture.cs | 28 ++++ .../OmniSharp.Cake.Tests.csproj | 9 +- tests/TestUtility/OmniSharpTestHost.cs | 4 +- tests/TestUtility/TestUtility.csproj | 1 + 14 files changed, 272 insertions(+), 12 deletions(-) create mode 100644 test-assets/test-projects/CakeProject/build.cake create mode 100644 test-assets/test-projects/CakeProject/foo.cake create mode 100644 test-assets/test-projects/CakeProject/tools/packages.config create mode 100644 tests/OmniSharp.Cake.Tests/AutoCompleteFacts.cs create mode 100644 tests/OmniSharp.Cake.Tests/CakeProjectSystemFacts.cs create mode 100644 tests/OmniSharp.Cake.Tests/CakeSingleRequestHandlerTestFixture.cs diff --git a/.gitignore b/.gitignore index 6475828809..ca7cbe5127 100644 --- a/.gitignore +++ b/.gitignore @@ -44,6 +44,10 @@ scripts/Omnisharp* tools/* !tools/packages.config +# Test assets +test-assets/**/tools/* +!test-assets/**/tools/packages.config + # VS Code /.vscode/settings.json /.vscode/launch.json diff --git a/build.cake b/build.cake index f9297f9637..3be7178337 100644 --- a/build.cake +++ b/build.cake @@ -353,6 +353,25 @@ 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", + "https://www.myget.org/F/cake/api/v3/index.json" + } + }); + } }); void BuildProject(BuildEnvironment env, string projectName, string projectFilePath, string configuration, string outputType = null) diff --git a/build.json b/build.json index 62cb645ead..ec863d291f 100644 --- a/build.json +++ b/build.json @@ -25,7 +25,8 @@ "OmniSharp.Stdio.Tests", "OmniSharp.DotNet.Tests", "OmniSharp.DotNetTest.Tests", - "OmniSharp.Tests" + "OmniSharp.Tests", + "OmniSharp.Cake.Tests" ], "TestAssets": [ "NUnitTestProject", @@ -42,5 +43,8 @@ "LegacyXunitTestProject", "LegacyMSTestProject", "LegacyProjectJsonApp" + ], + "CakeTestAssets": [ + "CakeProject" ] } diff --git a/scripts/common.cake b/scripts/common.cake index c61c5c8995..7dd0275f96 100644 --- a/scripts/common.cake +++ b/scripts/common.cake @@ -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) { diff --git a/src/OmniSharp.Cake/Services/CakeScriptService.cs b/src/OmniSharp.Cake/Services/CakeScriptService.cs index 0e2ee300f4..66af7d393f 100644 --- a/src/OmniSharp.Cake/Services/CakeScriptService.cs +++ b/src/OmniSharp.Cake/Services/CakeScriptService.cs @@ -13,9 +13,9 @@ namespace OmniSharp.Cake.Services { [Export(typeof(ICakeScriptService)), Shared] - public sealed class CakeScriptService : ICakeScriptService + public sealed class CakeScriptService : ICakeScriptService, IDisposable { - private readonly IScriptGenerationService _generationService; + private readonly ScriptGenerationClient _generationService; private readonly IDictionary> _cachedReferences; private readonly IDictionary> _cachedUsings; @@ -92,5 +92,10 @@ private void OnUsingsChanged(UsingsChangedEventArgs e) { UsingsChanged?.Invoke(this, e); } + + public void Dispose() + { + _generationService?.Dispose(); + } } } diff --git a/test-assets/test-projects/CakeProject/build.cake b/test-assets/test-projects/CakeProject/build.cake new file mode 100644 index 0000000000..3d906bc55d --- /dev/null +++ b/test-assets/test-projects/CakeProject/build.cake @@ -0,0 +1,15 @@ +var target = Argument("target", "Default"); + +#load foo.cake + +Task("Default") + .Does(() => +{ + Foo + .Create() + .Bar(); + + Information("Hello World!"); +}); + +RunTarget(target); diff --git a/test-assets/test-projects/CakeProject/foo.cake b/test-assets/test-projects/CakeProject/foo.cake new file mode 100644 index 0000000000..abe74d291e --- /dev/null +++ b/test-assets/test-projects/CakeProject/foo.cake @@ -0,0 +1,12 @@ +public class Foo +{ + public static Foo Create() + { + return new Foo(); + } + + public void Bar() + { + return; + } +} \ No newline at end of file diff --git a/test-assets/test-projects/CakeProject/tools/packages.config b/test-assets/test-projects/CakeProject/tools/packages.config new file mode 100644 index 0000000000..4505ff4bcc --- /dev/null +++ b/test-assets/test-projects/CakeProject/tools/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/tests/OmniSharp.Cake.Tests/AutoCompleteFacts.cs b/tests/OmniSharp.Cake.Tests/AutoCompleteFacts.cs new file mode 100644 index 0000000000..1f16bf3f07 --- /dev/null +++ b/tests/OmniSharp.Cake.Tests/AutoCompleteFacts.cs @@ -0,0 +1,124 @@ +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using OmniSharp.Cake.Services.RequestHandlers.Intellisense; +using OmniSharp.Models.AutoComplete; +using OmniSharp.Models.UpdateBuffer; +using TestUtility; +using Xunit; +using Xunit.Abstractions; + +namespace OmniSharp.Cake.Tests +{ + public class AutoCompleteFacts : CakeSingleRequestHandlerTestFixture + { + private readonly ILogger _logger; + + public AutoCompleteFacts(ITestOutputHelper testOutput) : base(testOutput) + { + _logger = LoggerFactory.CreateLogger(); + } + + protected override string EndpointName => OmniSharpEndpoints.AutoComplete; + + [Fact] + public async Task ShouldGenerateFromHostObject() + { + const string input = @"Task$$"; + + var completions = await FindCompletionsAsync(input, wantSnippet: true); + ContainsCompletions(completions.Select(c => c.DisplayText).Take(1), "Task(string name)"); + } + + + private async Task> FindCompletionsAsync(string source, bool wantSnippet = false) + { + using (var testProject = await TestAssets.Instance.GetTestProjectAsync("CakeProject", shadowCopy : false)) + using (var host = CreateOmniSharpHost(testProject.Directory)) + { + var testFile = new TestFile(Path.Combine(testProject.Directory, "build.cake"), source); + var point = testFile.Content.GetPointFromPosition(); + + var request = new AutoCompleteRequest + { + Line = point.Line, + Column = point.Offset, + FileName = testFile.FileName, + Buffer = testFile.Content.Code, + WordToComplete = GetPartialWord(testFile.Content), + WantMethodHeader = true, + WantSnippet = wantSnippet, + WantReturnType = true + }; + + var updateBufferRequest = new UpdateBufferRequest + { + Buffer = request.Buffer, + Column = request.Column, + FileName = request.FileName, + Line = request.Line, + FromDisk = false + }; + + await GetUpdateBufferHandler(host).Handle(updateBufferRequest); + + var requestHandler = GetRequestHandler(host); + + return await requestHandler.Handle(request); + } + } + + private static string GetPartialWord(TestContent testConnect) + { + if (!testConnect.HasPosition || testConnect.Position == 0) + { + return string.Empty; + } + + var index = testConnect.Position; + while (index >= 1) + { + var ch = testConnect.Code[index - 1]; + if (ch != '_' && !char.IsLetterOrDigit(ch)) + { + break; + } + + index--; + } + + return testConnect.Code.Substring(index, testConnect.Position - index); + } + + private void ContainsCompletions(IEnumerable completions, params string[] expected) + { + if (!completions.SequenceEqual(expected)) + { + var builder = new StringBuilder(); + builder.AppendLine("Expected"); + builder.AppendLine("--------"); + + foreach (var completion in expected) + { + builder.AppendLine(completion); + } + + builder.AppendLine(); + builder.AppendLine("Found"); + builder.AppendLine("-----"); + + foreach (var completion in completions) + { + builder.AppendLine(completion); + } + + _logger.LogError(builder.ToString()); + } + + Assert.Equal(expected, completions.ToArray()); + } + } +} diff --git a/tests/OmniSharp.Cake.Tests/CakeProjectSystemFacts.cs b/tests/OmniSharp.Cake.Tests/CakeProjectSystemFacts.cs new file mode 100644 index 0000000000..6e6b0c7222 --- /dev/null +++ b/tests/OmniSharp.Cake.Tests/CakeProjectSystemFacts.cs @@ -0,0 +1,48 @@ +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using OmniSharp.Models.WorkspaceInformation; +using OmniSharp.MSBuild.Models; +using OmniSharp.Services; +using TestUtility; +using Xunit; +using Xunit.Abstractions; + +namespace OmniSharp.Cake.Tests +{ + public class CakeProjectSystemFacts : AbstractTestFixture + { + public CakeProjectSystemFacts(ITestOutputHelper output) + : base(output) + { + } + + [Fact] + public async Task ShouldGetProjects() + { + using (var testProject = await TestAssets.Instance.GetTestProjectAsync("CakeProject", shadowCopy : false)) + using (var host = CreateOmniSharpHost(testProject.Directory)) + { + var workspaceInfo = await GetWorkspaceInfoAsync(host); + + Assert.Equal(2, workspaceInfo.Projects.Count()); + Assert.Contains("build.cake", workspaceInfo.Projects.Select(p => Path.GetFileName(p.Path))); + Assert.Contains("foo.cake", workspaceInfo.Projects.Select(p => Path.GetFileName(p.Path))); + } + } + + private static async Task GetWorkspaceInfoAsync(OmniSharpTestHost host) + { + var service = host.GetWorkspaceInformationService(); + + var request = new WorkspaceInformationRequest + { + ExcludeSourceFiles = false + }; + + var response = await service.Handle(request); + + return (CakeContextModelCollection)response["Cake"]; + } + } +} diff --git a/tests/OmniSharp.Cake.Tests/CakeSingleRequestHandlerTestFixture.cs b/tests/OmniSharp.Cake.Tests/CakeSingleRequestHandlerTestFixture.cs new file mode 100644 index 0000000000..259a184e4e --- /dev/null +++ b/tests/OmniSharp.Cake.Tests/CakeSingleRequestHandlerTestFixture.cs @@ -0,0 +1,28 @@ +using OmniSharp.Cake.Services.RequestHandlers.Buffer; +using OmniSharp.Mef; +using TestUtility; +using Xunit.Abstractions; + +namespace OmniSharp.Cake.Tests +{ + public abstract class CakeSingleRequestHandlerTestFixture : AbstractTestFixture + where TRequestHandler : IRequestHandler + { + protected CakeSingleRequestHandlerTestFixture(ITestOutputHelper testOutput) + : base(testOutput) + { + } + + protected abstract string EndpointName { get; } + + protected TRequestHandler GetRequestHandler(OmniSharpTestHost host) + { + return host.GetRequestHandler(EndpointName, Constants.LanguageNames.Cake); + } + + protected UpdateBufferHandler GetUpdateBufferHandler(OmniSharpTestHost host) + { + return host.GetRequestHandler(OmniSharpEndpoints.UpdateBuffer, Constants.LanguageNames.Cake); + } + } +} diff --git a/tests/OmniSharp.Cake.Tests/OmniSharp.Cake.Tests.csproj b/tests/OmniSharp.Cake.Tests/OmniSharp.Cake.Tests.csproj index 6ff2c27368..afc3ceea30 100644 --- a/tests/OmniSharp.Cake.Tests/OmniSharp.Cake.Tests.csproj +++ b/tests/OmniSharp.Cake.Tests/OmniSharp.Cake.Tests.csproj @@ -1,36 +1,29 @@ - net46 true AnyCPU true - - - - - - - + \ No newline at end of file diff --git a/tests/TestUtility/OmniSharpTestHost.cs b/tests/TestUtility/OmniSharpTestHost.cs index b77d151f36..61824f9412 100644 --- a/tests/TestUtility/OmniSharpTestHost.cs +++ b/tests/TestUtility/OmniSharpTestHost.cs @@ -8,6 +8,7 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; using OmniSharp; +using OmniSharp.Cake; using OmniSharp.DotNet; using OmniSharp.DotNetTest.Models; using OmniSharp.Eventing; @@ -33,7 +34,8 @@ public class OmniSharpTestHost : DisposableObject typeof(RunTestRequest).GetTypeInfo().Assembly, // OmniSharp.DotNetTest typeof(MSBuildProjectSystem).GetTypeInfo().Assembly, // OmniSharp.MSBuild typeof(OmniSharpWorkspace).GetTypeInfo().Assembly, // OmniSharp.Roslyn - typeof(RoslynFeaturesHostServicesProvider).GetTypeInfo().Assembly // OmniSharp.Roslyn.CSharp + typeof(RoslynFeaturesHostServicesProvider).GetTypeInfo().Assembly, // OmniSharp.Roslyn.CSharp + typeof(CakeProjectSystem).GetTypeInfo().Assembly, // OmniSharp.Cake }); private readonly TestServiceProvider _serviceProvider; diff --git a/tests/TestUtility/TestUtility.csproj b/tests/TestUtility/TestUtility.csproj index 3376ef0d58..f33ce183c1 100644 --- a/tests/TestUtility/TestUtility.csproj +++ b/tests/TestUtility/TestUtility.csproj @@ -12,6 +12,7 @@ + From 6d99493fd9f669ff665c38f8491384fd5c94b7da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Bj=C3=B6rkstr=C3=B6m?= Date: Tue, 10 Oct 2017 22:18:33 +0300 Subject: [PATCH 25/38] Catch any exception when parsing configuration. --- .../Configuration/CakeConfiguration.cs | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/OmniSharp.Cake/Configuration/CakeConfiguration.cs b/src/OmniSharp.Cake/Configuration/CakeConfiguration.cs index 31bd539478..8e9c58f450 100644 --- a/src/OmniSharp.Cake/Configuration/CakeConfiguration.cs +++ b/src/OmniSharp.Cake/Configuration/CakeConfiguration.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.Composition; using System.IO; +using Microsoft.Extensions.Logging; using OmniSharp.Cake.Configuration.Parser; namespace OmniSharp.Cake.Configuration @@ -16,7 +17,7 @@ internal sealed class CakeConfiguration : ICakeConfiguration private readonly Dictionary _lookup; [ImportingConstructor] - public CakeConfiguration(IOmniSharpEnvironment environment) + public CakeConfiguration(IOmniSharpEnvironment environment, ILoggerFactory loggerFactory) { _lookup = new Dictionary(StringComparer.OrdinalIgnoreCase); @@ -24,11 +25,20 @@ public CakeConfiguration(IOmniSharpEnvironment environment) var configurationPath = Path.Combine(environment.TargetDirectory, "cake.config"); if (File.Exists(configurationPath)) { - var parser = new ConfigurationParser(); - var configuration = parser.Read(configurationPath); - foreach (var key in configuration.Keys) + try { - _lookup[KeyNormalizer.Normalize(key)] = configuration[key]; + var parser = new ConfigurationParser(); + var configuration = parser.Read(configurationPath); + foreach (var key in configuration.Keys) + { + _lookup[KeyNormalizer.Normalize(key)] = configuration[key]; + } + } + catch (Exception ex) + { + loggerFactory + .CreateLogger() + .LogError(ex, "Error occured while parsing Cake configuration."); } } } From a295267a08cebd577181007b0a32e65ce8a6555f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Bj=C3=B6rkstr=C3=B6m?= Date: Tue, 10 Oct 2017 23:26:54 +0300 Subject: [PATCH 26/38] Use package versions from packages.props --- build/Packages.props | 1 + src/OmniSharp.Cake/OmniSharp.Cake.csproj | 6 +++--- .../OmniSharp.Cake.Tests.csproj | 13 ++++++++++--- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/build/Packages.props b/build/Packages.props index f7de2c33ed..aa7277201a 100644 --- a/build/Packages.props +++ b/build/Packages.props @@ -2,6 +2,7 @@ + 0.1.0-unstable0091 2.0.3 1.1.0 1.1.0 diff --git a/src/OmniSharp.Cake/OmniSharp.Cake.csproj b/src/OmniSharp.Cake/OmniSharp.Cake.csproj index 473bde13b8..a97658214f 100644 --- a/src/OmniSharp.Cake/OmniSharp.Cake.csproj +++ b/src/OmniSharp.Cake/OmniSharp.Cake.csproj @@ -12,8 +12,8 @@ - - - + + + diff --git a/tests/OmniSharp.Cake.Tests/OmniSharp.Cake.Tests.csproj b/tests/OmniSharp.Cake.Tests/OmniSharp.Cake.Tests.csproj index afc3ceea30..ba6d4542fd 100644 --- a/tests/OmniSharp.Cake.Tests/OmniSharp.Cake.Tests.csproj +++ b/tests/OmniSharp.Cake.Tests/OmniSharp.Cake.Tests.csproj @@ -1,29 +1,36 @@ + net46 true AnyCPU true + + + + - - - + + + + + \ No newline at end of file From 65518ba08f51c825e29f66f29abe599d461a767b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Bj=C3=B6rkstr=C3=B6m?= Date: Tue, 17 Oct 2017 22:52:51 +0300 Subject: [PATCH 27/38] Handle incremental changes. --- .../Extensions/RequestExtensions.cs | 18 +++ .../OmniSharp.Cake.Tests/UpdateBufferFacts.cs | 115 ++++++++++++++++++ 2 files changed, 133 insertions(+) create mode 100644 tests/OmniSharp.Cake.Tests/UpdateBufferFacts.cs diff --git a/src/OmniSharp.Cake/Extensions/RequestExtensions.cs b/src/OmniSharp.Cake/Extensions/RequestExtensions.cs index 87ea1ea7eb..75bf5ba69d 100644 --- a/src/OmniSharp.Cake/Extensions/RequestExtensions.cs +++ b/src/OmniSharp.Cake/Extensions/RequestExtensions.cs @@ -11,6 +11,24 @@ public static async Task TranslateAsync(this TRequest reques { request.Line = await LineIndexHelper.TranslateToGenerated(request.FileName, request.Line, workspace); + if (request.Changes == null) + { + return request; + } + + var changes = new List(); + foreach (var change in request.Changes) + { + var oldStartLine = change.StartLine; + change.StartLine = await LineIndexHelper.TranslateToGenerated(request.FileName, change.StartLine, workspace); + change.EndLine = oldStartLine == change.EndLine ? + change.StartLine : + await LineIndexHelper.TranslateToGenerated(request.FileName, change.EndLine, workspace); + + changes.Add(change); + } + request.Changes = changes; + return request; } } diff --git a/tests/OmniSharp.Cake.Tests/UpdateBufferFacts.cs b/tests/OmniSharp.Cake.Tests/UpdateBufferFacts.cs new file mode 100644 index 0000000000..463acc4b66 --- /dev/null +++ b/tests/OmniSharp.Cake.Tests/UpdateBufferFacts.cs @@ -0,0 +1,115 @@ +using System; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using OmniSharp.Cake.Services.RequestHandlers.Buffer; +using OmniSharp.Models; +using OmniSharp.Models.UpdateBuffer; +using TestUtility; +using Xunit; +using Xunit.Abstractions; + +namespace OmniSharp.Cake.Tests +{ + public class UpdateBufferFacts : CakeSingleRequestHandlerTestFixture + { + private const string CakeBuildSrc = + @"var target = Argument(""target"", ""Default""); + +Task(""Default"") + .Does(() => +{ + Information(""Hello World!""); +}); + +RunTarget(target);"; + private const string CakeBuildModified = + @"var target = Argument(""target"", ""Foobar""); + +Task(""Foobar"") + .Does(() => +{ + Verbose(""Hello World!""); +}); + +RunTarget(target);"; + + public UpdateBufferFacts(ITestOutputHelper testOutput) : base(testOutput) + { + } + + protected override string EndpointName => OmniSharpEndpoints.UpdateBuffer; + + [Fact] + public async Task ShouldSupportIncrementalChanges() + { + using (var testProject = await TestAssets.Instance.GetTestProjectAsync("CakeProject", shadowCopy: false)) + using (var host = CreateOmniSharpHost(testProject.Directory)) + { + var fileName = Path.Combine(testProject.Directory, "build.cake"); + + var updateBufferRequest = new UpdateBufferRequest + { + FileName = fileName, + Buffer = CakeBuildSrc, + FromDisk = false + }; + await GetUpdateBufferHandler(host).Handle(updateBufferRequest); + + updateBufferRequest = new UpdateBufferRequest + { + FileName = fileName, + FromDisk = false, + Changes = new[] + { + new LinePositionSpanTextChange + { + StartLine = 0, + StartColumn = 33, + EndLine = 0, + EndColumn = 40, + NewText = "Foobar" + }, + new LinePositionSpanTextChange + { + StartLine = 2, + StartColumn = 6, + EndLine = 2, + EndColumn = 13, + NewText = "Foobar" + }, + new LinePositionSpanTextChange + { + StartLine = 5, + StartColumn = 2, + EndLine = 5, + EndColumn = 13, + NewText = "Verbose" + } + } + }; + await GetUpdateBufferHandler(host).Handle(updateBufferRequest); + + var sourceText = await host.Workspace.GetDocument(fileName).GetTextAsync(); + var fullPath = Path.GetFullPath(fileName).Replace('\\', '/'); + var startIndex = 0; + for (var i = sourceText.Lines.Count - 1; i >= 0; i--) + { + var text = sourceText.Lines[i].ToString(); + + if (text.Equals($"#line 1 \"{fullPath}\"", StringComparison.OrdinalIgnoreCase)) + { + startIndex = i + 1; + break; + } + } + + var expectedLines = CakeBuildModified.Split('\n').ToList(); + for (var i = 0; i < expectedLines.Count; i++) + { + Assert.Equal(sourceText.Lines[startIndex + i].ToString(), expectedLines[i].TrimEnd('\r', '\n')); + } + } + } + } +} From e126ff4f2e22b84077b868c1a5647e644830183d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Bj=C3=B6rkstr=C3=B6m?= Date: Wed, 18 Oct 2017 22:03:20 +0300 Subject: [PATCH 28/38] Address code review comments. --- OmniSharp.sln | 4 ---- build/Packages.props | 3 +-- src/OmniSharp.Cake/CachingScriptMetadataResolver.cs | 12 ++++++------ src/OmniSharp.Cake/OmniSharp.Cake.csproj | 1 - .../OmniSharp.Cake.Tests/OmniSharp.Cake.Tests.csproj | 1 - 5 files changed, 7 insertions(+), 14 deletions(-) diff --git a/OmniSharp.sln b/OmniSharp.sln index b7bc67dc63..d07f37632d 100644 --- a/OmniSharp.sln +++ b/OmniSharp.sln @@ -1,10 +1,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -<<<<<<< HEAD VisualStudioVersion = 15.0.27004.2000 -======= -VisualStudioVersion = 15.0.26730.3 ->>>>>>> 80646728... Adds OmniSharp.Cake project and Cake project system MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{2C348365-A9D8-459E-9276-56FC46AAEE31}" EndProject diff --git a/build/Packages.props b/build/Packages.props index ee2a4a3557..478a867956 100644 --- a/build/Packages.props +++ b/build/Packages.props @@ -3,9 +3,8 @@ 0.1.0-unstable0091 - 2.0.3 0.1.0 - 0.1.0 + 0.1.0 1.1.0 1.1.0 1.1.0 diff --git a/src/OmniSharp.Cake/CachingScriptMetadataResolver.cs b/src/OmniSharp.Cake/CachingScriptMetadataResolver.cs index b282e33a0e..67f2774891 100644 --- a/src/OmniSharp.Cake/CachingScriptMetadataResolver.cs +++ b/src/OmniSharp.Cake/CachingScriptMetadataResolver.cs @@ -25,12 +25,12 @@ public override int GetHashCode() public override PortableExecutableReference ResolveMissingAssembly(MetadataReference definition, AssemblyIdentity referenceIdentity) { - if (MissingReferenceCache.ContainsKey(referenceIdentity.Name)) + if (MissingReferenceCache.TryGetValue(referenceIdentity.Name, out var result)) { - return MissingReferenceCache[referenceIdentity.Name]; + return result; } - var result = DefaultRuntimeResolver.ResolveMissingAssembly(definition, referenceIdentity); + result = DefaultRuntimeResolver.ResolveMissingAssembly(definition, referenceIdentity); if (result != null) { MissingReferenceCache[referenceIdentity.Name] = result; @@ -42,12 +42,12 @@ public override PortableExecutableReference ResolveMissingAssembly(MetadataRefer public override ImmutableArray ResolveReference(string reference, string baseFilePath, MetadataReferenceProperties properties) { var key = $"{reference}-{baseFilePath}"; - if (DirectReferenceCache.ContainsKey(key)) + if (DirectReferenceCache.TryGetValue(key, out var result)) { - return DirectReferenceCache[key]; + return result; } - var result = DefaultRuntimeResolver.ResolveReference(reference, baseFilePath, properties); + result = DefaultRuntimeResolver.ResolveReference(reference, baseFilePath, properties); if (result.Length > 0) { DirectReferenceCache[key] = result; diff --git a/src/OmniSharp.Cake/OmniSharp.Cake.csproj b/src/OmniSharp.Cake/OmniSharp.Cake.csproj index a97658214f..c1fd5f038a 100644 --- a/src/OmniSharp.Cake/OmniSharp.Cake.csproj +++ b/src/OmniSharp.Cake/OmniSharp.Cake.csproj @@ -2,7 +2,6 @@ net46 - true AnyCPU diff --git a/tests/OmniSharp.Cake.Tests/OmniSharp.Cake.Tests.csproj b/tests/OmniSharp.Cake.Tests/OmniSharp.Cake.Tests.csproj index ba6d4542fd..b268225af2 100644 --- a/tests/OmniSharp.Cake.Tests/OmniSharp.Cake.Tests.csproj +++ b/tests/OmniSharp.Cake.Tests/OmniSharp.Cake.Tests.csproj @@ -2,7 +2,6 @@ net46 - true AnyCPU true From e2dd7df304328f3a2631efa0db4fb234165f858c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Bj=C3=B6rkstr=C3=B6m?= Date: Thu, 19 Oct 2017 22:50:55 +0300 Subject: [PATCH 29/38] Make Cake Bakery resolution case insensitive --- .../Services/ScriptGenerationToolResolver.cs | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/OmniSharp.Cake/Services/ScriptGenerationToolResolver.cs b/src/OmniSharp.Cake/Services/ScriptGenerationToolResolver.cs index 4d42603299..828fd826bb 100644 --- a/src/OmniSharp.Cake/Services/ScriptGenerationToolResolver.cs +++ b/src/OmniSharp.Cake/Services/ScriptGenerationToolResolver.cs @@ -1,5 +1,8 @@ -using System.IO; +using System; +using System.Collections.Generic; +using System.IO; using System.Linq; +using System.Runtime.InteropServices; using OmniSharp.Cake.Configuration; namespace OmniSharp.Cake.Services @@ -33,10 +36,23 @@ private static string GetToolPath(string rootPath, ICakeConfiguration configurat private static string GetLatestBakeryPath(string toolPath) { - var directories = Directory.GetDirectories(toolPath, "cake.bakery*", SearchOption.TopDirectoryOnly); + var directories = GetBakeryPaths(toolPath); // TODO: Sort by semantic version? return directories.OrderByDescending(x => x).FirstOrDefault(); } + + private static IEnumerable GetBakeryPaths(string toolPath) + { + foreach (var directory in Directory.EnumerateDirectories(toolPath)) + { + var topDirectory = directory.Split(Path.DirectorySeparatorChar).Last(); + if (topDirectory.StartsWith("cake.bakery", StringComparison.OrdinalIgnoreCase)) + { + yield return topDirectory; + } + } + } + } } From a6194f64130b0b1c6f5bb781eec6f85903d17cfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Bj=C3=B6rkstr=C3=B6m?= Date: Thu, 19 Oct 2017 22:51:42 +0300 Subject: [PATCH 30/38] Update Cake.Scripting and Bakery versions --- build/Packages.props | 2 +- src/OmniSharp.Cake/OmniSharp.Cake.csproj | 3 ++- test-assets/test-projects/CakeProject/tools/packages.config | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/build/Packages.props b/build/Packages.props index 478a867956..b2d71c16dc 100644 --- a/build/Packages.props +++ b/build/Packages.props @@ -2,7 +2,7 @@ - 0.1.0-unstable0091 + 0.1.0-unstable0128 0.1.0 0.1.0 1.1.0 diff --git a/src/OmniSharp.Cake/OmniSharp.Cake.csproj b/src/OmniSharp.Cake/OmniSharp.Cake.csproj index c1fd5f038a..1508305320 100644 --- a/src/OmniSharp.Cake/OmniSharp.Cake.csproj +++ b/src/OmniSharp.Cake/OmniSharp.Cake.csproj @@ -15,4 +15,5 @@ - + + \ No newline at end of file diff --git a/test-assets/test-projects/CakeProject/tools/packages.config b/test-assets/test-projects/CakeProject/tools/packages.config index 4505ff4bcc..c4db46b6b9 100644 --- a/test-assets/test-projects/CakeProject/tools/packages.config +++ b/test-assets/test-projects/CakeProject/tools/packages.config @@ -1,4 +1,4 @@ - + \ No newline at end of file From 9fecd075a6cc91e8b86922f04abd0ea9cd9fe029 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Bj=C3=B6rkstr=C3=B6m?= Date: Fri, 20 Oct 2017 00:11:01 +0300 Subject: [PATCH 31/38] Add mono wrapper for executing bakery --- .../Services/CakeScriptService.cs | 5 +- .../Services/MonoScriptGenerationProcess.cs | 110 ++++++++++++++++++ 2 files changed, 114 insertions(+), 1 deletion(-) create mode 100644 src/OmniSharp.Cake/Services/MonoScriptGenerationProcess.cs diff --git a/src/OmniSharp.Cake/Services/CakeScriptService.cs b/src/OmniSharp.Cake/Services/CakeScriptService.cs index 66af7d393f..68f9dcc66d 100644 --- a/src/OmniSharp.Cake/Services/CakeScriptService.cs +++ b/src/OmniSharp.Cake/Services/CakeScriptService.cs @@ -9,6 +9,7 @@ using Cake.Scripting.Transport.Tcp.Client; using Microsoft.Extensions.Logging; using OmniSharp.Cake.Configuration; +using OmniSharp.Utilities; namespace OmniSharp.Cake.Services { @@ -39,7 +40,9 @@ public CakeScriptService(IOmniSharpEnvironment environment, ICakeConfiguration c if (File.Exists(serverExecutablePath)) { - _generationService = new ScriptGenerationClient(serverExecutablePath, environment.TargetDirectory, loggerFactory); + _generationService = PlatformHelper.IsMono ? + new ScriptGenerationClient(new MonoScriptGenerationProcess(serverExecutablePath, environment, loggerFactory), environment.TargetDirectory, loggerFactory) : + new ScriptGenerationClient(serverExecutablePath, environment.TargetDirectory, loggerFactory); } IsConnected = _generationService != null; diff --git a/src/OmniSharp.Cake/Services/MonoScriptGenerationProcess.cs b/src/OmniSharp.Cake/Services/MonoScriptGenerationProcess.cs new file mode 100644 index 0000000000..05d91ca76e --- /dev/null +++ b/src/OmniSharp.Cake/Services/MonoScriptGenerationProcess.cs @@ -0,0 +1,110 @@ +using System; +using System.Diagnostics; +using System.IO; +using System.Runtime.InteropServices; +using Cake.Scripting.Transport.Tcp.Client; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Abstractions; + +namespace OmniSharp.Cake.Services +{ + internal sealed class MonoScriptGenerationProcess : IScriptGenerationProcess + { + private readonly ILogger _logger; + private readonly IOmniSharpEnvironment _environment; + private Process _process; + + public MonoScriptGenerationProcess(string serverExecutablePath, IOmniSharpEnvironment environment, ILoggerFactory loggerFactory) + { + _logger = loggerFactory?.CreateLogger(typeof(MonoScriptGenerationProcess)) ?? NullLogger.Instance; + _environment = environment ?? throw new ArgumentNullException(nameof(environment)); + ServerExecutablePath = serverExecutablePath; + } + + public void Dispose() + { + _process?.Kill(); + _process?.WaitForExit(); + _process?.Dispose(); + } + + public void Start(int port, string workingDirectory) + { + var (fileName, arguments) = GetMonoRuntime(); + + if (fileName == null) + { + // Something went wrong figurint out mono runtime, + // try executing exe and let mono handle it. + fileName = ServerExecutablePath; + } + else + { + // Else set exe as argument + arguments += $"\"{ServerExecutablePath}\""; + } + + arguments += $" --port={port}"; + if (_logger.IsEnabled(LogLevel.Debug)) + { + arguments += " --verbose"; + } + + var startInfo = new ProcessStartInfo + { + FileName = fileName, + Arguments = arguments, + RedirectStandardOutput = true, + RedirectStandardError = true, + UseShellExecute = false, + WorkingDirectory = workingDirectory, + }; + + _logger.LogDebug("Starting \"{fileName}\" with arguments \"{arguments}\"", startInfo.FileName, startInfo.Arguments); + _process = Process.Start(startInfo); + _process.ErrorDataReceived += (s, e) => + { + if (e.Data != null) + { + _logger.LogError(e.Data); + } + }; + _process.BeginErrorReadLine(); + _process.OutputDataReceived += (s, e) => + { + if (e.Data != null) + { + _logger.LogDebug(e.Data); + } + }; + _process.BeginOutputReadLine(); + } + + private (string, string) GetMonoRuntime() + { + // Check using ps how process was started. + var startInfo = new ProcessStartInfo + { + FileName = "sh", + Arguments = $"-c \"ps -fp {Process.GetCurrentProcess().Id} | tail -n1 | awk '{{print $8}}'\"", + RedirectStandardOutput = true, + UseShellExecute = false, + }; + var process = Process.Start(startInfo); + var runtime = process.StandardOutput.ReadToEnd().TrimEnd('\n'); + process.WaitForExit(); + + // If OmniSharp bundled Mono runtime, use bootstrap script. + var script = Path.Combine(Path.GetDirectoryName(runtime), "run"); + if (File.Exists(script)) + { + return (script, "--no-omnisharp "); + } + + // Else use mono directly. + return (runtime, string.Empty); + } + + public string ServerExecutablePath { get; set; } + } +} From eb02fdea7025c19504b6a13f2319c36978f2b86b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Bj=C3=B6rkstr=C3=B6m?= Date: Sat, 21 Oct 2017 13:59:22 -0700 Subject: [PATCH 32/38] Fix LineIndexHelper and tests on Linux/OSX --- .../Utilities/LineIndexHelper.cs | 19 ++++++++++++++++--- .../LineIndexHelperFacts.cs | 14 +++++++++++--- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/src/OmniSharp.Cake/Utilities/LineIndexHelper.cs b/src/OmniSharp.Cake/Utilities/LineIndexHelper.cs index bd3fa6dbf4..6a859a0879 100644 --- a/src/OmniSharp.Cake/Utilities/LineIndexHelper.cs +++ b/src/OmniSharp.Cake/Utilities/LineIndexHelper.cs @@ -1,6 +1,7 @@ using System; using System.IO; using System.Threading.Tasks; +using OmniSharp.Utilities; namespace OmniSharp.Cake.Utilities { @@ -19,7 +20,12 @@ public static async Task TranslateToGenerated(string fileName, int index, O return index; } - var fullPath = Path.GetFullPath(fileName).Replace('\\', '/'); + var fullPath = Path.GetFullPath(fileName); + if (PlatformHelper.IsWindows) + { + // Cake alwyas normalizes dir separators to / + fullPath = fullPath.Replace('\\', '/'); + } var sourceText = await document.GetTextAsync(); for (var i = sourceText.Lines.Count - 1; i >= 0; i--) { @@ -52,7 +58,10 @@ public static async Task TranslateToGenerated(string fileName, int index, O return (-1, fileName); } - fileName = fileName.Replace('/', '\\'); + if (PlatformHelper.IsWindows) + { + fileName = fileName.Replace('/', '\\'); + } var document = workspace.GetDocument(fileName); if (document == null) { @@ -80,7 +89,11 @@ public static async Task TranslateToGenerated(string fileName, int index, O continue; } - var newFileName = tokens[2].Trim('"').Replace('/', '\\'); + var newFileName = tokens[2].Trim('"'); + if (PlatformHelper.IsWindows) + { + newFileName = newFileName.Replace('/', '\\'); + } if (sameFile && !newFileName.Equals(fileName)) { return (-1, fileName); diff --git a/tests/OmniSharp.Cake.Tests/LineIndexHelperFacts.cs b/tests/OmniSharp.Cake.Tests/LineIndexHelperFacts.cs index baa2c916ba..5d8b646384 100644 --- a/tests/OmniSharp.Cake.Tests/LineIndexHelperFacts.cs +++ b/tests/OmniSharp.Cake.Tests/LineIndexHelperFacts.cs @@ -8,6 +8,7 @@ using Microsoft.Extensions.Logging; using OmniSharp.Cake.Utilities; using OmniSharp.Services; +using OmniSharp.Utilities; using Xunit; namespace OmniSharp.Cake.Tests @@ -17,9 +18,9 @@ public class LineIndexHelperFacts private static Assembly Assembly => typeof(LineIndexHelperFacts).GetTypeInfo().Assembly; private static string ResourcePath => "OmniSharp.Cake.Tests.TestAssets"; - private static string SingleCakePath => @"C:\Work\single.cake"; + private static string SingleCakePath => PlatformHelper.IsWindows ? @"C:\Work\single.cake" : "/work/single.cake"; - private static string MultiCakePath => @"C:\Work\multi.cake"; + private static string MultiCakePath => PlatformHelper.IsWindows ? @"C:\Work\multi.cake" : "/work/multi.cake"; private static string GetResourceContent(string resourceName) { @@ -38,7 +39,14 @@ private static string GetResourceContent(string resourceName) private static string GetGeneratedFileContent(string name) { - return GetResourceContent($"{ResourcePath}.{Path.GetFileName(name)}.g.txt"); + var content = GetResourceContent($"{ResourcePath}.{Path.GetFileName(name)}.g.txt"); + + if (PlatformHelper.IsWindows) + { + return content; + } + // Adjust paths in generated content + return content.Replace("C:/Work/", "/work/"); } private static string GetFileContent(string name) From f6afebfcfb85b3e273cfb2e5dc18d213d09dbc29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Bj=C3=B6rkstr=C3=B6m?= Date: Sun, 22 Oct 2017 23:24:47 +0300 Subject: [PATCH 33/38] Add gotodefinition tests. --- .../Navigation/GotoDefinitionHandler.cs | 5 ++ .../GotoDefinitionFacts.cs | 46 +++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 tests/OmniSharp.Cake.Tests/GotoDefinitionFacts.cs diff --git a/src/OmniSharp.Cake/Services/RequestHandlers/Navigation/GotoDefinitionHandler.cs b/src/OmniSharp.Cake/Services/RequestHandlers/Navigation/GotoDefinitionHandler.cs index 98165412fb..815913795f 100644 --- a/src/OmniSharp.Cake/Services/RequestHandlers/Navigation/GotoDefinitionHandler.cs +++ b/src/OmniSharp.Cake/Services/RequestHandlers/Navigation/GotoDefinitionHandler.cs @@ -11,6 +11,7 @@ using OmniSharp.Models.GotoDefinition; using OmniSharp.Models.Metadata; using OmniSharp.Roslyn; +using OmniSharp.Utilities; namespace OmniSharp.Cake.Services.RequestHandlers.Navigation { @@ -33,6 +34,10 @@ protected override async Task TranslateResponse(GotoDefi if (string.IsNullOrEmpty(response.FileName) || !response.FileName.Equals(Constants.Paths.Generated)) { + if (PlatformHelper.IsWindows && !string.IsNullOrEmpty(response.FileName)) + { + response.FileName = response.FileName.Replace('/', '\\'); + } return response; } diff --git a/tests/OmniSharp.Cake.Tests/GotoDefinitionFacts.cs b/tests/OmniSharp.Cake.Tests/GotoDefinitionFacts.cs new file mode 100644 index 0000000000..8ef2bc0aeb --- /dev/null +++ b/tests/OmniSharp.Cake.Tests/GotoDefinitionFacts.cs @@ -0,0 +1,46 @@ +using System; +using System.IO; +using System.Threading.Tasks; +using OmniSharp.Cake.Services.RequestHandlers.Navigation; +using OmniSharp.Models; +using OmniSharp.Models.GotoDefinition; +using OmniSharp.Models.UpdateBuffer; +using TestUtility; +using Xunit; +using Xunit.Abstractions; + +namespace OmniSharp.Cake.Tests +{ + public sealed class GotoDefinitionFacts : CakeSingleRequestHandlerTestFixture + { + public GotoDefinitionFacts(ITestOutputHelper testOutput) : base(testOutput) + { + } + + protected override string EndpointName => OmniSharpEndpoints.GotoDefinition; + + [Fact] + public async Task ShouldSupportLoadedFiles() + { + using (var testProject = await TestAssets.Instance.GetTestProjectAsync("CakeProject", shadowCopy: false)) + using (var host = CreateOmniSharpHost(testProject.Directory)) + { + var fileName = Path.Combine(testProject.Directory, "build.cake"); + + var request = new GotoDefinitionRequest + { + FileName = fileName, + Line = 8, + Column = 10 + }; + + var requestHandler = GetRequestHandler(host); + var response = await requestHandler.Handle(request); + + Assert.Equal(Path.Combine(testProject.Directory, "foo.cake"), response.FileName); + Assert.Equal(2, response.Line); + Assert.Equal(22, response.Column); + } + } + } +} From e0cdfa54a2ee7516077780bafde3a33d22b353d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Bj=C3=B6rkstr=C3=B6m?= Date: Sun, 22 Oct 2017 23:28:16 +0300 Subject: [PATCH 34/38] Update to release bits of Cake.Scripting and Bakery --- NuGet.Config | 1 - build.cake | 3 +-- build/Packages.props | 2 +- test-assets/test-projects/CakeProject/tools/packages.config | 4 ++-- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/NuGet.Config b/NuGet.Config index 7f59d1ff82..41c0ecd6d8 100644 --- a/NuGet.Config +++ b/NuGet.Config @@ -5,6 +5,5 @@ - diff --git a/build.cake b/build.cake index 94926da252..e84dfb0ccf 100644 --- a/build.cake +++ b/build.cake @@ -373,8 +373,7 @@ Task("PrepareTestAssets") Prerelease = true, Verbosity = NuGetVerbosity.Quiet, Source = new[] { - "https://api.nuget.org/v3/index.json", - "https://www.myget.org/F/cake/api/v3/index.json" + "https://api.nuget.org/v3/index.json" } }); } diff --git a/build/Packages.props b/build/Packages.props index b2d71c16dc..ddbdeda62d 100644 --- a/build/Packages.props +++ b/build/Packages.props @@ -2,7 +2,7 @@ - 0.1.0-unstable0128 + 0.1.0 0.1.0 0.1.0 1.1.0 diff --git a/test-assets/test-projects/CakeProject/tools/packages.config b/test-assets/test-projects/CakeProject/tools/packages.config index c4db46b6b9..497ef2783c 100644 --- a/test-assets/test-projects/CakeProject/tools/packages.config +++ b/test-assets/test-projects/CakeProject/tools/packages.config @@ -1,4 +1,4 @@ - - + + \ No newline at end of file From 50ad596f9b25761c4170ee1c21c30368a75dcb77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Bj=C3=B6rkstr=C3=B6m?= Date: Tue, 24 Oct 2017 22:03:06 +0300 Subject: [PATCH 35/38] CakeConfiguration was never used. --- src/OmniSharp.Cake/CakeProjectSystem.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/OmniSharp.Cake/CakeProjectSystem.cs b/src/OmniSharp.Cake/CakeProjectSystem.cs index dd272860ab..c8fbedd1de 100644 --- a/src/OmniSharp.Cake/CakeProjectSystem.cs +++ b/src/OmniSharp.Cake/CakeProjectSystem.cs @@ -24,7 +24,6 @@ public class CakeProjectSystem : IProjectSystem private readonly OmniSharpWorkspace _workspace; private readonly IOmniSharpEnvironment _environment; private readonly IAssemblyLoader _assemblyLoader; - private readonly ICakeConfiguration _cakeConfiguration; private readonly ICakeScriptService _scriptService; private readonly ILogger _logger; private readonly Dictionary _projects; @@ -38,14 +37,12 @@ public CakeProjectSystem( OmniSharpWorkspace workspace, IOmniSharpEnvironment environment, IAssemblyLoader assemblyLoader, - ICakeConfiguration cakeConfiguration, ICakeScriptService scriptService, ILoggerFactory loggerFactory) { _workspace = workspace ?? throw new ArgumentNullException(nameof(workspace)); _environment = environment ?? throw new ArgumentNullException(nameof(environment)); _assemblyLoader = assemblyLoader ?? throw new ArgumentNullException(nameof(assemblyLoader)); - _cakeConfiguration = cakeConfiguration ?? throw new ArgumentNullException(nameof(cakeConfiguration)); _scriptService = scriptService ?? throw new ArgumentNullException(nameof(scriptService)); _logger = loggerFactory?.CreateLogger() ?? throw new ArgumentNullException(nameof(loggerFactory)); From 04825e0183b5aacdfd9e0dc0b207aac7fb51a6d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Bj=C3=B6rkstr=C3=B6m?= Date: Tue, 24 Oct 2017 22:43:07 +0300 Subject: [PATCH 36/38] Enhance compilation options usage in project system. --- src/OmniSharp.Cake/CakeProjectSystem.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/OmniSharp.Cake/CakeProjectSystem.cs b/src/OmniSharp.Cake/CakeProjectSystem.cs index c8fbedd1de..c24f4169b9 100644 --- a/src/OmniSharp.Cake/CakeProjectSystem.cs +++ b/src/OmniSharp.Cake/CakeProjectSystem.cs @@ -27,6 +27,7 @@ public class CakeProjectSystem : IProjectSystem private readonly ICakeScriptService _scriptService; private readonly ILogger _logger; private readonly Dictionary _projects; + private readonly Lazy _compilationOptions; public string Key => "Cake"; public string Language => Constants.LanguageNames.Cake; @@ -47,6 +48,7 @@ public CakeProjectSystem( _logger = loggerFactory?.CreateLogger() ?? throw new ArgumentNullException(nameof(loggerFactory)); _projects = new Dictionary(); + _compilationOptions = new Lazy(CreateCompilationOptions); } public void Initalize(IConfiguration configuration) @@ -117,11 +119,14 @@ private void ScriptUsingsChanged(object sender, UsingsChangedEventArgs e) return; } + var compilationOptions = e.Usings == null + ? _compilationOptions.Value + : _compilationOptions.Value.WithUsings(e.Usings); + foreach (var documentId in documentIds) { var document = solution.GetDocument(documentId); var project = document.Project; - var compilationOptions = GetCompilationOptions(e.Usings); _workspace.SetCompilationOptions(project.Id, compilationOptions); } @@ -209,7 +214,7 @@ private ProjectInfo GetProject(CakeScript cakeScript, string filePath) filePath: filePath, assemblyName: $"{name}.dll", language: LanguageNames.CSharp, - compilationOptions: GetCompilationOptions(cakeScript.Usings), + compilationOptions: cakeScript.Usings == null ? _compilationOptions.Value : _compilationOptions.Value.WithUsings(cakeScript.Usings), parseOptions: new CSharpParseOptions(LanguageVersion.Default, DocumentationMode.Parse, SourceCodeKind.Script), metadataReferences: cakeScript.References.Select(reference => MetadataReference.CreateFromFile(reference, documentation: GetDocumentationProvider(reference))), // TODO: projectReferences? @@ -225,11 +230,10 @@ private static DocumentationProvider GetDocumentationProvider(string assemblyPat : DocumentationProvider.Default; } - private static CompilationOptions GetCompilationOptions(IEnumerable usings) + private static CSharpCompilationOptions CreateCompilationOptions() { var compilationOptions = new CSharpCompilationOptions( OutputKind.DynamicallyLinkedLibrary, - usings: usings, allowUnsafe: true, metadataReferenceResolver: new CachingScriptMetadataResolver(), sourceReferenceResolver: ScriptSourceResolver.Default, From 48a2e73762495142c95732094e3f1829c3899bf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Bj=C3=B6rkstr=C3=B6m?= Date: Tue, 24 Oct 2017 22:45:08 +0300 Subject: [PATCH 37/38] Removed some magic integers. --- .../RequestHandlers/Navigation/GotoDefinitionHandler.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/OmniSharp.Cake/Services/RequestHandlers/Navigation/GotoDefinitionHandler.cs b/src/OmniSharp.Cake/Services/RequestHandlers/Navigation/GotoDefinitionHandler.cs index 815913795f..f68a5433a4 100644 --- a/src/OmniSharp.Cake/Services/RequestHandlers/Navigation/GotoDefinitionHandler.cs +++ b/src/OmniSharp.Cake/Services/RequestHandlers/Navigation/GotoDefinitionHandler.cs @@ -18,6 +18,8 @@ namespace OmniSharp.Cake.Services.RequestHandlers.Navigation [OmniSharpHandler(OmniSharpEndpoints.GotoDefinition, Constants.LanguageNames.Cake), Shared] public class GotoDefinitionHandler : CakeRequestHandler { + private const int MethodLineOffset = 3; + private const int PropertyLineOffset = 7; private readonly MetadataHelper _metadataHelper; [ImportingConstructor] @@ -60,7 +62,7 @@ private async Task GetAliasFromMetadataAsync(GotoDefinit { var document = Workspace.GetDocument(request.FileName); var response = new GotoDefinitionResponse(); - var lineIndex = request.Line + 3; + var lineIndex = request.Line + MethodLineOffset; var column = 0; if (document == null) @@ -77,7 +79,7 @@ private async Task GetAliasFromMetadataAsync(GotoDefinit } else { - lineIndex = request.Line + 7; + lineIndex = request.Line + PropertyLineOffset; sourceLine = sourceText.Lines[lineIndex].ToString(); if (sourceLine.Contains("(Context")) { From 8a5905842e5457898895818d26c68340381b5afc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Bj=C3=B6rkstr=C3=B6m?= Date: Wed, 25 Oct 2017 00:42:29 +0300 Subject: [PATCH 38/38] Added MIT License for code copied from Cake repo --- src/OmniSharp.Cake/Configuration/LICENSE | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/OmniSharp.Cake/Configuration/LICENSE diff --git a/src/OmniSharp.Cake/Configuration/LICENSE b/src/OmniSharp.Cake/Configuration/LICENSE new file mode 100644 index 0000000000..403462acc3 --- /dev/null +++ b/src/OmniSharp.Cake/Configuration/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) .NET Foundation and Contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file