public override IEnumerable <string> Select(PackageSession packageSession, IContentIndexMap contentIndexMap)
 {
     return(packageSession.Packages
            .SelectMany(package => package.Assets)                                   // Select all assets
            .Where(assetItem => assetItem.Asset.Tags.Any(tag => Tags.Contains(tag))) // Matches tags
            .Select(x => x.Location.FullPath));                                      // Convert to string;
 }
Exemple #2
0
        /// <inheritdoc/>
        public override IEnumerable <string> Select(PackageSession packageSession, IContentIndexMap contentIndexMap)
        {
            // Check if we need to create or regenerate regex.
            bool needGenerateRegex = false;

            if (regexes == null || regexes.Length != Paths.Count)
            {
                needGenerateRegex = true;
            }
            else
            {
                // Check used pattern
                for (int i = 0; i < Paths.Count; ++i)
                {
                    if (Paths[i] != regexes[i].Key)
                    {
                        needGenerateRegex = true;
                        break;
                    }
                }
            }

            // Transform gitignore patterns to regex.
            if (needGenerateRegex)
            {
                regexes = Paths.Select(x => new KeyValuePair <string, Regex>(x, new Regex(TransformToRegex(x)))).ToArray();
            }

            return(contentIndexMap.GetMergedIdMap()
                   .Select(asset => asset.Key)                                               // Select url
                   .Where(assetUrl => regexes.Any(regex => regex.Value.IsMatch(assetUrl)))); // Check if any Regex matches
        }
Exemple #3
0
        private void CollectBundle(ResolvedBundle resolvedBundle, string assetUrl, IContentIndexMap contentIndexMap)
        {
            // Check if index map contains it already (that also means object id has been stored as well)
            if (resolvedBundle.DependencyIndexMap.ContainsKey(assetUrl) || resolvedBundle.IndexMap.ContainsKey(assetUrl))
            {
                return;
            }

            ObjectId objectId;

            if (!contentIndexMap.TryGetValue(assetUrl, out objectId))
            {
                throw new InvalidOperationException(string.Format("Could not find asset {0} for bundle {1}", assetUrl, resolvedBundle.Name));
            }

            // Add asset to index map
            resolvedBundle.IndexMap.Add(assetUrl, objectId);

            // Check if object id has already been added (either as dependency or inside this actual pack)
            // As a consequence, no need to check references since they will somehow be part of this package or one of its dependencies.
            if (resolvedBundle.DependencyObjectIds.Contains(objectId) || !resolvedBundle.ObjectIds.Add(objectId))
            {
                return;
            }

            foreach (var reference in GetChunkReferences(ref objectId))
            {
                CollectBundle(resolvedBundle, reference, contentIndexMap);
            }
        }
 public override IEnumerable<string> Select(PackageSession packageSession, IContentIndexMap contentIndexMap)
 {
     return packageSession.Packages
         .SelectMany(package => package.Assets) // Select all assets
         .Where(assetItem => assetItem.Asset.Tags.Any(tag => Tags.Contains(tag))) // Matches tags
         .Select(x => x.Location.FullPath); // Convert to string;
 }
        /// <inheritdoc/>
        public override IEnumerable<string> Select(PackageSession packageSession, IContentIndexMap contentIndexMap)
        {
            // Check if we need to create or regenerate regex.
            bool needGenerateRegex = false;
            if (regexes == null || regexes.Length != Paths.Count)
            {
                needGenerateRegex = true;
            }
            else
            {
                // Check used pattern
                for (int i = 0; i < Paths.Count; ++i)
                {
                    if (Paths[i] != regexes[i].Key)
                    {
                        needGenerateRegex = true;
                        break;
                    }
                }
            }

            // Transform gitignore patterns to regex.
            if (needGenerateRegex)
                regexes = Paths.Select(x => new KeyValuePair<string, Regex>(x, new Regex(TransformToRegex(x)))).ToArray();

            return contentIndexMap.GetMergedIdMap()
                .Select(asset => asset.Key) // Select url
                .Where(assetUrl => regexes.Any(regex => regex.Value.IsMatch(assetUrl))); // Check if any Regex matches
        }
 public abstract IEnumerable<string> Select(PackageSession packageSession, IContentIndexMap contentIndexMap);
 /// <summary>
 /// Merges the values from the given asset index map.
 /// </summary>
 /// <param name="contentIndexMap">The asset index map to merge.</param>
 public void Merge(IContentIndexMap contentIndexMap)
 {
     Merge(contentIndexMap.GetMergedIdMap());
 }
Exemple #8
0
 public DatabaseFileProvider(IContentIndexMap contentIndexMap, ObjectDatabase objectDatabase, string mountPoint = null) : base(mountPoint)
 {
     this.contentIndexMap = contentIndexMap;
     this.objectDatabase  = objectDatabase;
 }
Exemple #9
0
 public BuildTransaction(IContentIndexMap contentIndexMap, IEnumerable <IReadOnlyDictionary <ObjectUrl, OutputObject> > outputObjectsGroups)
 {
     this.contentIndexMap     = contentIndexMap;
     this.outputObjectsGroups = outputObjectsGroups;
 }
Exemple #10
0
 public abstract IEnumerable <string> Select(PackageSession packageSession, IContentIndexMap contentIndexMap);
 public DatabaseFileProvider(IContentIndexMap contentIndexMap, ObjectDatabase objectDatabase, string mountPoint = null) : base(mountPoint)
 {
     this.contentIndexMap = contentIndexMap;
     this.objectDatabase = objectDatabase;
 }
Exemple #12
0
        private void CollectReferences(Bundle bundle, HashSet <string> assets, string assetUrl, IContentIndexMap contentIndexMap)
        {
            // Already included?
            if (!assets.Add(assetUrl))
            {
                return;
            }

            ObjectId objectId;

            if (!contentIndexMap.TryGetValue(assetUrl, out objectId))
            {
                throw new InvalidOperationException(string.Format("Could not find asset {0} for bundle {1}", assetUrl, bundle.Name));
            }

            // Include references
            foreach (var reference in GetChunkReferences(ref objectId))
            {
                CollectReferences(bundle, assets, reference, contentIndexMap);
            }
        }
 public BuildTransaction(IContentIndexMap contentIndexMap, IEnumerable<IDictionary<ObjectUrl, OutputObject>> outputObjectsGroups)
 {
     this.contentIndexMap = contentIndexMap;
     this.outputObjectsGroups = outputObjectsGroups;
 }
 /// <summary>
 /// Merges the values from the given asset index map.
 /// </summary>
 /// <param name="contentIndexMap">The asset index map to merge.</param>
 public void Merge(IContentIndexMap contentIndexMap)
 {
     Merge(contentIndexMap.GetMergedIdMap());
 }