public async Task<BuildResult> RunTarget (ProgressMonitor monitor, string target, ConfigurationSelector configuration)
		{
			switch (target)
			{
			case "Build":
				return await OnBuild (monitor, configuration);
			case "Clean":
				return await OnClean (monitor, configuration);
			}
			return new BuildResult (new CompilerResults (null), "");
		}
		public virtual BuildResult RunTarget (IProgressMonitor monitor, string target, ConfigurationSelector configuration)
		{
			switch (target)
			{
			case "Build":
				return OnBuild (monitor, configuration);
			case "Clean":
				return OnClean (monitor, configuration);
			}
			return new BuildResult (new CompilerResults (null), "");
		}
		protected override BuildResult OnClean (IProgressMonitor monitor, ConfigurationSelector configuration)
		{
			DotNetProject project = Project;
			DotNetProjectConfiguration conf = (DotNetProjectConfiguration) project.GetConfiguration (configuration);
			
			// Delete the generated debug info
			string file = project.GetOutputFileName (configuration);
			if (file != null) {
				string mdb = conf.TargetRuntime.GetAssemblyDebugInfoFile (file);
				if (File.Exists (mdb))
					FileService.DeleteFile (mdb);
			}

			List<string> cultures = new List<string> ();
			monitor.Log.WriteLine (GettextCatalog.GetString ("Removing all .resources files"));
			foreach (ProjectFile pfile in project.Files) {
				if (pfile.BuildAction == BuildAction.EmbeddedResource &&
					Path.GetExtension (pfile.Name) == ".resx") {
					string resFilename = Path.ChangeExtension (pfile.Name, ".resources");
					if (File.Exists (resFilename))
						FileService.DeleteFile (resFilename);
				}
				string culture = GetCulture (pfile.Name);
				if (culture != null)
					cultures.Add (culture);
			}

			if (cultures.Count > 0 && conf != null && project.DefaultNamespace != null) {
				monitor.Log.WriteLine (GettextCatalog.GetString ("Removing all satellite assemblies"));
				string outputDir = ((DotNetProjectConfiguration)conf).OutputDirectory;
				string satelliteAsmName = Path.GetFileNameWithoutExtension (((DotNetProjectConfiguration)conf).OutputAssembly) + ".resources.dll";

				foreach (string culture in cultures) {
					string path = String.Format ("{0}{3}{1}{3}{2}", outputDir, culture, satelliteAsmName, Path.DirectorySeparatorChar);
					if (File.Exists (path)) {
						FileService.DeleteFile (path);
						string dir = Path.GetDirectoryName (path);
						if (Directory.GetFiles (dir).Length == 0)
							FileService.DeleteDirectory (dir);
					}
				}
			}
			return null;
		}
        public async Task<Project> GetShadowProject (ProtobuildStandardDefinition protobuildDefinition, ProgressMonitor monitor,
	        ConfigurationSelector configuration)
	    {
            var platform = configuration.GetConfiguration(this).Id;
            await EnsureProjectsAreGeneratedForPlatform(platform, monitor);

            var solution = shadowSolutions[platform];
            return (Project)solution.Items.OfType<Project>().FirstOrDefault(x => x.BaseDirectory == protobuildDefinition.ProjectDirectory);
	    }
	    protected override BuildResult OnBuild (IProgressMonitor monitor, ConfigurationSelector configuration)
        {
            var platform = configuration.GetConfiguration(this).Id;
	        EnsureProjectsAreGeneratedForPlatform (platform, monitor);

	        var solution = shadowSolutions[platform];
			var result = solution.RootFolder.Build (monitor, configuration);
			if (Built != null)
			{
				Built(this, new SolutionItemEventArgs(null, this));
			}
			return result;
        }
            protected override async Task <ProjectFile []> OnGetSourceFiles(ProgressMonitor monitor, ConfigurationSelector configuration)
            {
                var files = await base.OnGetSourceFiles(monitor, configuration);

                if (!notifiedReferencesChanged)
                {
                    await Task.Run(async() => {
                        await Runtime.RunInMainThread(() => {
                            notifiedReferencesChanged = true;
                            NotifyModified("References");
                        });
                    });
                }
                return(files);
            }
