Example #1
0
        CachedInfo GetCachedInfo(CacheEntry entry, IWriteOperation operation, WriteResult result)
        {
            var info = new CachedInfo();

            info.Asset = entry;

            var dependencies  = new HashSet <CacheEntry>();
            var sceneBundleOp = operation as SceneBundleWriteOperation;

            if (sceneBundleOp != null)
            {
                dependencies.Add(m_Cache.GetCacheEntry(sceneBundleOp.ProcessedScene));
            }
            var sceneDataOp = operation as SceneDataWriteOperation;

            if (sceneDataOp != null)
            {
                dependencies.Add(m_Cache.GetCacheEntry(sceneDataOp.ProcessedScene));
            }
            foreach (var serializeObject in operation.Command.serializeObjects)
            {
                dependencies.Add(m_Cache.GetCacheEntry(serializeObject.serializationObject));
            }
            info.Dependencies = dependencies.ToArray();

            info.Data = new object[] { result };

            return(info);
        }
Example #2
0
#pragma warning restore 649

        CacheEntry GetSceneCacheEntry(GUID asset)
        {
            CacheEntry entry;

#if NONRECURSIVE_DEPENDENCY_DATA
            entry = m_Cache.GetCacheEntry(asset, m_Parameters.NonRecursiveDependencies ? -Version : Version);
#else
            entry = m_Cache.GetCacheEntry(asset, Version);
#endif
            return(entry);
        }
#pragma warning restore 649

        CachedInfo GetCachedInfo(GUID scene, IEnumerable<ObjectIdentifier> references, SceneDependencyInfo sceneInfo, BuildUsageTagSet usageTags, IEnumerable<CacheEntry> prefabEntries, Hash128 prefabDependency)
        {
            var info = new CachedInfo();
            info.Asset = m_Cache.GetCacheEntry(scene, Version);

            var dependencies = new HashSet<CacheEntry>();
            foreach (var reference in references)
                dependencies.Add(m_Cache.GetCacheEntry(reference));
            dependencies.UnionWith(prefabEntries);
            info.Dependencies = dependencies.ToArray();

            info.Data = new object[] { sceneInfo, usageTags, prefabDependency };

            return info;
        }
 void GetAssetHashes(HashSet <Hash128> hashes, GUID g, List <ObjectIdentifier> referencedObjects, bool useCache)
 {
     if (useCache)
     {
         hashes.Add(m_Cache.GetCacheEntry(g, Version).Hash);
         foreach (var reference in referencedObjects)
         {
             hashes.Add(m_Cache.GetCacheEntry(reference).Hash);
         }
     }
     else
     {
         hashes.Add(AssetDatabase.GetAssetDependencyHash(AssetDatabase.GUIDToAssetPath(g.ToString())));
     }
 }
Example #5
0
        static CacheEntry GetAssetCacheEntry(IBuildCache cache, GUID asset, bool NonRecursiveDependencies)
        {
            CacheEntry entry;

            entry = cache.GetCacheEntry(asset, NonRecursiveDependencies ? -kVersion : kVersion);
            return(entry);
        }
#pragma warning restore 649

        CachedInfo GetCachedInfo(GUID scene, IEnumerable <ObjectIdentifier> references, SceneDependencyInfo sceneInfo, BuildUsageTagSet usageTags)
        {
            var info = new CachedInfo();

            info.Asset = m_Cache.GetCacheEntry(scene, Version);

            var dependencies = new HashSet <CacheEntry>();

            foreach (ObjectIdentifier reference in references)
            {
                dependencies.Add(m_Cache.GetCacheEntry(reference));
            }
            info.Dependencies = dependencies.ToArray();

            info.Data = new object[] { sceneInfo, usageTags };

            return(info);
        }
Example #7
0
#pragma warning restore 649

        CachedInfo GetCachedInfo(GUID asset, AssetLoadInfo assetInfo, BuildUsageTagSet usageTags, SpriteImporterData importerData)
        {
            var info = new CachedInfo();

            info.Asset = m_Cache.GetCacheEntry(asset);

            var dependencies = new HashSet <CacheEntry>();

            foreach (var reference in assetInfo.referencedObjects)
            {
                dependencies.Add(m_Cache.GetCacheEntry(reference));
            }
            info.Dependencies = dependencies.ToArray();

            info.Data = new object[] { assetInfo, usageTags, importerData };

            return(info);
        }
