Example #1
0
        private static void InitiateExecutors()
        {
            var compiler = WebEditor.Host.ExportProvider.GetExport <ProjectCompiler>();

            ThreadingTask.Task.Run(async() =>
            {
                Parallel.ForEach(
                    Mef.GetSupportedContentTypes <ICompilerRunnerProvider>()
                    .Where(c => WESettings.Instance.ForContentType <ICompilerInvocationSettings>(c).CompileOnBuild),
                    c => compiler.Value.CompileSolutionAsync(c).DoNotWait("compiling solution-wide " + c.DisplayName)
                    );

                await BuildMenu.UpdateBundleFiles();
            }).DoNotWait("running solution-wide compilers");

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

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

            if (WESettings.Instance.CoffeeScript.LintOnBuild)
            {
                LintFileInvoker.RunOnAllFilesInProjectAsync(new[] { "*.coffee", "*.iced" }, f => new LintReporter(new CoffeeLintCompiler(), WESettings.Instance.CoffeeScript, f))
                .DoNotWait("running solution-wide CoffeeLint");
            }
        }
Example #2
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 #3
0
        private static void InitiateExecutors()
        {
            var compiler = WebEditor.Host.ExportProvider.GetExport <ProjectCompiler>();

            Task.Run(() =>
            {
                Parallel.ForEach(
                    Mef.GetSupportedContentTypes <ICompilerRunnerProvider>()
                    .Where(c => { var settings = WESettings.Instance.ForContentType <ICompilerInvocationSettings>(c); return(settings != null && settings.CompileOnBuild); }),
                    c => compiler.Value.CompileSolutionAsync(c).DoNotWait("compiling solution-wide " + c.DisplayName)
                    );
            }).DoNotWait("running solution-wide compilers");

            RunLinters();
            RunBundles();
        }