示例#7
0
 protected override void DoClean(IProgressMonitor monitor, ConfigurationSelector configuration)
 {
     base.DoClean(monitor, configuration);
 }
示例#8
0
 protected override BuildResult DoBuild(IProgressMonitor monitor, ConfigurationSelector configuration)
 {
     return(DubBuilder.BuildProject(this, monitor, configuration));
 }
示例#9
0
        public void Install(IProgressMonitor monitor, SolutionItem entry, string appName, string prefix, ConfigurationSelector configuration)
        {
            this.appName = appName;

            using (DeployContext ctx = new DeployContext(this, DeployService.CurrentPlatform, prefix))
            {
                InstallEntry(monitor, ctx, entry, configuration);
            }
        }
		protected override Task<BuildResult> OnBuild (MonoDevelop.Core.ProgressMonitor monitor, ConfigurationSelector configuration, OperationContext operationContext)
		{
			return Task.FromResult (BuildResult.CreateSuccess ());
		}
示例#11
0
        protected override void PopulateSupportFileList(MonoDevelop.Projects.FileCopySet list, ConfigurationSelector solutionConfiguration)
        {
            base.PopulateSupportFileList(list, solutionConfiguration);

            //HACK: workaround for MD not local-copying package references
            foreach (ProjectReference projectReference in References)
            {
                if (projectReference.Package != null && projectReference.Package.Name == "system.web.mvc")
                {
                    if (projectReference.ReferenceType == ReferenceType.Package)
                    {
                        foreach (MonoDevelop.Core.Assemblies.SystemAssembly assem in projectReference.Package.Assemblies)
                        {
                            list.Add(assem.Location);
                        }
                    }
                    break;
                }
            }
        }
 public BuildResult Compile(ProjectItemCollection projectItems, DotNetProjectConfiguration configuration, ConfigurationSelector configSelector, IProgressMonitor monitor)
 {
     return(CSharpBindingCompilerManager.Compile(projectItems, configuration, configSelector, monitor));
 }
示例#13
0
 public PackageReferenceNuGetProject(DotNetProject project, ConfigurationSelector configuration)
     : this(project, configuration, PackageManagementServices.PackageManagementEvents)
 {
 }
示例#14
0
        protected override void DoExecute(IProgressMonitor monitor, ExecutionContext context, ConfigurationSelector configuration)
        {
            if (!CheckCanExecute(configuration))
            {
                return;
            }

            var      config  = (PythonConfiguration)GetConfiguration(configuration);
            IConsole console = config.ExternalConsole ?
                               context.ExternalConsoleFactory.CreateConsole(!config.PauseConsoleOutput) :
                               context.ConsoleFactory.CreateConsole(!config.PauseConsoleOutput);

            var aggregatedMonitor = new AggregatedOperationMonitor(monitor);

            try {
                var executionCommand = CreateExecutionCommand(configuration, config);
                if (!context.ExecutionHandler.CanExecute(executionCommand))
                {
                    monitor.ReportError(GettextCatalog.GetString("Cannot execute application. The selected execution mode " +
                                                                 "is not supported for IronPython projects"), null);
                    return;
                }

                var asyncOp = context.ExecutionHandler.Execute(executionCommand, console);
                aggregatedMonitor.AddOperation(asyncOp);
                asyncOp.WaitForCompleted();

                monitor.Log.WriteLine("The application exited with code: " + asyncOp.ExitCode);
            } catch (Exception exc) {
                monitor.ReportError(GettextCatalog.GetString("Cannot execute \"{0}\"", config.MainModule), exc);
            } finally {
                console.Dispose();
                aggregatedMonitor.Dispose();
            }
        }
