Example #1
0
 public void UpdateLocalIncludeCache()
 {
     analysisFinished_LocalIncludes = false;
     LocalIncludeCache.SolutionPath = ParentSolution == null ? "" : ParentSolution.BaseDirectory.ToString();
     LocalIncludeCache.FallbackPath = BaseDirectory;
     DCompilerConfiguration.UpdateParseCacheAsync(LocalIncludeCache);
 }
Example #2
0
        public void UpdateFilelist()
        {
            foreach (var p in PhysicalDependencyPaths)
            {
                DubReferences.RawIncludes.Add(p);
            }

            foreach (var settings in GetBuildSettings(null))
            {
                List <DubBuildSetting> l;
                if (settings.TryGetValue(DubBuildSettings.ImportPathsProperty, out l))
                {
                    for (int i = l.Count - 1; i >= 0; i--)                     // Ignore architecture/os/compiler restrictions for now
                    {
                        for (int j = l[i].Flags.Length - 1; j >= 0; j--)
                        {
                            DubReferences.RawIncludes.Add(l[i].Flags[j]);
                        }
                    }
                }
            }

            DCompilerConfiguration.UpdateParseCacheAsync(LocalIncludes, false, LocalIncludeCache_FinishedParsing);

            Items.Clear();
            foreach (var f in GetItemFiles(true))
            {
                Items.Add(new ProjectFile(f));
            }
        }
