public CakeScriptService(IOmniSharpEnvironment environment, ICakeConfiguration configuration, ILoggerFactory loggerFactory)
        {
            if (environment == null)
            {
                throw new ArgumentNullException(nameof(environment));
            }
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }
            if (loggerFactory == null)
            {
                throw new ArgumentNullException(nameof(loggerFactory));
            }

            var serverExecutablePath = ScriptGenerationToolResolver.GetExecutablePath(environment.TargetDirectory, configuration);

            if (File.Exists(serverExecutablePath))
            {
                _generationService = PlatformHelper.IsMono ?
                                     new ScriptGenerationClient(new MonoScriptGenerationProcess(serverExecutablePath, environment, loggerFactory), environment.TargetDirectory, loggerFactory) :
                                     new ScriptGenerationClient(serverExecutablePath, environment.TargetDirectory, loggerFactory);
            }

            IsConnected       = _generationService != null;
            _cachedReferences = new Dictionary <string, ISet <string> >();
            _cachedUsings     = new Dictionary <string, ISet <string> >();
        }
예제 #2
0
        public bool Initialize(CakeOptions options)
        {
            var serverExecutablePath = ScriptGenerationToolResolver.GetExecutablePath(_environment.TargetDirectory, _cakeConfiguration, options);

            if (File.Exists(serverExecutablePath))
            {
                _generationService = PlatformHelper.IsMono ?
                                     new ScriptGenerationClient(new MonoScriptGenerationProcess(serverExecutablePath, _environment, _loggerFactory), _environment.TargetDirectory, _loggerFactory) :
                                     new ScriptGenerationClient(serverExecutablePath, _environment.TargetDirectory, _loggerFactory);
            }

            return(_generationService != null);
        }
예제 #3
0
        public bool Initialize(CakeOptions options)
        {
            var serverExecutablePath = ScriptGenerationToolResolver.GetExecutablePath(_environment.TargetDirectory, _cakeConfiguration, options);

            if (File.Exists(serverExecutablePath))
            {
                _logger.LogInformation($"Using Cake.Bakery at {serverExecutablePath}");

                _generationService = PlatformHelper.IsMono ?
                                     new ScriptGenerationClient(new MonoScriptGenerationProcess(serverExecutablePath, _environment, _loggerFactory), _environment.TargetDirectory, _loggerFactory) :
                                     new ScriptGenerationClient(serverExecutablePath, _environment.TargetDirectory, _loggerFactory);
            }
            else if (!string.IsNullOrEmpty(serverExecutablePath))
            {
                _logger.LogWarning($"Cake.Bakery not found at path {serverExecutablePath}");
            }

            return(_generationService != null);
        }