From 529e9694b38c8b58ed209efa96c3296ae4e97ad0 Mon Sep 17 00:00:00 2001 From: Patrick Lee <31744877+patricklee2@users.noreply.github.com> Date: Wed, 19 Jun 2019 17:25:12 -0700 Subject: [PATCH] add php oryx build support --- .../Deployment/Oryx/AppServiceOryxArguments.cs | 12 ++++++++++-- .../Deployment/Oryx/FunctionAppOryxArguments.cs | 4 ++++ .../Oryx/FunctionAppSupportedWorkerRuntime.cs | 10 +++++++++- Kudu.Core/Deployment/Oryx/OryxArguments.cs | 15 +++++++++++---- Kudu.Core/Deployment/Oryx/OryxBuildConstants.cs | 1 + Kudu.Core/Deployment/Oryx/SupportedLanguages.cs | 7 ++++++- 6 files changed, 41 insertions(+), 8 deletions(-) diff --git a/Kudu.Core/Deployment/Oryx/AppServiceOryxArguments.cs b/Kudu.Core/Deployment/Oryx/AppServiceOryxArguments.cs index 1e78706a..9e327fc1 100644 --- a/Kudu.Core/Deployment/Oryx/AppServiceOryxArguments.cs +++ b/Kudu.Core/Deployment/Oryx/AppServiceOryxArguments.cs @@ -82,6 +82,9 @@ private void SetLanguageOptions() } return; + + case Framework.PHP: + return; } } @@ -115,7 +118,6 @@ public string GenerateOryxBuildCommand(DeploymentContext context) case Framework.NodeJs: // Input/Output OryxArgumentsHelper.AddOryxBuildCommand(args, source: context.OutputPath, destination: context.OutputPath); - OryxArgumentsHelper.AddLanguage(args, "nodejs"); break; @@ -130,6 +132,12 @@ public string GenerateOryxBuildCommand(DeploymentContext context) OryxArgumentsHelper.AddOryxBuildCommand(args, source: context.RepositoryPath, destination: context.OutputPath); OryxArgumentsHelper.AddLanguage(args, "dotnet"); break; + + case Framework.PHP: + // Input/Output + OryxArgumentsHelper.AddOryxBuildCommand(args, source: context.OutputPath, destination: context.OutputPath); + OryxArgumentsHelper.AddLanguage(args, "php"); + break; } // Version @@ -137,7 +145,7 @@ public string GenerateOryxBuildCommand(DeploymentContext context) { case Framework.None: break; - + case Framework.PHP: case Framework.NodeJs: case Framework.Python: OryxArgumentsHelper.AddLanguageVersion(args, Version); diff --git a/Kudu.Core/Deployment/Oryx/FunctionAppOryxArguments.cs b/Kudu.Core/Deployment/Oryx/FunctionAppOryxArguments.cs index 915db022..edae7556 100644 --- a/Kudu.Core/Deployment/Oryx/FunctionAppOryxArguments.cs +++ b/Kudu.Core/Deployment/Oryx/FunctionAppOryxArguments.cs @@ -70,6 +70,10 @@ protected void AddLanguage(StringBuilder args, WorkerRuntime workerRuntime) case WorkerRuntime.Python: OryxArgumentsHelper.AddLanguage(args, "python"); break; + + case WorkerRuntime.PHP: + OryxArgumentsHelper.AddLanguage(args, "php"); + break; } } diff --git a/Kudu.Core/Deployment/Oryx/FunctionAppSupportedWorkerRuntime.cs b/Kudu.Core/Deployment/Oryx/FunctionAppSupportedWorkerRuntime.cs index 9375cfe8..513a4b5b 100644 --- a/Kudu.Core/Deployment/Oryx/FunctionAppSupportedWorkerRuntime.cs +++ b/Kudu.Core/Deployment/Oryx/FunctionAppSupportedWorkerRuntime.cs @@ -7,7 +7,8 @@ public enum WorkerRuntime None, Node, Python, - DotNet + DotNet, + PHP } public class FunctionAppSupportedWorkerRuntime @@ -30,6 +31,10 @@ public static WorkerRuntime ParseWorkerRuntime(string value) { return WorkerRuntime.DotNet; } + else if (value.StartsWith("PHP", StringComparison.OrdinalIgnoreCase)) + { + return WorkerRuntime.PHP; + } return WorkerRuntime.None; } @@ -47,6 +52,9 @@ public static string GetDefaultLanguageVersion(WorkerRuntime workerRuntime) case WorkerRuntime.Python: return OryxBuildConstants.FunctionAppWorkerRuntimeDefaults.Python; + case WorkerRuntime.PHP: + return OryxBuildConstants.FunctionAppWorkerRuntimeDefaults.PHP; + default: return ""; } diff --git a/Kudu.Core/Deployment/Oryx/OryxArguments.cs b/Kudu.Core/Deployment/Oryx/OryxArguments.cs index 726a99a2..f356c053 100644 --- a/Kudu.Core/Deployment/Oryx/OryxArguments.cs +++ b/Kudu.Core/Deployment/Oryx/OryxArguments.cs @@ -71,6 +71,9 @@ private void SetLanguageOptions() } return; + + case Framework.PHP: + return; } } @@ -103,20 +106,24 @@ public string GenerateOryxBuildCommand(DeploymentContext context) break; case Framework.NodeJs: - args.AppendFormat(" -l nodejs"); + args.AppendFormat(" --platform nodejs"); break; case Framework.Python: - args.AppendFormat(" -l python"); + args.AppendFormat(" --platform python"); break; case Framework.DotNETCore: - args.AppendFormat(" -l dotnet"); + args.AppendFormat(" --platform dotnet"); + break; + + case Framework.PHP: + args.AppendFormat(" --platform php"); break; } // Version - args.AppendFormat(" --language-version {0}", Version); + args.AppendFormat(" --platform-version {0}", Version); // Build Flags switch (Flags) diff --git a/Kudu.Core/Deployment/Oryx/OryxBuildConstants.cs b/Kudu.Core/Deployment/Oryx/OryxBuildConstants.cs index 3ba25df7..30d4e153 100644 --- a/Kudu.Core/Deployment/Oryx/OryxBuildConstants.cs +++ b/Kudu.Core/Deployment/Oryx/OryxBuildConstants.cs @@ -23,6 +23,7 @@ internal static class FunctionAppWorkerRuntimeDefaults public static readonly string Node = "8.15"; public static readonly string Python = "3.6"; public static readonly string Dotnet = "2.2"; + public static readonly string PHP = "7.3"; } internal static class FunctionAppBuildSettings diff --git a/Kudu.Core/Deployment/Oryx/SupportedLanguages.cs b/Kudu.Core/Deployment/Oryx/SupportedLanguages.cs index 60313767..8d08f961 100644 --- a/Kudu.Core/Deployment/Oryx/SupportedLanguages.cs +++ b/Kudu.Core/Deployment/Oryx/SupportedLanguages.cs @@ -9,7 +9,8 @@ public enum Framework None, NodeJs, Python, - DotNETCore + DotNETCore, + PHP } public class SupportedFrameworks @@ -28,6 +29,10 @@ public static Framework ParseLanguage(string value) { return Framework.DotNETCore; } + else if (value.StartsWith("PHP", StringComparison.OrdinalIgnoreCase)) + { + return Framework.PHP; + } return Framework.None; }