Example #1
0
        CreatedSYMBundle(
            ICollatedObject collatedFile)
        {
            var createDebugSymbols = Bam.Core.Module.Create <DSymUtilModule>(preInitCallback: module =>
            {
                module.SourceModule  = collatedFile.SourceModule;
                module.SourcePathKey = collatedFile.SourcePathKey;
                module.Macros.Add("publishingdir", collatedFile.PublishingDirectory.Clone(module));
            });

            this.DependsOn(createDebugSymbols);

            createDebugSymbols.Macros.Add("publishdir", this.CreateTokenizedString("$(buildroot)/$(modulename)-$(config)"));

            // dependents might reference the anchor's OutputName macro, e.g. dylibs copied into an application bundle
            createDebugSymbols.Macros.Add("AnchorOutputName", (collatedFile as CollatedObject).Macros["AnchorOutputName"]);

            this.collatedObjects.Add(createDebugSymbols);
        }
Example #2
0
        CopyPDB(
            ICollatedObject collatedFile)
        {
            var copyPDBModule = Bam.Core.Module.Create <CollatedFile>(preInitCallback: module =>
            {
                module.SourceModule = collatedFile.SourceModule;
                // TODO: there has not been a check whether this is a valid path or not (i.e. were debug symbols enabled for link?)
                module.SourcePathKey = C.ConsoleApplication.PDBKey;
                module.SetPublishingDirectory("$(0)", collatedFile.PublishingDirectory.Clone(module));
            });

            this.DependsOn(copyPDBModule);

            copyPDBModule.Macros.Add("publishdir", this.CreateTokenizedString("$(buildroot)/$(modulename)-$(config)"));

            // since PDBs aren't guaranteed to exist as it depends on build settings, allow missing files to go through
            // TODO
            //copyPDBModule.FailWhenSourceDoesNotExist = false;
            this.collatedObjects.Add(copyPDBModule);
        }
Example #3
0
        CopyDebugSymbols(
            ICollatedObject collatedFile)
        {
            var createDebugSymbols = Bam.Core.Module.Create <ObjCopyModule>(preInitCallback: module =>
            {
                module.SourceModule  = collatedFile.SourceModule;
                module.SourcePathKey = collatedFile.SourcePathKey;
                module.Macros.Add("publishingdir", collatedFile.PublishingDirectory.Clone(module));
            });

            this.DependsOn(createDebugSymbols);

            createDebugSymbols.Macros.Add("publishdir", this.CreateTokenizedString("$(buildroot)/$(modulename)-$(config)"));

            createDebugSymbols.PrivatePatch(settings =>
            {
                var objCopySettings  = settings as IObjCopyToolSettings;
                objCopySettings.Mode = EObjCopyToolMode.OnlyKeepDebug;
            });

            this.collatedObjects.Add(createDebugSymbols);
        }
        StripBinary(
            ICollatedObject collatedFile)
        {
            var stripBinary = Bam.Core.Module.Create <StripModule>(preInitCallback: module =>
            {
                module.SourceModule  = collatedFile as Bam.Core.Module;
                module.SourcePathKey = CollatedObject.Key;
                module.Macros.Add("publishingdir", collatedFile.PublishingDirectory.Clone(module));
            });

            this.DependsOn(stripBinary);
            stripBinary.DependsOn(collatedFile as Bam.Core.Module);

            // dependents might reference the anchor's OutputName macro, e.g. dylibs copied into an application bundle
            stripBinary.Macros.Add("AnchorOutputName", (collatedFile as CollatedObject).Macros["AnchorOutputName"]);

            stripBinary.Macros.Add("publishdir", this.CreateTokenizedString("$(buildroot)/$(modulename)-$(config)"));

            stripBinary.Anchor = collatedFile.Anchor;

            this.collatedObjects.Add(collatedFile, stripBinary);

            return(stripBinary);
        }
        eachAnchorDependent(
            ICollatedObject collatedObj,
            object customData)
        {
            var sourceModule = collatedObj.SourceModule;

            if (sourceModule != null)
            {
                Bam.Core.Log.DebugMessage("\t'{0}'", sourceModule.ToString());
            }
            else
            {
                Bam.Core.Log.DebugMessage("\t'{0}'", (collatedObj as CollatedObject).SourcePath.ToString());
            }

            if ((collatedObj as CollatedObject).Ignore)
            {
                return;
            }

            var cModule = sourceModule as C.CModule;

            if (null == cModule)
            {
                // e.g. a shared object symbolic link
                if (collatedObj is CollatedFile)
                {
                    this.CloneFile(collatedObj);
                }
                else if (collatedObj is CollatedDirectory)
                {
                    this.CloneDirectory(collatedObj);
                }
                return;
            }

            if (cModule.IsPrebuilt)
            {
                if (collatedObj is CollatedOSXFramework)
                {
                    this.CloneOSXFramework(collatedObj);
                }
                else
                {
                    this.CloneFile(collatedObj);
                }
                return;
            }

            if (sourceModule.BuildEnvironment.Platform.Includes(Bam.Core.EPlatform.Windows))
            {
                if (sourceModule.Tool.Macros.Contains("pdbext"))
                {
                    this.CloneFile(collatedObj);
                }
                else
                {
                    var stripped = this.StripBinary(collatedObj);
                    var debugSymbolsCollation = customData as DebugSymbolCollation;
                    var debugSymbols          = debugSymbolsCollation.FindDebugSymbols(collatedObj.SourceModule) as ObjCopyModule;
                    if (null != debugSymbols)
                    {
                        var linkBack = debugSymbols.LinkBackToDebugSymbols(stripped);
                        this.DependsOn(linkBack);
                    }
                }
            }
            else if (sourceModule.BuildEnvironment.Platform.Includes(Bam.Core.EPlatform.Linux))
            {
                var stripped = this.StripBinary(collatedObj);
                var debugSymbolsCollation = customData as DebugSymbolCollation;
                var debugSymbols          = debugSymbolsCollation.FindDebugSymbols(collatedObj.SourceModule) as ObjCopyModule;
                if (null != debugSymbols)
                {
                    var linkBack = debugSymbols.LinkBackToDebugSymbols(stripped);
                    this.DependsOn(linkBack);
                }
            }
            else if (sourceModule.BuildEnvironment.Platform.Includes(Bam.Core.EPlatform.OSX))
            {
                this.StripBinary(collatedObj);
            }
            else
            {
                throw new Bam.Core.Exception("Unsupported platform '{0}'", sourceModule.BuildEnvironment.Platform.ToString());
            }
        }
 CloneDirectory(
     ICollatedObject collatedObject)
 {
     CloneObject <CollatedDirectory>(collatedObject);
 }
 CloneFile(
     ICollatedObject collatedObject)
 {
     CloneObject <CollatedFile>(collatedObject);
 }