示例#15
0
        protected override void DoExecute(IProgressMonitor monitor, ExecutionContext context, ConfigurationSelector configuration)
        {
            var conf = GetConfiguration(configuration) as DProjectConfiguration;

            if (conf == null)
            {
                return;
            }

            bool     pause = conf.PauseConsoleOutput;
            IConsole console;

            if (CompileTarget != DCompileTarget.Executable)
            {
                MessageService.ShowMessage("Compile target is not an executable!");
                return;
            }

            monitor.Log.WriteLine("Running project...");

            if (conf.ExternalConsole)
            {
                console = context.ExternalConsoleFactory.CreateConsole(!pause);
            }
            else
            {
                console = context.ConsoleFactory.CreateConsole(!pause);
            }

            var operationMonitor = new AggregatedOperationMonitor(monitor);

            try
            {
                var cmd = CreateExecutionCommand(conf);
                if (!context.ExecutionHandler.CanExecute(cmd))
                {
                    monitor.ReportError("Cannot execute \"" + conf.Output + "\". The selected execution mode is not supported for D projects.", null);
                    return;
                }

                var op = context.ExecutionHandler.Execute(cmd, console);

                operationMonitor.AddOperation(op);
                op.WaitForCompleted();

                monitor.Log.WriteLine("The operation exited with code: {0}", op.ExitCode);
            }
            catch (Exception ex)
            {
                monitor.ReportError("Cannot execute \"" + conf.Output + "\"", ex);
            }
            finally
            {
                operationMonitor.Dispose();
                console.Dispose();
            }
        }
示例#16
0
        protected override BuildResult DoBuild(IProgressMonitor monitor, ConfigurationSelector configuration)
        {
            var cfg = GetConfiguration(configuration) as DProjectConfiguration;

            return(DCompiler.Compile(this, Files, cfg, monitor));
        }
示例#17
0
        public override FilePath GetOutputFileName(ConfigurationSelector configuration)
        {
            var cfg = GetConfiguration(configuration) as DProjectConfiguration;

            return(cfg.OutputDirectory.Combine(cfg.CompiledOutputName));
        }
		protected virtual Task<BuildResult> OnClean (ProgressMonitor monitor, ConfigurationSelector configuration)
		{
			return Task.FromResult (BuildResult.CreateSuccess ());
		}
示例#19
0
        protected override void DoExecute(IProgressMonitor monitor, ExecutionContext context, ConfigurationSelector configuration)
        {
            if (!CheckCanExecute(configuration))
            {
                return;
            }

            var      config  = (LuaConfiguration)GetConfiguration(configuration);
            IConsole console = config.ExternalConsole ?
                               context.ExternalConsoleFactory.CreateConsole(!config.PauseConsoleOutput) :
                               context.ConsoleFactory.CreateConsole(!config.PauseConsoleOutput);

            var aggregatedMonitor = new AggregatedOperationMonitor(monitor);

            try
            {
                string param = string.Format("\"{0}\" {1}", config.MainFile, config.CommandLineParameters);

                IProcessAsyncOperation op =
                    Runtime.ProcessService.StartConsoleProcess(GetLuaPath(config.LangVersion),
                                                               param, BaseDirectory,
                                                               config.EnvironmentVariables, console, null);

                monitor.CancelRequested += delegate {
                    op.Cancel();
                };

                aggregatedMonitor.AddOperation(op);
                op.WaitForCompleted();
                monitor.Log.WriteLine("The application exited with code: " + op.ExitCode);

                /*
                 * var executionCommand = //CreateExecutionCommand( configuration, config );
                 *      new NativeExecutionCommand( GetLuaPath( config.LangVersion ),
                 *                                 config.CommandLineParameters,
                 *                                 BaseDirectory );
                 *
                 *
                 * if( !context.ExecutionHandler.CanExecute( executionCommand ) )
                 * {
                 *      monitor.ReportError( GettextCatalog.GetString( "Cannot execute application. The selected execution mode " +
                 *      "is not supported for Lua projects" ), null );
                 *      return;
                 * }
                 *
                 * IProcessAsyncOperation asyncOp = context.ExecutionHandler.Execute( executionCommand, console );
                 * aggregatedMonitor.AddOperation( asyncOp );
                 * asyncOp.WaitForCompleted();
                 *
                 * monitor.Log.WriteLine( "The application exited with code: " + asyncOp.ExitCode );
                 */
            }
            catch (Exception exc)
            {
                monitor.ReportError(GettextCatalog.GetString("Cannot execute \"{0}\"", config.MainFile), exc);
            }
            finally
            {
                console.Dispose();
                aggregatedMonitor.Dispose();
            }
        }
