public BuildArgumentForm(DMDConfig.DBuildArguments Arguments)
		{
			InitializeComponent();
			buildArgs = Arguments;

			LoadCurrent();
		}
Exemple #2
0
        public DMDSettingsPage(DMDConfig Configuration)
        {
            InitializeComponent();
            this.Config = Configuration;
            List_DefaultLibs.ItemsSource = Libs;

            LoadCurrent();
        }
		public DMDSettingsPage(DMDConfig Configuration)
		{
			InitializeComponent();
			this.Config = Configuration;
			List_DefaultLibs.ItemsSource = Libs;

			LoadCurrent();
		}
		public GlobalParseCachePage(DMDSettingsPage DMDPage,DMDConfig Config)
		{
			InitializeComponent();

			this.ParentPage = DMDPage;
			this.cfg = Config;

			LoadCurrent();
		}
        public GlobalParseCachePage(DMDSettingsPage DMDPage, DMDConfig Config)
        {
            InitializeComponent();

            this.ParentPage = DMDPage;
            this.cfg        = Config;

            LoadCurrent();
        }
Exemple #6
0
        public BuildResult CompileSource(SourceModule Module, DMDConfig dmd, bool DebugCompile, string objFile, string execDirectory)
        {
            var obj = Path.ChangeExtension(objFile, ".obj");
            var br  = new BuildResult()
            {
                SourceFile = Module.AbsoluteFileName, TargetFile = obj, Successful = true
            };

            ErrorLogger.Log("Compile " + (Module.Project != null?Module.Project.ToRelativeFileName(Module.FileName):Module.FileName), ErrorType.Information, ErrorOrigin.Build);

            var dmd_exe = dmd.SoureCompiler;

            // Always enable it to use environment paths to find dmd.exe
            if (!Path.IsPathRooted(dmd_exe) && Directory.Exists(dmd.BaseDirectory))
            {
                dmd_exe = Path.Combine(dmd.BaseDirectory, dmd.SoureCompiler);
            }

            TempPrc = FileExecution.ExecuteSilentlyAsync(dmd_exe,
                                                         BuildDSourceCompileArgumentString(dmd.BuildArguments(DebugCompile).SoureCompiler, Module.AbsoluteFileName, obj, dmd.ImportDirectories), // Compile our program always in debug mode
                                                         execDirectory,
                                                         OnOutput, delegate(string s) {
                var err = ParseErrorMessage(s);
                if (Module.Project != null && Module.Project.ContainsFile(err.FileName))
                {
                    err.Project = Module.Project;
                }
                if (err.Type == GenericError.ErrorType.Error)
                {
                    br.Successful = false;
                }
                br.BuildErrors.Add(err);
            }, OnExit);

            if (TempPrc != null && !TempPrc.HasExited)
            {
                TempPrc.WaitForExit(MaxCompilationTime);
            }

            br.Successful = br.Successful && TempPrc != null && TempPrc.ExitCode == 0 && File.Exists(obj);
            return(br);
        }
Exemple #7
0
        public void Load(XmlReader x)
        {
            while (x.Read())
            {
                switch (x.LocalName)
                {
                    case "BracketHightlighting":
                        if (x.MoveToAttribute("value"))
                            EnableMatchingBracketHighlighting = x.ReadContentAsBoolean();
                        break;

                    case "UseMethodInsight":
                        if (x.MoveToAttribute("value"))
                            UseMethodInsight = x.ReadContentAsBoolean();
                        break;

                    case "UseCodeCompletion":
                        if (x.MoveToAttribute("value"))
                            UseCodeCompletion = x.ReadContentAsBoolean();
                        break;

                    case "ForceCodeCompetionPopupCommit":
                        if (x.MoveToAttribute("value"))
                            ForceCodeCompetionPopupCommit = x.ReadContentAsBoolean();
                        break;

                    case "UseSemanticErrorHighlighting":
                        if (x.MoveToAttribute("value"))
                            UseSemanticErrorHighlighting = x.ReadContentAsBoolean();
                        break;

                    case "UseSemanticHighlighting":
                        if (x.MoveToAttribute("value"))
                            UseSemanticHighlighting = x.ReadContentAsBoolean();
                        break;

                    case "SmartIndentation":
                        if (x.MoveToAttribute("value"))
                            EnableSmartIndentation = x.ReadContentAsBoolean();
                        break;

                    case "CompletionOptions":
                        CompletionOptions.Instance.Load(x.ReadSubtree());
                        break;

                    case "cv2pdb":
                        cv2pdb_exe = x.ReadString();
                        break;

                    case "dmd":
                        var config = new DMDConfig();
                        config.Load(x);

                        if (config.Version == DVersion.D1)
                            dmd1 = config;
                        else
                            dmd2 = config;
                        break;
                }
            }
        }
