Esempio n. 1
0
        /// <summary>
        /// Returns all libs that are included by default both by the compiler and this specific build config
        /// </summary>
        public IEnumerable <string> GetReferencedLibraries(ConfigurationSelector configSelector)
        {
            foreach (var i in Project.Compiler.DefaultLibraries)
            {
                yield return(i);
            }
            foreach (var i in ExtraLibraries)
            {
                yield return(i);
            }

            bool takeDefSelector = configSelector == null;

            foreach (var dep in DProject.GetSortedProjectDependencies(Project))
            {
                if (takeDefSelector)
                {
                    configSelector = dep.DefaultConfiguration.Selector;
                }

                var activeConfig = dep.GetConfiguration(configSelector) as DProjectConfiguration;

                if (activeConfig != null && activeConfig.CompileTarget == DCompileTarget.StaticLibrary)
                {
                    yield return(dep.GetOutputFileName(configSelector));
                }
            }
        }
Esempio n. 2
0
        public ProjectIncludesWidget(DProject prj, DProjectConfiguration cfg)
        {
            this.Build();

            Project       = prj;
            CurrentConfig = cfg;
        }
Esempio n. 3
0
        /// <summary>
        /// Builds an array of all global version id definitions.
        /// Used for code completion.
        /// </summary>
        public void UpdateGlobalVersionIdentifiers(DProject prjOverride = null)
        {
            if (prjOverride == null)
            {
                if ((prjOverride = Project) == null)
                {
                    return;
                }
            }

            var cmp = prjOverride.Compiler;

            // Compiler args + cfg args + extra args
            var buildCfg  = cmp.GetOrCreateTargetConfiguration(this.CompileTarget);
            var buildArgs = buildCfg.GetArguments(this.DebugMode);
            var cmpArgs   = (buildArgs.OneStepBuildArguments ?? buildArgs.CompilerArguments) +
                            ExtraCompilerArguments + ExtraLinkerArguments;

            //TODO: Distinguish between D1/D2 and probably later versions?
            var a   = D_Parser.Misc.VersionIdEvaluation.GetVersionIds(cmp.PredefinedVersionConstant, cmpArgs, UnittestMode);
            var res = new string[(a == null ? 0 : a.Length) + (CustomVersionIdentifiers == null ? 0: CustomVersionIdentifiers.Length)];

            if (a != null)
            {
                Array.Copy(a, res, a.Length);
            }
            if (CustomVersionIdentifiers != null)
            {
                Array.Copy(CustomVersionIdentifiers, 0, res, res.Length - CustomVersionIdentifiers.Length, CustomVersionIdentifiers.Length);
            }
            gVersionIds = res;
        }
        public ProjectDependenciesWidget(DProject prj, DProjectConfiguration cfg)
        {
            this.Build();
            Show();

            Project       = prj;
            CurrentConfig = cfg;
        }
Esempio n. 5
0
        /// <summary>
        /// Returns dependent projects in a topological order (from least to most dependent)
        /// </summary>
        public static List<DProject> GetSortedProjectDependencies(DProject p)
        {
            var l = new List<DProject>();

            var r = new List<DProject>(p.DependingProjects);
            var skippedItems = new List<int>();

            for(int i = r.Count - 1; i >= 0; i--)
                if(r[i].ProjectDependencies.Count == 0)
                {
                    l.Add(r[i]);
                    r.RemoveAt(i);
                }

            // If l.count == 0, there is at least one cycle..

            while(r.Count != 0)
            {
                for(int i = r.Count -1 ; i>=0; i--)
                {
                    bool hasNotYetEnlistedChild = true;
                    foreach(var ch in r[i].DependingProjects)
                        if(!l.Contains(ch))
                        {
                            hasNotYetEnlistedChild = false;
                            break;
                        }

                    if(!hasNotYetEnlistedChild){

                        if(skippedItems.Contains(i))
                            return null;
                        skippedItems.Add(i);
                        continue;
                    }

                    l.Add(r[i]);
                    r.RemoveAt(i);
                }
            }

            return l;
        }
Esempio n. 6
0
        /// <summary>
        /// Builds an array of all global version id definitions.
        /// Used for code completion.
        /// </summary>
        public void UpdateGlobalVersionIdentifiers(DProject prjOverride = null)
        {
            if (prjOverride == null)
                if ((prjOverride = Project) == null)
                    return;

            var cmp = prjOverride.Compiler;

            // Compiler args + cfg args + extra args
            var buildCfg = cmp.GetOrCreateTargetConfiguration(this.CompileTarget);
            var buildArgs = buildCfg.GetArguments(this.DebugMode);
            var cmpArgs = (buildArgs.OneStepBuildArguments ?? buildArgs.CompilerArguments) + " " +
                ExtraCompilerArguments + " " + ExtraLinkerArguments;

            //TODO: Distinguish between D1/D2 and probably later versions?
            var a = D_Parser.Misc.VersionIdEvaluation.GetVersionIds(cmp.PredefinedVersionConstant,cmpArgs, UnittestMode);
            var res = new string[(a== null ? 0 : a.Length) + (CustomVersionIdentifiers == null ? 0: CustomVersionIdentifiers.Length)];
            if(a!=null)
                Array.Copy(a,res,a.Length);
            if(CustomVersionIdentifiers!=null)
                Array.Copy(CustomVersionIdentifiers,0,res,res.Length - CustomVersionIdentifiers.Length,CustomVersionIdentifiers.Length);
            gVersionIds = res;
        }
 public DProjectConfiguration(DProject Project)
 {
     this.Project = Project;
 }
Esempio n. 8
0
 public DProjectConfiguration(DProject Project)
 {
     this.Project = Project;
 }