示例#20
0
 protected override void SaveResults(ICoverageResults results, Project testProject, ConfigurationSelector configuration)
 {
     progress.Report(new Log("Saving coverage results...", LogLevel.Info));
     base.SaveResults(results, testProject, configuration);
     FinishedGatheringCoveage();
 }
示例#21
0
		protected override BuildResult OnBuild (MonoDevelop.Core.IProgressMonitor monitor, ConfigurationSelector configuration)
		{
			return new BuildResult ();
		}
示例#22
0
        public override DeployFileCollection GetProjectDeployFiles(DeployContext ctx, Project project, ConfigurationSelector config)
        {
            DeployFileCollection col = base.GetProjectDeployFiles(ctx, project, config);

            LinuxDeployData data = LinuxDeployData.GetLinuxDeployData(project);

            if (ctx.Platform == "Linux")
            {
                DotNetProject netProject = project as DotNetProject;
                if (netProject != null)
                {
                    DotNetProjectConfiguration conf = netProject.GetConfiguration(config) as DotNetProjectConfiguration;
                    if (conf != null)
                    {
                        if (conf.CompileTarget == CompileTarget.Exe || conf.CompileTarget == CompileTarget.WinExe)
                        {
                            if (data.GenerateScript)
                            {
                                col.Add(GenerateLaunchScript(ctx, netProject, data, conf));
                            }
                        }
                        if (conf.CompileTarget == CompileTarget.Library || conf.CompiledOutputName.FileName.EndsWith(".dll"))
                        {
                            if (data.GeneratePcFile)
                            {
                                col.Add(GeneratePcFile(ctx, netProject, data, conf));
                            }
                        }
                    }
                }
            }

            // If the project is deploying an app.desktop file, rename it to the name of the project.
            foreach (DeployFile file in col)
            {
                if (Path.GetFileName(file.RelativeTargetPath) == "app.desktop")
                {
                    string dir = Path.GetDirectoryName(file.RelativeTargetPath);
                    file.RelativeTargetPath = Path.Combine(dir, data.PackageName + ".desktop");
                }
            }

            return(col);
        }
示例#23
0
 protected override void PopulateOutputFileList(List <FilePath> list, ConfigurationSelector configuration)
 {
     base.PopulateOutputFileList(list, configuration);
 }
示例#24
0
 protected override ExecutionCommand OnCreateExecutionCommand(ConfigurationSelector configSel, DotNetProjectConfiguration configuration, ProjectRunConfiguration runConfiguration)
 {
     return(CreateDotNetCoreExecutionCommand(configSel, configuration, runConfiguration));
 }
示例#25
0
 protected override void DoExecute(IProgressMonitor monitor, ExecutionContext context, ConfigurationSelector configuration)
 {
     DubBuilder.ExecuteProject(this, monitor, context, configuration);
 }