Example #8
0
#pragma warning restore 649

        CachedInfo GetCachedInfo(GUID scene, IEnumerable <ObjectIdentifier> references, SceneDependencyInfo sceneInfo, BuildUsageTagSet usageTags, IEnumerable <CacheEntry> prefabEntries, Hash128 prefabDependency)
        {
            var info = new CachedInfo();

            info.Asset = m_Cache.GetCacheEntry(scene, Version);

#if ENABLE_TYPE_HASHING || UNITY_2020_1_OR_NEWER
            var uniqueTypes = new HashSet <System.Type>(sceneInfo.includedTypes);
#else
            var uniqueTypes = new HashSet <System.Type>();
#endif
            var objectTypes  = new List <KeyValuePair <ObjectIdentifier, System.Type[]> >();
            var dependencies = new HashSet <CacheEntry>(prefabEntries);
            ExtensionMethods.ExtractCommonCacheData(m_Cache, null, references, uniqueTypes, objectTypes, dependencies);
            info.Dependencies = dependencies.ToArray();

            info.Data = new object[] { sceneInfo, usageTags, prefabDependency, objectTypes };

            return(info);
        }
#pragma warning restore 649

        CachedInfo GetCachedInfo(GUID scene, IEnumerable <ObjectIdentifier> references, SceneDependencyInfo sceneInfo, BuildUsageTagSet usageTags)
        {
            var info = new CachedInfo();

            info.Asset = m_Cache.GetCacheEntry(scene, Version);

            var dependencies = new HashSet <CacheEntry>();

            foreach (var reference in references)
            {
                dependencies.Add(m_Cache.GetCacheEntry(reference));
            }
            var prefabEntries = AssetDatabase.GetDependencies(AssetDatabase.GUIDToAssetPath(scene.ToString())).Where(path => path.EndsWith(".prefab")).Select(m_Cache.GetCacheEntry);

            dependencies.UnionWith(prefabEntries);
            info.Dependencies = dependencies.ToArray();

            info.Data = new object[] { sceneInfo, usageTags };

            return(info);
        }
        static CachedInfo GetCachedInfo(IBuildCache cache, GUID asset, AssetLoadInfo assetInfo, BuildUsageTagSet usageTags, SpriteImporterData importerData, ExtendedAssetData assetData)
        {
            var info = new CachedInfo();

            info.Asset = cache.GetCacheEntry(asset, kVersion);

            var uniqueTypes  = new HashSet <System.Type>();
            var objectTypes  = new List <KeyValuePair <ObjectIdentifier, System.Type[]> >();
            var dependencies = new HashSet <CacheEntry>();

            ExtensionMethods.ExtractCommonCacheData(cache, assetInfo.includedObjects, assetInfo.referencedObjects, uniqueTypes, objectTypes, dependencies);
            info.Dependencies = dependencies.ToArray();

            info.Data = new object[] { assetInfo, usageTags, importerData, assetData, objectTypes };
            return(info);
        }
Example #11
0
        static CachedInfo GetCachedInfo(IBuildCache cache, CacheEntry entry, IEnumerable <ResourceFile> resources, BundleDetails details)
        {
            var info = new CachedInfo();

            info.Asset = entry;

            var dependencies = new HashSet <CacheEntry>();

            foreach (var resource in resources)
            {
                dependencies.Add(cache.GetCacheEntry(resource.fileName));
            }
            info.Dependencies = dependencies.ToArray();

            info.Data = new object[] { details };

            return(info);
        }
        static CacheEntry GetCacheEntry(IBuildCache cache, string bundleName, IEnumerable <ResourceFile> resources, BuildCompression compression)
        {
            var entry = new CacheEntry();

            entry.Type = CacheEntry.EntryType.Data;
            entry.Guid = HashingMethods.Calculate("ArchiveAndCompressBundles", bundleName).ToGUID();
            List <object> toHash = new List <object> {
                kVersion, compression
            };

            foreach (var resource in resources)
            {
                toHash.Add(resource.serializedFile);
                toHash.Add(resource.fileAlias);
                toHash.Add(cache.GetCacheEntry(resource.fileName).Hash);
            }
            entry.Hash    = HashingMethods.Calculate(toHash).ToHash128();
            entry.Version = kVersion;
            return(entry);
        }
Example #13
0
 public static void ExtractCommonCacheData(IBuildCache cache, IEnumerable <ObjectIdentifier> includedObjects, IEnumerable <ObjectIdentifier> referencedObjects, HashSet <Type> uniqueTypes, List <ObjectTypes> objectTypes, HashSet <CacheEntry> dependencies)
 {
     if (includedObjects != null)
     {
         foreach (var objectId in includedObjects)
         {
             var types = BuildCacheUtility.GetSortedUniqueTypesForObject(objectId);
             objectTypes.Add(new ObjectTypes(objectId, types));
             uniqueTypes.UnionWith(types);
         }
     }
     if (referencedObjects != null)
     {
         foreach (var objectId in referencedObjects)
         {
             var types = BuildCacheUtility.GetSortedUniqueTypesForObject(objectId);
             objectTypes.Add(new ObjectTypes(objectId, types));
             uniqueTypes.UnionWith(types);
             dependencies.Add(cache.GetCacheEntry(objectId));
         }
     }
     dependencies.UnionWith(uniqueTypes.Select(cache.GetCacheEntry));
 }