Beispiel #1
0
        public override IEnumerable <string> GetSourcePaths(ConfigurationSelector sel)
        {
            var dirs = new List <string>();
            List <DubBuildSetting> l;
            string d;
            bool   returnedOneItem = false;

            foreach (var sett in GetBuildSettings(sel))
            {
                if (sett.TryGetValue(DubBuildSettings.SourcePathsProperty, out l))
                {
                    returnedOneItem = true;
                    foreach (var setting in l)
                    {
                        foreach (var directory in setting.Values)
                        {
                            d = ProjectBuilder.EnsureCorrectPathSeparators(directory);
                            if (!Path.IsPathRooted(d))
                            {
                                if (this is DubSubPackage)
                                {
                                    (this as DubSubPackage).useOriginalBasePath = true;
                                }
                                d = Path.GetFullPath(Path.Combine(BaseDirectory.ToString(), d));
                                if (this is DubSubPackage)
                                {
                                    (this as DubSubPackage).useOriginalBasePath = false;
                                }
                            }

                            // Ignore os/arch/version constraints for now

                            if (dirs.Contains(d) || !Directory.Exists(d))
                            {
                                continue;
                            }

                            dirs.Add(d);
                        }
                    }
                }
            }

            if (!returnedOneItem)
            {
                d = BaseDirectory.Combine("source").ToString();
                if (Directory.Exists(d))
                {
                    dirs.Add(d);
                }

                d = BaseDirectory.Combine("src").ToString();
                if (Directory.Exists(d))
                {
                    dirs.Add(d);
                }
            }

            return(dirs);
        }
Beispiel #2
0
 public void UpdateLocalIncludeCache()
 {
     DCompilerConfiguration.UpdateParseCacheAsync(LocalIncludes, BaseDirectory,
                                                  ParentSolution == null ?
                                                  BaseDirectory.ToString() :
                                                  ParentSolution.BaseDirectory.ToString(), true,
                                                  LocalIncludeCache_FinishedParsing);
 }
Beispiel #3
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;
            }

            LocalFileCache.BeginParse(new[] { BaseDirectory.ToString() }, BaseDirectory);

            /*
             * 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((object o) =>
                {
                    foreach (var f in (List <ProjectFile>)o)
                    {
                        var mod     = DParser.ParseFile(f.FilePath) as DModule;
                        var modName = f.ProjectVirtualPath.ToString().Replace(Path.DirectorySeparatorChar, '.');

                        _filelinkModulesToInsert.Add(mod);
                    }

                    analysisFinished_FileLinks = true;
                    _InsertFileLinkModulesIntoLocalCache();
                    TryBuildUfcsCache();
                })
                {
                    IsBackground = true
                }
            }
Beispiel #4
0
        public override FilePath GetOutputFileName(ConfigurationSelector configuration)
        {
            var cfg = GetConfiguration(configuration) as DubProjectConfiguration;

            string targetPath = null, targetName = null, targetType = null;

            CommonBuildSettings.TryGetTargetFileProperties(this, configuration, ref targetType, ref targetName, ref targetPath);
            if (cfg != null)
            {
                cfg.BuildSettings.TryGetTargetFileProperties(this, configuration, ref targetType, ref targetName, ref targetPath);
            }

            if (string.IsNullOrWhiteSpace(targetPath))
            {
                targetPath = BaseDirectory.ToString();
            }
            else if (!Path.IsPathRooted(targetPath))
            {
                targetPath = BaseDirectory.Combine(targetPath).ToString();
            }

            if (string.IsNullOrWhiteSpace(targetName))
            {
                var packName = packageName.Split(':');
                targetName = packName[packName.Length - 1];
            }

            if (string.IsNullOrWhiteSpace(targetType) ||
                (targetType = targetType.ToLowerInvariant()) == "executable" ||
                targetType == "autodetect")
            {
                if (OS.IsWindows)
                {
                    targetName += ".exe";
                }
            }
            else
            {
                //TODO
            }


            return(Path.Combine(targetPath, targetName));
        }