Example #1
0
 public BuildFile EnsureBuildFileExists(
     FileReference fileRef)
 {
     lock (this.BuildFiles)
     {
         var existingBuildFile = this.BuildFiles.Where(item => item.FileRef == fileRef).FirstOrDefault();
         if (null != existingBuildFile)
         {
             return existingBuildFile;
         }
         var newBuildFile = new BuildFile(fileRef);
         this.BuildFiles.Add(newBuildFile);
         return newBuildFile;
     }
 }
Example #2
0
 public FileReference EnsureFileReferenceExists(
     Bam.Core.TokenizedString path,
     FileReference.EFileType type,
     bool explicitType = true,
     FileReference.ESourceTree sourceTree = FileReference.ESourceTree.NA)
 {
     lock (this.FileReferences)
     {
         var existingFileRef = this.FileReferences.Where(item => item.Path.Equals(path)).FirstOrDefault();
         if (null != existingFileRef)
         {
             return existingFileRef;
         }
         var newFileRef = new FileReference(path, type, this, explicitType, sourceTree);
         this.FileReferences.Add(newFileRef);
         return newFileRef;
     }
 }
Example #3
0
 private BuildFile EnsureBuildFileExists(
     Bam.Core.TokenizedString path,
     FileReference.EFileType type)
 {
     var fileRef = this.Project.EnsureFileReferenceExists(
         path,
         type,
         sourceTree: FileReference.ESourceTree.Absolute);
     var buildFile = this.Project.EnsureBuildFileExists(fileRef);
     return buildFile;
 }
Example #4
0
 private void AddFileRefToGroup(
     FileReference fileRef)
 {
     var relDir = this.Module.CreateTokenizedString("@trimstart(@relativeto(@dir($(0)),$(packagedir)),../)", fileRef.Path);
     var newGroup = this.CreateGroupHierarchy(relDir);
     var parentGroup = newGroup;
     while (parentGroup.Parent != null)
     {
         parentGroup = parentGroup.Parent;
         if (parentGroup == this.Project.MainGroup)
         {
             break;
         }
     }
     this.Project.MainGroup.AddChild(parentGroup);
     newGroup.AddChild(fileRef);
 }
Example #5
0
        public BuildFile EnsureSourceBuildFileExists(
            Bam.Core.TokenizedString path,
            FileReference.EFileType type)
        {
            lock (this)
            {
                if (null == this.SourcesBuildPhase)
                {
                    this.SourcesBuildPhase = new SourcesBuildPhase();
                    if (null == this.BuildPhases)
                    {
                        this.BuildPhases = new Bam.Core.Array<BuildPhase>();
                    }
                    this.BuildPhases.Add(this.SourcesBuildPhase);
                    this.Project.SourcesBuildPhases.Add(this.SourcesBuildPhase);
                }

                var buildFile = this.EnsureBuildFileExists(path, type);
                this.AddFileRefToGroup(buildFile.FileRef);
                this.SourcesBuildPhase.AddBuildFile(buildFile);
                return buildFile;
            }
        }
Example #6
0
        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);
            }
        }
Example #7
0
        public BuildFile EnsureFrameworksBuildFileExists(
            Bam.Core.TokenizedString path,
            FileReference.EFileType type)
        {
            lock (this)
            {
                this.EnsureFrameworksBuildPhaseExists();

                var buildFile = this.EnsureBuildFileExists(path, type);
                this.FrameworksBuildPhase.AddBuildFile(buildFile);
                return buildFile;
            }
        }