Beispiel #1
0
            public ObjectId ComputeInputHash(UrlType type, string filePath)
            {
                var hash = ObjectId.Empty;

                switch (type)
                {
                case UrlType.File:
                    hash = builderContext.InputHashes.ComputeFileHash(filePath);
                    break;

                case UrlType.Internal:
                    if (!buildTransaction.TryGetValue(filePath, out hash))
                    {
                        Logger.Warning("Location " + filePath + " does not exist currently and is required to compute the current command hash. The build cache will not work for this command!");
                    }
                    break;

                case UrlType.Virtual:
                    var providerResult = VirtualFileSystem.ResolveProvider(filePath, true);
                    var dbProvider     = providerResult.Provider as DatabaseFileProvider;
                    var microProvider  = providerResult.Provider as MicroThreadFileProvider;
                    if (microProvider != null)
                    {
                        dbProvider = microProvider.ThreadLocal.Value as DatabaseFileProvider;
                    }

                    if (dbProvider != null)
                    {
                        dbProvider.AssetIndexMap.TryGetValue(providerResult.Path, out hash);
                    }
                    break;
                }

                return(hash);
            }
Beispiel #2
0
            public ObjectId ComputeInputHash(UrlType type, string filePath)
            {
                var hash = ObjectId.Empty;

                switch (type)
                {
                case UrlType.File:
                    hash = builderContext.InputHashes.ComputeFileHash(filePath);
                    break;

                case UrlType.Content:
                    if (!buildTransaction.TryGetValue(filePath, out hash))
                    {
                        Logger.Warning("Location " + filePath + " does not exist currently and is required to compute the current command hash. The build cache will not work for this command!");
                    }
                    break;
                }

                return(hash);
            }
 public bool TryGetValue(string url, out ObjectId objectId)
 {
     return(buildTransaction.TryGetValue(url, out objectId));
 }