Exemple #1
0
        private void WriteSerialziedFiles(string bundleName, IWriteOperation op, List <WriteCommand> allCommands, BuildSettings settings, BuildUsageTagGlobal globalUsage, ref List <WriteResult> outResults)
        {
            WriteResult result;
            var         dependencies = op.CalculateDependencies(allCommands);

            var objectIDs    = op.command.serializeObjects.Select(x => x.serializationObject).ToArray();
            var dependentIDs = dependencies.SelectMany(x => x.serializeObjects.Select(y => y.serializationObject)).ToArray();

            BuildUsageTagSet buildUsage = new BuildUsageTagSet();

            BundleBuildInterface.CalculateBuildUsageTags(objectIDs, dependentIDs, globalUsage, buildUsage);

            Hash128 hash = CalculateInputHash(op, dependencies, settings, globalUsage, buildUsage);

            if (UseCache && BuildCache.TryLoadCachedResults(hash, out result))
            {
                outResults.Add(result);
                return;
            }

            result = op.Write(GetBuildPath(hash), dependencies, settings, globalUsage, buildUsage);
            outResults.Add(result);

            if (UseCache && !BuildCache.SaveCachedResults(hash, result))
            {
                BuildLogger.LogWarning("Unable to cache CommandSetWriter results for command '{0}'.", op.command.internalName);
            }
        }