Exemplo n.º 1
0
        public DnxProjectSystem(OmnisharpWorkspace workspace,
                                IOmnisharpEnvironment env,
                                IOptions <OmniSharpOptions> optionsAccessor,
                                ILoggerFactory loggerFactory,
                                IMetadataFileReferenceCache metadataFileReferenceCache,
                                IApplicationLifetime lifetime,
                                IFileSystemWatcher watcher,
                                IEventEmitter emitter,
                                DnxContext context)
        {
            _workspace = workspace;
            _env       = env;
            _logger    = loggerFactory.CreateLogger <DnxProjectSystem>();
            _metadataFileReferenceCache = metadataFileReferenceCache;
            _options  = optionsAccessor.Options;
            _dnxPaths = new DnxPaths(env, _options, loggerFactory);
            _designTimeHostManager = new DesignTimeHostManager(loggerFactory, _dnxPaths);
            _packagesRestoreTool   = new PackagesRestoreTool(_options, loggerFactory, emitter, context, _dnxPaths);
            _context             = context;
            _watcher             = watcher;
            _emitter             = emitter;
            _directoryEnumerator = new DirectoryEnumerator(loggerFactory);

            lifetime.ApplicationStopping.Register(OnShutdown);
        }
        public DnxProjectSystem(OmnisharpWorkspace workspace,
                                    IOmnisharpEnvironment env,
                                    IOptions<OmniSharpOptions> optionsAccessor,
                                    ILoggerFactory loggerFactory,
                                    IMetadataFileReferenceCache metadataFileReferenceCache,
                                    IApplicationLifetime lifetime,
                                    IFileSystemWatcher watcher,
                                    IEventEmitter emitter,
                                    DnxContext context)
        {
            _workspace = workspace;
            _env = env;
            _logger = loggerFactory.CreateLogger<DnxProjectSystem>();
            _metadataFileReferenceCache = metadataFileReferenceCache;
            _options = optionsAccessor.Options;
            _dnxPaths = new DnxPaths(env, _options, loggerFactory);
            _designTimeHostManager = new DesignTimeHostManager(loggerFactory, _dnxPaths);
            _packagesRestoreTool = new PackagesRestoreTool(_options, loggerFactory, emitter, context, _dnxPaths);
            _context = context;
            _watcher = watcher;
            _emitter = emitter;
            _directoryEnumerator = new DirectoryEnumerator(loggerFactory);

            lifetime.ApplicationStopping.Register(OnShutdown);
        }
 public ProjectSystemController(DnxContext dnxContext, MSBuildContext msbuildContext, ScriptCsContext scriptCsContext,
     OmnisharpWorkspace workspace)
 {
     _dnxContext = dnxContext;
     _msbuildContext = msbuildContext;
     _scriptCsContext = scriptCsContext;
     _workspace = workspace;
 }
 public ProjectEventForwarder(DnxContext dnxContext, MSBuildContext msbuildContext, OmnisharpWorkspace workspace, IEventEmitter emitter)
 {
     _dnxContext = dnxContext;
     _msbuildContext = msbuildContext;
     _workspace = workspace;
     _emitter = emitter;
     _workspace.WorkspaceChanged += OnWorkspaceChanged;
 }
        public DnxWorkspaceInformation(DnxContext context)
        {
            _context = context;

            Projects = context.Projects.Values.Select(p => new DnxProject(p));

            RuntimePath = context.RuntimePath;
            DesignTimeHostPort = context.DesignTimeHostPort;
        }
 public DnxTestCommandProvider(DnxContext context,
                                   IOmnisharpEnvironment env,
                                   ILoggerFactory loggerFactory,
                                   IEventEmitter emitter)
 {
     _context = context;
     var dnxPaths = new DnxPaths(env, context.Options, loggerFactory);
     _dnx = dnxPaths.Dnx != null ? dnxPaths.Dnx + " ." : dnxPaths.K;
 }
        public DnxTestCommandProvider(DnxContext context,
                                      IOmnisharpEnvironment env,
                                      ILoggerFactory loggerFactory,
                                      IEventEmitter emitter)
        {
            _context = context;
            var dnxPaths = new DnxPaths(env, context.Options, loggerFactory);

            _dnx = dnxPaths.Dnx + " .";
        }
 public PackagesRestoreTool(OmniSharpOptions options, ILoggerFactory logger, IEventEmitter emitter, DnxContext context, DnxPaths paths)
 {
     _options = options;
     _logger = logger.CreateLogger<PackagesRestoreTool>();
     _emitter = emitter;
     _context = context;
     _paths = paths;
     _lock = new object();
     _projectLocks = new Dictionary<string, object>();
     _semaphore = new SemaphoreSlim(Environment.ProcessorCount / 2);
 }
