public string GenerateOryxBuildCommand(DeploymentContext context) { StringBuilder args = new StringBuilder(); // Language switch (Language) { case Framework.None: // Input/Output OryxArgumentsHelper.AddOryxBuildCommand(args, source: context.OutputPath, destination: context.OutputPath); break; case Framework.NodeJs: // Input/Output OryxArgumentsHelper.AddOryxBuildCommand(args, source: context.OutputPath, destination: context.OutputPath); OryxArgumentsHelper.AddLanguage(args, "nodejs"); break; case Framework.Python: // Input/Output OryxArgumentsHelper.AddOryxBuildCommand(args, source: context.OutputPath, destination: context.OutputPath); OryxArgumentsHelper.AddLanguage(args, "python"); break; case Framework.DotNETCore: // Input/Output [For .NET core, the source path is the RepositoryPath] 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); break; // work around issue regarding sdk version vs runtime version case Framework.DotNETCore: if (Version == "1.0") { Version = "1.1"; } else if (Version == "2.0") { Version = "2.1"; } OryxArgumentsHelper.AddLanguageVersion(args, Version); break; default: break; } // Build Flags switch (Flags) { case BuildOptimizationsFlags.Off: case BuildOptimizationsFlags.None: break; case BuildOptimizationsFlags.CompressModules: OryxArgumentsHelper.AddTempDirectoryOption(args, context.BuildTempPath); if (Language == Framework.NodeJs) { OryxArgumentsHelper.AddNodeCompressOption(args, "tar-gz"); } else if (Language == Framework.Python) { OryxArgumentsHelper.AddPythonCompressOption(args); } break; case BuildOptimizationsFlags.UseExpressBuild: OryxArgumentsHelper.AddTempDirectoryOption(args, context.BuildTempPath); if (Language == Framework.NodeJs) { OryxArgumentsHelper.AddNodeCompressOption(args, "zip"); } break; case BuildOptimizationsFlags.UseTempDirectory: OryxArgumentsHelper.AddTempDirectoryOption(args, context.BuildTempPath); break; } // Virtual Env? if (!String.IsNullOrEmpty(VirtualEnv)) { OryxArgumentsHelper.AddPythonVirtualEnv(args, VirtualEnv); } return(args.ToString()); }
public string GenerateOryxBuildCommand(DeploymentContext context) { StringBuilder args = new StringBuilder(); // Language switch (Language) { case Framework.None: // Input/Output if (Flags == BuildOptimizationsFlags.DeploymentV2) { OryxArgumentsHelper.AddOryxBuildCommand(args, source: context.RepositoryPath, destination: context.BuildTempPath); } else { OryxArgumentsHelper.AddOryxBuildCommand(args, source: context.RepositoryPath, destination: context.OutputPath); } break; case Framework.NodeJs: // Input/Output if (Flags == BuildOptimizationsFlags.DeploymentV2) { OryxArgumentsHelper.AddOryxBuildCommand(args, source: context.RepositoryPath, destination: context.BuildTempPath); } else { OryxArgumentsHelper.AddOryxBuildCommand(args, source: context.RepositoryPath, destination: context.OutputPath); } OryxArgumentsHelper.AddLanguage(args, "nodejs"); break; case Framework.Python: // Input/Output if (Flags == BuildOptimizationsFlags.DeploymentV2) { OryxArgumentsHelper.AddOryxBuildCommand(args, source: context.RepositoryPath, destination: context.BuildTempPath); } else { OryxArgumentsHelper.AddOryxBuildCommand(args, source: context.RepositoryPath, destination: context.OutputPath); } OryxArgumentsHelper.AddLanguage(args, "python"); break; case Framework.DotNETCore: if (Flags == BuildOptimizationsFlags.UseExpressBuild || Flags == BuildOptimizationsFlags.DeploymentV2) { // We don't want to copy the built artifacts to wwwroot for ExpressBuild scenario OryxArgumentsHelper.AddOryxBuildCommand(args, source: context.RepositoryPath, destination: context.BuildTempPath); } else { // Input/Output [For .NET core, the source path is the RepositoryPath] OryxArgumentsHelper.AddOryxBuildCommand(args, source: context.RepositoryPath, destination: context.OutputPath); } OryxArgumentsHelper.AddLanguage(args, "dotnet"); break; case Framework.PHP: // Input/Output if (Flags == BuildOptimizationsFlags.DeploymentV2) { OryxArgumentsHelper.AddOryxBuildCommand(args, source: context.RepositoryPath, destination: context.BuildTempPath); } else { OryxArgumentsHelper.AddOryxBuildCommand(args, source: context.RepositoryPath, destination: context.OutputPath); } OryxArgumentsHelper.AddLanguage(args, "php"); break; } // Version switch (Language) { case Framework.None: break; case Framework.PHP: OryxArgumentsHelper.AddLanguageVersion(args, Version); break; case Framework.NodeJs: if (Version.Contains("lts", StringComparison.OrdinalIgnoreCase)) { // 10-LTS, 12-LTS should use versions 10, 12 etc // Oryx Builder uses lts for major versions Version = Version.Replace("lts", "").Replace("-", ""); } if (string.IsNullOrEmpty(Version) || Version.Contains("10.16", StringComparison.OrdinalIgnoreCase)) { // Active LTS Version = "10"; } else if (Version.Contains("12.9", StringComparison.OrdinalIgnoreCase)) { Version = "12"; } OryxArgumentsHelper.AddLanguageVersion(args, Version); break; case Framework.Python: OryxArgumentsHelper.AddLanguageVersion(args, Version); break; // work around issue regarding sdk version vs runtime version case Framework.DotNETCore: if (Version == "1.0") { Version = "1.1"; } else if (Version == "2.0") { Version = "2.1"; } OryxArgumentsHelper.AddLanguageVersion(args, Version); break; default: break; } // Build Flags switch (Flags) { case BuildOptimizationsFlags.Off: case BuildOptimizationsFlags.None: break; case BuildOptimizationsFlags.CompressModules: OryxArgumentsHelper.AddTempDirectoryOption(args, context.BuildTempPath); if (Language == Framework.NodeJs) { OryxArgumentsHelper.AddNodeCompressOption(args, "tar-gz"); } else if (Language == Framework.Python) { OryxArgumentsHelper.AddPythonCompressOption(args, "tar-gz"); } break; case BuildOptimizationsFlags.UseExpressBuild: OryxArgumentsHelper.AddTempDirectoryOption(args, context.BuildTempPath); if (Language == Framework.NodeJs) { OryxArgumentsHelper.AddNodeCompressOption(args, "zip"); } else if (Language == Framework.Python) { OryxArgumentsHelper.AddPythonCompressOption(args, "zip"); } break; case BuildOptimizationsFlags.UseTempDirectory: OryxArgumentsHelper.AddTempDirectoryOption(args, context.BuildTempPath); break; case BuildOptimizationsFlags.DeploymentV2: OryxArgumentsHelper.AddTempDirectoryOption(args, context.BuildTempPath); break; } // Virtual Env? if (!String.IsNullOrEmpty(VirtualEnv)) { OryxArgumentsHelper.AddPythonVirtualEnv(args, VirtualEnv); } OryxArgumentsHelper.AddDebugLog(args); return(args.ToString()); }