ExtendSource <DependentModule>( CModuleContainer <ObjectFile> affectedSource) where DependentModule : CModuleContainer <ObjectFile>, new() { var dependent = Bam.Core.Graph.Instance.FindReferencedModule <DependentModule>(); if (null == dependent) { return; } // as the referenced container of source is to be shoehorned into // this module, make sure that the external container isn't built standalone // note that the referenced container will float to the top of the dependency // graph, but just won't do anything foreach (var child in dependent.Children) { var childAsObjectFile = child as ObjectFileBase; if (null == childAsObjectFile) { continue; } childAsObjectFile.PerformCompilation = false; } affectedSource.ExtendWith(dependent); affectedSource.UsePublicPatchesPrivately(dependent); }
ExtendSource <DependentModule>( CModuleContainer <ObjectFile> affectedSource) where DependentModule : CModuleContainer <ObjectFile>, new() { var dependent = Bam.Core.Graph.Instance.FindReferencedModule <DependentModule>(); if (null == dependent) { return; } affectedSource.ExtendWith(dependent); affectedSource.UsePublicPatchesPrivately(dependent); }
ExtendWith( CModuleContainer <ChildModuleType> otherSource) { foreach (var child in otherSource.Children) { var clonedChild = Bam.Core.Module.CloneWithPrivatePatches(child, this); // attach the cloned object file into the container so parentage is clear for macros (clonedChild as Bam.Core.IChildModule).Parent = this; this.children.Add(clonedChild); this.DependsOn(clonedChild); // source might be a buildable module (derived from C.SourceFile), or non-buildable module (C.SourceFile), or just a path if (clonedChild is IRequiresSourceModule) { var sourceOfChild = (child as IRequiresSourceModule).Source; if (sourceOfChild is Bam.Core.ICloneModule) { (sourceOfChild as Bam.Core.ICloneModule).Clone(this, (newModule) => { // associate the cloned source, to the cloned object file // might need to happen prior to type-specific post-cloning ops (clonedChild as IRequiresSourceModule).Source = newModule as SourceFile; }); } else { (clonedChild as IRequiresSourceModule).Source = sourceOfChild; } } else { throw new Bam.Core.Exception( new System.NotImplementedException(), "Container does not include objects implementing the interface '{0}'", typeof(IRequiresSourceModule).ToString()); } } }
ExtendWith( CModuleContainer <ChildModuleType> otherSource) { foreach (var child in otherSource.Children) { var clonedChild = Bam.Core.Module.CloneWithPrivatePatches(child, this); // attach the cloned object file into the container so parentage is clear for macros (clonedChild as Bam.Core.IChildModule).Parent = this; this.children.Add(clonedChild); this.DependsOn(clonedChild); // source might be a buildable module (derived from C.SourceFile), or non-buildable module (C.SourceFile), or just a path if (clonedChild is IRequiresSourceModule) { var sourceOfChild = (child as IRequiresSourceModule).Source; if (sourceOfChild is Bam.Core.ICloneModule) { (sourceOfChild as Bam.Core.ICloneModule).Clone(this, (newModule) => { // associate the cloned source, to the cloned object file // might need to happen prior to type-specific post-cloning ops (clonedChild as IRequiresSourceModule).Source = newModule as SourceFile; }); } else { (clonedChild as IRequiresSourceModule).Source = sourceOfChild; } } else { clonedChild.InputPath.Aliased(child.InputPath); } } }