Browse Source

Add/use dotnet-format

davidfowl/dependencies
Ryan Nowak 7 years ago
parent
commit
3c26b6febb
  1. 12
      .config/dotnet-tools.json
  2. 30
      .github/workflows/format.yml
  3. 50
      .vscode/tasks.json
  4. 17
      build/dotnet-format-problem-matcher.json
  5. 2
      src/micronetes/Micronetes.Hosting.Diagnostics/DiagnosticsCollector.cs
  6. 2
      src/micronetes/Micronetes.Hosting.Diagnostics/Logging/LogObject.cs
  7. 2
      src/micronetes/Micronetes.Hosting.Diagnostics/Logging/LogValuesFormatter.cs
  8. 2
      src/micronetes/Micronetes.Hosting.Runtime/StartupHook.cs
  9. 2
      src/micronetes/Micronetes.Hosting/MicronetesHost.cs
  10. 4
      src/opulence/Opulence/ApplicationGlobals.cs
  11. 4
      src/opulence/Opulence/ContainerRegistry.cs
  12. 4
      src/opulence/Opulence/DeploymentKind.cs
  13. 4
      src/opulence/Opulence/DockerImage.cs
  14. 4
      src/opulence/Opulence/EnvironmentAttribute.cs
  15. 4
      src/opulence/Opulence/Environments.cs
  16. 4
      src/opulence/Opulence/Framework.cs
  17. 4
      src/opulence/Opulence/FrameworkCollection.cs
  18. 4
      src/opulence/Opulence/GeneratedAssets.cs
  19. 4
      src/opulence/Opulence/HelmChartStep.cs
  20. 8
      src/opulence/Opulence/Pipeline.cs
  21. 4
      src/opulence/Opulence/PipelineHolder.cs
  22. 4
      src/opulence/Opulence/Project.cs
  23. 4
      src/opulence/Opulence/Secret.cs
  24. 8
      src/opulence/Opulence/Service.cs
  25. 4
      src/opulence/Opulence/ServiceBinding.cs
  26. 4
      src/opulence/Opulence/Source.cs
  27. 4
      src/opulence/Opulence/Step.cs
  28. 12
      src/opulence/dotnet-opulence/Application.cs
  29. 6
      src/opulence/dotnet-opulence/ApplicationFactory.cs
  30. 4
      src/opulence/dotnet-opulence/ApplicationYamlWriter.cs
  31. 6
      src/opulence/dotnet-opulence/BuildDockerImageStep.cs
  32. 2
      src/opulence/dotnet-opulence/CombineStep.cs
  33. 10
      src/opulence/dotnet-opulence/CommandException.cs
  34. 10
      src/opulence/dotnet-opulence/ConsoleExtensions.cs
  35. 12
      src/opulence/dotnet-opulence/CustomizationPipeline.cs
  36. 4
      src/opulence/dotnet-opulence/DeployCommand.cs
  37. 2
      src/opulence/dotnet-opulence/DeployServiceYamlStep.cs
  38. 8
      src/opulence/dotnet-opulence/DirectoryCopy.cs
  39. 12
      src/opulence/dotnet-opulence/DirectorySearch.cs
  40. 6
      src/opulence/dotnet-opulence/DockerContainerBuilder.cs
  41. 4
      src/opulence/dotnet-opulence/DockerPush.cs
  42. 6
      src/opulence/dotnet-opulence/DockerfileGenerator.cs
  43. 6
      src/opulence/dotnet-opulence/GenerateCommand.cs
  44. 4
      src/opulence/dotnet-opulence/GenerateDockerfileStep.cs
  45. 4
      src/opulence/dotnet-opulence/GenerateHelmChartStep.cs
  46. 4
      src/opulence/dotnet-opulence/GenerateKubernetesManifestStep.cs
  47. 4
      src/opulence/dotnet-opulence/GenerateOamComponentStep.cs
  48. 6
      src/opulence/dotnet-opulence/HelmChartBuilder.cs
  49. 4
      src/opulence/dotnet-opulence/HelmChartGenerator.cs
  50. 4
      src/opulence/dotnet-opulence/HelmPush.cs
  51. 4
      src/opulence/dotnet-opulence/IYamlManifestOutput.cs
  52. 14
      src/opulence/dotnet-opulence/InitCommand.cs
  53. 4
      src/opulence/dotnet-opulence/KubernetesDeploymentOutput.cs
  54. 4
      src/opulence/dotnet-opulence/KubernetesManifestGenerator.cs
  55. 4
      src/opulence/dotnet-opulence/KubernetesServiceOutput.cs
  56. 4
      src/opulence/dotnet-opulence/Names.cs
  57. 4
      src/opulence/dotnet-opulence/OamApplicationGenerator.cs
  58. 8
      src/opulence/dotnet-opulence/OamComponentGenerator.cs
  59. 4
      src/opulence/dotnet-opulence/OamComponentOutput.cs
  60. 14
      src/opulence/dotnet-opulence/OutputContext.cs
  61. 2
      src/opulence/dotnet-opulence/PackageCommand.cs
  62. 6
      src/opulence/dotnet-opulence/Program.cs
  63. 4
      src/opulence/dotnet-opulence/ProjectReader.cs
  64. 2
      src/opulence/dotnet-opulence/PushCommand.cs
  65. 4
      src/opulence/dotnet-opulence/PushDockerImageStep.cs
  66. 18
      src/opulence/dotnet-opulence/ScriptRunner.cs
  67. 6
      src/opulence/dotnet-opulence/ServiceExecutor.cs
  68. 14
      src/opulence/dotnet-opulence/StandardOptions.cs
  69. 4
      src/opulence/dotnet-opulence/StepView.cs
  70. 2
      src/opulence/dotnet-opulence/TargetInstaller.cs
  71. 4
      src/opulence/dotnet-opulence/TempDirectory.cs
  72. 4
      src/opulence/dotnet-opulence/TempFile.cs
  73. 4
      src/opulence/dotnet-opulence/Templates.cs
  74. 4
      src/opulence/dotnet-opulence/Verbosity.cs
  75. 4
      src/opulence/dotnet-opulence/WriteServiceYamlStep.cs
  76. 2
      test/E2ETest/UnitTest1.cs

12
.config/dotnet-tools.json

@ -0,0 +1,12 @@
{
"version": 1,
"isRoot": true,
"tools": {
"dotnet-format": {
"version": "3.3.111304",
"commands": [
"dotnet-format"
]
}
}
}

30
.github/workflows/format.yml