Exemple #8
0
        public void Load(XmlReader x)
        {
            while (x.Read())
            {
                switch (x.LocalName)
                {
                case "BracketHightlighting":
                    if (x.MoveToAttribute("value"))
                    {
                        EnableMatchingBracketHighlighting = x.ReadContentAsBoolean();
                    }
                    break;

                case "UseMethodInsight":
                    if (x.MoveToAttribute("value"))
                    {
                        UseMethodInsight = x.ReadContentAsBoolean();
                    }
                    break;

                case "UseCodeCompletion":
                    if (x.MoveToAttribute("value"))
                    {
                        UseCodeCompletion = x.ReadContentAsBoolean();
                    }
                    break;

                case "ForceCodeCompetionPopupCommit":
                    if (x.MoveToAttribute("value"))
                    {
                        ForceCodeCompetionPopupCommit = x.ReadContentAsBoolean();
                    }
                    break;

                case "UseSemanticErrorHighlighting":
                    if (x.MoveToAttribute("value"))
                    {
                        UseSemanticErrorHighlighting = x.ReadContentAsBoolean();
                    }
                    break;

                case "UseSemanticHighlighting":
                    if (x.MoveToAttribute("value"))
                    {
                        UseSemanticHighlighting = x.ReadContentAsBoolean();
                    }
                    break;

                case "SmartIndentation":
                    if (x.MoveToAttribute("value"))
                    {
                        EnableSmartIndentation = x.ReadContentAsBoolean();
                    }
                    break;

                case "CompletionOptions":
                    this.CompletionOptions.Load(x.ReadSubtree());
                    break;

                case "cv2pdb":
                    cv2pdb_exe = x.ReadString();
                    break;

                case "dmd":
                    var config = new DMDConfig();
                    config.Load(x);

                    if (config.Version == DVersion.D1)
                    {
                        dmd1 = config;
                    }
                    else
                    {
                        dmd2 = config;
                    }
                    break;
                }
            }
        }
Exemple #9
0
        /// <summary>
        /// Links several object files to an executable, dynamic or static library
        /// </summary>
        public BuildResult LinkFiles(DMDConfig dmd, string linkerExe, string linkerArgs, string startDirectory, string targetFile, bool CreatePDB, params string[] files)
        {
            var errList = new List <GenericError>();
            var br      = new BuildResult()
            {
                TargetFile = targetFile, Successful = true
            };

            ErrorLogger.Log("Link files to " + Path.GetFileName(targetFile), ErrorType.Information, ErrorOrigin.Build);

            if (File.Exists(targetFile))
            {
                try
                {
                    File.Delete(targetFile);
                }
                catch (Exception ex)                 // Perhaps our targetFile is still in use
                {
                    br.BuildErrors.Add(new GenericError()
                    {
                        Message = ex.Message
                    });
                    return(br);
                }
            }

            // Ensure that target directory exists
            var tarDir = Path.GetDirectoryName(targetFile);

            try
            {
                Util.CreateDirectoryRecursively(tarDir);
            }
            catch (Exception ex)
            {
                ErrorLogger.Log(ex, ErrorType.Error, ErrorOrigin.Build);
                br.Successful = false;
                return(br);
            }

            // Always enable it to use environment paths to find dmd.exe
            if (!Path.IsPathRooted(linkerExe) && Directory.Exists(dmd.BaseDirectory))
            {
                linkerExe = Path.Combine(dmd.BaseDirectory, linkerExe);
            }

            //CRITICAL: Execute linker exe
            TempPrc = FileExecution.ExecuteSilentlyAsync(
                linkerExe, BuildDLinkerArgumentString(linkerArgs, startDirectory, targetFile, dmd.ImportDirectories, files), startDirectory,
                OnOutput, delegate(string s)
            {
                var err = ParseErrorMessage(s);
                if (err.Type == GenericError.ErrorType.Error)
                {
                    br.Successful = false;
                }
                br.BuildErrors.Add(err);
            }, OnExit);

            if (TempPrc != null && !TempPrc.HasExited)
            {
                TempPrc.WaitForExit(MaxCompilationTime);
            }

            br.Successful = br.Successful && TempPrc.ExitCode == 0 && File.Exists(targetFile);

            // If targetFile is executable or dynamic linked library, create PDB
            if (br.Successful && CreatePDB && (targetFile.EndsWith(".exe") || targetFile.EndsWith(".dll")))
            {
                var br_ = CreatePDBFromExe(targetFile);
                br.BuildErrors.AddRange(br_.BuildErrors);

                br.AdditionalFiles = new[] { br_.TargetFile };
            }

            return(br);
        }
