Skip to content

Commit

Permalink
Merge pull request #59 from patricklee2/php
Browse files Browse the repository at this point in the history
add php oryx build support
  • Loading branch information
JennyLawrance authored Jun 21, 2019
2 parents 0f5025b + 529e969 commit 990cfa6
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 8 deletions.
12 changes: 10 additions & 2 deletions Kudu.Core/Deployment/Oryx/AppServiceOryxArguments.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ private void SetLanguageOptions()
}

return;

case Framework.PHP:
return;
}
}

Expand Down Expand Up @@ -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;

Expand All @@ -130,14 +132,20 @@ 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
switch (Language)
{
case Framework.None:
break;

case Framework.PHP:
case Framework.NodeJs:
case Framework.Python:
OryxArgumentsHelper.AddLanguageVersion(args, Version);
Expand Down
4 changes: 4 additions & 0 deletions Kudu.Core/Deployment/Oryx/FunctionAppOryxArguments.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down
10 changes: 9 additions & 1 deletion Kudu.Core/Deployment/Oryx/FunctionAppSupportedWorkerRuntime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ public enum WorkerRuntime
None,
Node,
Python,
DotNet
DotNet,
PHP
}

public class FunctionAppSupportedWorkerRuntime
Expand All @@ -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;
}
Expand All @@ -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 "";
}
Expand Down
15 changes: 11 additions & 4 deletions Kudu.Core/Deployment/Oryx/OryxArguments.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ private void SetLanguageOptions()
}

return;

case Framework.PHP:
return;
}
}

Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions Kudu.Core/Deployment/Oryx/OryxBuildConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion Kudu.Core/Deployment/Oryx/SupportedLanguages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ public enum Framework
None,
NodeJs,
Python,
DotNETCore
DotNETCore,
PHP
}

public class SupportedFrameworks
Expand All @@ -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;
}
Expand Down

0 comments on commit 990cfa6

Please sign in to comment.