@ -0,0 +1,30 @@
name: Format
on:
pull_request:
branches:
- master
- release/*
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v1.0.0
with:
version: 3.1.100
- name: dotnet tool restore
run: dotnet tool restore
- name: add dotnet format problem matcher
run: echo "::add-matcher::build/dotnet-format-problem-matcher.json"
- name: dotnet format
run: dotnet format -w tye.sln --check --dry-run -v diag

50
.vscode/tasks.json

@ -12,6 +12,56 @@
"/consoleloggerparameters:NoSummary" "/consoleloggerparameters:NoSummary"
], ],
"problemMatcher": "$msCompile" "problemMatcher": "$msCompile"
},
{
"label": "format",
"command": "dotnet",
"type": "process",
"args": [
"dotnet-format",
"-w ${workspaceFolder}/tye.sln"
],
"problemMatcher": {
"fileLocation": [
"relative",
"${workspaceFolder}"
],
"severity": "warning",
"source": "dotnet format",
"pattern": {
"regexp": "^\\s+(.*)\\((\\d+),(\\d+)\\):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"message": 4,
}
}
}
{
"label": "format-check",
"command": "dotnet",
"type": "process",
"args": [
"dotnet-format",
"-w ${workspaceFolder}/tye.sln",
"--check",
"--dry-run"
],
"problemMatcher": {
"fileLocation": [
"relative",
"${workspaceFolder}"
],
"severity": "warning",
"source": "dotnet format",
"pattern": {
"regexp": "^\\s+(.*)\\((\\d+),(\\d+)\\):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"message": 4,
}
}
} }
] ]
} }

17
build/dotnet-format-problem-matcher.json

@ -0,0 +1,17 @@
{
"problemMatcher": [
{
"owner": "dotnet-format",
"severity": "warning",
"pattern": [
{
"regexp": "^\\s+(.*)\\((\\d+),(\\d+)\\):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"message": 4
}
]
}
]
}

2
src/micronetes/Micronetes.Hosting.Diagnostics/DiagnosticsCollector.cs

@ -849,5 +849,5 @@ namespace Micronetes.Hosting.Diagnostics
public const EventKeywords JsonMessage = (EventKeywords)8; public const EventKeywords JsonMessage = (EventKeywords)8;
} }
} }
} }
} }

2
src/micronetes/Micronetes.Hosting.Diagnostics/Logging/LogObject.cs

@ -64,4 +64,4 @@ namespace Micronetes.Hosting.Diagnostics.Logging
return _formattedMessage ?? string.Empty; return _formattedMessage ?? string.Empty;
} }
} }
} }

2
src/micronetes/Micronetes.Hosting.Diagnostics/Logging/LogValuesFormatter.cs

@ -197,4 +197,4 @@ namespace Micronetes.Hosting.Diagnostics.Logging
} }
} }
} }

2
src/micronetes/Micronetes.Hosting.Runtime/StartupHook.cs

@ -21,4 +21,4 @@ internal class StartupHook
Thread.Sleep(1000); Thread.Sleep(1000);
} }
} }
} }

2
src/micronetes/Micronetes.Hosting/MicronetesHost.cs

@ -1,4 +1,4 @@
using System; using System;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Micronetes.Hosting.Diagnostics; using Micronetes.Hosting.Diagnostics;

4
src/opulence/Opulence/ApplicationGlobals.cs

@ -1,4 +1,4 @@
namespace Opulence namespace Opulence
{ {
public sealed class ApplicationGlobals public sealed class ApplicationGlobals
{ {
@ -8,4 +8,4 @@ namespace Opulence
public ContainerRegistry? Registry { get; set; } public ContainerRegistry? Registry { get; set; }
} }
} }

4
src/opulence/Opulence/ContainerRegistry.cs

@ -1,4 +1,4 @@
using System; using System;
namespace Opulence namespace Opulence
{ {
@ -16,4 +16,4 @@ namespace Opulence
public string Hostname { get; } public string Hostname { get; }
} }
} }

4
src/opulence/Opulence/DeploymentKind.cs

@ -1,4 +1,4 @@
namespace Opulence namespace Opulence
{ {
public enum DeploymentKind public enum DeploymentKind
{ {
@ -6,4 +6,4 @@ namespace Opulence
Kubernetes, Kubernetes,
Oam, Oam,
} }
} }

4
src/opulence/Opulence/DockerImage.cs

@ -1,4 +1,4 @@
using System; using System;
namespace Opulence namespace Opulence
{ {
@ -16,4 +16,4 @@ namespace Opulence
public string Image { get; } public string Image { get; }
} }
} }

4
src/opulence/Opulence/EnvironmentAttribute.cs

@ -1,4 +1,4 @@
using System; using System;
namespace Opulence namespace Opulence
{ {
@ -16,4 +16,4 @@ namespace Opulence
public string EnvironmentName { get; } public string EnvironmentName { get; }
} }
} }

4
src/opulence/Opulence/Environments.cs

@ -1,4 +1,4 @@
namespace Opulence namespace Opulence
{ {
public static class Environments public static class Environments
{ {
@ -6,4 +6,4 @@ namespace Opulence
public const string Production = "Production"; public const string Production = "Production";
} }
} }

4
src/opulence/Opulence/Framework.cs

@ -1,4 +1,4 @@
using System; using System;
namespace Opulence namespace Opulence
{ {
@ -16,4 +16,4 @@ namespace Opulence
public string Name { get; } public string Name { get; }
} }
} }

4
src/opulence/Opulence/FrameworkCollection.cs

@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
@ -19,4 +19,4 @@ namespace Opulence
} }
} }
} }
} }

4
src/opulence/Opulence/GeneratedAssets.cs

@ -1,7 +1,7 @@
namespace Opulence namespace Opulence
{ {
public sealed class GeneratedAssets public sealed class GeneratedAssets
{ {
public ContainerInfo? Container { get; set; } public ContainerInfo? Container { get; set; }
} }
} }

4
src/opulence/Opulence/HelmChartStep.cs

@ -1,4 +1,4 @@
namespace Opulence namespace Opulence
{ {
public sealed class HelmChartStep : Step public sealed class HelmChartStep : Step
{ {
@ -6,4 +6,4 @@ namespace Opulence
public string ChartName { get; set; } = default!; public string ChartName { get; set; } = default!;
} }
} }

8
src/opulence/Opulence/Pipeline.cs

@ -1,11 +1,11 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Opulence namespace Opulence
{ {
public abstract class Pipeline public abstract class Pipeline
{ {
private static readonly Dictionary<Type, List<MulticastDelegate>> callbacks = new Dictionary<Type, List<MulticastDelegate>>(); private static readonly Dictionary<Type, List<MulticastDelegate>> callbacks = new Dictionary<Type, List<MulticastDelegate>>();
public static void Configure<TApplication>(Action<TApplication> callback) public static void Configure<TApplication>(Action<TApplication> callback)
@ -39,7 +39,7 @@ namespace Opulence
var method = pipeline.GetType().GetMethod("Register").MakeGenericMethod(type); var method = pipeline.GetType().GetMethod("Register").MakeGenericMethod(type);
for (var i = 0; i < delegates.Count; i++) for (var i = 0; i < delegates.Count; i++)
{ {
method.Invoke(pipeline, new[]{ delegates[i], }); method.Invoke(pipeline, new[] { delegates[i], });
} }
} }
@ -50,4 +50,4 @@ namespace Opulence
public abstract Task<object?> ExecuteAsync(); public abstract Task<object?> ExecuteAsync();
} }
} }

4
src/opulence/Opulence/PipelineHolder.cs

@ -1,4 +1,4 @@
using System; using System;
namespace Opulence namespace Opulence
{ {
@ -16,4 +16,4 @@ namespace Opulence
public Pipeline __Pipeline { get; } public Pipeline __Pipeline { get; }
} }
} }

4
src/opulence/Opulence/Project.cs

@ -1,4 +1,4 @@
using System; using System;
namespace Opulence namespace Opulence
{ {
@ -22,4 +22,4 @@ namespace Opulence
public string Version { get; set; } = default!; public string Version { get; set; } = default!;
} }
} }

4
src/opulence/Opulence/Secret.cs

@ -1,7 +1,7 @@
namespace Opulence namespace Opulence
{ {
public class Secret public class Secret
{ {
public string? Name { get; set; } public string? Name { get; set; }
} }
} }

8
src/opulence/Opulence/Service.cs

@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace Opulence namespace Opulence
@ -20,7 +20,7 @@ namespace Opulence
public GeneratedAssets GeneratedAssets { get; } = new GeneratedAssets(); public GeneratedAssets GeneratedAssets { get; } = new GeneratedAssets();
public int? Port { get; set; } public int? Port { get; set; }
public string? Protocol { get; set; } public string? Protocol { get; set; }
public Source? Source { get; set; } public Source? Source { get; set; }
@ -28,7 +28,7 @@ namespace Opulence
public Dictionary<string, object> Environment { get; set; } = new Dictionary<string, object>(); public Dictionary<string, object> Environment { get; set; } = new Dictionary<string, object>();
public int Replicas { get; set; } = 1; public int Replicas { get; set; } = 1;
public List<ServiceBinding> Bindings { get; } = new List<ServiceBinding>(); public List<ServiceBinding> Bindings { get; } = new List<ServiceBinding>();
} }
} }

4
src/opulence/Opulence/ServiceBinding.cs

@ -1,4 +1,4 @@
using System; using System;
namespace Opulence namespace Opulence
{ {
@ -32,4 +32,4 @@ namespace Opulence
public int? Port { get; set; } public int? Port { get; set; }
public Secret? ConnectionString { get; set; } public Secret? ConnectionString { get; set; }
} }
} }

4
src/opulence/Opulence/Source.cs

@ -1,4 +1,4 @@
namespace Opulence namespace Opulence
{ {
public abstract class Source public abstract class Source
{ {
@ -6,4 +6,4 @@ namespace Opulence
{ {
} }
} }
} }

4
src/opulence/Opulence/Step.cs

@ -1,7 +1,7 @@
namespace Opulence namespace Opulence
{ {
public abstract class Step public abstract class Step
{ {
public abstract string DisplayName { get; } public abstract string DisplayName { get; }
} }
} }

12
src/opulence/dotnet-opulence/Application.cs

@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
@ -60,7 +60,7 @@ namespace Opulence
throw new ArgumentNullException(nameof(environment)); throw new ArgumentNullException(nameof(environment));
} }
return Environments.Count == 0 || Environments.Contains(environment, StringComparer.OrdinalIgnoreCase); return Environments.Count == 0 || Environments.Contains(environment, StringComparer.OrdinalIgnoreCase);
} }
internal bool IsMatchForProject(Application application, FileInfo projectFile) internal bool IsMatchForProject(Application application, FileInfo projectFile)
@ -80,7 +80,7 @@ namespace Opulence
return true; return true;
} }
if (Service.Source is Project project && if (Service.Source is Project project &&
string.Equals(application.GetProjectDirectory(project), projectFile.DirectoryName, StringComparison.Ordinal)) string.Equals(application.GetProjectDirectory(project), projectFile.DirectoryName, StringComparison.Ordinal))
{ {
return true; return true;
@ -111,7 +111,7 @@ namespace Opulence
ImageName = imageName; ImageName = imageName;
ImageTag = imageTag; ImageTag = imageTag;
} }
public string ImageName { get; } public string ImageName { get; }
public string ImageTag { get; } public string ImageTag { get; }
@ -140,7 +140,7 @@ namespace Opulence
RootDirectory = rootDirectory; RootDirectory = rootDirectory;
} }
public override ApplicationGlobals Globals public override ApplicationGlobals Globals
{ {
get get
{ {
@ -224,4 +224,4 @@ namespace Opulence
public override IReadOnlyList<ServiceEntry> Services { get; } public override IReadOnlyList<ServiceEntry> Services { get; }
} }
} }

6
src/opulence/dotnet-opulence/ApplicationFactory.cs

@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -129,7 +129,7 @@ namespace Opulence
} }
} }
var application = new GroveledApplication(globals, solutionFile.DirectoryName, services); var application = new GroveledApplication(globals, solutionFile.DirectoryName, services);
foreach (var service in application.Services) foreach (var service in application.Services)
{ {
@ -139,4 +139,4 @@ namespace Opulence
return application; return application;
} }
} }
} }

4
src/opulence/dotnet-opulence/ApplicationYamlWriter.cs

@ -1,4 +1,4 @@
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -23,4 +23,4 @@ namespace Opulence
return Task.CompletedTask; return Task.CompletedTask;
} }
} }
} }

6
src/opulence/dotnet-opulence/BuildDockerImageStep.cs

@ -1,4 +1,4 @@
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Opulence namespace Opulence
{ {
@ -7,7 +7,7 @@ namespace Opulence
public override string DisplayText => "Building Docker Image..."; public override string DisplayText => "Building Docker Image...";
public string Environment { get; set; } = "production"; public string Environment { get; set; } = "production";
public override async Task ExecuteAsync(OutputContext output, Application application, ServiceEntry service) public override async Task ExecuteAsync(OutputContext output, Application application, ServiceEntry service)
{ {
if (SkipWithoutProject(output, service, out var project)) if (SkipWithoutProject(output, service, out var project))
@ -28,4 +28,4 @@ namespace Opulence
await DockerContainerBuilder.BuildContainerImageAsync(output, application, service, project, container); await DockerContainerBuilder.BuildContainerImageAsync(output, application, service, project, container);
} }
} }
} }

2
src/opulence/dotnet-opulence/CombineStep.cs

@ -1,4 +1,4 @@
using System.CommandLine.Invocation; using System.CommandLine.Invocation;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;

10
src/opulence/dotnet-opulence/CommandException.cs

@ -1,15 +1,15 @@
using System; using System;
namespace Opulence namespace Opulence
{ {
internal class CommandException : Exception internal class CommandException : Exception
{ {
public CommandException(string message) public CommandException(string message)
: base(message) : base(message)
{ } { }
public CommandException(string message, Exception inner) public CommandException(string message, Exception inner)
: base(message, inner) : base(message, inner)
{ } { }
} }
} }

10
src/opulence/dotnet-opulence/ConsoleExtensions.cs

@ -1,10 +1,10 @@
using System.Linq; using System.Linq;
namespace System.CommandLine namespace System.CommandLine
{ {
internal static class ConsoleExtensions internal static class ConsoleExtensions
{ {
private static bool? _isConsoleRedirectionCheckSupported; private static bool? _isConsoleRedirectionCheckSupported;
private static bool IsConsoleRedirectionCheckSupported private static bool IsConsoleRedirectionCheckSupported
{ {
@ -35,7 +35,7 @@ namespace System.CommandLine
((dynamic)console).ForegroundColor = color; ((dynamic)console).ForegroundColor = color;
} }
if (IsConsoleRedirectionCheckSupported && if (IsConsoleRedirectionCheckSupported &&
!Console.IsOutputRedirected) !Console.IsOutputRedirected)
{ {
Console.ForegroundColor = color; Console.ForegroundColor = color;
@ -53,7 +53,7 @@ namespace System.CommandLine
((dynamic)console).ForegroundColor = ConsoleColor.Red; ((dynamic)console).ForegroundColor = ConsoleColor.Red;
} }
if (IsConsoleRedirectionCheckSupported && if (IsConsoleRedirectionCheckSupported &&
!Console.IsOutputRedirected) !Console.IsOutputRedirected)
{ {
Console.ResetColor(); Console.ResetColor();
@ -64,4 +64,4 @@ namespace System.CommandLine
} }
} }
} }
} }

12
src/opulence/dotnet-opulence/CustomizationPipeline.cs

@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
@ -74,7 +74,7 @@ namespace Opulence
string? projectFilePath = null; string? projectFilePath = null;
if (solution != null) if (solution != null)
{ {
var project = FindProjectInSolution(solution, service.FriendlyName); var project = FindProjectInSolution(solution, service.FriendlyName);
if (project == null) if (project == null)
{ {
output.WriteDebugLine($"Could not find project for service '{service.FriendlyName}'."); output.WriteDebugLine($"Could not find project for service '{service.FriendlyName}'.");
@ -97,12 +97,12 @@ namespace Opulence
projectRelativeFilePath = projectFile.FullName; projectRelativeFilePath = projectFile.FullName;
projectFilePath = projectFile.FullName; projectFilePath = projectFile.FullName;
} }
if (projectFilePath != null) if (projectFilePath != null)
{ {
var project = new Project(projectRelativeFilePath!); var project = new Project(projectRelativeFilePath!);
await ProjectReader.ReadProjectDetailsAsync(output, new FileInfo(projectFilePath), project); await ProjectReader.ReadProjectDetailsAsync(output, new FileInfo(projectFilePath), project);
service.Service.Source = project; service.Service.Source = project;
// Apply defaults to everything that has a project. // Apply defaults to everything that has a project.
@ -146,7 +146,7 @@ namespace Opulence
var project = solution.ProjectsInOrder[i]; var project = solution.ProjectsInOrder[i];
var normalized = Names.NormalizeToFriendly(project.ProjectName); var normalized = Names.NormalizeToFriendly(project.ProjectName);
if (string.Equals(normalized, projectName, StringComparison.Ordinal) && if (string.Equals(normalized, projectName, StringComparison.Ordinal) &&
project.AbsolutePath.EndsWith(".csproj", StringComparison.Ordinal)) project.AbsolutePath.EndsWith(".csproj", StringComparison.Ordinal))
{ {
return project; return project;
@ -156,4 +156,4 @@ namespace Opulence
return null; return null;
} }
} }
} }

4
src/opulence/dotnet-opulence/DeployCommand.cs

@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.CommandLine; using System.CommandLine;
using System.CommandLine.Invocation; using System.CommandLine.Invocation;
@ -133,4 +133,4 @@ namespace Opulence
step.MarkComplete(); step.MarkComplete();
} }
} }
} }

2
src/opulence/dotnet-opulence/DeployServiceYamlStep.cs

@ -1,4 +1,4 @@
using System.CommandLine.Invocation; using System.CommandLine.Invocation;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;

8
src/opulence/dotnet-opulence/DirectoryCopy.cs

@ -1,4 +1,4 @@
using System.IO; using System.IO;
namespace Opulence namespace Opulence
{ {
@ -12,12 +12,12 @@ namespace Opulence
private static void CopyCore(DirectoryInfo source, DirectoryInfo destination) private static void CopyCore(DirectoryInfo source, DirectoryInfo destination)
{ {
Directory.CreateDirectory(destination.FullName); Directory.CreateDirectory(destination.FullName);
foreach (var file in source.GetFiles()) foreach (var file in source.GetFiles())
{ {
file.CopyTo(Path.Combine(destination.FullName, file.Name), true); file.CopyTo(Path.Combine(destination.FullName, file.Name), true);
} }
foreach (var nextSource in source.GetDirectories()) foreach (var nextSource in source.GetDirectories())
{ {
var nextDestination = destination.CreateSubdirectory(nextSource.Name); var nextDestination = destination.CreateSubdirectory(nextSource.Name);
@ -25,4 +25,4 @@ namespace Opulence
} }
} }
} }
} }

12
src/opulence/dotnet-opulence/DirectorySearch.cs

@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
@ -20,7 +20,7 @@ namespace Opulence
} }
var directory = new DirectoryInfo(directoryPath); var directory = new DirectoryInfo(directoryPath);
while (true) while (true)
{ {
var filePath = Path.Combine(directory.FullName, fileName); var filePath = Path.Combine(directory.FullName, fileName);
@ -33,7 +33,7 @@ namespace Opulence
{ {
return null; return null;
} }
if (directory.Parent == null) if (directory.Parent == null)
{ {
return null; return null;
@ -56,7 +56,7 @@ namespace Opulence
} }
var directory = new DirectoryInfo(directoryPath); var directory = new DirectoryInfo(directoryPath);
while (true) while (true)
{ {
if (directory.EnumerateFiles(searchPattern).Any()) if (directory.EnumerateFiles(searchPattern).Any())
@ -68,7 +68,7 @@ namespace Opulence
{ {
return Array.Empty<FileInfo>(); return Array.Empty<FileInfo>();
} }
if (directory.Parent == null) if (directory.Parent == null)
{ {
return Array.Empty<FileInfo>(); return Array.Empty<FileInfo>();
@ -78,4 +78,4 @@ namespace Opulence
} }
} }
} }
} }

6
src/opulence/dotnet-opulence/DockerContainerBuilder.cs

@ -1,4 +1,4 @@
using System; using System;
using System.CommandLine.Invocation; using System.CommandLine.Invocation;
using System.IO; using System.IO;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -35,7 +35,7 @@ namespace Opulence
} }
using var tempFile = TempFile.Create(); using var tempFile = TempFile.Create();
var dockerFilePath = Path.Combine(application.GetProjectDirectory(project), Path.GetDirectoryName(project.RelativeFilePath)!, "Dockerfile"); var dockerFilePath = Path.Combine(application.GetProjectDirectory(project), Path.GetDirectoryName(project.RelativeFilePath)!, "Dockerfile");
if (File.Exists(dockerFilePath)) if (File.Exists(dockerFilePath))
{ {
@ -67,4 +67,4 @@ namespace Opulence
service.Outputs.Add(new DockerImageOutput(container.ImageName!, container.ImageTag!)); service.Outputs.Add(new DockerImageOutput(container.ImageName!, container.ImageTag!));
} }
} }
} }

4
src/opulence/dotnet-opulence/DockerPush.cs

@ -1,4 +1,4 @@
using System; using System;
using System.CommandLine.Invocation; using System.CommandLine.Invocation;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -39,4 +39,4 @@ namespace Opulence
} }
} }
} }
} }

6
src/opulence/dotnet-opulence/DockerfileGenerator.cs

@ -42,7 +42,7 @@ namespace Opulence
using var stream = File.OpenWrite(filePath); using var stream = File.OpenWrite(filePath);
using var writer = new StreamWriter(stream, encoding: Encoding.UTF8, leaveOpen: true); using var writer = new StreamWriter(stream, encoding: Encoding.UTF8, leaveOpen: true);
var entryPoint = Path.GetFileNameWithoutExtension(project.RelativeFilePath); var entryPoint = Path.GetFileNameWithoutExtension(project.RelativeFilePath);
output.WriteDebugLine($"Writing dockerfile to '{filePath}'."); output.WriteDebugLine($"Writing dockerfile to '{filePath}'.");
if (container.UseMultiphaseDockerfile ?? true) if (container.UseMultiphaseDockerfile ?? true)
@ -98,7 +98,7 @@ namespace Opulence
throw new ArgumentNullException(nameof(container)); throw new ArgumentNullException(nameof(container));
} }
if (container.BaseImageName == null && if (container.BaseImageName == null &&
project.Frameworks.Any(f => f.Name == "Microsoft.AspNetCore.App")) project.Frameworks.Any(f => f.Name == "Microsoft.AspNetCore.App"))
{ {
container.BaseImageName = "mcr.microsoft.com/dotnet/core/aspnet"; container.BaseImageName = "mcr.microsoft.com/dotnet/core/aspnet";
@ -135,7 +135,7 @@ namespace Opulence
{ {
container.ImageName ??= $"{application.Globals.Registry?.Hostname}/{service.Service.Name.ToLowerInvariant()}"; container.ImageName ??= $"{application.Globals.Registry?.Hostname}/{service.Service.Name.ToLowerInvariant()}";
} }
container.ImageTag ??= project.Version.Replace("+", "-"); container.ImageTag ??= project.Version.Replace("+", "-");
} }
} }

6
src/opulence/dotnet-opulence/GenerateCommand.cs

@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.CommandLine; using System.CommandLine;
using System.CommandLine.Invocation; using System.CommandLine.Invocation;
@ -38,7 +38,7 @@ namespace Opulence
if (outputs.Count == 0 || outputs.Contains("container")) if (outputs.Count == 0 || outputs.Contains("container"))
{ {
steps.Add(new GenerateDockerfileStep(){ Force = force, }); steps.Add(new GenerateDockerfileStep() { Force = force, });
} }
if (outputs.Count == 0 || outputs.Contains("chart")) if (outputs.Count == 0 || outputs.Contains("chart"))
@ -56,4 +56,4 @@ namespace Opulence
} }
} }
} }
} }

4
src/opulence/dotnet-opulence/GenerateDockerfileStep.cs

@ -1,4 +1,4 @@
using System.IO; using System.IO;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Opulence namespace Opulence
@ -40,4 +40,4 @@ namespace Opulence
output.WriteInfoLine($"Generated Dockerfile at '{dockerFilePath}'."); output.WriteInfoLine($"Generated Dockerfile at '{dockerFilePath}'.");
} }
} }
} }

4
src/opulence/dotnet-opulence/GenerateHelmChartStep.cs

@ -1,4 +1,4 @@
using System.IO; using System.IO;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Opulence namespace Opulence
@ -44,4 +44,4 @@ namespace Opulence
} }
} }
} }

4
src/opulence/dotnet-opulence/GenerateKubernetesManifestStep.cs

@ -1,4 +1,4 @@
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Opulence namespace Opulence
{ {
@ -26,4 +26,4 @@ namespace Opulence
return Task.CompletedTask; return Task.CompletedTask;
} }
} }
} }

4
src/opulence/dotnet-opulence/GenerateOamComponentStep.cs

@ -1,4 +1,4 @@
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Opulence namespace Opulence
{ {
@ -26,4 +26,4 @@ namespace Opulence
return Task.CompletedTask; return Task.CompletedTask;
} }
} }
} }

6
src/opulence/dotnet-opulence/HelmChartBuilder.cs

@ -1,4 +1,4 @@
using System; using System;
using System.CommandLine.Invocation; using System.CommandLine.Invocation;
using System.IO; using System.IO;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -42,7 +42,7 @@ namespace Opulence
var projectDirectory = Path.Combine(application.RootDirectory, Path.GetDirectoryName(project.RelativeFilePath)!); var projectDirectory = Path.Combine(application.RootDirectory, Path.GetDirectoryName(project.RelativeFilePath)!);
var outputDirectoryPath = Path.Combine(projectDirectory, "bin"); var outputDirectoryPath = Path.Combine(projectDirectory, "bin");
using var tempDirectory = TempDirectory.Create(); using var tempDirectory = TempDirectory.Create();
HelmChartGenerator.ApplyHelmChartDefaults(application, service, container, chart); HelmChartGenerator.ApplyHelmChartDefaults(application, service, container, chart);
var chartRoot = Path.Combine(projectDirectory, "charts"); var chartRoot = Path.Combine(projectDirectory, "charts");
@ -80,4 +80,4 @@ namespace Opulence
output.WriteInfoLine($"Created Helm Chart: {Path.Combine(outputDirectoryPath, chart.ChartName + "-" + project.Version.Replace('+', '-') + ".tgz")}"); output.WriteInfoLine($"Created Helm Chart: {Path.Combine(outputDirectoryPath, chart.ChartName + "-" + project.Version.Replace('+', '-') + ".tgz")}");
} }
} }
} }

4
src/opulence/dotnet-opulence/HelmChartGenerator.cs

@ -1,4 +1,4 @@
using System; using System;
using System.IO; using System.IO;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -108,4 +108,4 @@ namespace Opulence
chart.ChartName ??= service.Service.Name.ToLowerInvariant(); chart.ChartName ??= service.Service.Name.ToLowerInvariant();
} }
} }
} }

4
src/opulence/dotnet-opulence/HelmPush.cs

@ -1,4 +1,4 @@
using System; using System;
using System.CommandLine.Invocation; using System.CommandLine.Invocation;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -49,4 +49,4 @@ namespace Opulence
} }
} }
} }
} }

4
src/opulence/dotnet-opulence/IYamlManifestOutput.cs

@ -1,4 +1,4 @@
using YamlDotNet.RepresentationModel; using YamlDotNet.RepresentationModel;
namespace Opulence namespace Opulence
{ {
@ -6,4 +6,4 @@ namespace Opulence
{ {
YamlDocument Yaml { get; } YamlDocument Yaml { get; }
} }
} }

14
src/opulence/dotnet-opulence/InitCommand.cs

@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.CommandLine; using System.CommandLine;
using System.CommandLine.Builder; using System.CommandLine.Builder;
@ -62,21 +62,21 @@ namespace Opulence
using (var step = output.BeginStep("Looking For .sln File...")) using (var step = output.BeginStep("Looking For .sln File..."))
{ {
solutionFilePath = DirectorySearch.AscendingWildcardSearch(directory.FullName, "*.sln").FirstOrDefault()?.FullName; solutionFilePath = DirectorySearch.AscendingWildcardSearch(directory.FullName, "*.sln").FirstOrDefault()?.FullName;
if (opulenceFilePath == null && if (opulenceFilePath == null &&
solutionFilePath != null && solutionFilePath != null &&
output.Confirm($"Use '{Path.GetDirectoryName(solutionFilePath)}' as Root?")) output.Confirm($"Use '{Path.GetDirectoryName(solutionFilePath)}' as Root?"))
{ {
opulenceFilePath = Path.Combine(Path.GetDirectoryName(solutionFilePath)!, "Opulence.csx"); opulenceFilePath = Path.Combine(Path.GetDirectoryName(solutionFilePath)!, "Opulence.csx");
step.MarkComplete(); step.MarkComplete();
} }
else else
{ {
output.WriteInfoLine("Not Found."); output.WriteInfoLine("Not Found.");
step.MarkComplete(); step.MarkComplete();
} }
} }
if (opulenceFilePath == null && if (opulenceFilePath == null &&
Path.GetFullPath(directory.FullName) != Path.GetFullPath(Environment.CurrentDirectory)) Path.GetFullPath(directory.FullName) != Path.GetFullPath(Environment.CurrentDirectory))
{ {
// User specified a directory other than the current one // User specified a directory other than the current one
@ -188,6 +188,6 @@ namespace Opulence
await writer.WriteLineAsync($"{{"); await writer.WriteLineAsync($"{{");
await writer.WriteLineAsync($" // Configure your service bindings here with code."); await writer.WriteLineAsync($" // Configure your service bindings here with code.");
await writer.WriteLineAsync($"}});"); await writer.WriteLineAsync($"}});");
} }
} }
} }

4
src/opulence/dotnet-opulence/KubernetesDeploymentOutput.cs

@ -1,4 +1,4 @@
using System; using System;
using YamlDotNet.RepresentationModel; using YamlDotNet.RepresentationModel;
namespace Opulence namespace Opulence
@ -24,4 +24,4 @@ namespace Opulence
public string Name { get; } public string Name { get; }
public YamlDocument Yaml { get; } public YamlDocument Yaml { get; }
} }
} }

4
src/opulence/dotnet-opulence/KubernetesManifestGenerator.cs

@ -1,4 +1,4 @@
using System; using System;
using System.Linq; using System.Linq;
using YamlDotNet.RepresentationModel; using YamlDotNet.RepresentationModel;
@ -193,4 +193,4 @@ namespace Opulence
return new KubernetesDeploymentOutput(service.Service.Name, new YamlDocument(root)); return new KubernetesDeploymentOutput(service.Service.Name, new YamlDocument(root));
} }
} }
} }

4
src/opulence/dotnet-opulence/KubernetesServiceOutput.cs

@ -1,4 +1,4 @@
using System; using System;
using YamlDotNet.RepresentationModel; using YamlDotNet.RepresentationModel;
namespace Opulence namespace Opulence
@ -24,4 +24,4 @@ namespace Opulence
public string Name { get; } public string Name { get; }
public YamlDocument Yaml { get; } public YamlDocument Yaml { get; }
} }
} }

4
src/opulence/dotnet-opulence/Names.cs

@ -1,4 +1,4 @@
using System; using System;
namespace Opulence namespace Opulence
{ {
@ -29,4 +29,4 @@ namespace Opulence
return name; return name;
} }
} }
} }

4
src/opulence/dotnet-opulence/OamApplicationGenerator.cs

@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
@ -81,4 +81,4 @@ namespace Opulence
return Task.CompletedTask; return Task.CompletedTask;
} }
} }
} }

8
src/opulence/dotnet-opulence/OamComponentGenerator.cs

@ -1,4 +1,4 @@
using System; using System;
using System.Linq; using System.Linq;
using YamlDotNet.RepresentationModel; using YamlDotNet.RepresentationModel;
@ -32,10 +32,10 @@ namespace Opulence
root.Add("metadata", metadata); root.Add("metadata", metadata);
metadata.Add("name", service.Service.Name); metadata.Add("name", service.Service.Name);
var spec = new YamlMappingNode(); var spec = new YamlMappingNode();
root.Add("spec", spec); root.Add("spec", spec);
spec.Add("workloadType", "core.oam.dev/v1alpha1.Server"); spec.Add("workloadType", "core.oam.dev/v1alpha1.Server");
var containers = new YamlSequenceNode(); var containers = new YamlSequenceNode();
spec.Add("containers", containers); spec.Add("containers", containers);
@ -51,4 +51,4 @@ namespace Opulence
return new OamComponentOutput(service.Service.Name, new YamlDocument(root)); return new OamComponentOutput(service.Service.Name, new YamlDocument(root));
} }
} }
} }

4
src/opulence/dotnet-opulence/OamComponentOutput.cs

@ -1,4 +1,4 @@
using System; using System;
using YamlDotNet.RepresentationModel; using YamlDotNet.RepresentationModel;
namespace Opulence namespace Opulence
@ -24,4 +24,4 @@ namespace Opulence
public string Name { get; } public string Name { get; }
public YamlDocument Yaml { get; } public YamlDocument Yaml { get; }
} }
} }

14
src/opulence/dotnet-opulence/OutputContext.cs

@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.CommandLine; using System.CommandLine;
using System.CommandLine.IO; using System.CommandLine.IO;
@ -109,7 +109,7 @@ namespace Opulence
public void WriteCommandLine(string process, string args) public void WriteCommandLine(string process, string args)
{ {
WriteDebugLine($"> {process} {args}"); WriteDebugLine($"> {process} {args}");
} }
public bool Confirm(string prompt) public bool Confirm(string prompt)
@ -149,7 +149,7 @@ namespace Opulence
} }
} }
// //
public void WriteBanner() public void WriteBanner()
@ -202,7 +202,7 @@ namespace Opulence
if (output.Verbosity >= Verbosity.Info) if (output.Verbosity >= Verbosity.Info)
{ {
output.Console.SetTerminalForegroundColor(ConsoleColor.Red); output.Console.SetTerminalForegroundColor(ConsoleColor.Red);
output.Console.Out.WriteLine(new string(' ', output.indent + IndentAmount)+ line); output.Console.Out.WriteLine(new string(' ', output.indent + IndentAmount) + line);
output.Console.ResetTerminalForegroundColor(); output.Console.ResetTerminalForegroundColor();
} }
} }
@ -232,7 +232,7 @@ namespace Opulence
} }
public bool Completed => message != null; public bool Completed => message != null;
public string? Message => message; public string? Message => message;
public string Title => title; public string Title => title;
@ -247,10 +247,10 @@ namespace Opulence
{ {
return; return;
} }
output.EndStep(this); output.EndStep(this);
disposed = true; disposed = true;
} }
} }
} }
} }

2
src/opulence/dotnet-opulence/PackageCommand.cs

@ -68,7 +68,7 @@ namespace Opulence
// for just the project. We won't run the "application package" part. // for just the project. We won't run the "application package" part.
if (!string.Equals(".sln", projectFile.Extension, StringComparison.Ordinal)) if (!string.Equals(".sln", projectFile.Extension, StringComparison.Ordinal))
{ {
steps.Add(new WriteServiceYamlStep(){ OutputDirectory = outputDirectory, Force = force, }); steps.Add(new WriteServiceYamlStep() { OutputDirectory = outputDirectory, Force = force, });
} }
var executor = new ServiceExecutor(output, application, steps); var executor = new ServiceExecutor(output, application, steps);

6
src/opulence/dotnet-opulence/Program.cs

@ -1,4 +1,4 @@
using System; using System;
using System.CommandLine; using System.CommandLine;
using System.CommandLine.Builder; using System.CommandLine.Builder;
using System.CommandLine.Help; using System.CommandLine.Help;
@ -36,14 +36,14 @@ namespace Opulence
builder.UseDebugDirective(); builder.UseDebugDirective();
builder.UseParseErrorReporting(); builder.UseParseErrorReporting();
builder.ParseResponseFileAs(ResponseFileHandling.ParseArgsAsSpaceSeparated); builder.ParseResponseFileAs(ResponseFileHandling.ParseArgsAsSpaceSeparated);
builder.UsePrefixes(new []{ "-", "--", }); // disable garbage windows conventions builder.UsePrefixes(new[] { "-", "--", }); // disable garbage windows conventions
builder.CancelOnProcessTermination(); builder.CancelOnProcessTermination();
builder.UseExceptionHandler(HandleException); builder.UseExceptionHandler(HandleException);
// Allow fancy drawing. // Allow fancy drawing.
builder.UseAnsiTerminalWhenAvailable(); builder.UseAnsiTerminalWhenAvailable();
var parser = builder.Build(); var parser = builder.Build();
return await parser.InvokeAsync(args); return await parser.InvokeAsync(args);
} }

4
src/opulence/dotnet-opulence/ProjectReader.cs

@ -1,4 +1,4 @@
using System; using System;
using System.CommandLine.Invocation; using System.CommandLine.Invocation;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
@ -115,4 +115,4 @@ namespace Opulence
} }
} }
} }
} }

2
src/opulence/dotnet-opulence/PushCommand.cs

@ -1,4 +1,4 @@
using System; using System;
using System.CommandLine; using System.CommandLine;
using System.CommandLine.Invocation; using System.CommandLine.Invocation;
using System.IO; using System.IO;

4
src/opulence/dotnet-opulence/PushDockerImageStep.cs

@ -1,4 +1,4 @@
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Opulence namespace Opulence
@ -33,4 +33,4 @@ namespace Opulence
} }
} }
} }
} }

18
src/opulence/dotnet-opulence/ScriptRunner.cs

@ -1,4 +1,4 @@
using System; using System;
using System.IO; using System.IO;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -34,7 +34,7 @@ namespace Opulence
var code = File.ReadAllText(scriptFilePath); var code = File.ReadAllText(scriptFilePath);
var script = CSharpScript.Create<object>( var script = CSharpScript.Create<object>(
code, code,
options: ScriptOptions.Default.WithImports(new []{ "System", "System.Collections.Generic", }), options: ScriptOptions.Default.WithImports(new[] { "System", "System.Collections.Generic", }),
globalsType: typeof(PipelineHolder), globalsType: typeof(PipelineHolder),
assemblyLoader: null); assemblyLoader: null);
script = script.ContinueWith<object>(@"return await Pipeline.ExecuteAsync(__Pipeline);", options: ScriptOptions.Default); script = script.ContinueWith<object>(@"return await Pipeline.ExecuteAsync(__Pipeline);", options: ScriptOptions.Default);
@ -58,10 +58,10 @@ namespace Opulence
output.WriteDebugLine($"Done compiling {Path.GetFileName(scriptFilePath)}'."); output.WriteDebugLine($"Done compiling {Path.GetFileName(scriptFilePath)}'.");
var pipeline = new CustomizationPipeline( var pipeline = new CustomizationPipeline(
output, output,
rootDirectory: Path.GetDirectoryName(scriptFilePath)!, rootDirectory: Path.GetDirectoryName(scriptFilePath)!,
name: Names.NormalizeToDns(Path.GetFileNameWithoutExtension(projectFile.Name)), name: Names.NormalizeToDns(Path.GetFileNameWithoutExtension(projectFile.Name)),
solution: null, solution: null,
projectFile); projectFile);
var holder = new PipelineHolder(pipeline); var holder = new PipelineHolder(pipeline);
@ -115,7 +115,7 @@ namespace Opulence
var code = File.ReadAllText(scriptFilePath); var code = File.ReadAllText(scriptFilePath);
var script = CSharpScript.Create<object>( var script = CSharpScript.Create<object>(
code, code,
options: ScriptOptions.Default.WithImports(new []{ "System", "System.Collections.Generic", }), options: ScriptOptions.Default.WithImports(new[] { "System", "System.Collections.Generic", }),
globalsType: typeof(PipelineHolder), globalsType: typeof(PipelineHolder),
assemblyLoader: null); assemblyLoader: null);
script = script.ContinueWith<object>(@"return await Pipeline.ExecuteAsync(__Pipeline);", options: ScriptOptions.Default); script = script.ContinueWith<object>(@"return await Pipeline.ExecuteAsync(__Pipeline);", options: ScriptOptions.Default);
@ -139,10 +139,10 @@ namespace Opulence
output.WriteDebugLine($"Done compiling {Path.GetFileName(scriptFilePath)}'."); output.WriteDebugLine($"Done compiling {Path.GetFileName(scriptFilePath)}'.");
var pipeline = new CustomizationPipeline( var pipeline = new CustomizationPipeline(
output, output,
rootDirectory: Path.GetDirectoryName(scriptFilePath)!, rootDirectory: Path.GetDirectoryName(scriptFilePath)!,
name: Names.NormalizeToDns(Path.GetFileNameWithoutExtension(solutionFile.Name)), name: Names.NormalizeToDns(Path.GetFileNameWithoutExtension(solutionFile.Name)),
solution, solution,
projectFile: null); projectFile: null);
var holder = new PipelineHolder(pipeline); var holder = new PipelineHolder(pipeline);
@ -163,4 +163,4 @@ namespace Opulence
} }
} }
} }
} }

6
src/opulence/dotnet-opulence/ServiceExecutor.cs

@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using System.IO; using System.IO;
@ -77,7 +77,7 @@ namespace Opulence
{ {
throw new ArgumentNullException(nameof(service)); throw new ArgumentNullException(nameof(service));
} }
if (service.Service.Source is Project p) if (service.Service.Source is Project p)
{ {
project = p; project = p;
@ -134,4 +134,4 @@ namespace Opulence
} }
} }
} }
} }

14
src/opulence/dotnet-opulence/StandardOptions.cs

@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.CommandLine; using System.CommandLine;
using System.CommandLine.Parsing; using System.CommandLine.Parsing;
@ -15,7 +15,7 @@ namespace Opulence
{ {
get get
{ {
return new Option(new []{ "-e", "--environment" }, "Environemnt") return new Option(new[] { "-e", "--environment" }, "Environemnt")
{ {
Argument = new Argument<string>("environment", () => "production") Argument = new Argument<string>("environment", () => "production")
{ {
@ -48,7 +48,7 @@ namespace Opulence
argument.AddSuggestions(AllOutputs); argument.AddSuggestions(AllOutputs);
argument.SetDefaultValue(new List<string>(AllOutputs)); argument.SetDefaultValue(new List<string>(AllOutputs));
return new Option(new[]{ "-o", "--outputs" }, "Outputs to generate") return new Option(new[] { "-o", "--outputs" }, "Outputs to generate")
{ {
Argument = argument, Argument = argument,
}; };
@ -85,7 +85,7 @@ namespace Opulence
Name = "project-file or solution-file or directory", Name = "project-file or solution-file or directory",
}; };
return new Option(new [] { "-p", "--project", }, "Project file, Solution file or directory") return new Option(new[] { "-p", "--project", }, "Project file, Solution file or directory")
{ {
Argument = argument, Argument = argument,
}; };
@ -165,12 +165,12 @@ namespace Opulence
} }
} }
} }
public static Option Verbosity public static Option Verbosity
{ {
get get
{ {
return new Option(new [] { "-v", "--verbosity" }, "Output verbostiy") return new Option(new[] { "-v", "--verbosity" }, "Output verbostiy")
{ {
Argument = new Argument<Verbosity>("one of: quiet|info|debug", () => Opulence.Verbosity.Info) Argument = new Argument<Verbosity>("one of: quiet|info|debug", () => Opulence.Verbosity.Info)
{ {
@ -181,4 +181,4 @@ namespace Opulence
} }
} }
} }
} }

4
src/opulence/dotnet-opulence/StepView.cs

@ -1,7 +1,7 @@
namespace Opulence namespace Opulence
{ {
internal class StepView internal class StepView
{ {
} }
} }

2
src/opulence/dotnet-opulence/TargetInstaller.cs

@ -28,7 +28,7 @@ namespace Opulence
{ {
return; return;
} }
var toolType = typeof(TargetInstaller); var toolType = typeof(TargetInstaller);
var toolAssembly = toolType.GetTypeInfo().Assembly; var toolAssembly = toolType.GetTypeInfo().Assembly;
var toolImportTargetsResourceName = $"Opulence.Resources.Imports.targets"; var toolImportTargetsResourceName = $"Opulence.Resources.Imports.targets";

4
src/opulence/dotnet-opulence/TempDirectory.cs

@ -1,4 +1,4 @@
using System; using System;
using System.IO; using System.IO;
namespace Opulence namespace Opulence
@ -24,4 +24,4 @@ namespace Opulence
Directory.Delete(DirectoryPath, recursive: true); Directory.Delete(DirectoryPath, recursive: true);
} }
} }
} }

4
src/opulence/dotnet-opulence/TempFile.cs

@ -1,4 +1,4 @@
using System; using System;
using System.IO; using System.IO;
namespace Opulence namespace Opulence
@ -23,4 +23,4 @@ namespace Opulence
public string FilePath { get; } public string FilePath { get; }
} }
} }

4
src/opulence/dotnet-opulence/Templates.cs

@ -1,4 +1,4 @@
using System.IO; using System.IO;
namespace Opulence namespace Opulence
{ {
@ -22,4 +22,4 @@ namespace Opulence
} }
} }
} }
} }

4
src/opulence/dotnet-opulence/Verbosity.cs

@ -1,4 +1,4 @@
namespace Opulence namespace Opulence
{ {
internal enum Verbosity internal enum Verbosity
{ {
@ -6,4 +6,4 @@ namespace Opulence
Info, Info,
Debug, Debug,
} }
} }

4
src/opulence/dotnet-opulence/WriteServiceYamlStep.cs

@ -1,4 +1,4 @@
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -40,4 +40,4 @@ namespace Opulence
return Task.CompletedTask; return Task.CompletedTask;
} }
} }
} }

2
test/E2ETest/UnitTest1.cs

@ -1,4 +1,4 @@
using System; using System;
using Xunit; using Xunit;
namespace E2ETest namespace E2ETest

Loading…
Cancel
Save