示例#26
0
        protected override Task OnExecute(ProgressMonitor monitor, ExecutionContext context, ConfigurationSelector configuration, SolutionItemRunConfiguration runConfiguration)
        {
            if (DotNetCoreRuntime.IsMissing)
            {
                return(ShowCannotExecuteDotNetCoreApplicationDialog());
            }

            return(base.OnExecute(monitor, context, configuration, runConfiguration));
        }
        protected override BuildResult OnBuild(IProgressMonitor monitor, ConfigurationSelector configuration)
        {
            DotNetProject project = Project;

            if (!project.TargetRuntime.IsInstalled(project.TargetFramework))
            {
                BuildResult res = new BuildResult();
                res.AddError(GettextCatalog.GetString("Framework '{0}' not installed.", project.TargetFramework.Name));
                return(res);
            }

            bool hasBuildableFiles = false;

            foreach (ProjectFile pf in project.Files)
            {
                if (pf.BuildAction == BuildAction.Compile || pf.BuildAction == BuildAction.EmbeddedResource)
                {
                    hasBuildableFiles = true;
                    break;
                }
            }
            if (!hasBuildableFiles)
            {
                return(new BuildResult());
            }

            if (project.LanguageBinding == null)
            {
                BuildResult langres = new BuildResult();
                string      msg     = GettextCatalog.GetString("Unknown language '{0}'. You may need to install an additional add-in to support this language.", project.LanguageName);
                langres.AddError(msg);
                monitor.ReportError(msg, null);
                return(langres);
            }

            BuildResult           refres         = null;
            HashSet <ProjectItem> itemsToExclude = new HashSet <ProjectItem> ();

            foreach (ProjectReference pr in project.References)
            {
                if (pr.ReferenceType == ReferenceType.Project)
                {
                    // Ignore non-dotnet projects
                    Project p = project.ParentSolution != null?project.ParentSolution.FindProjectByName(pr.Reference) : null;

                    if (p != null && !(p is DotNetProject))
                    {
                        continue;
                    }

                    if (p == null || pr.GetReferencedFileNames(configuration).Length == 0)
                    {
                        if (refres == null)
                        {
                            refres = new BuildResult();
                        }
                        string msg = GettextCatalog.GetString("Referenced project '{0}' not found in the solution.", pr.Reference);
                        monitor.ReportWarning(msg);
                        refres.AddWarning(msg);
                    }
                }

                if (!pr.IsValid)
                {
                    if (refres == null)
                    {
                        refres = new BuildResult();
                    }
                    string msg;
                    if (!pr.IsExactVersion && pr.SpecificVersion)
                    {
                        msg = GettextCatalog.GetString("Reference '{0}' not found on system. Using '{1}' instead.", pr.StoredReference, pr.Reference);
                        monitor.ReportWarning(msg);
                        refres.AddWarning(msg);
                    }
                    else
                    {
                        bool errorsFound = false;
                        foreach (string asm in pr.GetReferencedFileNames(configuration))
                        {
                            if (!File.Exists(asm))
                            {
                                msg = GettextCatalog.GetString("Assembly '{0}' not found. Make sure that the assembly exists in disk. If the reference is required to build the project you may get compilation errors.", Path.GetFileName(asm));
                                refres.AddWarning(msg);
                                monitor.ReportWarning(msg);
                                errorsFound = true;
                                itemsToExclude.Add(pr);
                            }
                        }
                        msg = null;
                        if (!errorsFound)
                        {
                            msg = GettextCatalog.GetString("The reference '{0}' is not valid for the target framework of the project.", pr.StoredReference, pr.Reference);
                            monitor.ReportWarning(msg);
                            refres.AddWarning(msg);
                            itemsToExclude.Add(pr);
                        }
                    }
                }
            }

            DotNetProjectConfiguration conf = (DotNetProjectConfiguration)project.GetConfiguration(configuration);

            // Create a copy of the data needed to compile the project.
            // This data can be modified by extensions.
            // Also filter out items whose condition evaluates to false

            BuildData            buildData = new BuildData();
            ProjectParserContext ctx       = new ProjectParserContext(project, conf);

            buildData.Items = new ProjectItemCollection();
            foreach (ProjectItem item in project.Items)
            {
                if (!itemsToExclude.Contains(item) && (string.IsNullOrEmpty(item.Condition) || ConditionParser.ParseAndEvaluate(item.Condition, ctx)))
                {
                    buildData.Items.Add(item);
                }
            }
            buildData.Configuration = (DotNetProjectConfiguration)conf.Clone();
            buildData.Configuration.SetParentItem(project);
            buildData.ConfigurationSelector = configuration;

            return(ProjectExtensionUtil.Compile(monitor, project, buildData, delegate {
                ProjectItemCollection items = buildData.Items;
                BuildResult res = BuildResources(buildData.Configuration, ref items, monitor);
                if (res != null)
                {
                    return res;
                }

                res = project.LanguageBinding.Compile(items, buildData.Configuration, buildData.ConfigurationSelector, monitor);
                if (refres != null)
                {
                    refres.Append(res);
                    return refres;
                }
                else
                {
                    return res;
                }
            }));
        }
