Пример #1
0
        int IVsSolutionEvents.OnAfterOpenSolution(object pUnkReserved, int fNewSolution)
        {
            var port = Network.freeTcpPort();

            Logger.LogInfo("Package: Selected {0} as the port for Engine server.", port);
            TddStud10Host = new TddStud10HostProxy(port, FSharpOption <bool> .None);
            TddStud10Host.Start();

            var cfg = EngineConfigLoader.load(new EngineConfig(), FilePath.NewFilePath(GetSolutionPath()));

            EngineLoader.Load(
                this,
                new EngineParams(
                    HostVersion,
                    cfg,
                    FilePath.NewFilePath(GetSolutionPath()),
                    DateTime.UtcNow
                    ));

            if (!cfg.IsDisabled)
            {
                EngineLoader.EnableEngine();
            }
            else
            {
                TelemetryClient.TrackEvent("EngineDisabledOnLoad", new Dictionary <string, string>(), new Dictionary <string, double>());
            }

            Logger.LogInfo("Triggering SnapshotGC on solution load.");
            SnapshotGC.SweepAsync(FilePath.NewFilePath(Environment.ExpandEnvironmentVariables(cfg.SnapShotRoot)));

            return(VSConstants.S_OK);
        }
Пример #2
0
        private static RunStepResult TakeSolutionSnapshot(IRunExecutorHost host, RunStartParams rsp, RunStepInfo rsi)
        {
            var solutionGrandParentPath = Path.GetDirectoryName(Path.GetDirectoryName(rsp.Solution.Path.Item));
            var projects = VsSolution.GetProjects(host.HostVersion, rsp.Solution.Path.Item).ToList();

            var toCopy = new List <Tuple <string, SearchOption> >
            {
                new Tuple <string, SearchOption>(Path.GetDirectoryName(rsp.Solution.Path.Item), SearchOption.TopDirectoryOnly),
            };

            Array.ForEach(rsp.Config.SnapshotIncludeFolders,
                          item =>
            {
                toCopy.Add(new Tuple <string, SearchOption>(Path.Combine(Path.GetDirectoryName(rsp.Solution.Path.Item), item), SearchOption.AllDirectories));
            });

            projects.ForEach(p =>
            {
                var projectFile = Path.Combine(Path.GetDirectoryName(rsp.Solution.Path.Item), p.RelativePath);
                var folder      = Path.GetDirectoryName(projectFile);
                toCopy.Add(new Tuple <string, SearchOption>(folder, SearchOption.AllDirectories));
            });

            toCopy.ForEach(item =>
            {
                if (!host.CanContinue())
                {
                    throw new OperationCanceledException();
                }

                CopyFiles(rsp, solutionGrandParentPath, item.Item1, item.Item2);
            });

            SnapshotGC.mark(FilePath.NewFilePath(Path.GetDirectoryName(rsp.Solution.SnapshotPath.Item)));

            TelemetryClient.TrackEvent(rsi.name.Item, new Dictionary <string, string>(), new Dictionary <string, double> {
                { "ProjectCount", projects.Count }
            });

            return(RunStepStatus.Succeeded.ToRSR(RunData.NoData, "What was done - TBD"));
        }