コード例 #1
0
        private void CreateBuildActionEntry(
            System.Xml.XmlDocument doc,
            System.Xml.XmlElement buildActionEntriesEl,
            Target target,
            Bam.Core.Array<Target> buildActionsCreated)
        {
            #if true
            #else
            // add all required dependencies in first (order matters)
            foreach (var required in target.TargetDependencies)
            {
                this.CreateBuildActionEntry(doc, buildActionEntriesEl, required., buildActionsCreated);
            }
            #endif

            // the same target might appear again while iterating through the required targets of dependencies
            // only add it once (first one is important for ordering)
            if (buildActionsCreated.Contains(target))
            {
                return;
            }

            var buildActionEntry = doc.CreateElement("BuildActionEntry");
            buildActionEntriesEl.AppendChild(buildActionEntry);
            var buildableReference = doc.CreateElement("BuildableReference");
            buildActionEntry.AppendChild(buildableReference);
            {
                buildableReference.SetAttribute("BuildableIdentifier", "primary");
                buildableReference.SetAttribute("BlueprintIdentifier", target.GUID);
                if (null != target.FileReference)
                {
                    buildableReference.SetAttribute("BuildableName", target.FileReference.Name);
                }
                buildableReference.SetAttribute("BlueprintName", target.Name);
                if (target.Project.ProjectDir == this.Project.ProjectDir)
                {
                    buildableReference.SetAttribute("ReferencedContainer",
                        "container:" + System.IO.Path.GetFileName(this.Project.ProjectDir.Parse()));
                }
                else
                {
                    var relative = Bam.Core.RelativePathUtilities.GetPath(target.Project.ProjectDir.Parse(), this.Project.ProjectDir.Parse());
                    buildableReference.SetAttribute("ReferencedContainer",
                        "container:" + relative);
                }
            }

            buildActionsCreated.Add(target);
        }
コード例 #2
0
        private System.Xml.XmlDocument CreateSchemePlist(
            Target target)
        {
            var doc = new System.Xml.XmlDocument();

            var schemeEl = doc.CreateElement("Scheme");
            doc.AppendChild(schemeEl);

            this.CreateBuildActions(doc, schemeEl, target);
            this.CreateTestActions(doc, schemeEl, target);
            this.CreateLaunchActions(doc, schemeEl, target);

            var profileActionEl = doc.CreateElement("ProfileAction");
            schemeEl.AppendChild(profileActionEl);
            profileActionEl.SetAttribute("buildConfiguration", target.ConfigurationList.ElementAt(0).Name);

            var analyzeActionEl = doc.CreateElement("AnalyzeAction");
            schemeEl.AppendChild(analyzeActionEl);
            analyzeActionEl.SetAttribute("buildConfiguration", target.ConfigurationList.ElementAt(0).Name);

            var archiveActionEl = doc.CreateElement("ArchiveAction");
            schemeEl.AppendChild(archiveActionEl);
            archiveActionEl.SetAttribute("buildConfiguration", target.ConfigurationList.ElementAt(0).Name);

            return doc;
        }
コード例 #3
0
 private void CreateTestActions(
     System.Xml.XmlDocument doc,
     System.Xml.XmlElement schemeElement,
     Target target)
 {
     var testActionEl = doc.CreateElement("TestAction");
     schemeElement.AppendChild(testActionEl);
     {
         testActionEl.SetAttribute("selectedDebuggerIdentifier", "Xcode.DebuggerFoundation.Debugger.LLDB");
         testActionEl.SetAttribute("selectedLauncherIdentifier", "Xcode.DebuggerFoundation.Launcher.LLDB");
         testActionEl.SetAttribute("shouldUseLaunchSchemeArgsEnv", "YES");
         testActionEl.SetAttribute("buildConfiguration", target.ConfigurationList.ElementAt(0).Name);
     }
 }
コード例 #4
0
        private void CreateLaunchActions(
            System.Xml.XmlDocument doc,
            System.Xml.XmlElement schemeElement,
            Target target)
        {
            var launchActionEl = doc.CreateElement("LaunchAction");
            schemeElement.AppendChild(launchActionEl);
            {
                launchActionEl.SetAttribute("selectedDebuggerIdentifier", "Xcode.DebuggerFoundation.Debugger.LLDB");
                launchActionEl.SetAttribute("selectedLauncherIdentifier", "Xcode.DebuggerFoundation.Launcher.LLDB");
                launchActionEl.SetAttribute("buildConfiguration", target.ConfigurationList.ElementAt(0).Name);

                var productRunnableEl = doc.CreateElement("BuildableProductRunnable");
                launchActionEl.AppendChild(productRunnableEl);

                var buildableRefEl = doc.CreateElement("BuildableReference");
                productRunnableEl.AppendChild(buildableRefEl);

                buildableRefEl.SetAttribute("BuildableIdentifier", "primary");

                if (null != target.FileReference)
                {
                    buildableRefEl.SetAttribute("BlueprintIdentifier", target.FileReference.GUID);
                    buildableRefEl.SetAttribute("BuildableName", target.FileReference.Name);
                    buildableRefEl.SetAttribute("BlueprintName", target.FileReference.Name);
                }

                if (target.Project.ProjectDir == this.Project.ProjectDir)
                {
                    buildableRefEl.SetAttribute("ReferencedContainer",
                        "container:" + System.IO.Path.GetFileName(target.Project.ProjectDir.Parse()));
                }
                else
                {
                    var relative = Bam.Core.RelativePathUtilities.GetPath(target.Project.ProjectDir.Parse(), this.Project.ProjectDir.Parse());
                    buildableRefEl.SetAttribute("ReferencedContainer",
                        "container:" + relative);
                }
            }
        }
