コード例 #1
0
ファイル: RunScriptGenerator.cs プロジェクト: kichalla/oryx
        public string GenerateBashScript(string targetPlatformName, RunScriptGeneratorOptions options)
        {
            var targetPlatform = _programmingPlatforms.Where(
                p => string.Equals(p.Name, targetPlatformName, StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault();

            if (targetPlatform == null)
            {
                throw new UnsupportedLanguageException($"Platform '{targetPlatformName}' is not supported.");
            }

            var runScript = targetPlatform.GenerateBashRunScript(options);

            return(runScript);
        }
コード例 #2
0
        public string GenerateBashScript(string targetPlatformName, RunScriptGeneratorOptions opts)
        {
            if (opts.SourceRepo == null)
            {
                throw new ArgumentNullException(nameof(opts.SourceRepo), "Source repository must be supplied.");
            }

            var targetPlatform = _programmingPlatforms
                                 .Where(p => p.Name.EqualsIgnoreCase(targetPlatformName))
                                 .FirstOrDefault();

            if (targetPlatform == null)
            {
                throw new UnsupportedLanguageException($"Platform '{targetPlatformName}' is not supported.");
            }

            return(RunStartupScriptGeneratorForPlatform(targetPlatform, opts));
        }
コード例 #3
0
        private string RunStartupScriptGeneratorForPlatform(IProgrammingPlatform plat, RunScriptGeneratorOptions opts)
        {
            var scriptGenPath = FilePaths.RunScriptGeneratorDir + "/" + plat.Name;

            var scriptGenArgs = new List <string> {
                "-appPath", opts.SourceRepo.RootPath, "-output", _tempScriptPath
            };

            scriptGenArgs.AddRange(opts.PassThruArguments);

            (int exitCode, string stdout, string stderr) = ProcessHelper.RunProcess(
                scriptGenPath, scriptGenArgs, Environment.CurrentDirectory, RunScriptGeneratorTimeout);

            if (exitCode != ProcessConstants.ExitSuccess)
            {
                _logger.LogError("{scriptGenPath} returned {exitCode}", scriptGenPath, exitCode);
                throw new Exception("{scriptGenPath} failed");
            }

            return(File.ReadAllText(_tempScriptPath));
        }