public static void Init(ISecretsManager secretsManager, string[] args)
 {
     try
     {
         if (args.Contains("--csharp") || args.Contains("--dotnet"))
         {
             _currentWorkerRuntime = WorkerRuntime.dotnet;
         }
         else if (args.Contains("--javascript") || args.Contains("--typescript") || args.Contains("--node"))
         {
             _currentWorkerRuntime = WorkerRuntime.node;
         }
         else if (args.Contains("--java"))
         {
             _currentWorkerRuntime = WorkerRuntime.java;
         }
         else if (args.Contains("--python"))
         {
             _currentWorkerRuntime = WorkerRuntime.python;
         }
         else if (args.Contains("--powershell"))
         {
             _currentWorkerRuntime = WorkerRuntime.powershell;
         }
         else
         {
             _currentWorkerRuntime = WorkerRuntimeLanguageHelper.GetCurrentWorkerRuntimeLanguage(secretsManager);
         }
     }
     catch
     {
         _currentWorkerRuntime = WorkerRuntime.None;
     }
 }
Exemple #2
0
        public static async Task <string> EnsureExtensionsProjectExistsAsync(ISecretsManager secretsManager, bool csx, string extensionsDir = null)
        {
            var workerRuntime = WorkerRuntimeLanguageHelper.GetCurrentWorkerRuntimeLanguage(secretsManager);

            if (workerRuntime == WorkerRuntime.dotnet && !csx)
            {
                return(DotnetHelpers.GetCsproj());
            }

            if (String.IsNullOrEmpty(extensionsDir))
            {
                extensionsDir = Environment.CurrentDirectory;
            }

            var extensionsProj = Path.Combine(extensionsDir, "extensions.csproj");

            if (!FileSystemHelpers.FileExists(extensionsProj))
            {
                FileSystemHelpers.EnsureDirectory(extensionsDir);
                await FileSystemHelpers.WriteAllTextToFileAsync(extensionsProj, await StaticResources.ExtensionsProject);
            }
            return(extensionsProj);
        }