示例#28
0
        protected override async Task OnExecuteCommand(ProgressMonitor monitor, ExecutionContext context, ConfigurationSelector configuration, ExecutionCommand executionCommand)
        {
            bool externalConsole = false;
            bool pauseConsole    = false;

            var dotNetCoreExecutionCommand = executionCommand as DotNetCoreExecutionCommand;

            if (dotNetCoreExecutionCommand != null)
            {
                externalConsole = dotNetCoreExecutionCommand.ExternalConsole;
                pauseConsole    = dotNetCoreExecutionCommand.PauseConsoleOutput;
            }

            OperationConsole console = externalConsole ? context.ExternalConsoleFactory.CreateConsole(!pauseConsole, monitor.CancellationToken)
                                : context.ConsoleFactory.CreateConsole(OperationConsoleFactory.CreateConsoleOptions.Default.WithTitle(Project.Name), monitor.CancellationToken);

            using (console) {
                ProcessAsyncOperation asyncOp = context.ExecutionHandler.Execute(executionCommand, console);

                try {
                    using (var stopper = monitor.CancellationToken.Register(asyncOp.Cancel))
                        await asyncOp.Task;

                    monitor.Log.WriteLine(GettextCatalog.GetString("The application exited with code: {0}", asyncOp.ExitCode));
                } catch (OperationCanceledException) {
                }
            }
        }
            protected internal async override Task <List <AssemblyReference> > OnGetReferencedAssemblies(ConfigurationSelector configuration)
            {
                var refs = await base.OnGetReferencedAssemblies(configuration);

                if (notifiedReferencesChanged)
                {
                    refs.AddRange(extraReferences);
                }
                return(refs);
            }
示例#30
0
        protected override async Task <ProjectFile[]> OnGetSourceFiles(ProgressMonitor monitor, ConfigurationSelector configuration)
        {
            var sourceFiles = await base.OnGetSourceFiles(monitor, configuration);

            return(AddMissingProjectFiles(sourceFiles));
        }
	    public async Task Generate (ProgressMonitor monitor, ConfigurationSelector configuration)
        {
            var platform = configuration.GetConfiguration(this).Id;
			await EnsureProjectsAreGeneratedForPlatform(platform, monitor);
			if (Generated != null)
			{
				try
				{
					Generated(this, new SolutionItemEventArgs(null, this));
				}
				catch (Exception ex)
				{
					Console.Error.WriteLine("An exception occurred while notifying that generation was complete " + ex);
					//monitor.ReportError("An exception occurred while notifying that generation was complete", ex);
				}
			}
	    }
示例#32
0
 public AspNetAppProjectConfiguration GetConfiguration(ConfigurationSelector configuration)
 {
     return((AspNetAppProjectConfiguration)Project.GetConfiguration(configuration));
 }
 public BuildResult RunTarget(IProgressMonitor monitor, string target, ConfigurationSelector configuration)
 {
     throw new NotSupportedException();
 }
		protected virtual BuildResult OnClean (IProgressMonitor monitor, ConfigurationSelector configuration)
		{
			return null;
		}
示例#35
0
        protected override bool OnGetCanExecute(ExecutionContext context, ConfigurationSelector configuration, SolutionItemRunConfiguration runConfiguration)
        {
            var cmd = CreateExecutionCommand(configuration, GetConfiguration(configuration));

            return(context.ExecutionHandler.CanExecute(cmd));
        }
示例#36
0
        void InstallEntry(IProgressMonitor monitor, DeployContext ctx, SolutionItem entry, ConfigurationSelector configuration)
        {
            foreach (DeployFile df in DeployService.GetDeployFiles(ctx, new SolutionItem[] { entry }, configuration))
            {
                string targetPath = df.ResolvedTargetFile;
                if (targetPath == null)
                {
                    monitor.ReportWarning("Could not copy file '" + df.RelativeTargetPath + "': Unknown target directory.");
                    continue;
                }

                CopyFile(monitor, df.SourcePath, df.ResolvedTargetFile, df.FileAttributes);
            }

            SolutionFolder c = entry as SolutionFolder;

            if (c != null)
            {
                monitor.BeginTask("Installing solution '" + c.Name + "'", c.Items.Count);
                foreach (SolutionItem ce in c.Items)
                {
                    InstallEntry(monitor, ctx, ce, configuration);
                    monitor.Step(1);
                }
                monitor.EndTask();
            }
        }