Example #3
0
        public bool ApplyToVirtConfiguration()
        {
            if (configuration == null)
            {
                return(false);
            }

            configuration.BinPath = txtBinPath.Text;

            //for now, using Executable target compiler command for all targets source compiling
            LinkTargetConfiguration targetConfig;

            targetConfig          = configuration.GetOrCreateTargetConfiguration(DCompileTarget.Executable);
            targetConfig.Compiler = txtCompiler.Text;

            //linker targets
            targetConfig        = configuration.GetOrCreateTargetConfiguration(DCompileTarget.Executable);
            targetConfig.Linker = txtConsoleAppLinker.Text;

            targetConfig        = configuration.GetOrCreateTargetConfiguration(DCompileTarget.ConsolelessExecutable);
            targetConfig.Linker = txtGUIAppLinker.Text;

            targetConfig        = configuration.GetOrCreateTargetConfiguration(DCompileTarget.SharedLibrary);
            targetConfig.Linker = txtSharedLibLinker.Text;

            targetConfig        = configuration.GetOrCreateTargetConfiguration(DCompileTarget.StaticLibrary);
            targetConfig.Linker = txtStaticLibLinker.Text;

            releaseArgumentsDialog.Store();
            debugArgumentsDialog.Store();

            configuration.DefaultLibraries.Clear();
            configuration.DefaultLibraries.AddRange(text_DefaultLibraries.Buffer.Text.Split(new[] { '\n' }, StringSplitOptions.RemoveEmptyEntries));

            #region Store new include paths
            var paths = text_Includes.Buffer.Text.Split(new[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);

            // Remove trailing / and \
            for (int i = 0; i < paths.Length; i++)
            {
                paths[i] = paths[i].TrimEnd('\\', '/');
            }

            if (configuration.ParseCache.UpdateRequired(paths))
            {
                configuration.ParseCache.ParsedDirectories.Clear();
                configuration.ParseCache.ParsedDirectories.AddRange(paths);

                try {
                    // Update parse cache immediately
                    DCompilerConfiguration.UpdateParseCacheAsync(configuration.ParseCache);
                } catch (Exception ex) {
                    LoggingService.LogError("Include path analysis error", ex);
                }
            }
            #endregion

            return(true);
        }
Example #4
0
 public void UpdateLocalIncludeCache()
 {
     DCompilerConfiguration.UpdateParseCacheAsync(LocalIncludes, BaseDirectory,
                                                  ParentSolution == null ?
                                                  BaseDirectory.ToString() :
                                                  ParentSolution.BaseDirectory.ToString(), true,
                                                  LocalIncludeCache_FinishedParsing);
 }
Example #5
0
        public void Deserialize(ITypeSerializer handler, DataCollection data)
        {
            handler.Deserialize(this, data);

            foreach (var p in tempIncludes)
            {
                LocalIncludeCache.Add(p);
            }

            // Parse local includes
            DCompilerConfiguration.UpdateParseCacheAsync(LocalIncludeCache);
        }
Example #6
0
        /// <summary>
        /// Updates the project's parse cache and reparses all of its D sources
        /// </summary>
        public void UpdateParseCache()
        {
            analysisFinished_LocalCache = analysisFinished_FileLinks = false;

            var hasFileLinks = new List <ProjectFile>();

            foreach (var f in Files)
            {
                if ((f.IsLink || f.IsExternalToProject) && File.Exists(f.ToString()))
                {
                    hasFileLinks.Add(f);
                }
            }

            // To prevent race condition bugs, test if links exist _before_ the actual local file parse procedure starts.
            if (hasFileLinks.Count == 0)
            {
                analysisFinished_FileLinks = true;
            }

            DCompilerConfiguration.UpdateParseCacheAsync(GetSourcePaths(), true, LocalFileCache_FinishedParsing);

            //EDIT: What if those file links refer to other project's files? Or what if more than one project reference the same files?
            //Furthermore, what if those files become edited and reparsed? Will their reference in the projects be updated either?
            // -> make a root for every file link in the global parse cache and build up a virtual root containing all file links right before a cache view is requested?

            /*
             * Since we don't want to include all link files' directories for performance reasons,
             * parse them separately and let the entire reparsing procedure wait for them to be successfully parsed.
             * Ufcs completion preparation will be done afterwards in the TryBuildUfcsCache() method.
             */
            if (hasFileLinks.Count != 0)
            {
                new System.Threading.Thread(() =>
                {
                    var r = new MutableRootPackage();
                    foreach (var f in hasFileLinks)
                    {
                        r.AddModule(DParser.ParseFile(f.FilePath) as DModule);
                    }
                    fileLinkModulesRoot = r;

                    analysisFinished_FileLinks = true;
                    TryBuildUfcsCache();
                })
                {
                    IsBackground = true
                }
            }
Example #7
0
        public bool ApplyToVirtConfiguration()
        {
            if (configuration == null)
            {
                return(false);
            }

            configuration.BinPath = txtBinPath.Text;
            configuration.SourceCompilerCommand = txtCompiler.Text;
            configuration.EnableGDCLibPrefixing = check_enableLibPrefixing.Active;

            var targetConfig = configuration.GetOrCreateTargetConfiguration(DCompileTarget.Executable);

            targetConfig.Linker = txtConsoleAppLinker.Text;

            targetConfig        = configuration.GetOrCreateTargetConfiguration(DCompileTarget.SharedLibrary);
            targetConfig.Linker = txtSharedLibLinker.Text;

            targetConfig        = configuration.GetOrCreateTargetConfiguration(DCompileTarget.StaticLibrary);
            targetConfig.Linker = txtStaticLibLinker.Text;

            releaseArgumentsDialog.Store();
            debugArgumentsDialog.Store();

            configuration.DefaultLibraries.Clear();
            configuration.DefaultLibraries.AddRange(text_DefaultLibraries.Buffer.Text.Split(new[] { '\n' }, StringSplitOptions.RemoveEmptyEntries));

            #region Store new include paths
            configuration.IncludePaths.Clear();
            foreach (var p in text_Includes.Buffer.Text.Split(new[] { '\n' }, StringSplitOptions.RemoveEmptyEntries))
            {
                configuration.IncludePaths.Add(p.TrimEnd('\\', '/'));
            }

            try {
                // Update parse cache immediately
                configuration.UpdateParseCacheAsync();
            } catch (Exception ex) {
                LoggingService.LogError("Include path analysis error", ex);
            }
            #endregion

            return(true);
        }
Example #8
0
        public bool ApplyToVirtConfiguration()
        {
            if (configuration == null)
            {
                return(false);
            }

            configuration.BinPath = txtBinPath.Text;
            configuration.SourceCompilerCommand = txtCompiler.Text;
            configuration.EnableGDCLibPrefixing = check_enableLibPrefixing.Active;

            var targetConfig = configuration.GetOrCreateTargetConfiguration(DCompileTarget.Executable);

            targetConfig.Linker = txtConsoleAppLinker.Text;

            targetConfig        = configuration.GetOrCreateTargetConfiguration(DCompileTarget.SharedLibrary);
            targetConfig.Linker = txtSharedLibLinker.Text;

            targetConfig        = configuration.GetOrCreateTargetConfiguration(DCompileTarget.StaticLibrary);
            targetConfig.Linker = txtStaticLibLinker.Text;

            releaseArgumentsDialog.Store();
            debugArgumentsDialog.Store();

            configuration.DefaultLibraries.Clear();
            foreach (var p in text_DefaultLibraries.Buffer.Text.Split('\n'))
            {
                var p_ = p.Trim();
                if (!String.IsNullOrWhiteSpace(p_))
                {
                    configuration.DefaultLibraries.Add(p_);
                }
            }

            try
            {
                using (var sr = new StringReader(tb_ArgPatterns.Buffer.Text))
                    using (var xml = new System.Xml.XmlTextReader(sr))
                        configuration.ArgumentPatterns.ReadFrom(xml);
            }
            catch (Exception ex) {
                LoggingService.LogError("Error during parsing argument patterns", ex);
                return(false);
            }

            #region Store new include paths
            configuration.IncludePaths.Clear();
            foreach (var p in text_Includes.Buffer.Text.Split('\n'))
            {
                var p_ = p.Trim().TrimEnd('\\', '/');
                if (!string.IsNullOrWhiteSpace(p_))
                {
                    configuration.IncludePaths.Add(p_);
                }
            }

            try {
                // Update parse cache immediately
                configuration.UpdateParseCacheAsync();
            } catch (Exception ex) {
                LoggingService.LogError("Include path analysis error", ex);
            }
            #endregion

            return(true);
        }
Example #9
0
        public bool Store()
        {
            if (configuration == null)
            {
                return(false);
            }

            // Store used compiler vendor
            project.UseDefaultCompilerVendor = cbUseDefaultCompiler.Active;
            project.PreferOneStepBuild       = cbPreferOneStepCompilation.Active;

            Gtk.TreeIter iter;
            if (cmbCompiler.GetActiveIter(out iter))
            {
                project.UsedCompilerVendor = cmbCompiler.Model.GetValue(iter, 0) as string;
            }

            // Store args
            configuration.ExtraCompilerArguments = extraCompilerTextView.Buffer.Text;
            configuration.ExtraLinkerArguments   = extraLinkerTextView.Buffer.Text;

            configuration.OutputDirectory = text_BinDirectory.Text;
            configuration.Output          = text_TargetFile.Text;
            configuration.ObjectDirectory = text_ObjectsDirectory.Text;
            configuration.DDocDirectory   = text_DDocDir.Text;

            if (combo_ProjectType.GetActiveIter(out iter))
            {
                configuration.CompileTarget = (DCompileTarget)model_compileTarget.GetValue(iter, 1);
            }

            configuration.CustomDebugIdentifiers   = text_debugConstants.Text.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
            configuration.CustomVersionIdentifiers = text_versionConstants.Text.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
            configuration.UpdateGlobalVersionIdentifiers(project);

            // Store libs
            configuration.ExtraLibraries.Clear();
            configuration.ExtraLibraries.AddRange(text_Libraries.Buffer.Text.Split(new[] { '\n' }, StringSplitOptions.RemoveEmptyEntries));

            // Store includes
            #region Store new include paths
            var paths = text_Includes.Buffer.Text.Split(new[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);

            // Remove trailing / and \
            for (int i = 0; i < paths.Length; i++)
            {
                paths[i] = paths[i].TrimEnd('\\', '/');
            }

            if (project.LocalIncludeCache.UpdateRequired(paths))
            {
                project.LocalIncludeCache.ParsedDirectories.Clear();
                project.LocalIncludeCache.ParsedDirectories.AddRange(paths);

                try {
                    // Update parse cache immediately
                    DCompilerConfiguration.UpdateParseCacheAsync(project.LocalIncludeCache);
                } catch (Exception ex) {
                    LoggingService.LogError("Include path analysis error", ex);
                }
            }
            #endregion

            // Store project deps
            project.ProjectDependencies.Clear();
            foreach (var i in vbox_ProjectDeps)
            {
                var cb = i as CheckButton;

                if (cb == null || !cb.Active)
                {
                    continue;
                }

                var prj = cb.Data["prj"] as Project;
                if (prj != null)
                {
                    project.ProjectDependencies.Add(prj.ItemId);
                }
            }

            return(true);
        }
Example #10
0
 public void UpdateLocalIncludeCache()
 {
     analysisFinished_LocalIncludes = false;
     LocalIncludeCache.FallbackPath = BaseDirectory;
     DCompilerConfiguration.UpdateParseCacheAsync(LocalIncludeCache);
 }