private static DependenciesInfo ParseBundleDependenciesFromRules(BundlerBuildRule buildRule, ref ReservedSharedBundleInfo reserved, ref DependencyCache cache) { buildRule.rules.Sort((a, b) => - a.shared.CompareTo(b.shared)); var depsInfo = new DependenciesInfo(); foreach (var rule in buildRule.rules) { var packType = (PackType)Enum.Parse(typeof(PackType), rule.packType); switch (packType) { case PackType.PackByFile: ParseBundleDependenciesByRuleOfPackByFile(rule, ref depsInfo, ref reserved, ref cache); break; case PackType.PackByDirectory: ParseBundleDependenciesByRuleOfPackByDirectory(rule, ref depsInfo, ref reserved, ref cache); break; case PackType.PackBySubDirectory: ParseBundleDependenciesByRuleOfPackBySubDirectory(rule, ref depsInfo, ref reserved, ref cache); break; default: throw new ArgumentOutOfRangeException(rule.packType); } } return(depsInfo); }
private static string[] GetManagedFilesByRules(BundlerBuildRule rules) { var files = new HashSet <string>(); rules.managed.ForEach(v => { var ret = GetFileListByRule(v); foreach (var file in ret) { files.Add(file); } }); return(files.ToArray()); }
public static BundlerManifest GenerateManifest(BundlerBuildRule buildRule) { var cache = LoadAssetDependenciesCache(); var reservedSharedBundle = new ReservedSharedBundleInfo(); var depsInfo = ParseBundleDependenciesFromRules(buildRule, ref reservedSharedBundle, ref cache); var bundlesInfo = GenerateBundlesInfo(ref depsInfo, ref reservedSharedBundle, ref cache); ResolveBundleDependencies(ref bundlesInfo, ref cache); //FilterRedundantDependencies(ref bundlesInfo); var manifest = GenerateBundlerManifest(ref bundlesInfo); Resources.UnloadUnusedAssets(); SaveAssetDependenciesCache(cache); return(manifest); }
public static void StripUnmanagedFiles(BundlerBuildRule buildRule, BundlerManifest manifest) { var managedFiles = GetManagedFilesByRules(buildRule); var toRemoved = new List <string>(); foreach (var kv in manifest.assets) { if (!managedFiles.Contains(kv.Key)) { toRemoved.Add(kv.Key); } } toRemoved.ForEach(v => manifest.assets.Remove(v)); Debug.Log(string.Format("{0} unmanaged files removed from manifest.", toRemoved.Count)); }
public static void GenerateManifestToFile(BundlerBuildRule buildRule, string outputPath) { var manifest = GenerateManifest(buildRule); SaveManifest(ref manifest, outputPath); }