Exemplo n.º 9
0
        public DnxTestCommandProvider(DnxContext context,
                                      IOmnisharpEnvironment env,
                                      ILoggerFactory loggerFactory,
                                      IEventEmitter emitter,
                                      IOptions <OmniSharpOptions> options)
        {
            _context = context;
            var dnxPaths = new DnxPaths(env, options.Options, loggerFactory);

            _dnx = dnxPaths.Dnx != null ? dnxPaths.Dnx + " ." : dnxPaths.K;
        }
Exemplo n.º 10
0
 public PackagesRestoreTool(OmniSharpOptions options, ILoggerFactory logger, IEventEmitter emitter, DnxContext context, DotNetCorePaths paths)
 {
     _options      = options;
     _logger       = logger.CreateLogger <PackagesRestoreTool>();
     _emitter      = emitter;
     _context      = context;
     _paths        = paths;
     _lock         = new object();
     _projectLocks = new Dictionary <string, object>();
     _semaphore    = new SemaphoreSlim(GetNumConcurrentRestores());
 }
Exemplo n.º 11
0
 public PackagesRestoreTool(DnxOptions options, IEventEmitter emitter, DnxContext context, DnxPaths paths)
 {
     _options = options;
     //_logger = logger.CreateLogger<PackagesRestoreTool>();
     _emitter      = emitter;
     _context      = context;
     _paths        = paths;
     _lock         = new object();
     _projectLocks = new Dictionary <string, object>();
     _semaphore    = new SemaphoreSlim(Environment.ProcessorCount / 2);
 }
Exemplo n.º 12
0
        public DnxProjectSystem(OmnisharpWorkspace workspace,
                                IOmnisharpEnvironment env,
                                ILoggerFactory loggerFactory,
                                IMetadataFileReferenceCache metadataFileReferenceCache,
                                IApplicationLifetime lifetime,
                                IFileSystemWatcher watcher,
                                IEventEmitter emitter,
                                DnxContext context)
        {
            _workspace     = workspace;
            _env           = env;
            _loggerFactory = loggerFactory;
            _logger        = loggerFactory.CreateLogger <DnxProjectSystem>();
            _metadataFileReferenceCache = metadataFileReferenceCache;
            _context             = context;
            _watcher             = watcher;
            _emitter             = emitter;
            _directoryEnumerator = new DirectoryEnumerator(loggerFactory);

            lifetime?.ApplicationStopping.Register(OnShutdown);
        }
