From 280fe7f59b65fd0a5854217bc6b855b5254a9a6d Mon Sep 17 00:00:00 2001 From: Ryan Nowak Date: Mon, 2 Mar 2020 23:42:54 -0800 Subject: [PATCH] Make opulence projects disappear (#51) --- .../Application.cs | 2 +- .../ApplicationGlobals.cs | 2 +- .../ApplicationYamlWriter.cs | 2 +- .../BuildDockerImageStep.cs | 2 +- .../CombineStep.cs | 2 +- .../CommandException.cs | 2 +- .../ComputedBindings.cs | 2 +- .../ConsoleExtensions.cs | 0 .../Opulence => Tye.Core}/ContainerInfo.cs | 2 +- .../ContainerRegistry.cs | 2 +- .../CustomizationPipeline.cs | 2 +- .../DeployServiceYamlStep.cs | 4 +- .../Opulence => Tye.Core}/DeploymentKind.cs | 2 +- .../DirectoryCopy.cs | 2 +- .../DirectorySearch.cs | 2 +- .../DockerContainerBuilder.cs | 2 +- .../Opulence => Tye.Core}/DockerImage.cs | 2 +- .../DockerPush.cs | 2 +- .../DockerfileGenerator.cs | 4 +- .../EnvironmentAttribute.cs | 2 +- .../Opulence => Tye.Core}/Environments.cs | 2 +- .../Opulence => Tye.Core}/Framework.cs | 2 +- .../FrameworkCollection.cs | 2 +- .../GenerateDockerfileStep.cs | 2 +- .../GenerateHelmChartStep.cs | 2 +- .../GenerateKubernetesManifestStep.cs | 2 +- .../GenerateOamComponentStep.cs | 2 +- .../Opulence => Tye.Core}/GeneratedAssets.cs | 2 +- .../HelmChartBuilder.cs | 2 +- .../HelmChartGenerator.cs | 4 +- .../Opulence => Tye.Core}/HelmChartStep.cs | 2 +- .../dotnet-opulence => Tye.Core}/HelmPush.cs | 2 +- .../IYamlManifestOutput.cs | 2 +- .../KubernetesDeploymentOutput.cs | 2 +- .../KubernetesManifestGenerator.cs | 18 +- .../KubernetesServiceOutput.cs | 2 +- .../dotnet-opulence => Tye.Core}/Names.cs | 2 +- .../OamApplicationGenerator.cs | 2 +- .../OamComponentGenerator.cs | 2 +- .../OamComponentOutput.cs | 2 +- .../OutputContext.cs | 2 +- .../Opulence => Tye.Core}/Pipeline.cs | 2 +- .../Opulence => Tye.Core}/PipelineHolder.cs | 2 +- .../dotnet-opulence => Tye.Core}/Program.cs | 2 +- .../Opulence => Tye.Core}/Project.cs | 2 +- .../ProjectReader.cs | 8 +- .../PushDockerImageStep.cs | 2 +- .../Resources/Imports.targets | 4 +- src/{opulence/Opulence => Tye.Core}/Secret.cs | 2 +- .../Opulence => Tye.Core}/Service.cs | 2 +- .../Opulence => Tye.Core}/ServiceBinding.cs | 2 +- .../ServiceExecutor.cs | 2 +- src/{opulence/Opulence => Tye.Core}/Source.cs | 2 +- .../StandardOptions.cs | 4 +- src/{opulence/Opulence => Tye.Core}/Step.cs | 2 +- .../dotnet-opulence => Tye.Core}/StepView.cs | 2 +- .../TargetInstaller.cs | 6 +- .../dotnet-opulence => Tye.Core}/Templates.cs | 2 +- .../Templates/Helm/templates/_helpers.tpl | 0 .../Templates/Helm/templates/deployment.yaml | 0 .../Templates/Helm/templates/service.yaml | 0 src/Tye.Core/Tye.Core.csproj | 34 ++++ .../dotnet-opulence => Tye.Core}/Verbosity.cs | 2 +- .../WriteServiceYamlStep.cs | 4 +- .../build/Tye.targets} | 12 +- .../buildMultiTargeting/Tye.targets} | 6 +- src/opulence/Opulence/Opulence.csproj | 13 -- .../dotnet-opulence/ApplicationFactory.cs | 142 --------------- .../dotnet-opulence/GenerateCommand.cs | 59 ------- .../dotnet-opulence/PackageCommand.cs | 119 ------------- .../Properties/launchSettings.json | 8 - src/opulence/dotnet-opulence/PushCommand.cs | 55 ------ src/opulence/dotnet-opulence/ScriptRunner.cs | 166 ------------------ .../dotnet-opulence/dotnet-opulence.csproj | 44 ----- src/tye/ConfigModel/ConfigApplication.cs | 12 +- src/tye/OpulenceApplicationAdapter.cs | 5 +- src/tye/Program.DeployCommand.cs | 29 ++- src/tye/Program.GenerateCommand.cs | 11 +- src/tye/Program.InitCommand.cs | 1 - src/tye/tye.csproj | 2 +- tye.sln | 48 ++--- 81 files changed, 169 insertions(+), 753 deletions(-) rename src/{opulence/dotnet-opulence => Tye.Core}/Application.cs (99%) rename src/{opulence/Opulence => Tye.Core}/ApplicationGlobals.cs (91%) rename src/{opulence/dotnet-opulence => Tye.Core}/ApplicationYamlWriter.cs (97%) rename src/{opulence/dotnet-opulence => Tye.Core}/BuildDockerImageStep.cs (97%) rename src/{opulence/dotnet-opulence => Tye.Core}/CombineStep.cs (99%) rename src/{opulence/dotnet-opulence => Tye.Core}/CommandException.cs (93%) rename src/{opulence/dotnet-opulence => Tye.Core}/ComputedBindings.cs (98%) rename src/{opulence/dotnet-opulence => Tye.Core}/ConsoleExtensions.cs (100%) rename src/{opulence/Opulence => Tye.Core}/ContainerInfo.cs (98%) rename src/{opulence/Opulence => Tye.Core}/ContainerRegistry.cs (94%) rename src/{opulence/dotnet-opulence => Tye.Core}/CustomizationPipeline.cs (99%) rename src/{opulence/dotnet-opulence => Tye.Core}/DeployServiceYamlStep.cs (97%) rename src/{opulence/Opulence => Tye.Core}/DeploymentKind.cs (81%) rename src/{opulence/dotnet-opulence => Tye.Core}/DirectoryCopy.cs (97%) rename src/{opulence/dotnet-opulence => Tye.Core}/DirectorySearch.cs (99%) rename src/{opulence/dotnet-opulence => Tye.Core}/DockerContainerBuilder.cs (99%) rename src/{opulence/Opulence => Tye.Core}/DockerImage.cs (94%) rename src/{opulence/dotnet-opulence => Tye.Core}/DockerPush.cs (98%) rename src/{opulence/dotnet-opulence => Tye.Core}/DockerfileGenerator.cs (98%) rename src/{opulence/Opulence => Tye.Core}/EnvironmentAttribute.cs (95%) rename src/{opulence/Opulence => Tye.Core}/Environments.cs (88%) rename src/{opulence/Opulence => Tye.Core}/Framework.cs (94%) rename src/{opulence/Opulence => Tye.Core}/FrameworkCollection.cs (96%) rename src/{opulence/dotnet-opulence => Tye.Core}/GenerateDockerfileStep.cs (98%) rename src/{opulence/dotnet-opulence => Tye.Core}/GenerateHelmChartStep.cs (98%) rename src/{opulence/dotnet-opulence => Tye.Core}/GenerateKubernetesManifestStep.cs (98%) rename src/{opulence/dotnet-opulence => Tye.Core}/GenerateOamComponentStep.cs (97%) rename src/{opulence/Opulence => Tye.Core}/GeneratedAssets.cs (83%) rename src/{opulence/dotnet-opulence => Tye.Core}/HelmChartBuilder.cs (99%) rename src/{opulence/dotnet-opulence => Tye.Core}/HelmChartGenerator.cs (97%) rename src/{opulence/Opulence => Tye.Core}/HelmChartStep.cs (89%) rename src/{opulence/dotnet-opulence => Tye.Core}/HelmPush.cs (99%) rename src/{opulence/dotnet-opulence => Tye.Core}/IYamlManifestOutput.cs (87%) rename src/{opulence/dotnet-opulence => Tye.Core}/KubernetesDeploymentOutput.cs (97%) rename src/{opulence/dotnet-opulence => Tye.Core}/KubernetesManifestGenerator.cs (94%) rename src/{opulence/dotnet-opulence => Tye.Core}/KubernetesServiceOutput.cs (97%) rename src/{opulence/dotnet-opulence => Tye.Core}/Names.cs (97%) rename src/{opulence/dotnet-opulence => Tye.Core}/OamApplicationGenerator.cs (99%) rename src/{opulence/dotnet-opulence => Tye.Core}/OamComponentGenerator.cs (98%) rename src/{opulence/dotnet-opulence => Tye.Core}/OamComponentOutput.cs (96%) rename src/{opulence/dotnet-opulence => Tye.Core}/OutputContext.cs (99%) rename src/{opulence/Opulence => Tye.Core}/Pipeline.cs (98%) rename src/{opulence/Opulence => Tye.Core}/PipelineHolder.cs (94%) rename src/{opulence/dotnet-opulence => Tye.Core}/Program.cs (81%) rename src/{opulence/Opulence => Tye.Core}/Project.cs (96%) rename src/{opulence/dotnet-opulence => Tye.Core}/ProjectReader.cs (90%) rename src/{opulence/dotnet-opulence => Tye.Core}/PushDockerImageStep.cs (98%) rename src/{opulence/dotnet-opulence => Tye.Core}/Resources/Imports.targets (56%) rename src/{opulence/Opulence => Tye.Core}/Secret.cs (78%) rename src/{opulence/Opulence => Tye.Core}/Service.cs (97%) rename src/{opulence/Opulence => Tye.Core}/ServiceBinding.cs (95%) rename src/{opulence/dotnet-opulence => Tye.Core}/ServiceExecutor.cs (99%) rename src/{opulence/Opulence => Tye.Core}/Source.cs (81%) rename src/{opulence/dotnet-opulence => Tye.Core}/StandardOptions.cs (98%) rename src/{opulence/Opulence => Tye.Core}/Step.cs (81%) rename src/{opulence/dotnet-opulence => Tye.Core}/StepView.cs (67%) rename src/{opulence/dotnet-opulence => Tye.Core}/TargetInstaller.cs (92%) rename src/{opulence/dotnet-opulence => Tye.Core}/Templates.cs (96%) rename src/{opulence/dotnet-opulence => Tye.Core}/Templates/Helm/templates/_helpers.tpl (100%) rename src/{opulence/dotnet-opulence => Tye.Core}/Templates/Helm/templates/deployment.yaml (100%) rename src/{opulence/dotnet-opulence => Tye.Core}/Templates/Helm/templates/service.yaml (100%) create mode 100644 src/Tye.Core/Tye.Core.csproj rename src/{opulence/dotnet-opulence => Tye.Core}/Verbosity.cs (79%) rename src/{opulence/dotnet-opulence => Tye.Core}/WriteServiceYamlStep.cs (96%) rename src/{opulence/dotnet-opulence/build/Opulence.targets => Tye.Core/build/Tye.targets} (55%) rename src/{opulence/dotnet-opulence/buildMultiTargeting/Opulence.targets => Tye.Core/buildMultiTargeting/Tye.targets} (70%) delete mode 100644 src/opulence/Opulence/Opulence.csproj delete mode 100644 src/opulence/dotnet-opulence/ApplicationFactory.cs delete mode 100644 src/opulence/dotnet-opulence/GenerateCommand.cs delete mode 100644 src/opulence/dotnet-opulence/PackageCommand.cs delete mode 100644 src/opulence/dotnet-opulence/Properties/launchSettings.json delete mode 100644 src/opulence/dotnet-opulence/PushCommand.cs delete mode 100644 src/opulence/dotnet-opulence/ScriptRunner.cs delete mode 100644 src/opulence/dotnet-opulence/dotnet-opulence.csproj diff --git a/src/opulence/dotnet-opulence/Application.cs b/src/Tye.Core/Application.cs similarity index 99% rename from src/opulence/dotnet-opulence/Application.cs rename to src/Tye.Core/Application.cs index d430f4b9..4a028cc4 100644 --- a/src/opulence/dotnet-opulence/Application.cs +++ b/src/Tye.Core/Application.cs @@ -4,7 +4,7 @@ using System.IO; using System.Linq; using System.Reflection; -namespace Opulence +namespace Tye { public abstract class Application { diff --git a/src/opulence/Opulence/ApplicationGlobals.cs b/src/Tye.Core/ApplicationGlobals.cs similarity index 91% rename from src/opulence/Opulence/ApplicationGlobals.cs rename to src/Tye.Core/ApplicationGlobals.cs index 65809ce3..5cf5bef7 100644 --- a/src/opulence/Opulence/ApplicationGlobals.cs +++ b/src/Tye.Core/ApplicationGlobals.cs @@ -1,4 +1,4 @@ -namespace Opulence +namespace Tye { public sealed class ApplicationGlobals { diff --git a/src/opulence/dotnet-opulence/ApplicationYamlWriter.cs b/src/Tye.Core/ApplicationYamlWriter.cs similarity index 97% rename from src/opulence/dotnet-opulence/ApplicationYamlWriter.cs rename to src/Tye.Core/ApplicationYamlWriter.cs index 5fb46e47..e1b86da4 100644 --- a/src/opulence/dotnet-opulence/ApplicationYamlWriter.cs +++ b/src/Tye.Core/ApplicationYamlWriter.cs @@ -4,7 +4,7 @@ using System.Text; using System.Threading.Tasks; using YamlDotNet.RepresentationModel; -namespace Opulence +namespace Tye { public sealed class ApplicationYamlWriter { diff --git a/src/opulence/dotnet-opulence/BuildDockerImageStep.cs b/src/Tye.Core/BuildDockerImageStep.cs similarity index 97% rename from src/opulence/dotnet-opulence/BuildDockerImageStep.cs rename to src/Tye.Core/BuildDockerImageStep.cs index 35049133..1ea95bf6 100644 --- a/src/opulence/dotnet-opulence/BuildDockerImageStep.cs +++ b/src/Tye.Core/BuildDockerImageStep.cs @@ -1,6 +1,6 @@ using System.Threading.Tasks; -namespace Opulence +namespace Tye { public sealed class BuildDockerImageStep : ServiceExecutor.Step { diff --git a/src/opulence/dotnet-opulence/CombineStep.cs b/src/Tye.Core/CombineStep.cs similarity index 99% rename from src/opulence/dotnet-opulence/CombineStep.cs rename to src/Tye.Core/CombineStep.cs index eec7e597..aa5ce780 100644 --- a/src/opulence/dotnet-opulence/CombineStep.cs +++ b/src/Tye.Core/CombineStep.cs @@ -1,6 +1,6 @@ using System.Threading.Tasks; -namespace Opulence +namespace Tye { public sealed class CombineStep : ServiceExecutor.Step { diff --git a/src/opulence/dotnet-opulence/CommandException.cs b/src/Tye.Core/CommandException.cs similarity index 93% rename from src/opulence/dotnet-opulence/CommandException.cs rename to src/Tye.Core/CommandException.cs index de6cf96c..83e69a92 100644 --- a/src/opulence/dotnet-opulence/CommandException.cs +++ b/src/Tye.Core/CommandException.cs @@ -1,6 +1,6 @@ using System; -namespace Opulence +namespace Tye { internal class CommandException : Exception { diff --git a/src/opulence/dotnet-opulence/ComputedBindings.cs b/src/Tye.Core/ComputedBindings.cs similarity index 98% rename from src/opulence/dotnet-opulence/ComputedBindings.cs rename to src/Tye.Core/ComputedBindings.cs index 1fb3138b..a74a7a56 100644 --- a/src/opulence/dotnet-opulence/ComputedBindings.cs +++ b/src/Tye.Core/ComputedBindings.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace Opulence +namespace Tye { public class ComputedBindings : ServiceOutput { diff --git a/src/opulence/dotnet-opulence/ConsoleExtensions.cs b/src/Tye.Core/ConsoleExtensions.cs similarity index 100% rename from src/opulence/dotnet-opulence/ConsoleExtensions.cs rename to src/Tye.Core/ConsoleExtensions.cs diff --git a/src/opulence/Opulence/ContainerInfo.cs b/src/Tye.Core/ContainerInfo.cs similarity index 98% rename from src/opulence/Opulence/ContainerInfo.cs rename to src/Tye.Core/ContainerInfo.cs index 529a4c1c..483906fc 100644 --- a/src/opulence/Opulence/ContainerInfo.cs +++ b/src/Tye.Core/ContainerInfo.cs @@ -1,4 +1,4 @@ -namespace Opulence +namespace Tye { public sealed class ContainerInfo { diff --git a/src/opulence/Opulence/ContainerRegistry.cs b/src/Tye.Core/ContainerRegistry.cs similarity index 94% rename from src/opulence/Opulence/ContainerRegistry.cs rename to src/Tye.Core/ContainerRegistry.cs index 22350c3c..bac47324 100644 --- a/src/opulence/Opulence/ContainerRegistry.cs +++ b/src/Tye.Core/ContainerRegistry.cs @@ -1,6 +1,6 @@ using System; -namespace Opulence +namespace Tye { public sealed class ContainerRegistry { diff --git a/src/opulence/dotnet-opulence/CustomizationPipeline.cs b/src/Tye.Core/CustomizationPipeline.cs similarity index 99% rename from src/opulence/dotnet-opulence/CustomizationPipeline.cs rename to src/Tye.Core/CustomizationPipeline.cs index e4f5e1af..9e301451 100644 --- a/src/opulence/dotnet-opulence/CustomizationPipeline.cs +++ b/src/Tye.Core/CustomizationPipeline.cs @@ -5,7 +5,7 @@ using System.Linq; using System.Threading.Tasks; using Microsoft.Build.Construction; -namespace Opulence +namespace Tye { internal class CustomizationPipeline : Pipeline { diff --git a/src/opulence/dotnet-opulence/DeployServiceYamlStep.cs b/src/Tye.Core/DeployServiceYamlStep.cs similarity index 97% rename from src/opulence/dotnet-opulence/DeployServiceYamlStep.cs rename to src/Tye.Core/DeployServiceYamlStep.cs index 2e910f71..7c235a8b 100644 --- a/src/opulence/dotnet-opulence/DeployServiceYamlStep.cs +++ b/src/Tye.Core/DeployServiceYamlStep.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; using Tye; using YamlDotNet.RepresentationModel; -namespace Opulence +namespace Tye { public sealed class DeployServiceYamlStep : ServiceExecutor.Step { @@ -28,7 +28,7 @@ namespace Opulence { using var stream = File.OpenWrite(tempFile.FilePath); - using var writer = new StreamWriter(stream, Encoding.UTF8, leaveOpen: true); + using var writer = new StreamWriter(stream, Encoding.UTF8, bufferSize: -1, leaveOpen: true); var yamlStream = new YamlStream(yaml.Select(y => y.Yaml)); yamlStream.Save(writer, assignAnchors: false); } diff --git a/src/opulence/Opulence/DeploymentKind.cs b/src/Tye.Core/DeploymentKind.cs similarity index 81% rename from src/opulence/Opulence/DeploymentKind.cs rename to src/Tye.Core/DeploymentKind.cs index 4b7a7144..41225530 100644 --- a/src/opulence/Opulence/DeploymentKind.cs +++ b/src/Tye.Core/DeploymentKind.cs @@ -1,4 +1,4 @@ -namespace Opulence +namespace Tye { public enum DeploymentKind { diff --git a/src/opulence/dotnet-opulence/DirectoryCopy.cs b/src/Tye.Core/DirectoryCopy.cs similarity index 97% rename from src/opulence/dotnet-opulence/DirectoryCopy.cs rename to src/Tye.Core/DirectoryCopy.cs index 21d071d6..0d2e2d1f 100644 --- a/src/opulence/dotnet-opulence/DirectoryCopy.cs +++ b/src/Tye.Core/DirectoryCopy.cs @@ -1,6 +1,6 @@ using System.IO; -namespace Opulence +namespace Tye { public static class DirectoryCopy { diff --git a/src/opulence/dotnet-opulence/DirectorySearch.cs b/src/Tye.Core/DirectorySearch.cs similarity index 99% rename from src/opulence/dotnet-opulence/DirectorySearch.cs rename to src/Tye.Core/DirectorySearch.cs index 759c2eb3..97d56083 100644 --- a/src/opulence/dotnet-opulence/DirectorySearch.cs +++ b/src/Tye.Core/DirectorySearch.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; -namespace Opulence +namespace Tye { internal static class DirectorySearch { diff --git a/src/opulence/dotnet-opulence/DockerContainerBuilder.cs b/src/Tye.Core/DockerContainerBuilder.cs similarity index 99% rename from src/opulence/dotnet-opulence/DockerContainerBuilder.cs rename to src/Tye.Core/DockerContainerBuilder.cs index 70813cc1..94cdee60 100644 --- a/src/opulence/dotnet-opulence/DockerContainerBuilder.cs +++ b/src/Tye.Core/DockerContainerBuilder.cs @@ -4,7 +4,7 @@ using System.IO; using System.Threading.Tasks; using Tye; -namespace Opulence +namespace Tye { internal static class DockerContainerBuilder { diff --git a/src/opulence/Opulence/DockerImage.cs b/src/Tye.Core/DockerImage.cs similarity index 94% rename from src/opulence/Opulence/DockerImage.cs rename to src/Tye.Core/DockerImage.cs index 0bbd0674..710c2440 100644 --- a/src/opulence/Opulence/DockerImage.cs +++ b/src/Tye.Core/DockerImage.cs @@ -1,6 +1,6 @@ using System; -namespace Opulence +namespace Tye { public sealed class DockerImage : Source { diff --git a/src/opulence/dotnet-opulence/DockerPush.cs b/src/Tye.Core/DockerPush.cs similarity index 98% rename from src/opulence/dotnet-opulence/DockerPush.cs rename to src/Tye.Core/DockerPush.cs index da1782ba..7e643319 100644 --- a/src/opulence/dotnet-opulence/DockerPush.cs +++ b/src/Tye.Core/DockerPush.cs @@ -2,7 +2,7 @@ using System.CommandLine.Invocation; using System.Threading.Tasks; -namespace Opulence +namespace Tye { internal static class DockerPush { diff --git a/src/opulence/dotnet-opulence/DockerfileGenerator.cs b/src/Tye.Core/DockerfileGenerator.cs similarity index 98% rename from src/opulence/dotnet-opulence/DockerfileGenerator.cs rename to src/Tye.Core/DockerfileGenerator.cs index 0c142566..974dcd45 100644 --- a/src/opulence/dotnet-opulence/DockerfileGenerator.cs +++ b/src/Tye.Core/DockerfileGenerator.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace Opulence +namespace Tye { public static class DockerfileGenerator { @@ -41,7 +41,7 @@ namespace Opulence } 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, bufferSize: -1, leaveOpen: true); var entryPoint = Path.GetFileNameWithoutExtension(project.RelativeFilePath); output.WriteDebugLine($"Writing dockerfile to '{filePath}'."); diff --git a/src/opulence/Opulence/EnvironmentAttribute.cs b/src/Tye.Core/EnvironmentAttribute.cs similarity index 95% rename from src/opulence/Opulence/EnvironmentAttribute.cs rename to src/Tye.Core/EnvironmentAttribute.cs index 9ee217e1..22463751 100644 --- a/src/opulence/Opulence/EnvironmentAttribute.cs +++ b/src/Tye.Core/EnvironmentAttribute.cs @@ -1,6 +1,6 @@ using System; -namespace Opulence +namespace Tye { public class EnvironmentAttribute : Attribute { diff --git a/src/opulence/Opulence/Environments.cs b/src/Tye.Core/Environments.cs similarity index 88% rename from src/opulence/Opulence/Environments.cs rename to src/Tye.Core/Environments.cs index 3e82304a..017f3274 100644 --- a/src/opulence/Opulence/Environments.cs +++ b/src/Tye.Core/Environments.cs @@ -1,4 +1,4 @@ -namespace Opulence +namespace Tye { public static class Environments { diff --git a/src/opulence/Opulence/Framework.cs b/src/Tye.Core/Framework.cs similarity index 94% rename from src/opulence/Opulence/Framework.cs rename to src/Tye.Core/Framework.cs index f99e43c3..88ba8dec 100644 --- a/src/opulence/Opulence/Framework.cs +++ b/src/Tye.Core/Framework.cs @@ -1,6 +1,6 @@ using System; -namespace Opulence +namespace Tye { public sealed class Framework { diff --git a/src/opulence/Opulence/FrameworkCollection.cs b/src/Tye.Core/FrameworkCollection.cs similarity index 96% rename from src/opulence/Opulence/FrameworkCollection.cs rename to src/Tye.Core/FrameworkCollection.cs index 09e36c6a..b5eebfe5 100644 --- a/src/opulence/Opulence/FrameworkCollection.cs +++ b/src/Tye.Core/FrameworkCollection.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Collections.ObjectModel; -namespace Opulence +namespace Tye { public sealed class FrameworkCollection : Collection { diff --git a/src/opulence/dotnet-opulence/GenerateDockerfileStep.cs b/src/Tye.Core/GenerateDockerfileStep.cs similarity index 98% rename from src/opulence/dotnet-opulence/GenerateDockerfileStep.cs rename to src/Tye.Core/GenerateDockerfileStep.cs index 4dec6b99..e057f6e3 100644 --- a/src/opulence/dotnet-opulence/GenerateDockerfileStep.cs +++ b/src/Tye.Core/GenerateDockerfileStep.cs @@ -1,7 +1,7 @@ using System.IO; using System.Threading.Tasks; -namespace Opulence +namespace Tye { internal sealed class GenerateDockerfileStep : ServiceExecutor.Step { diff --git a/src/opulence/dotnet-opulence/GenerateHelmChartStep.cs b/src/Tye.Core/GenerateHelmChartStep.cs similarity index 98% rename from src/opulence/dotnet-opulence/GenerateHelmChartStep.cs rename to src/Tye.Core/GenerateHelmChartStep.cs index 6cb985aa..2694165b 100644 --- a/src/opulence/dotnet-opulence/GenerateHelmChartStep.cs +++ b/src/Tye.Core/GenerateHelmChartStep.cs @@ -1,7 +1,7 @@ using System.IO; using System.Threading.Tasks; -namespace Opulence +namespace Tye { internal sealed class GenerateHelmChartStep : ServiceExecutor.Step { diff --git a/src/opulence/dotnet-opulence/GenerateKubernetesManifestStep.cs b/src/Tye.Core/GenerateKubernetesManifestStep.cs similarity index 98% rename from src/opulence/dotnet-opulence/GenerateKubernetesManifestStep.cs rename to src/Tye.Core/GenerateKubernetesManifestStep.cs index f7a4ac89..42b42503 100644 --- a/src/opulence/dotnet-opulence/GenerateKubernetesManifestStep.cs +++ b/src/Tye.Core/GenerateKubernetesManifestStep.cs @@ -1,6 +1,6 @@ using System.Threading.Tasks; -namespace Opulence +namespace Tye { public sealed class GenerateKubernetesManifestStep : ServiceExecutor.Step { diff --git a/src/opulence/dotnet-opulence/GenerateOamComponentStep.cs b/src/Tye.Core/GenerateOamComponentStep.cs similarity index 97% rename from src/opulence/dotnet-opulence/GenerateOamComponentStep.cs rename to src/Tye.Core/GenerateOamComponentStep.cs index 9812d1a2..31336e66 100644 --- a/src/opulence/dotnet-opulence/GenerateOamComponentStep.cs +++ b/src/Tye.Core/GenerateOamComponentStep.cs @@ -1,6 +1,6 @@ using System.Threading.Tasks; -namespace Opulence +namespace Tye { internal sealed class GenerateOamComponentStep : ServiceExecutor.Step { diff --git a/src/opulence/Opulence/GeneratedAssets.cs b/src/Tye.Core/GeneratedAssets.cs similarity index 83% rename from src/opulence/Opulence/GeneratedAssets.cs rename to src/Tye.Core/GeneratedAssets.cs index 90f287d1..07c2b7b3 100644 --- a/src/opulence/Opulence/GeneratedAssets.cs +++ b/src/Tye.Core/GeneratedAssets.cs @@ -1,4 +1,4 @@ -namespace Opulence +namespace Tye { public sealed class GeneratedAssets { diff --git a/src/opulence/dotnet-opulence/HelmChartBuilder.cs b/src/Tye.Core/HelmChartBuilder.cs similarity index 99% rename from src/opulence/dotnet-opulence/HelmChartBuilder.cs rename to src/Tye.Core/HelmChartBuilder.cs index ba59bc11..af60525e 100644 --- a/src/opulence/dotnet-opulence/HelmChartBuilder.cs +++ b/src/Tye.Core/HelmChartBuilder.cs @@ -4,7 +4,7 @@ using System.IO; using System.Threading.Tasks; using Tye; -namespace Opulence +namespace Tye { internal static class HelmChartBuilder { diff --git a/src/opulence/dotnet-opulence/HelmChartGenerator.cs b/src/Tye.Core/HelmChartGenerator.cs similarity index 97% rename from src/opulence/dotnet-opulence/HelmChartGenerator.cs rename to src/Tye.Core/HelmChartGenerator.cs index 53836406..843252b9 100644 --- a/src/opulence/dotnet-opulence/HelmChartGenerator.cs +++ b/src/Tye.Core/HelmChartGenerator.cs @@ -2,7 +2,7 @@ using System.IO; using System.Threading.Tasks; -namespace Opulence +namespace Tye { internal static class HelmChartGenerator { @@ -67,7 +67,7 @@ namespace Opulence $"apiVersion: v1", $"name: {chart.ChartName}", $"# helm requires the version and appVersion to specified in Chart.yaml", - $"# opulence will override these values when packaging the chart", + $"# tye will override these values when packaging the chart", $"version: {project.Version.Replace('+', '-')}", $"appVersion: {project.Version.Replace('+', '-')}" }); diff --git a/src/opulence/Opulence/HelmChartStep.cs b/src/Tye.Core/HelmChartStep.cs similarity index 89% rename from src/opulence/Opulence/HelmChartStep.cs rename to src/Tye.Core/HelmChartStep.cs index 2cf2c8a6..4f2dacf6 100644 --- a/src/opulence/Opulence/HelmChartStep.cs +++ b/src/Tye.Core/HelmChartStep.cs @@ -1,4 +1,4 @@ -namespace Opulence +namespace Tye { public sealed class HelmChartStep : Step { diff --git a/src/opulence/dotnet-opulence/HelmPush.cs b/src/Tye.Core/HelmPush.cs similarity index 99% rename from src/opulence/dotnet-opulence/HelmPush.cs rename to src/Tye.Core/HelmPush.cs index bdd128cd..65cd52ac 100644 --- a/src/opulence/dotnet-opulence/HelmPush.cs +++ b/src/Tye.Core/HelmPush.cs @@ -2,7 +2,7 @@ using System.CommandLine.Invocation; using System.Threading.Tasks; -namespace Opulence +namespace Tye { internal static class HelmPush { diff --git a/src/opulence/dotnet-opulence/IYamlManifestOutput.cs b/src/Tye.Core/IYamlManifestOutput.cs similarity index 87% rename from src/opulence/dotnet-opulence/IYamlManifestOutput.cs rename to src/Tye.Core/IYamlManifestOutput.cs index 8bf26193..eab01bfa 100644 --- a/src/opulence/dotnet-opulence/IYamlManifestOutput.cs +++ b/src/Tye.Core/IYamlManifestOutput.cs @@ -1,6 +1,6 @@ using YamlDotNet.RepresentationModel; -namespace Opulence +namespace Tye { internal interface IYamlManifestOutput { diff --git a/src/opulence/dotnet-opulence/KubernetesDeploymentOutput.cs b/src/Tye.Core/KubernetesDeploymentOutput.cs similarity index 97% rename from src/opulence/dotnet-opulence/KubernetesDeploymentOutput.cs rename to src/Tye.Core/KubernetesDeploymentOutput.cs index bbf99584..64ae7aa3 100644 --- a/src/opulence/dotnet-opulence/KubernetesDeploymentOutput.cs +++ b/src/Tye.Core/KubernetesDeploymentOutput.cs @@ -1,7 +1,7 @@ using System; using YamlDotNet.RepresentationModel; -namespace Opulence +namespace Tye { internal sealed class KubernetesDeploymentOutput : ServiceOutput, IYamlManifestOutput { diff --git a/src/opulence/dotnet-opulence/KubernetesManifestGenerator.cs b/src/Tye.Core/KubernetesManifestGenerator.cs similarity index 94% rename from src/opulence/dotnet-opulence/KubernetesManifestGenerator.cs rename to src/Tye.Core/KubernetesManifestGenerator.cs index c9328c23..af135f16 100644 --- a/src/opulence/dotnet-opulence/KubernetesManifestGenerator.cs +++ b/src/Tye.Core/KubernetesManifestGenerator.cs @@ -3,7 +3,7 @@ using System.Linq; using YamlDotNet.Core; using YamlDotNet.RepresentationModel; -namespace Opulence +namespace Tye { internal static class KubernetesManifestGenerator { @@ -36,7 +36,11 @@ namespace Opulence var labels = new YamlMappingNode(); metadata.Add("labels", labels); labels.Add("app.kubernetes.io/name", service.Service.Name); - labels.Add("app.kubernetes.io/part-of", application.Globals.Name); + + if (application.Globals.Name is object) + { + labels.Add("app.kubernetes.io/part-of", application.Globals.Name); + } var spec = new YamlMappingNode(); root.Add("spec", spec); @@ -96,7 +100,10 @@ namespace Opulence var labels = new YamlMappingNode(); metadata.Add("labels", labels); labels.Add("app.kubernetes.io/name", service.Service.Name); - labels.Add("app.kubernetes.io/part-of", application.Globals.Name); + if (application.Globals.Name is object) + { + labels.Add("app.kubernetes.io/part-of", application.Globals.Name); + } var spec = new YamlMappingNode(); root.Add("spec", spec); @@ -117,7 +124,10 @@ namespace Opulence labels = new YamlMappingNode(); metadata.Add("labels", labels); labels.Add("app.kubernetes.io/name", service.Service.Name); - labels.Add("app.kubernetes.io/part-of", application.Globals.Name); + if (application.Globals.Name is object) + { + labels.Add("app.kubernetes.io/part-of", application.Globals.Name); + } spec = new YamlMappingNode(); template.Add("spec", spec); diff --git a/src/opulence/dotnet-opulence/KubernetesServiceOutput.cs b/src/Tye.Core/KubernetesServiceOutput.cs similarity index 97% rename from src/opulence/dotnet-opulence/KubernetesServiceOutput.cs rename to src/Tye.Core/KubernetesServiceOutput.cs index 4c8edc19..30d88b40 100644 --- a/src/opulence/dotnet-opulence/KubernetesServiceOutput.cs +++ b/src/Tye.Core/KubernetesServiceOutput.cs @@ -1,7 +1,7 @@ using System; using YamlDotNet.RepresentationModel; -namespace Opulence +namespace Tye { internal sealed class KubernetesServiceOutput : ServiceOutput, IYamlManifestOutput { diff --git a/src/opulence/dotnet-opulence/Names.cs b/src/Tye.Core/Names.cs similarity index 97% rename from src/opulence/dotnet-opulence/Names.cs rename to src/Tye.Core/Names.cs index 8d89ab67..3afc2fcb 100644 --- a/src/opulence/dotnet-opulence/Names.cs +++ b/src/Tye.Core/Names.cs @@ -1,6 +1,6 @@ using System; -namespace Opulence +namespace Tye { internal static class Names { diff --git a/src/opulence/dotnet-opulence/OamApplicationGenerator.cs b/src/Tye.Core/OamApplicationGenerator.cs similarity index 99% rename from src/opulence/dotnet-opulence/OamApplicationGenerator.cs rename to src/Tye.Core/OamApplicationGenerator.cs index 482397df..ef15de08 100644 --- a/src/opulence/dotnet-opulence/OamApplicationGenerator.cs +++ b/src/Tye.Core/OamApplicationGenerator.cs @@ -5,7 +5,7 @@ using System.Linq; using System.Threading.Tasks; using YamlDotNet.RepresentationModel; -namespace Opulence +namespace Tye { internal static class OamApplicationGenerator { diff --git a/src/opulence/dotnet-opulence/OamComponentGenerator.cs b/src/Tye.Core/OamComponentGenerator.cs similarity index 98% rename from src/opulence/dotnet-opulence/OamComponentGenerator.cs rename to src/Tye.Core/OamComponentGenerator.cs index fae20881..b2e32f4d 100644 --- a/src/opulence/dotnet-opulence/OamComponentGenerator.cs +++ b/src/Tye.Core/OamComponentGenerator.cs @@ -2,7 +2,7 @@ using System.Linq; using YamlDotNet.RepresentationModel; -namespace Opulence +namespace Tye { internal static class OamComponentGenerator { diff --git a/src/opulence/dotnet-opulence/OamComponentOutput.cs b/src/Tye.Core/OamComponentOutput.cs similarity index 96% rename from src/opulence/dotnet-opulence/OamComponentOutput.cs rename to src/Tye.Core/OamComponentOutput.cs index 714223e3..07031070 100644 --- a/src/opulence/dotnet-opulence/OamComponentOutput.cs +++ b/src/Tye.Core/OamComponentOutput.cs @@ -1,7 +1,7 @@ using System; using YamlDotNet.RepresentationModel; -namespace Opulence +namespace Tye { internal sealed class OamComponentOutput : ServiceOutput, IYamlManifestOutput { diff --git a/src/opulence/dotnet-opulence/OutputContext.cs b/src/Tye.Core/OutputContext.cs similarity index 99% rename from src/opulence/dotnet-opulence/OutputContext.cs rename to src/Tye.Core/OutputContext.cs index a9dd90a9..64fc74a9 100644 --- a/src/opulence/dotnet-opulence/OutputContext.cs +++ b/src/Tye.Core/OutputContext.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.CommandLine; using System.CommandLine.IO; -namespace Opulence +namespace Tye { public sealed class OutputContext { diff --git a/src/opulence/Opulence/Pipeline.cs b/src/Tye.Core/Pipeline.cs similarity index 98% rename from src/opulence/Opulence/Pipeline.cs rename to src/Tye.Core/Pipeline.cs index 77147659..5fee3c18 100644 --- a/src/opulence/Opulence/Pipeline.cs +++ b/src/Tye.Core/Pipeline.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Threading.Tasks; -namespace Opulence +namespace Tye { public abstract class Pipeline { diff --git a/src/opulence/Opulence/PipelineHolder.cs b/src/Tye.Core/PipelineHolder.cs similarity index 94% rename from src/opulence/Opulence/PipelineHolder.cs rename to src/Tye.Core/PipelineHolder.cs index e6a71374..de104415 100644 --- a/src/opulence/Opulence/PipelineHolder.cs +++ b/src/Tye.Core/PipelineHolder.cs @@ -1,6 +1,6 @@ using System; -namespace Opulence +namespace Tye { public sealed class PipelineHolder { diff --git a/src/opulence/dotnet-opulence/Program.cs b/src/Tye.Core/Program.cs similarity index 81% rename from src/opulence/dotnet-opulence/Program.cs rename to src/Tye.Core/Program.cs index 7f1d6234..ff9e4c08 100644 --- a/src/opulence/dotnet-opulence/Program.cs +++ b/src/Tye.Core/Program.cs @@ -1,4 +1,4 @@ -namespace Opulence +namespace Tye { static class Program { diff --git a/src/opulence/Opulence/Project.cs b/src/Tye.Core/Project.cs similarity index 96% rename from src/opulence/Opulence/Project.cs rename to src/Tye.Core/Project.cs index f63778fb..1749c253 100644 --- a/src/opulence/Opulence/Project.cs +++ b/src/Tye.Core/Project.cs @@ -1,6 +1,6 @@ using System; -namespace Opulence +namespace Tye { public sealed class Project : Source { diff --git a/src/opulence/dotnet-opulence/ProjectReader.cs b/src/Tye.Core/ProjectReader.cs similarity index 90% rename from src/opulence/dotnet-opulence/ProjectReader.cs rename to src/Tye.Core/ProjectReader.cs index 958acada..6e33de87 100644 --- a/src/opulence/dotnet-opulence/ProjectReader.cs +++ b/src/Tye.Core/ProjectReader.cs @@ -5,7 +5,7 @@ using System.Linq; using System.Threading.Tasks; using Semver; -namespace Opulence +namespace Tye { public static class ProjectReader { @@ -59,7 +59,7 @@ namespace Opulence try { var capture = output.Capture(); - var opulenceRoot = Path.GetDirectoryName(typeof(Program).Assembly.Location); + var programRoot = Path.GetDirectoryName(typeof(Program).Assembly.Location); var restore = string.Empty; if (!File.Exists(Path.Combine(projectFile.DirectoryName, "obj", "project.assets.json"))) @@ -68,10 +68,10 @@ namespace Opulence } output.WriteDebugLine("Running 'dotnet msbuild'."); - output.WriteCommandLine("dotnet", $"msbuild {restore} /t:EvaluateOpulenceProjectInfo \"/p:OpulenceTargetLocation={opulenceRoot}\" \"/p:OpulenceOutputFilePath={outputFilePath}\""); + output.WriteCommandLine("dotnet", $"msbuild {restore} /t:EvaluateTyeProjectInfo \"/p:TyeTargetLocation={programRoot}\" \"/p:TyeOutputFilePath={outputFilePath}\""); var exitCode = await Process.ExecuteAsync( $"dotnet", - $"msbuild {restore} /t:EvaluateOpulenceProjectInfo \"/p:OpulenceTargetLocation={opulenceRoot}\" \"/p:OpulenceOutputFilePath={outputFilePath}\"", + $"msbuild {restore} /t:EvaluateTyeProjectInfo \"/p:TyeTargetLocation={programRoot}\" \"/p:TyeOutputFilePath={outputFilePath}\"", workingDir: projectFile.DirectoryName, stdOut: capture.StdOut, stdErr: capture.StdErr); diff --git a/src/opulence/dotnet-opulence/PushDockerImageStep.cs b/src/Tye.Core/PushDockerImageStep.cs similarity index 98% rename from src/opulence/dotnet-opulence/PushDockerImageStep.cs rename to src/Tye.Core/PushDockerImageStep.cs index b36982b6..d7acf011 100644 --- a/src/opulence/dotnet-opulence/PushDockerImageStep.cs +++ b/src/Tye.Core/PushDockerImageStep.cs @@ -1,7 +1,7 @@ using System.Linq; using System.Threading.Tasks; -namespace Opulence +namespace Tye { public sealed class PushDockerImageStep : ServiceExecutor.Step { diff --git a/src/opulence/dotnet-opulence/Resources/Imports.targets b/src/Tye.Core/Resources/Imports.targets similarity index 56% rename from src/opulence/dotnet-opulence/Resources/Imports.targets rename to src/Tye.Core/Resources/Imports.targets index 2f3ef3d9..e695c12c 100644 --- a/src/opulence/dotnet-opulence/Resources/Imports.targets +++ b/src/Tye.Core/Resources/Imports.targets @@ -1,8 +1,8 @@  - + - + \ No newline at end of file diff --git a/src/opulence/Opulence/Secret.cs b/src/Tye.Core/Secret.cs similarity index 78% rename from src/opulence/Opulence/Secret.cs rename to src/Tye.Core/Secret.cs index bd379921..8fa7061b 100644 --- a/src/opulence/Opulence/Secret.cs +++ b/src/Tye.Core/Secret.cs @@ -1,4 +1,4 @@ -namespace Opulence +namespace Tye { public class Secret { diff --git a/src/opulence/Opulence/Service.cs b/src/Tye.Core/Service.cs similarity index 97% rename from src/opulence/Opulence/Service.cs rename to src/Tye.Core/Service.cs index 6805cd8d..bf46009f 100644 --- a/src/opulence/Opulence/Service.cs +++ b/src/Tye.Core/Service.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; -namespace Opulence +namespace Tye { public sealed class Service { diff --git a/src/opulence/Opulence/ServiceBinding.cs b/src/Tye.Core/ServiceBinding.cs similarity index 95% rename from src/opulence/Opulence/ServiceBinding.cs rename to src/Tye.Core/ServiceBinding.cs index 7f77ebf8..b2a32637 100644 --- a/src/opulence/Opulence/ServiceBinding.cs +++ b/src/Tye.Core/ServiceBinding.cs @@ -1,6 +1,6 @@ using System; -namespace Opulence +namespace Tye { public class ServiceBinding { diff --git a/src/opulence/dotnet-opulence/ServiceExecutor.cs b/src/Tye.Core/ServiceExecutor.cs similarity index 99% rename from src/opulence/dotnet-opulence/ServiceExecutor.cs rename to src/Tye.Core/ServiceExecutor.cs index 2748b38b..fcaea5e9 100644 --- a/src/opulence/dotnet-opulence/ServiceExecutor.cs +++ b/src/Tye.Core/ServiceExecutor.cs @@ -5,7 +5,7 @@ using System.IO; using System.Linq; using System.Threading.Tasks; -namespace Opulence +namespace Tye { public sealed class ServiceExecutor { diff --git a/src/opulence/Opulence/Source.cs b/src/Tye.Core/Source.cs similarity index 81% rename from src/opulence/Opulence/Source.cs rename to src/Tye.Core/Source.cs index 8af402b7..b846dc7d 100644 --- a/src/opulence/Opulence/Source.cs +++ b/src/Tye.Core/Source.cs @@ -1,4 +1,4 @@ -namespace Opulence +namespace Tye { public abstract class Source { diff --git a/src/opulence/dotnet-opulence/StandardOptions.cs b/src/Tye.Core/StandardOptions.cs similarity index 98% rename from src/opulence/dotnet-opulence/StandardOptions.cs rename to src/Tye.Core/StandardOptions.cs index ef4c92e0..90283aad 100644 --- a/src/opulence/dotnet-opulence/StandardOptions.cs +++ b/src/Tye.Core/StandardOptions.cs @@ -5,7 +5,7 @@ using System.CommandLine.Parsing; using System.IO; using System.Linq; -namespace Opulence +namespace Tye { public static class StandardOptions { @@ -183,7 +183,7 @@ namespace Opulence { return new Option(new[] { "-v", "--verbosity" }, "Output verbostiy") { - Argument = new Argument("one of: quiet|info|debug", () => Opulence.Verbosity.Info) + Argument = new Argument("one of: quiet|info|debug", () => Tye.Verbosity.Info) { Arity = ArgumentArity.ExactlyOne, }, diff --git a/src/opulence/Opulence/Step.cs b/src/Tye.Core/Step.cs similarity index 81% rename from src/opulence/Opulence/Step.cs rename to src/Tye.Core/Step.cs index 8275d112..e03df906 100644 --- a/src/opulence/Opulence/Step.cs +++ b/src/Tye.Core/Step.cs @@ -1,4 +1,4 @@ -namespace Opulence +namespace Tye { public abstract class Step { diff --git a/src/opulence/dotnet-opulence/StepView.cs b/src/Tye.Core/StepView.cs similarity index 67% rename from src/opulence/dotnet-opulence/StepView.cs rename to src/Tye.Core/StepView.cs index 2fda2e55..f4425c82 100644 --- a/src/opulence/dotnet-opulence/StepView.cs +++ b/src/Tye.Core/StepView.cs @@ -1,4 +1,4 @@ -namespace Opulence +namespace Tye { internal class StepView { diff --git a/src/opulence/dotnet-opulence/TargetInstaller.cs b/src/Tye.Core/TargetInstaller.cs similarity index 92% rename from src/opulence/dotnet-opulence/TargetInstaller.cs rename to src/Tye.Core/TargetInstaller.cs index 27a87ec2..516e0e46 100644 --- a/src/opulence/dotnet-opulence/TargetInstaller.cs +++ b/src/Tye.Core/TargetInstaller.cs @@ -5,7 +5,7 @@ using System; using System.IO; using System.Reflection; -namespace Opulence +namespace Tye { public static class TargetInstaller { @@ -21,7 +21,7 @@ namespace Opulence Directory.CreateDirectory(intermediateDirectory); - var fileName = $"{Path.GetFileName(projectFilePath)}.opulence.targets"; + var fileName = $"{Path.GetFileName(projectFilePath)}.Tye.targets"; var targetFilePath = Path.Combine(intermediateDirectory, fileName); if (File.Exists(targetFilePath)) @@ -31,7 +31,7 @@ namespace Opulence var toolType = typeof(TargetInstaller); var toolAssembly = toolType.GetTypeInfo().Assembly; - var toolImportTargetsResourceName = $"Opulence.Resources.Imports.targets"; + var toolImportTargetsResourceName = $"Tye.Resources.Imports.targets"; using var stream = toolAssembly.GetManifestResourceStream(toolImportTargetsResourceName); if (stream == null) diff --git a/src/opulence/dotnet-opulence/Templates.cs b/src/Tye.Core/Templates.cs similarity index 96% rename from src/opulence/dotnet-opulence/Templates.cs rename to src/Tye.Core/Templates.cs index dfcacdc5..b48b7219 100644 --- a/src/opulence/dotnet-opulence/Templates.cs +++ b/src/Tye.Core/Templates.cs @@ -1,6 +1,6 @@ using System.IO; -namespace Opulence +namespace Tye { internal static class Templates { diff --git a/src/opulence/dotnet-opulence/Templates/Helm/templates/_helpers.tpl b/src/Tye.Core/Templates/Helm/templates/_helpers.tpl similarity index 100% rename from src/opulence/dotnet-opulence/Templates/Helm/templates/_helpers.tpl rename to src/Tye.Core/Templates/Helm/templates/_helpers.tpl diff --git a/src/opulence/dotnet-opulence/Templates/Helm/templates/deployment.yaml b/src/Tye.Core/Templates/Helm/templates/deployment.yaml similarity index 100% rename from src/opulence/dotnet-opulence/Templates/Helm/templates/deployment.yaml rename to src/Tye.Core/Templates/Helm/templates/deployment.yaml diff --git a/src/opulence/dotnet-opulence/Templates/Helm/templates/service.yaml b/src/Tye.Core/Templates/Helm/templates/service.yaml similarity index 100% rename from src/opulence/dotnet-opulence/Templates/Helm/templates/service.yaml rename to src/Tye.Core/Templates/Helm/templates/service.yaml diff --git a/src/Tye.Core/Tye.Core.csproj b/src/Tye.Core/Tye.Core.csproj new file mode 100644 index 00000000..a99fe249 --- /dev/null +++ b/src/Tye.Core/Tye.Core.csproj @@ -0,0 +1,34 @@ + + + + netstandard2.1 + Tye + 8.0 + Enable + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/opulence/dotnet-opulence/Verbosity.cs b/src/Tye.Core/Verbosity.cs similarity index 79% rename from src/opulence/dotnet-opulence/Verbosity.cs rename to src/Tye.Core/Verbosity.cs index 2a04f32e..0039eb9c 100644 --- a/src/opulence/dotnet-opulence/Verbosity.cs +++ b/src/Tye.Core/Verbosity.cs @@ -1,4 +1,4 @@ -namespace Opulence +namespace Tye { public enum Verbosity { diff --git a/src/opulence/dotnet-opulence/WriteServiceYamlStep.cs b/src/Tye.Core/WriteServiceYamlStep.cs similarity index 96% rename from src/opulence/dotnet-opulence/WriteServiceYamlStep.cs rename to src/Tye.Core/WriteServiceYamlStep.cs index 4d1476d9..8048dd04 100644 --- a/src/opulence/dotnet-opulence/WriteServiceYamlStep.cs +++ b/src/Tye.Core/WriteServiceYamlStep.cs @@ -4,7 +4,7 @@ using System.Text; using System.Threading.Tasks; using YamlDotNet.RepresentationModel; -namespace Opulence +namespace Tye { internal sealed class WriteServiceYamlStep : ServiceExecutor.Step { @@ -33,7 +33,7 @@ namespace Opulence File.Delete(outputFilePath); using var stream = File.OpenWrite(outputFilePath); - using var writer = new StreamWriter(stream, Encoding.UTF8, leaveOpen: true); + using var writer = new StreamWriter(stream, Encoding.UTF8, bufferSize: -1, leaveOpen: true); var yamlStream = new YamlStream(yaml.Select(y => y.Yaml)); yamlStream.Save(writer, assignAnchors: false); diff --git a/src/opulence/dotnet-opulence/build/Opulence.targets b/src/Tye.Core/build/Tye.targets similarity index 55% rename from src/opulence/dotnet-opulence/build/Opulence.targets rename to src/Tye.Core/build/Tye.targets index 2588a3b0..80be5c4d 100644 --- a/src/opulence/dotnet-opulence/build/Opulence.targets +++ b/src/Tye.Core/build/Tye.targets @@ -1,17 +1,17 @@  - - $(EvaluateOpulenceProjectInfoDependsOn); + + $(EvaluateTyeProjectInfoDependsOn); ResolveReferences; ResolvePackageDependenciesDesignTime; PrepareResources; GetAssemblyAttributes; - + - - + + <_Frameworks>@(FrameworkReference, ',') @@ -22,7 +22,7 @@ <_Lines Include="frameworks=$(_Frameworks)" /> - + diff --git a/src/opulence/dotnet-opulence/buildMultiTargeting/Opulence.targets b/src/Tye.Core/buildMultiTargeting/Tye.targets similarity index 70% rename from src/opulence/dotnet-opulence/buildMultiTargeting/Opulence.targets rename to src/Tye.Core/buildMultiTargeting/Tye.targets index 4efd31e6..ad18d2af 100644 --- a/src/opulence/dotnet-opulence/buildMultiTargeting/Opulence.targets +++ b/src/Tye.Core/buildMultiTargeting/Tye.targets @@ -1,7 +1,7 @@  - + - + \ No newline at end of file diff --git a/src/opulence/Opulence/Opulence.csproj b/src/opulence/Opulence/Opulence.csproj deleted file mode 100644 index 7cd4d233..00000000 --- a/src/opulence/Opulence/Opulence.csproj +++ /dev/null @@ -1,13 +0,0 @@ - - - - netstandard2.0 - 8.0 - Enable - - - - - - - diff --git a/src/opulence/dotnet-opulence/ApplicationFactory.cs b/src/opulence/dotnet-opulence/ApplicationFactory.cs deleted file mode 100644 index 0fd47574..00000000 --- a/src/opulence/dotnet-opulence/ApplicationFactory.cs +++ /dev/null @@ -1,142 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Threading.Tasks; -using Microsoft.Build.Construction; - -namespace Opulence -{ - public static class ApplicationFactory - { - public static async Task CreateApplicationAsync(OutputContext output, FileInfo projectFile) - { - if (output is null) - { - throw new ArgumentNullException(nameof(output)); - } - - if (projectFile is null) - { - throw new ArgumentNullException(nameof(projectFile)); - } - - if (string.Equals(projectFile.Extension, ".sln", StringComparison.Ordinal)) - { - output.WriteDebugLine($"Solution '{projectFile.FullName}' was provided as input."); - return await CreateApplicationForSolutionAsync(output, projectFile); - } - else - { - output.WriteDebugLine($"Project '{projectFile.FullName}' was provided as input."); - return await CreateApplicationForProjectAsync(output, projectFile); - } - } - - private static async Task CreateApplicationForProjectAsync(OutputContext output, FileInfo projectFile) - { - // Project workflow: - // - // 1. Determine if there's an 'Opulence.csx' - use that to initialize the set of services. - // 2. If there's not an 'Opulence.csx' then move on with just the project. - - var application = await ScriptRunner.RunCustomizationScriptAsync(output, projectFile); - if (application != null) - { - return application; - } - - return await InferApplicationForProject(output, projectFile); - } - - private static async Task InferApplicationForProject(OutputContext output, FileInfo projectFile) - { - var globals = new ApplicationGlobals(); - globals.Name = Names.NormalizeToDns(Path.GetFileNameWithoutExtension(projectFile.Name)); - - var services = new List(); - - var name = Path.GetFileNameWithoutExtension(projectFile.Name); - var project = new Project(projectFile.FullName); - var service = new ServiceEntry(new Service(name), name); - service.Service.Source = project; - services.Add(service); - - await ProjectReader.ReadProjectDetailsAsync(output, projectFile, project); - - var container = new ContainerInfo(); - service.Service.GeneratedAssets.Container = container; - - var application = new GroveledApplication(globals, projectFile.DirectoryName, services); - - DockerfileGenerator.ApplyContainerDefaults(application, service, project, container); - - return application; - } - - private static async Task CreateApplicationForSolutionAsync(OutputContext output, FileInfo solutionFile) - { - // Solution workflow: - // - // 1. If there's an 'Opulence.csx' - use that that to initialize the set of services. - // 2. If there's not an 'Opulence.csx' then grovel all of the projects in the solution looking - // for executable projects. - - SolutionFile solution; - try - { - solution = SolutionFile.Parse(solutionFile.FullName); - } - catch (Exception ex) - { - throw new CommandException($"Parsing solution file '{solutionFile.FullName}' failed.", ex); - } - - var application = await ScriptRunner.RunCustomizationScriptAsync(output, solutionFile, solution); - if (application != null) - { - return application; - } - - return await InferApplicationForSolution(output, solutionFile, solution); - } - - private static async Task InferApplicationForSolution(OutputContext output, FileInfo solutionFile, SolutionFile solution) - { - var globals = new ApplicationGlobals(); - - globals.Name = Names.NormalizeToDns(Path.GetFileNameWithoutExtension(solutionFile.Name)); - - var services = new List(); - for (var i = 0; i < solution.ProjectsInOrder.Count; i++) - { - // The library we're using doesn't translate Windows style paths automatically. - var solutionProject = solution.ProjectsInOrder[i]; - if (solutionProject.AbsolutePath.EndsWith(".csproj", StringComparison.Ordinal)) - { - var projectFilePath = solutionProject.RelativePath.Replace('\\', Path.DirectorySeparatorChar); - var projectFile = new FileInfo(projectFilePath); - - var name = Path.GetFileNameWithoutExtension(projectFile.Name); - var project = new Project(projectFile.FullName); - var service = new ServiceEntry(new Service(name), name); - service.Service.Source = project; - services.Add(service); - - await ProjectReader.ReadProjectDetailsAsync(output, projectFile, project); - - var container = new ContainerInfo(); - service.Service.GeneratedAssets.Container = container; - } - } - - var application = new GroveledApplication(globals, solutionFile.DirectoryName, services); - - foreach (var service in application.Services) - { - DockerfileGenerator.ApplyContainerDefaults(application, service, (Project)service.Service.Source!, service.Service.GeneratedAssets.Container!); - } - - return application; - } - } -} diff --git a/src/opulence/dotnet-opulence/GenerateCommand.cs b/src/opulence/dotnet-opulence/GenerateCommand.cs deleted file mode 100644 index b8ccf62c..00000000 --- a/src/opulence/dotnet-opulence/GenerateCommand.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System; -using System.Collections.Generic; -using System.CommandLine; -using System.CommandLine.Invocation; -using System.IO; -using System.Threading.Tasks; - -namespace Opulence -{ - internal static class GenerateCommand - { - public static Command Create() - { - var command = new Command("generate", "Generate assets") - { - StandardOptions.Project, - StandardOptions.Verbosity, - StandardOptions.Outputs, - StandardOptions.Force, - }; - - command.Handler = CommandHandler.Create, bool>((console, project, verbosity, outputs, force) => - { - var output = new OutputContext(console, verbosity); - return ExecuteAsync(output, project, outputs, force); - }); - - return command; - } - - private static async Task ExecuteAsync(OutputContext output, FileInfo projectFile, List outputs, bool force) - { - output.WriteBanner(); - - var application = await ApplicationFactory.CreateApplicationAsync(output, projectFile); - - var steps = new List(); - - if (outputs.Count == 0 || outputs.Contains("container")) - { - steps.Add(new GenerateDockerfileStep() { Force = force, }); - } - - if (outputs.Count == 0 || outputs.Contains("chart")) - { - steps.Add(new GenerateHelmChartStep()); - } - - var executor = new ServiceExecutor(output, application, steps); - foreach (var service in application.Services) - { - if (service.IsMatchForProject(application, projectFile)) - { - await executor.ExecuteAsync(service); - } - } - } - } -} diff --git a/src/opulence/dotnet-opulence/PackageCommand.cs b/src/opulence/dotnet-opulence/PackageCommand.cs deleted file mode 100644 index eb85bacd..00000000 --- a/src/opulence/dotnet-opulence/PackageCommand.cs +++ /dev/null @@ -1,119 +0,0 @@ -using System; -using System.Collections.Generic; -using System.CommandLine; -using System.CommandLine.Invocation; -using System.IO; -using System.Text; -using System.Threading.Tasks; - -namespace Opulence -{ - public class PackageCommand - { - public static Command Create() - { - var command = new Command("package", "Package the project") - { - StandardOptions.Project, - StandardOptions.Verbosity, - StandardOptions.Force, - StandardOptions.Environment, - new Option(new []{ "-o", "--output" }, "Output directory") - { - Argument = new Argument("output", () => new DirectoryInfo(Environment.CurrentDirectory)) - { - Arity = ArgumentArity.ExactlyOne, - }, - Required = false, - }, - }; - command.Handler = CommandHandler.Create((console, project, output, environment, force, verbosity) => - { - return ExecuteAsync(new OutputContext(console, verbosity), project, output, environment, force); - }); - - return command; - } - - private static async Task ExecuteAsync(OutputContext output, FileInfo projectFile, DirectoryInfo outputDirectory, string environment, bool force) - { - output.WriteBanner(); - - var application = await ApplicationFactory.CreateApplicationAsync(output, projectFile); - - var steps = new List - { - new CombineStep() { Environment = environment, }, - new BuildDockerImageStep() { Environment = environment, }, - }; - - if (application.Globals.DeploymentKind == DeploymentKind.None) - { - // No extra steps - } - else if (application.Globals.DeploymentKind == DeploymentKind.Kubernetes) - { - steps.Add(new GenerateKubernetesManifestStep() { Environment = environment, }); - } - else if (application.Globals.DeploymentKind == DeploymentKind.Oam) - { - steps.Add(new GenerateOamComponentStep() { Environment = environment, }); - } - else - { - throw new InvalidOperationException($"Unknown DeploymentKind: " + application.Globals.DeploymentKind); - } - - // If this is command is for a project, then write out the component manifest - // for just the project. We won't run the "application package" part. - if (!string.Equals(".sln", projectFile.Extension, StringComparison.Ordinal)) - { - steps.Add(new WriteServiceYamlStep() { OutputDirectory = outputDirectory, Force = force, }); - } - - var executor = new ServiceExecutor(output, application, steps); - foreach (var service in application.Services) - { - if (service.IsMatchForProject(application, projectFile)) - { - await executor.ExecuteAsync(service); - } - } - - if (string.Equals(".sln", projectFile.Extension, StringComparison.Ordinal)) - { - await PackageApplicationAsync(output, application, outputDirectory, Path.GetFileNameWithoutExtension(projectFile.Name), environment); - } - } - - private static async Task PackageApplicationAsync(OutputContext output, Application application, DirectoryInfo outputDirectory, string applicationName, string environment) - { - using var step = output.BeginStep("Writing Application Manifests..."); - var outputFile = Path.Combine(outputDirectory.FullName, $"{applicationName}-{environment}.yaml"); - output.WriteInfoLine($"Writing output to '{outputFile}'."); - - File.Delete(outputFile); - using var stream = File.OpenWrite(outputFile); - using var writer = new StreamWriter(stream, Encoding.UTF8, leaveOpen: true); - - if (application.Globals.DeploymentKind == DeploymentKind.None) - { - // No extra steps - } - else if (application.Globals.DeploymentKind == DeploymentKind.Kubernetes) - { - await ApplicationYamlWriter.WriteAsync(output, writer, application); - } - else if (application.Globals.DeploymentKind == DeploymentKind.Oam) - { - await OamApplicationGenerator.WriteOamApplicationAsync(writer, output, application, applicationName, environment); - } - else - { - throw new InvalidOperationException($"Unknown DeploymentKind: " + application.Globals.DeploymentKind); - } - - step.MarkComplete(); - } - } -} diff --git a/src/opulence/dotnet-opulence/Properties/launchSettings.json b/src/opulence/dotnet-opulence/Properties/launchSettings.json deleted file mode 100644 index 9cdc2632..00000000 --- a/src/opulence/dotnet-opulence/Properties/launchSettings.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "profiles": { - "dotnet-opulence": { - "commandName": "Project", - "commandLineArgs": "" - } - } -} \ No newline at end of file diff --git a/src/opulence/dotnet-opulence/PushCommand.cs b/src/opulence/dotnet-opulence/PushCommand.cs deleted file mode 100644 index 7135eb18..00000000 --- a/src/opulence/dotnet-opulence/PushCommand.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System; -using System.CommandLine; -using System.CommandLine.Invocation; -using System.IO; -using System.Threading.Tasks; - -namespace Opulence -{ - public class PushCommand - { - public static Command Create() - { - var command = new Command("push", "Push the application to registry") - { - StandardOptions.Project, - StandardOptions.Verbosity, - StandardOptions.Environment, - }; - - command.Handler = CommandHandler.Create((console, project, environment, verbosity) => - { - return ExecuteAsync(new OutputContext(console, verbosity), project, environment); - }); - - return command; - } - - private static async Task ExecuteAsync(OutputContext output, FileInfo projectFile, string environment) - { - output.WriteBanner(); - - var application = await ApplicationFactory.CreateApplicationAsync(output, projectFile); - if (application.Globals.Registry?.Hostname == null) - { - throw new CommandException("A registry is required for push operations. run 'dotnet-opulence init'."); - } - - var steps = new ServiceExecutor.Step[] - { - new CombineStep() { Environment = environment, }, - new BuildDockerImageStep() { Environment = environment, }, - new PushDockerImageStep() { Environment = environment, }, - }; - - var executor = new ServiceExecutor(output, application, steps); - foreach (var service in application.Services) - { - if (service.IsMatchForProject(application, projectFile)) - { - await executor.ExecuteAsync(service); - } - } - } - } -} diff --git a/src/opulence/dotnet-opulence/ScriptRunner.cs b/src/opulence/dotnet-opulence/ScriptRunner.cs deleted file mode 100644 index 7e45a63a..00000000 --- a/src/opulence/dotnet-opulence/ScriptRunner.cs +++ /dev/null @@ -1,166 +0,0 @@ -using System; -using System.IO; -using System.Text; -using System.Threading.Tasks; -using Microsoft.Build.Construction; -using Microsoft.CodeAnalysis.CSharp; -using Microsoft.CodeAnalysis.CSharp.Scripting; -using Microsoft.CodeAnalysis.Scripting; - -namespace Opulence -{ - internal static class ScriptRunner - { - public static async Task RunCustomizationScriptAsync(OutputContext output, FileInfo projectFile) - { - if (output is null) - { - throw new ArgumentNullException(nameof(output)); - } - - using (var step = output.BeginStep("Applying Application Customizations...")) - { - var scriptFilePath = DirectorySearch.AscendingSearch(projectFile.DirectoryName, "Opulence.csx"); - output.WriteDebugLine($"Looking for customization script above '{projectFile}'."); - if (!File.Exists(scriptFilePath)) - { - output.WriteDebugLine($"No customization script found."); - step.MarkComplete("Skipping..."); - return null; - } - - output.WriteInfoLine($"Configuring application using '{Path.GetFileName(scriptFilePath)}'."); - - var code = File.ReadAllText(scriptFilePath); - var script = CSharpScript.Create( - code, - options: ScriptOptions.Default.WithImports(new[] { "System", "System.Collections.Generic", }), - globalsType: typeof(PipelineHolder), - assemblyLoader: null); - script = script.ContinueWith(@"return await Pipeline.ExecuteAsync(__Pipeline);", options: ScriptOptions.Default); - - output.WriteDebugLine($"Compiling {Path.GetFileName(scriptFilePath)}'."); - script.Compile(); - var diagnostics = script.Compile(); - if (diagnostics.Length > 0) - { - var builder = new StringBuilder(); - output.WriteDebugLine($"Script '{scriptFilePath}' had compilation errors."); - builder.AppendLine($"Script '{scriptFilePath}' had compilation errors."); - foreach (var diagnostic in diagnostics) - { - output.WriteDebugLine(CSharpDiagnosticFormatter.Instance.Format(diagnostic)); - builder.AppendLine(CSharpDiagnosticFormatter.Instance.Format(diagnostic)); - } - - throw new CommandException(builder.ToString()); - } - output.WriteDebugLine($"Done compiling {Path.GetFileName(scriptFilePath)}'."); - - var pipeline = new CustomizationPipeline( - output, - rootDirectory: Path.GetDirectoryName(scriptFilePath)!, - name: Names.NormalizeToDns(Path.GetFileNameWithoutExtension(projectFile.Name)), - solution: null, - projectFile); - var holder = new PipelineHolder(pipeline); - - output.WriteDebugLine($"Running {Path.GetFileName(scriptFilePath)}'."); - object obj; - try - { - var result = await script.RunAsync(holder); - obj = result.ReturnValue; - } - catch (Exception ex) - { - throw new CommandException($"Failed executing {Path.GetFileName(scriptFilePath)}'.", ex); - } - - step.MarkComplete(); - return new ApplicationWrapper(obj, Path.GetDirectoryName(scriptFilePath)!); - } - } - - public static async Task RunCustomizationScriptAsync(OutputContext output, FileInfo solutionFile, SolutionFile solution) - { - if (output is null) - { - throw new ArgumentNullException(nameof(output)); - } - - if (solutionFile is null) - { - throw new ArgumentNullException(nameof(solutionFile)); - } - - if (solution is null) - { - throw new ArgumentNullException(nameof(solution)); - } - - using (var step = output.BeginStep("Applying Application Customizations...")) - { - var scriptFilePath = Path.Combine(solutionFile.DirectoryName, "Opulence.csx"); - output.WriteDebugLine($"Looking for customization script at '{scriptFilePath}'."); - if (!File.Exists(scriptFilePath)) - { - output.WriteDebugLine($"No customization script found."); - step.MarkComplete("Skipping..."); - return null; - } - - output.WriteInfoLine($"Configuring application using '{Path.GetFileName(scriptFilePath)}'."); - - var code = File.ReadAllText(scriptFilePath); - var script = CSharpScript.Create( - code, - options: ScriptOptions.Default.WithImports(new[] { "System", "System.Collections.Generic", }), - globalsType: typeof(PipelineHolder), - assemblyLoader: null); - script = script.ContinueWith(@"return await Pipeline.ExecuteAsync(__Pipeline);", options: ScriptOptions.Default); - - output.WriteDebugLine($"Compiling {Path.GetFileName(scriptFilePath)}'."); - script.Compile(); - var diagnostics = script.Compile(); - if (diagnostics.Length > 0) - { - var builder = new StringBuilder(); - output.WriteDebugLine($"Script '{scriptFilePath}' had compilation errors."); - builder.AppendLine($"Script '{scriptFilePath}' had compilation errors."); - foreach (var diagnostic in diagnostics) - { - output.WriteDebugLine(CSharpDiagnosticFormatter.Instance.Format(diagnostic)); - builder.AppendLine(CSharpDiagnosticFormatter.Instance.Format(diagnostic)); - } - - throw new CommandException(builder.ToString()); - } - output.WriteDebugLine($"Done compiling {Path.GetFileName(scriptFilePath)}'."); - - var pipeline = new CustomizationPipeline( - output, - rootDirectory: Path.GetDirectoryName(scriptFilePath)!, - name: Names.NormalizeToDns(Path.GetFileNameWithoutExtension(solutionFile.Name)), - solution, - projectFile: null); - var holder = new PipelineHolder(pipeline); - - output.WriteDebugLine($"Running {Path.GetFileName(scriptFilePath)}'."); - object obj; - try - { - var result = await script.RunAsync(holder); - obj = result.ReturnValue; - } - catch (Exception ex) - { - throw new CommandException($"Failed executing {Path.GetFileName(scriptFilePath)}'.", ex); - } - - step.MarkComplete(); - return new ApplicationWrapper(obj, Path.GetDirectoryName(scriptFilePath)!); - } - } - } -} diff --git a/src/opulence/dotnet-opulence/dotnet-opulence.csproj b/src/opulence/dotnet-opulence/dotnet-opulence.csproj deleted file mode 100644 index c9b7441a..00000000 --- a/src/opulence/dotnet-opulence/dotnet-opulence.csproj +++ /dev/null @@ -1,44 +0,0 @@ - - - - Exe - netcoreapp3.1 - Opulence - true - Opulence.dotnet-opulence - opulence - Enable - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/tye/ConfigModel/ConfigApplication.cs b/src/tye/ConfigModel/ConfigApplication.cs index 6716748f..57aaf01e 100644 --- a/src/tye/ConfigModel/ConfigApplication.cs +++ b/src/tye/ConfigModel/ConfigApplication.cs @@ -18,9 +18,9 @@ namespace Tye.ConfigModel public List Services { get; set; } = new List(); - public Application ToHostingApplication() + public Micronetes.Hosting.Model.Application ToHostingApplication() { - var services = new Dictionary(); + var services = new Dictionary(); foreach (var service in Services) { RunInfo? runInfo; @@ -45,14 +45,14 @@ namespace Tye.ConfigModel throw new InvalidOperationException($"Cannot figure out how to run service '{service.Name}'."); } - var description = new ServiceDescription(service.Name, runInfo) + var description = new Micronetes.Hosting.Model.ServiceDescription(service.Name, runInfo) { Replicas = service.Replicas ?? 1, }; foreach (var binding in service.Bindings) { - description.Bindings.Add(new ServiceBinding() + description.Bindings.Add(new Micronetes.Hosting.Model.ServiceBinding() { ConnectionString = binding.ConnectionString, Host = binding.Host, @@ -68,10 +68,10 @@ namespace Tye.ConfigModel description.Configuration.Add(new ConfigurationSource(entry.Name, entry.Value)); } - services.Add(service.Name, new Service(description)); + services.Add(service.Name, new Micronetes.Hosting.Model.Service(description)); } - return new Application(Source, services); + return new Micronetes.Hosting.Model.Application(Source, services); } } } diff --git a/src/tye/OpulenceApplicationAdapter.cs b/src/tye/OpulenceApplicationAdapter.cs index b03c16ee..ca90fef9 100644 --- a/src/tye/OpulenceApplicationAdapter.cs +++ b/src/tye/OpulenceApplicationAdapter.cs @@ -1,14 +1,13 @@ using System.Collections.Generic; -using Opulence; using Tye.ConfigModel; namespace Tye { - internal class OpulenceApplicationAdapter : Opulence.Application + internal class TemporaryApplicationAdapter : Tye.Application { private readonly ConfigApplication application; - public OpulenceApplicationAdapter( + public TemporaryApplicationAdapter( ConfigApplication application, ApplicationGlobals globals, IReadOnlyList services) diff --git a/src/tye/Program.DeployCommand.cs b/src/tye/Program.DeployCommand.cs index 978a2622..443afb61 100644 --- a/src/tye/Program.DeployCommand.cs +++ b/src/tye/Program.DeployCommand.cs @@ -5,7 +5,6 @@ using System.CommandLine.Invocation; using System.IO; using System.Text; using System.Threading.Tasks; -using Opulence; using Tye.ConfigModel; namespace Tye @@ -38,7 +37,7 @@ namespace Tye private static async Task ExecuteDeployAsync(OutputContext output, ConfigApplication application, string environment, bool interactive) { - var opulenceApplication = await CreateOpulenceApplicationAsync(output, application, interactive); + var temporaryApplication = await CreateApplicationAdapterAsync(output, application, interactive); var steps = new List() { new CombineStep() { Environment = environment, }, @@ -49,16 +48,16 @@ namespace Tye steps.Add(new GenerateKubernetesManifestStep() { Environment = environment, }); steps.Add(new DeployServiceYamlStep() { Environment = environment, }); - var executor = new ServiceExecutor(output, opulenceApplication, steps); - foreach (var service in opulenceApplication.Services) + var executor = new ServiceExecutor(output, temporaryApplication, steps); + foreach (var service in temporaryApplication.Services) { await executor.ExecuteAsync(service); } - await DeployApplicationManifestAsync(output, opulenceApplication, application.Source.Directory.Name, environment); + await DeployApplicationManifestAsync(output, temporaryApplication, application.Source.Directory.Name, environment); } - private static async Task CreateOpulenceApplicationAsync(OutputContext output, ConfigApplication application, bool interactive) + private static async Task CreateApplicationAdapterAsync(OutputContext output, ConfigApplication application, bool interactive) { var globals = new ApplicationGlobals() { @@ -66,7 +65,7 @@ namespace Tye Registry = application.Registry is null ? null : new ContainerRegistry(application.Registry), }; - var services = new List(); + var services = new List(); foreach (var configService in application.Services) { if (configService.Project is string projectFile) @@ -120,29 +119,29 @@ namespace Tye } } - var opulenceApplication = new OpulenceApplicationAdapter(application, globals, services); - if (opulenceApplication.Globals.Registry?.Hostname == null && interactive) + var temporaryApplication = new TemporaryApplicationAdapter(application, globals, services); + if (temporaryApplication.Globals.Registry?.Hostname == null && interactive) { var registry = output.Prompt("Enter the Container Registry (ex: 'example.azurecr.io' for Azure or 'example' for dockerhub)"); - opulenceApplication.Globals.Registry = new ContainerRegistry(registry); + temporaryApplication.Globals.Registry = new ContainerRegistry(registry); } - else if (opulenceApplication.Globals.Registry?.Hostname == null) + else if (temporaryApplication.Globals.Registry?.Hostname == null) { throw new CommandException("A registry is required for deploy operations. Add the registry to 'tye.yaml' or use '-i' for interactive mode."); } - foreach (var service in opulenceApplication.Services) + foreach (var service in temporaryApplication.Services) { if (service.Service.Source is Project project && service.Service.GeneratedAssets.Container is ContainerInfo container) { - DockerfileGenerator.ApplyContainerDefaults(opulenceApplication, service, project, container); + DockerfileGenerator.ApplyContainerDefaults(temporaryApplication, service, project, container); } } - return opulenceApplication; + return temporaryApplication; } - private static async Task DeployApplicationManifestAsync(OutputContext output, Opulence.Application application, string applicationName, string environment) + private static async Task DeployApplicationManifestAsync(OutputContext output, Tye.Application application, string applicationName, string environment) { using var step = output.BeginStep("Deploying Application Manifests..."); diff --git a/src/tye/Program.GenerateCommand.cs b/src/tye/Program.GenerateCommand.cs index 2bc399f8..48d7afd4 100644 --- a/src/tye/Program.GenerateCommand.cs +++ b/src/tye/Program.GenerateCommand.cs @@ -5,7 +5,6 @@ using System.CommandLine.Invocation; using System.IO; using System.Text; using System.Threading.Tasks; -using Opulence; using Tye.ConfigModel; namespace Tye @@ -42,7 +41,7 @@ namespace Tye private static async Task ExecuteGenerateAsync(OutputContext output, ConfigApplication application, string environment, bool interactive) { - var opulenceApplication = await CreateOpulenceApplicationAsync(output, application, interactive); + var temporaryApplication = await CreateApplicationAdapterAsync(output, application, interactive); var steps = new List() { new CombineStep() { Environment = environment, }, @@ -51,16 +50,16 @@ namespace Tye steps.Add(new GenerateKubernetesManifestStep() { Environment = environment, }); - var executor = new ServiceExecutor(output, opulenceApplication, steps); - foreach (var service in opulenceApplication.Services) + var executor = new ServiceExecutor(output, temporaryApplication, steps); + foreach (var service in temporaryApplication.Services) { await executor.ExecuteAsync(service); } - await GenerateApplicationManifestAsync(output, opulenceApplication, application.Source.Directory.Name, environment); + await GenerateApplicationManifestAsync(output, temporaryApplication, application.Source.Directory.Name, environment); } - private static async Task GenerateApplicationManifestAsync(OutputContext output, Opulence.Application application, string applicationName, string environment) + private static async Task GenerateApplicationManifestAsync(OutputContext output, Tye.Application application, string applicationName, string environment) { using var step = output.BeginStep("Generating Application Manifests..."); diff --git a/src/tye/Program.InitCommand.cs b/src/tye/Program.InitCommand.cs index 6f275dc2..c3aeb444 100644 --- a/src/tye/Program.InitCommand.cs +++ b/src/tye/Program.InitCommand.cs @@ -3,7 +3,6 @@ using System.CommandLine; using System.CommandLine.Invocation; using System.CommandLine.IO; using System.IO; -using Opulence; using Tye.ConfigModel; using YamlDotNet.Serialization; using YamlDotNet.Serialization.NamingConventions; diff --git a/src/tye/tye.csproj b/src/tye/tye.csproj index 14609c44..4bebde16 100644 --- a/src/tye/tye.csproj +++ b/src/tye/tye.csproj @@ -11,7 +11,7 @@ - + diff --git a/tye.sln b/tye.sln index 59863630..f7260601 100644 --- a/tye.sln +++ b/tye.sln @@ -11,12 +11,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{F19B02EB-A EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "E2ETest", "test\E2ETest\E2ETest.csproj", "{D15E5FF6-C1E7-4110-A2BE-06ADA7ACA82B}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "opulence", "opulence", "{E8219571-549D-4EFE-8E62-54082D707B9A}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Opulence", "src\opulence\Opulence\Opulence.csproj", "{0A8A0C69-49CB-462E-A7D4-605F78786EEF}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dotnet-opulence", "src\opulence\dotnet-opulence\dotnet-opulence.csproj", "{BA03A616-4649-414D-A116-727D72F4BF50}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "micronetes", "micronetes", "{B2C364E4-969E-4770-BF5F-BE65D292F70A}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Micronetes.Hosting", "src\micronetes\Micronetes.Hosting\Micronetes.Hosting.csproj", "{0F4F5A86-DD27-4AF9-BF97-221EAD5040E7}" @@ -25,6 +19,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Micronetes.Hosting.Diagnost EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Micronetes.Hosting.Runtime", "src\micronetes\Micronetes.Hosting.Runtime\Micronetes.Hosting.Runtime.csproj", "{34719884-1338-4965-BA2A-F98DB03733C2}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tye.Core", "src\Tye.Core\Tye.Core.csproj", "{D0359C69-6EA9-4B03-9455-90E8E04F1CB0}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -62,30 +58,6 @@ Global {D15E5FF6-C1E7-4110-A2BE-06ADA7ACA82B}.Release|x64.Build.0 = Release|Any CPU {D15E5FF6-C1E7-4110-A2BE-06ADA7ACA82B}.Release|x86.ActiveCfg = Release|Any CPU {D15E5FF6-C1E7-4110-A2BE-06ADA7ACA82B}.Release|x86.Build.0 = Release|Any CPU - {0A8A0C69-49CB-462E-A7D4-605F78786EEF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0A8A0C69-49CB-462E-A7D4-605F78786EEF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0A8A0C69-49CB-462E-A7D4-605F78786EEF}.Debug|x64.ActiveCfg = Debug|Any CPU - {0A8A0C69-49CB-462E-A7D4-605F78786EEF}.Debug|x64.Build.0 = Debug|Any CPU - {0A8A0C69-49CB-462E-A7D4-605F78786EEF}.Debug|x86.ActiveCfg = Debug|Any CPU - {0A8A0C69-49CB-462E-A7D4-605F78786EEF}.Debug|x86.Build.0 = Debug|Any CPU - {0A8A0C69-49CB-462E-A7D4-605F78786EEF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0A8A0C69-49CB-462E-A7D4-605F78786EEF}.Release|Any CPU.Build.0 = Release|Any CPU - {0A8A0C69-49CB-462E-A7D4-605F78786EEF}.Release|x64.ActiveCfg = Release|Any CPU - {0A8A0C69-49CB-462E-A7D4-605F78786EEF}.Release|x64.Build.0 = Release|Any CPU - {0A8A0C69-49CB-462E-A7D4-605F78786EEF}.Release|x86.ActiveCfg = Release|Any CPU - {0A8A0C69-49CB-462E-A7D4-605F78786EEF}.Release|x86.Build.0 = Release|Any CPU - {BA03A616-4649-414D-A116-727D72F4BF50}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {BA03A616-4649-414D-A116-727D72F4BF50}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BA03A616-4649-414D-A116-727D72F4BF50}.Debug|x64.ActiveCfg = Debug|Any CPU - {BA03A616-4649-414D-A116-727D72F4BF50}.Debug|x64.Build.0 = Debug|Any CPU - {BA03A616-4649-414D-A116-727D72F4BF50}.Debug|x86.ActiveCfg = Debug|Any CPU - {BA03A616-4649-414D-A116-727D72F4BF50}.Debug|x86.Build.0 = Debug|Any CPU - {BA03A616-4649-414D-A116-727D72F4BF50}.Release|Any CPU.ActiveCfg = Release|Any CPU - {BA03A616-4649-414D-A116-727D72F4BF50}.Release|Any CPU.Build.0 = Release|Any CPU - {BA03A616-4649-414D-A116-727D72F4BF50}.Release|x64.ActiveCfg = Release|Any CPU - {BA03A616-4649-414D-A116-727D72F4BF50}.Release|x64.Build.0 = Release|Any CPU - {BA03A616-4649-414D-A116-727D72F4BF50}.Release|x86.ActiveCfg = Release|Any CPU - {BA03A616-4649-414D-A116-727D72F4BF50}.Release|x86.Build.0 = Release|Any CPU {0F4F5A86-DD27-4AF9-BF97-221EAD5040E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {0F4F5A86-DD27-4AF9-BF97-221EAD5040E7}.Debug|Any CPU.Build.0 = Debug|Any CPU {0F4F5A86-DD27-4AF9-BF97-221EAD5040E7}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -122,16 +94,26 @@ Global {34719884-1338-4965-BA2A-F98DB03733C2}.Release|x64.Build.0 = Release|Any CPU {34719884-1338-4965-BA2A-F98DB03733C2}.Release|x86.ActiveCfg = Release|Any CPU {34719884-1338-4965-BA2A-F98DB03733C2}.Release|x86.Build.0 = Release|Any CPU + {D0359C69-6EA9-4B03-9455-90E8E04F1CB0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D0359C69-6EA9-4B03-9455-90E8E04F1CB0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D0359C69-6EA9-4B03-9455-90E8E04F1CB0}.Debug|x64.ActiveCfg = Debug|Any CPU + {D0359C69-6EA9-4B03-9455-90E8E04F1CB0}.Debug|x64.Build.0 = Debug|Any CPU + {D0359C69-6EA9-4B03-9455-90E8E04F1CB0}.Debug|x86.ActiveCfg = Debug|Any CPU + {D0359C69-6EA9-4B03-9455-90E8E04F1CB0}.Debug|x86.Build.0 = Debug|Any CPU + {D0359C69-6EA9-4B03-9455-90E8E04F1CB0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D0359C69-6EA9-4B03-9455-90E8E04F1CB0}.Release|Any CPU.Build.0 = Release|Any CPU + {D0359C69-6EA9-4B03-9455-90E8E04F1CB0}.Release|x64.ActiveCfg = Release|Any CPU + {D0359C69-6EA9-4B03-9455-90E8E04F1CB0}.Release|x64.Build.0 = Release|Any CPU + {D0359C69-6EA9-4B03-9455-90E8E04F1CB0}.Release|x86.ActiveCfg = Release|Any CPU + {D0359C69-6EA9-4B03-9455-90E8E04F1CB0}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(NestedProjects) = preSolution {9BFE4070-D6D8-41F8-B92E-F85C3DCD7AB8} = {8C662D59-A3CB-466F-8E85-A8E6BA5E7601} {D15E5FF6-C1E7-4110-A2BE-06ADA7ACA82B} = {F19B02EB-A372-417A-B2C2-EA0D5A3C76D5} - {E8219571-549D-4EFE-8E62-54082D707B9A} = {8C662D59-A3CB-466F-8E85-A8E6BA5E7601} - {0A8A0C69-49CB-462E-A7D4-605F78786EEF} = {E8219571-549D-4EFE-8E62-54082D707B9A} - {BA03A616-4649-414D-A116-727D72F4BF50} = {E8219571-549D-4EFE-8E62-54082D707B9A} {B2C364E4-969E-4770-BF5F-BE65D292F70A} = {8C662D59-A3CB-466F-8E85-A8E6BA5E7601} {0F4F5A86-DD27-4AF9-BF97-221EAD5040E7} = {B2C364E4-969E-4770-BF5F-BE65D292F70A} {CEBFC149-8162-4A0A-9AD4-40498B9172CD} = {B2C364E4-969E-4770-BF5F-BE65D292F70A} {34719884-1338-4965-BA2A-F98DB03733C2} = {B2C364E4-969E-4770-BF5F-BE65D292F70A} + {D0359C69-6EA9-4B03-9455-90E8E04F1CB0} = {8C662D59-A3CB-466F-8E85-A8E6BA5E7601} EndGlobalSection EndGlobal