コード例 #5
0
        private void CreateBuildActions(
            System.Xml.XmlDocument doc,
            System.Xml.XmlElement schemeElement,
            Target target)
        {
            var buildActionEl = doc.CreateElement("BuildAction");
            schemeElement.AppendChild(buildActionEl);
            {
                buildActionEl.SetAttribute("parallelizeBuildables", "YES");
                buildActionEl.SetAttribute("buildImplicitDependencies", "YES");

                var buildActionEntries = doc.CreateElement("BuildActionEntries");
                buildActionEl.AppendChild(buildActionEntries);

                var buildActionsCreated = new Bam.Core.Array<Target>();
                this.CreateBuildActionEntry(doc, buildActionEntries, target, buildActionsCreated);
            }
        }
コード例 #6
0
ファイル: Target.cs プロジェクト: knocte/BuildAMation
        public void Requires(
            Target other)
        {
            lock (this)
            {
                var existingTargetDep = this.TargetDependencies.Where(item => item.Dependency == other).FirstOrDefault();
                if (null != existingTargetDep)
                {
                    return;
                }
                if (this.Project == other.Project)
                {
                    var itemProxy = this.Project.ContainerItemProxies.Where(item => (item.ContainerPortal == this.Project) && (item.Remote == other)).FirstOrDefault();
                    if (null == itemProxy)
                    {
                        itemProxy = new ContainerItemProxy(this.Project, this.Project, other, false);
                    }

                    var dependency = this.TargetDependencies.Where(item => (item.Dependency == other) && (item.Proxy == itemProxy)).FirstOrDefault();
                    if (null == dependency)
                    {
                        dependency = new TargetDependency(this.Project, other, itemProxy);
                        this.TargetDependencies.AddUnique(dependency);
                    }
                }
                else
                {
                    var fileRef = this.Project.EnsureFileReferenceExists(
                        other.Project.ProjectDir,
                        FileReference.EFileType.Project,
                        explicitType: false,
                        sourceTree: FileReference.ESourceTree.Absolute);
                    this.Project.MainGroup.AddChild(fileRef);

                    var itemProxy = this.Project.ContainerItemProxies.Where(item => (item.ContainerPortal == fileRef) && (item.Remote == other)).FirstOrDefault();
                    if (null == itemProxy)
                    {
                        itemProxy = new ContainerItemProxy(this.Project, fileRef, other, false);
                    }

                    var refProxy = this.Project.ReferenceProxies.Where(item => item.RemoteRef == itemProxy).FirstOrDefault();
                    if (null == refProxy)
                    {
                        refProxy = new ReferenceProxy(
                            this.Project,
                            other.FileReference.Type,
                            other.FileReference.Path,
                            itemProxy,
                            other.FileReference.SourceTree);
                    }

                    var productRefGroup = this.Project.Groups.Where(item => item.Children.Contains(refProxy)).FirstOrDefault();
                    if (null == productRefGroup)
                    {
                        productRefGroup = new Group("Products");
                        productRefGroup.AddChild(refProxy);
                        this.Project.Groups.Add(productRefGroup);
                    }

                    var productRef = this.Project.ProjectReferences.Where(item => item.Key == productRefGroup).FirstOrDefault();
                    if (productRef.Equals(default(System.Collections.Generic.Dictionary<Group, FileReference>)))
                    {
                        this.Project.ProjectReferences.Add(productRefGroup, fileRef);
                    }

                    var dependency = this.TargetDependencies.Where(item => (item.Dependency == null) && (item.Proxy == itemProxy)).FirstOrDefault();
                    if (null == dependency)
                    {
                        dependency = new TargetDependency(this.Project, null, itemProxy);
                        this.TargetDependencies.AddUnique(dependency);
                    }
                }
            }
        }
コード例 #7
0
ファイル: Target.cs プロジェクト: knocte/BuildAMation
        public void EnsureOutputFileReferenceExists(
            Bam.Core.TokenizedString path,
            FileReference.EFileType type,
            Target.EProductType productType)
        {
            this.SetProductType(productType);

            var fileRef = this.Project.EnsureFileReferenceExists(path, type, sourceTree: FileReference.ESourceTree.BuiltProductsDir);
            if (null == this.FileReference)
            {
                this.FileReference = fileRef;
                this.Project.ProductRefGroup.AddChild(fileRef);
            }
        }
コード例 #8
0
ファイル: Target.cs プロジェクト: knocte/BuildAMation
 public void DependsOn(
     Target other)
 {
     lock (this)
     {
         this.EnsureFrameworksBuildPhaseExists();
         if (this.Project == other.Project)
         {
             var linkedBuildFile = this.Project.EnsureBuildFileExists(other.FileReference);
             this.FrameworksBuildPhase.AddBuildFile(linkedBuildFile);
         }
         else
         {
             var fileRefAlias = other.FileReference.MakeLinkableAlias(this.Module, this.Project);
             var linkedBuildFile = this.Project.EnsureBuildFileExists(fileRefAlias);
             this.FrameworksBuildPhase.AddBuildFile(linkedBuildFile);
         }
     }
 }