示例#37
0
        protected async override Task OnExecute(ProgressMonitor monitor, ExecutionContext context, ConfigurationSelector configuration, SolutionItemRunConfiguration runConfiguration)
        {
            //check XSP is available

            var cfg = GetConfiguration(configuration);
            var cmd = CreateExecutionCommand(configuration, cfg);
            var browserExcTarget = context.ExecutionTarget as BrowserExecutionTarget;

            OperationConsole console = null;

            bool isXsp = true;             //FIXME: fix this when it might not be true - should delegate to the ExecutionHandler

            try {
                //HACK: check XSP exists first, because error UX is cleaner w/o displaying a blank console pad.
                if (isXsp)
                {
                    try {
                        AspNetExecutionHandler.GetXspPath((AspNetExecutionCommand)cmd);
                    } catch (UserException ex) {
                        MessageService.ShowError(
                            GettextCatalog.GetString("Could not launch ASP.NET web server"),
                            ex.Message);
                        throw;
                    }
                }

                console = context.ConsoleFactory.CreateConsole(monitor.CancellationToken);

                // The running Port value is now captured in the XspBrowserLauncherConsole object
                string url = String.Format("http://{0}", XspParameters.Address);


                if (isXsp)
                {
                    console = new XspBrowserLauncherConsole(console, delegate(string port) {
                        if (browserExcTarget != null)
                        {
                            browserExcTarget.DesktopApp.Launch(String.Format("{0}:{1}", url, port));
                        }
                        else
                        {
                            BrowserLauncher.LaunchDefaultBrowser(String.Format("{0}:{1}", url, port));
                        }
                    });
                }

                monitor.Log.WriteLine(GettextCatalog.GetString("Running web server..."));

                var op = context.ExecutionHandler.Execute(cmd, console);

                if (!isXsp)
                {
                    if (browserExcTarget != null)
                    {
                        browserExcTarget.DesktopApp.Launch(url);
                    }
                    else
                    {
                        BrowserLauncher.LaunchDefaultBrowser(url);
                    }
                }

                using (monitor.CancellationToken.Register(op.Cancel))
                    await op.Task;

                monitor.Log.WriteLine(GettextCatalog.GetString("The web server exited with code: {0}", op.ExitCode));
            } catch (Exception ex) {
                if (!(ex is UserException))
                {
                    LoggingService.LogError("Could not launch ASP.NET web server.", ex);
                }
                monitor.ReportError(GettextCatalog.GetString("Could not launch web server."), ex);
            } finally {
                if (console != null)
                {
                    console.Dispose();
                }
            }
        }