Exemple #10
0
		/// <summary>
		/// Links several object files to an executable, dynamic or static library
		/// </summary>
		public BuildResult LinkFiles(DMDConfig dmd,string linkerExe, string linkerArgs, string startDirectory, string targetFile, bool CreatePDB, params string[] files)
		{
			var errList = new List<GenericError>();
			var br = new BuildResult() { TargetFile=targetFile, Successful=true};

			ErrorLogger.Log("Link files to "+Path.GetFileName( targetFile),ErrorType.Information,ErrorOrigin.Build);

			if (File.Exists(targetFile))
			{
				try
				{
					File.Delete(targetFile);
				}
				catch (Exception ex) // Perhaps our targetFile is still in use
				{
					br.BuildErrors.Add(new GenericError() { Message=ex.Message});
					return br;
				}
			}

			// Ensure that target directory exists
			var tarDir = Path.GetDirectoryName(targetFile);
			try
			{
				Util.CreateDirectoryRecursively(tarDir);
			}
			catch (Exception ex)
			{
				ErrorLogger.Log(ex, ErrorType.Error, ErrorOrigin.Build);
				br.Successful = false;
				return br;
			}

			// Always enable it to use environment paths to find dmd.exe
			if (!Path.IsPathRooted(linkerExe) && Directory.Exists(dmd.BaseDirectory))
				linkerExe = Path.Combine(dmd.BaseDirectory, linkerExe);

			//CRITICAL: Execute linker exe
			TempPrc = FileExecution.ExecuteSilentlyAsync(
					linkerExe,	BuildDLinkerArgumentString(linkerArgs, startDirectory,targetFile,dmd.ImportDirectories,files), startDirectory,
					OnOutput, delegate(string s)
			{
				var err = ParseErrorMessage(s);
				if (err.Type == GenericError.ErrorType.Error)
					br.Successful = false;
				br.BuildErrors.Add(err);
			}, OnExit);

			if (TempPrc != null && !TempPrc.HasExited)
				TempPrc.WaitForExit(MaxCompilationTime);

			br.Successful = br.Successful && TempPrc.ExitCode==0 && File.Exists(targetFile);

			// If targetFile is executable or dynamic linked library, create PDB
			if (br.Successful && CreatePDB && (targetFile.EndsWith(".exe") || targetFile.EndsWith(".dll")))
			{
				var br_=CreatePDBFromExe(targetFile);
				br.BuildErrors.AddRange(br_.BuildErrors);

				br.AdditionalFiles=new[]{br_.TargetFile};
			}

			return br;
		}
Exemple #11
0
		public BuildResult CompileSource(SourceModule Module,DMDConfig dmd,bool DebugCompile, string objFile, string execDirectory)
		{
			var obj = Path.ChangeExtension(objFile, ".obj");
			var br = new BuildResult() { SourceFile = Module.AbsoluteFileName,TargetFile=obj,Successful=true };

			ErrorLogger.Log("Compile " + (Module.Project!=null?Module.Project.ToRelativeFileName( Module.FileName):Module.FileName),ErrorType.Information,ErrorOrigin.Build);

			var dmd_exe = dmd.SoureCompiler;

			// Always enable it to use environment paths to find dmd.exe
			if (!Path.IsPathRooted(dmd_exe) && Directory.Exists(dmd.BaseDirectory))
				dmd_exe = Path.Combine(dmd.BaseDirectory, dmd.SoureCompiler);

			TempPrc = FileExecution.ExecuteSilentlyAsync(dmd_exe,
					BuildDSourceCompileArgumentString(dmd.BuildArguments(DebugCompile).SoureCompiler, Module.AbsoluteFileName, obj,dmd.ImportDirectories), // Compile our program always in debug mode
					execDirectory,
					OnOutput, delegate(string s) {
						var err = ParseErrorMessage(s);
						if (Module.Project != null && Module.Project.ContainsFile(err.FileName))
							err.Project = Module.Project;
						if (err.Type == GenericError.ErrorType.Error)
							br.Successful = false;
						br.BuildErrors.Add(err);
					}, OnExit);

			if (TempPrc != null && !TempPrc.HasExited)
				TempPrc.WaitForExit(MaxCompilationTime);

			br.Successful = br.Successful && TempPrc!=null && TempPrc.ExitCode==0 && File.Exists(obj);
			return br;
		}