示例#1
0
        protected override void DoProcess(RuntimePlatform platform, UnityEditor.BuildTarget target, IBundleBuildConfig settings, ABBuildResult result, IList <IBundleFileManifest> bundleList)
        {
            var outputPath = OutputPath.Get(platform);
            var list       = bundleList.OrderBy(c => c.ABName).ToArray();
            var manifest   = result.Manifest;
            var packResult = new StringBuilder();

            packResult.AppendLine("[Bundle List]");
            using (var scope = new ProgressDialogScope("Bundle List", list.Length * 2))
            {
                for (int i = 0; i < list.Length; i++)
                {
                    packResult.AppendLine(list[i].ABName);
                }
                packResult.AppendLine("=============================");
                for (int i = 0; i < list.Length; i++)
                {
                    var bundle = list[i];
                    scope.Show(bundle.ABName, i);
                    AppendDependencies(packResult, bundle, manifest);
                }
            }
            var assetsList = new StringBuilder();

            // Bundle List
            assetsList.AppendLine("[Bundle Assets dependencies]");
            using (var scope = new ProgressDialogScope("Bundle Assets List", list.Length))
            {
                for (int i = 0; i < list.Length; i++)
                {
                    var d = bundleList[i];
                    assetsList.AppendFormat("{0} : {1}", i + 1, d.ABName)
                    .AppendLine();
                    scope.Show(d.ABName, i);
                    foreach (var path in d.Assets)
                    {
                        assetsList
                        .Append("    ")
                        .AppendFormat("{0}", path)
                        .AppendLine();
                    }
                }
            }
            if (Directory.Exists(outputPath.BasePath))
            {
                Directory.CreateDirectory(outputPath.BasePath);
            }
            var resultContents = new[]
            {
                new { name = nameof(packResult), content = packResult },
                new { name = nameof(assetsList), content = assetsList },
            };

            foreach (var c in resultContents)
            {
                var filePath = outputPath.ToLocation(c.name + ".txt");
                File.WriteAllText(filePath.FullPath, c.content.ToString());
            }
        }
示例#2
0
        protected override ABBuildResult DoBuild(RuntimePlatform platform, BuildTarget buildTarget, BuildAssetBundleOptions option, AssetBundleBuild[] bundleList)
        {
            var path     = OutputPath.Get(platform);
            var manifest = BuildPipeline.BuildAssetBundles(
                outputPath: path.BasePath,
                assetBundleOptions: option,
                targetPlatform: buildTarget,

                builds: bundleList);

            return(new ABBuildResult(manifest, manifest != null ? BuildResultCode.Success : BuildResultCode.Error, path.BasePath));
        }
示例#3
0
        //=========================================
        //  関数
        //=========================================

        /// <summary>
        /// ビルドマップを作成
        /// </summary>
        protected override void DoProcess(RuntimePlatform platform, BuildTarget target, IBundleBuildConfig settings, ABBuildResult result, IList <IBundleFileManifest> bundleList)
        {
            var json            = new BuildMapDataTable();
            var buildMapFile    = m_buildMapPath.Get(platform);
            var bundleDirectory = OutputPath.Get(platform);

            //	外部情報
            var manifest = result.Manifest;
            var prefix   = settings.TargetDirPath;

            json.Prefix = prefix;
            var table = bundleList.ToDictionary(c => c.ABName, c => c.Identifier);

            using (var scope = new ProgressDialogScope("Create Bundle Manifest : " + buildMapFile, bundleList.Count))
            {
                //	テーブル作成
                for (int i = 0; i < bundleList.Count; i++)
                {
                    //	BuildFileData
                    var fileData = bundleList[i];
                    //	Path
                    var file = bundleDirectory.ToLocation(fileData.ABName);
                    //	Create BuildMap Data
                    var d = CreateBuildData(file, fileData, table, manifest);
                    scope.Show(fileData.ABName, i);
                    json.Add(d);
                }
            }
            var addresses = bundleList
                            .SelectMany(c => c.Address)
                            .Distinct()
                            .ToArray();

            using (var scope = new ProgressDialogScope("Create Asset Table : " + buildMapFile, addresses.Length))
            {
                for (int i = 0; i < addresses.Length; i++)
                {
                    var address = addresses[i];
                    var path    = address.StartsWith(prefix) ? address : prefix + address;
                    var d       = new AssetBuildData
                    {
                        Path = address,
                        Guid = AssetDatabase.AssetPathToGUID(path)
                    };
                    scope.Show(address, i);
                    json.Add(d);
                }
            }
            var builder = m_builder.Build();

            builder.Write(buildMapFile.FullPath, json);
        }
示例#4
0
        protected override ABBuildResult DoBuild(RuntimePlatform platform, BuildTarget buildTarget, BuildAssetBundleOptions option, AssetBundleBuild[] bundleList)
        {
            var path     = OutputPath.Get(platform);
            var manifest = BuildPipeline.BuildAssetBundles
                           (
                outputPath: path.BasePath,
                builds: bundleList,
                assetBundleOptions: option |= BuildAssetBundleOptions.DryRunBuild,
                targetPlatform: buildTarget
                           );

            return(new ABBuildResult(manifest, BuildResultCode.Success, "Complete"));
        }
示例#5
0
        /// <summary>
        /// 実行
        /// </summary>
        protected override void DoProcess(RuntimePlatform platform, BuildTarget target, IBundleBuildConfig settings, ABBuildResult result, IList <IBundleFileManifest> bundleList)
        {
            //	親ディレクトリ
            var rootDirPath = OutputPath.Get(platform);

            if (!Directory.Exists(rootDirPath.BasePath))
            {
                Debug.LogWarning($"OutputDir is Not Exists : { rootDirPath}");
                return;
            }

            //	ファイル一覧
            var fileList = Directory.EnumerateFiles(
                path: rootDirPath.BasePath,
                searchPattern: settings.GetBundleName("*"),
                searchOption: SearchOption.AllDirectories
                )
                           .Select(c => c.Replace("\\", "/"))
                           .OrderBy(c => c)
                           .ToList();

            // 出力結果にあるものは除外していく
            foreach (var ab in bundleList)
            {
                var abPath = rootDirPath.ToLocation(ab.ABName);
                if (File.Exists(abPath.FullPath))
                {
                    fileList.Remove(abPath.FullPath);
                }
            }

            var builder = new StringBuilder();

            //	不要になったファイルを削除
            foreach (var f in fileList)
            {
                builder.AppendLine($"delete :: {f}");
                SafeDelete(f);
                SafeDelete(f + ".manifest");
            }
            File.WriteAllText(rootDirPath.ToLocation("delete-log.txt").FullPath, builder.ToString(), new UTF8Encoding(false));
        }
示例#6
0
        protected override void Execute(NativeActivityContext context)
        {
            if (Format == SupportedTypes.AutoDetect)
            {
                Format = this.DetectType();
            }

            switch (Format)
            {
            case SupportedTypes.ZIP:
                UncompressZIP(FilePath.Get(context), OutputPath.Get(context));
                break;

            case SupportedTypes.RAR:
                UncompressRAR();
                break;

            default:
                throw new NotImplementedException("Format not implemented yet");
            }
        }