示例#38
0
 public DotNetCoreNuGetProject(DotNetProject project, ConfigurationSelector configuration)
     : this(project, project.GetDotNetCoreTargetFrameworks(), configuration)
 {
 }
		protected override BuildResult OnBuild (IProgressMonitor monitor, ConfigurationSelector configuration)
		{
			DotNetProject project = Project;
			
			bool hasBuildableFiles = false;
			foreach (ProjectFile pf in project.Files) {
				if (pf.BuildAction == BuildAction.Compile || pf.BuildAction == BuildAction.EmbeddedResource) {
					hasBuildableFiles = true;
					break;
				}
			}
			if (!hasBuildableFiles)
				return new BuildResult ();
			
			if (project.LanguageBinding == null) {
				BuildResult langres = new BuildResult ();
				string msg = GettextCatalog.GetString ("Unknown language '{0}'. You may need to install an additional add-in to support this language.", project.LanguageName);
				langres.AddError (msg);
				monitor.ReportError (msg, null);
				return langres;
			}

			BuildResult refres = null;
			HashSet<ProjectItem> itemsToExclude = new HashSet<ProjectItem> ();
			
			foreach (ProjectReference pr in project.References) {
				
				if (pr.ReferenceType == ReferenceType.Project) {
					// Ignore non-dotnet projects
					Project p = project.ParentSolution != null ? project.ParentSolution.FindProjectByName (pr.Reference) : null;
					if (p != null && !(p is DotNetProject))
						continue;

					if (p == null || pr.GetReferencedFileNames (configuration).Length == 0) {
						if (refres == null)
							refres = new BuildResult ();
						string msg = GettextCatalog.GetString ("Referenced project '{0}' not found in the solution.", pr.Reference);
						monitor.ReportWarning (msg);
						refres.AddWarning (msg);
					}
				}
				
				if (!pr.IsValid) {
					if (refres == null)
						refres = new BuildResult ();
					string msg;
					if (!pr.IsExactVersion && pr.SpecificVersion) {
						msg = GettextCatalog.GetString ("Reference '{0}' not found on system. Using '{1}' instead.", pr.StoredReference, pr.Reference);
						monitor.ReportWarning (msg);
						refres.AddWarning (msg);
					}
					else {
						bool errorsFound = false;
						foreach (string asm in pr.GetReferencedFileNames (configuration)) {
							if (!File.Exists (asm)) {
								msg = GettextCatalog.GetString ("Assembly '{0}' not found. Make sure that the assembly exists in disk. If the reference is required to build the project you may get compilation errors.", Path.GetFileName (asm));
								refres.AddWarning (msg);
								monitor.ReportWarning (msg);
								errorsFound = true;
								itemsToExclude.Add (pr);
							}
						}
						msg = null;
						if (!errorsFound) {
							msg = GettextCatalog.GetString ("The reference '{0}' is not valid for the target framework of the project.", pr.StoredReference, pr.Reference);
							monitor.ReportWarning (msg);
							refres.AddWarning (msg);
							itemsToExclude.Add (pr);
						}
					}
				}
			}
			
			DotNetProjectConfiguration conf = (DotNetProjectConfiguration) project.GetConfiguration (configuration);

			// Create a copy of the data needed to compile the project.
			// This data can be modified by extensions.
			// Also filter out items whose condition evaluates to false
			
			BuildData buildData = new BuildData ();
			ProjectParserContext ctx = new ProjectParserContext (project, conf);
		
			buildData.Items = new ProjectItemCollection ();
			foreach (ProjectItem item in project.Items) {
				if (!itemsToExclude.Contains (item) && (string.IsNullOrEmpty (item.Condition) || ConditionParser.ParseAndEvaluate (item.Condition, ctx)))
					buildData.Items.Add (item);
			}
			buildData.Configuration = (DotNetProjectConfiguration) conf.Clone ();
			buildData.Configuration.SetParentItem (project);
			buildData.ConfigurationSelector = configuration;

			return ProjectExtensionUtil.Compile (monitor, project, buildData, delegate {
				ProjectItemCollection items = buildData.Items;
				BuildResult res = BuildResources (buildData.Configuration, ref items, monitor);
				if (res != null)
					return res;
	
				res = project.LanguageBinding.Compile (items, buildData.Configuration, buildData.ConfigurationSelector, monitor);
				if (refres != null) {
					refres.Append (res);
					return refres;
				}
				else
					return res;
			});
		}		
示例#40
0
 public override IEnumerable <SolutionItem> GetReferencedItems(ConfigurationSelector configuration)
 {
     return(new SolutionItem[0]);
 }
		protected override bool OnFastCheckNeedsBuild (ConfigurationSelector configuration)
		{
			return false;
		}
示例#42
0
 public bool BuildSettingMatchesConfiguration(DubBuildSetting sett, ConfigurationSelector config)
 {
     return(true);
 }
示例#43
0
		public override bool FastCheckNeedsBuild (ConfigurationSelector configuration)
		{
			return false;
		}
 public BuildResult Compile(ProjectItemCollection items, DotNetProjectConfiguration configuration, ConfigurationSelector configSelector, IProgressMonitor monitor)
 {
     Debug.Assert(compilerServices != null);
     return(compilerServices.Compile(items, configuration, configSelector, monitor));
 }