Exemplo n.º 13
0
        public DnxProjectSystem(OmnisharpWorkspace workspace,
                                IOmnisharpEnvironment env,
                                ILoggerFactory loggerFactory,
                                IMetadataFileReferenceCache metadataFileReferenceCache,
                                IApplicationLifetime lifetime,
                                IFileSystemWatcher watcher,
                                IEventEmitter emitter,
                                DnxContext context)
        {
            _workspace = workspace;
            _env = env;
            _loggerFactory = loggerFactory;
            _logger = loggerFactory.CreateLogger<DnxProjectSystem>();
            _metadataFileReferenceCache = metadataFileReferenceCache;
            _context = context;
            _watcher = watcher;
            _emitter = emitter;
            _directoryEnumerator = new DirectoryEnumerator(loggerFactory);

            lifetime?.ApplicationStopping.Register(OnShutdown);
        }
        public DnxProjectSystem CreateProjectSystem(
			Solution solution,
			IApplicationLifetime appLifetime,
			DnxContext context)
        {
            var workspace = new OmnisharpWorkspace ();
            var env = new OmnisharpEnvironment (solution.BaseDirectory);
            var options = new OmniSharpOptionsWrapper ();
            var loggerFactory = new LoggerFactory ();
            var cache = new MetadataFileReferenceCache ();
            var emitter = new EventEmitter ();
            var watcher = new FileSystemWatcherWrapper (env);

            return new DnxProjectSystem (
                workspace,
                env,
                options,
                loggerFactory,
                cache,
                appLifetime,
                watcher,
                emitter,
                context);
        }
        internal void LoadAspNetProjectSystem(Solution solution)
        {
            UnloadProjectSystem ();

            applicationLifetime = new MonoDevelopApplicationLifetime ();
            context = new DnxContext ();
            var factory = new AspNet5ProjectSystemFactory ();
            projectSystem = factory.CreateProjectSystem (solution, applicationLifetime, context);
            projectSystem.Initalize ();
        }
        private async Task<string> GetTestCommandArgumentsAsync(string source, TestCommandType testType = TestCommandType.Single)
        {
            var workspace = TestHelpers.CreateSimpleWorkspace(source);
            var context = new DnxContext();
            var projectName = "project.json";
            var projectCounter = 1;

            context.ProjectContextMapping.Add(projectName, projectCounter);
            context.Projects.Add(projectCounter, new Project
            {
                Path = "project.json",
                Commands = { { "test", "Xunit.KRunner" } }
            });

            var testCommandProviders = new[] { new DnxTestCommandProvider(context, new FakeEnvironment(), new FakeLoggerFactory(), new NullEventEmitter(), new FakeOmniSharpOptions()) };
            var controller = new TestCommandController(workspace, testCommandProviders);
            var lineColumn = TestHelpers.GetLineAndColumnFromDollar(source);

            var request = new TestCommandRequest
            {
                Line = lineColumn.Line,
                Column = lineColumn.Column,
                FileName = "dummy.cs",
                Buffer = source.Replace("$", ""),
                Type = testType
            };

            var bufferFilter = new UpdateBufferFilter(workspace);
            bufferFilter.OnActionExecuting(TestHelpers.CreateActionExecutingContext(request, controller));
            var testCommand = await controller.GetTestCommand(request);
            return testCommand.TestCommand;
        }
 public CurrentProjectFacts()
 {
     _context = new DnxContext();
     _workspace = new OmnisharpWorkspace();
 }
 public CurrentProjectFacts()
 {
     _workspace = new OmnisharpWorkspace(new HostServicesBuilder(Enumerable.Empty<ICodeActionProvider>()));
     _context = new DnxContext();
     _projectSystem = new DnxProjectSystem(_workspace, null, new FakeLoggerFactory(), null, null, null, null, _context);
 }
        void LoadDnxProjectSystem(Solution solution)
        {
            UnloadProjectSystem ();

            applicationLifetime = new MonoDevelopApplicationLifetime ();
            context = new DnxContext ();
            var factory = new DnxProjectSystemFactory ();
            projectSystem = factory.CreateProjectSystem (solution, applicationLifetime, context);
            projectSystem.Initalize ();

            if (context.RuntimePath == null) {
                string error = GetRuntimeError (projectSystem);
                throw new ApplicationException (error);
            }
        }
 void UnloadProjectSystem()
 {
     initializeError = String.Empty;
     if (applicationLifetime != null) {
         applicationLifetime.Stopping ();
         applicationLifetime.Dispose ();
         applicationLifetime = null;
         if (projectSystem != null) {
             projectSystem.Dispose ();
             projectSystem = null;
         }
         context = null;
     }
 }
 void UnloadProjectSystem()
 {
     if (applicationLifetime != null) {
         applicationLifetime.Stopping ();
         applicationLifetime.Dispose ();
         applicationLifetime = null;
         projectSystem.Dispose ();
         projectSystem = null;
         context = null;
     }
 }
 public AspNetProjectLocator(DnxContext context)
 {
     this.context = context;
 }
 public AspNetProjectReferenceMaintainer(DnxContext context)
 {
     this.context = context;
 }
 public DnxProjectLocator(DnxContext context)
 {
     this.context = context;
 }