Example #1
0
        private void BuildEvents_OnBuildDone(vsBuildScope Scope, vsBuildAction Action)
        {
            bool success = _dte.Solution.SolutionBuild.LastBuildInfo == 0;

            if (!success)
            {
                string text = _dte.StatusBar.Text; // respect localization of "Build failed"
                Dispatcher.CurrentDispatcher.BeginInvoke(new Action(() =>
                {
                    _dte.StatusBar.Text = text;
                }), DispatcherPriority.ApplicationIdle, null);

                return;
            }

            if (Action != vsBuildAction.vsBuildActionClean)
            {
                var compiler = WebEditor.Host.ExportProvider.GetExport <ProjectCompiler>();
                ThreadingTask.Task.Run(() =>
                {
                    Parallel.ForEach(
                        Mef.GetSupportedContentTypes <ICompilerRunnerProvider>()
                        .Where(c => WESettings.Instance.ForContentType <ICompilerInvocationSettings>(c).CompileOnBuild),
                        c => compiler.Value.CompileSolutionAsync(c).DontWait("compiling solution-wide " + c.DisplayName)
                        );
                    BuildMenu.UpdateBundleFiles();
                }).DontWait("running solution-wide compilers");

                if (WESettings.Instance.JavaScript.LintOnBuild)
                {
                    LintFileInvoker.RunOnAllFilesInProjectAsync(new[] { "*.js" }, f => new JavaScriptLintReporter(new JsHintCompiler(), f))
                    .DontWait("running solution-wide JSHint");
                    LintFileInvoker.RunOnAllFilesInProjectAsync(new[] { "*.js" }, f => new JavaScriptLintReporter(new JsCodeStyleCompiler(), f))
                    .DontWait("running solution-wide JSCS");
                }

                if (WESettings.Instance.TypeScript.LintOnBuild)
                {
                    LintFileInvoker.RunOnAllFilesInProjectAsync(new[] { "*.ts" }, f => new LintReporter(new TsLintCompiler(), WESettings.Instance.TypeScript, f))
                    .DontWait("running solution-wide TSLint");
                }

                if (WESettings.Instance.CoffeeScript.LintOnBuild)
                {
                    LintFileInvoker.RunOnAllFilesInProjectAsync(new[] { "*.coffee", "*.iced" }, f => new LintReporter(new CoffeeLintCompiler(), WESettings.Instance.CoffeeScript, f))
                    .DontWait("running solution-wide CoffeeLint");
                }
            }
            else if (Action == vsBuildAction.vsBuildActionClean)
            {
                LintReporter.Reset();
            }
        }
Example #2
0
        private void BuildEvents_OnBuildDone(vsBuildScope Scope, vsBuildAction Action)
        {
            if (_dte.Solution.SolutionBuild.LastBuildInfo != 0)
            {
                string text = _dte.StatusBar.Text; // respect localization of "Build failed"
                Dispatcher.CurrentDispatcher.BeginInvoke(new Action(() =>
                {
                    _dte.StatusBar.Text = text;
                }), DispatcherPriority.ApplicationIdle, null);

                return;
            }

            if (Action == vsBuildAction.vsBuildActionClean)
            {
                LintReporter.Reset();
                return;
            }

            InitiateExecutors();
        }