示例#1
0
        public BuildReport BuildPackage(string[] scenes)
        {
            var p    = P.GetActiveTargetParams();
            var path = $"{p.outputDirectory}/{P.GetOutputPackageName( p )}";

            try {
                B.development = p.development;

                B.compressionType             = p.compression;
                B.il2CppCompilerConfiguration = p.il2CppCompilerConfiguration;
                B.WebGL_compressionFormat     = p.WebGL_compressionFormat;
                B.WebGL_linkerTarget          = p.WebGL_linkerTarget;
                B.WebGL_memorySize            = p.WebGL_memorySize;
                B.WebGL_exceptionSupport      = p.WebGL_exceptionSupport;
#if UNITY_2019_1_OR_NEWER
                B.WebGL_threadsSupport = p.WebGL_threadsSupport;
                B.WebGL_wasmStreaming  = p.WebGL_wasmStreaming;
#endif
                Log($"path: {path}");
                Log($"buildTarget: {p.buildTarget.ToString()}");
                Log($"options: {p.options.ToString()}");
                return(BuildPipeline.BuildPlayer(scenes, path, BuildTarget.WebGL, p.options));
            }
            catch (Exception e) {
                Debug.LogException(e);
            }

            return(null);
        }
示例#2
0
        static void Batch()
        {
            Log("Batch");
            P.Load();

            Log($"{string.Join( "; ", EditorUserBuildSettings.activeScriptCompilationDefines )}");

            Log($"activeBuildTargetGroup: {UnityEditorUserBuildSettings.activeBuildTargetGroup.ToString()}");
            Log($"activeBuildTarget: {EditorUserBuildSettings.activeBuildTarget.ToString()}");

            var currentParams = P.GetActiveTargetParams();

            Log($"{currentParams.buildTarget}");

            foreach (var arg in Environment.GetCommandLineArgs())
            {
                if (arg.Contains("-buildIndex"))
                {
                    int index = int.Parse(arg.Split(':')[1]);
                    P.i.buildParamIndex = index;
                    break;
                }
            }
            Build(0x01);
        }
示例#3
0
        static string BuildPackage()
        {
            var currentParams = P.GetActiveTargetParams();

            IBuildPlatform builder = null;

            switch (UnityEditorUserBuildSettings.activeBuildTargetGroup)
            {
            case BuildTargetGroup.Standalone:
                builder = new BuildPlatformStandard();
                break;

            case BuildTargetGroup.Android:
                builder = new BuildPlatformAndroid();
                break;

            case BuildTargetGroup.WebGL:
                builder = new BuildPlatformWebGL();
                break;
            }

            if (builder == null)
            {
                return(string.Empty);
            }

            Log($"{builder.GetType().Name}");
            B.CallEvent(typeof(BuildAssistEventPackageBuildPreProcess));

            //Debug.Log( string.Join( " ", PB.GetBuildSceneName( currentParams ) ) );
            var report = builder.BuildPackage(PB.GetBuildSceneName(currentParams));

            //var report = ( UnityEditor.Build.Reporting.BuildReport ) null;
            B.CallEvent(typeof(BuildAssistEventPackageBuildPostProcess));

            if (report == null)
            {
                return(string.Empty);
            }

            Log($"# BuildPipeline Result: {report.summary.result.ToString()}");
            return(report.summary.result.ToString());
        }
        public BuildReport BuildPackage(string[] scenes)
        {
            var p    = P.GetActiveTargetParams();
            var path = $"{p.outputDirectory}/{P.GetOutputPackageName( p )}";

            //var scenes = BuildManagerCommand.GetBuildSceneName();
            try {
                B.development    = p.development;
                B.buildAppBundle = p.buildAppBundle;

                B.compressionType             = p.compression;
                B.il2CppCompilerConfiguration = p.il2CppCompilerConfiguration;
                B.scriptingBackend            = p.scriptingBackend;

                if (p.scriptingBackend == ScriptingImplementation.Mono2x)
                {
                    B.targetArchitectures = AndroidArchitecture.ARMv7;
                }
                else
                {
                    B.targetArchitectures = AndroidArchitecture.ARMv7 | AndroidArchitecture.ARM64;
                }

                // どちらのMinifyが利用されるかの調査、下記コードで"Release"がセットされると、後の工程で"Release"の文字列判定でReleaseが選択される模様
                //
                // string value2 = (!Unsupported.IsSourceBuild()) ? ((!development) ? "Release" : "Development") : EditorUserBuildSettings.androidBuildType.ToString();
                //
                // Unsupported.IsSourceBuild()はエディタ上ではFalseが返ってくる
                // 過去バージョンとの兼ね合いかわからないがTrueの場合はEditorUserBuildSettings.androidBuildTypeが利用されることになる
                // 2018.4.12f1時点ではEditorUserBuildSettings.androidBuildTypeは封印されているため、エディタ上からの入力は不可能
                // なのでUnsupported.IsSourceBuild()がTrueでもいいようにEditorUserBuildSettings.androidBuildTypeを書き換える
                B.androidBuildType = p.development ? AndroidBuildType.Development : AndroidBuildType.Release;
                //Log( $"path: {path}" );
                Log($"buildTarget: {p.buildTarget.ToString()}");
                return(BuildPipeline.BuildPlayer(scenes, path, BuildTarget.Android, p.options));
            }
            catch (System.Exception e) {
                Debug.LogException(e);
            }

            return(null);
        }
示例#5
0
        public static string Build(int mode)
        {
            Log("Start Build:");
            PB.Load();
            B.CallEvent(typeof(BuildAssistEventPackageBuildStartProcess));

            using (new ScopeBuildExclusionAssets(PB.i.enableExlusionAssets, PB.i.exclusionFileList))
                using (new ScopeBuildSettings())
                    using (new ScopeScriptingDefineSymbols()) {
                        var currentParams = P.GetActiveTargetParams();

                        if (!Application.isBatchMode)
                        {
                            if (EditorUserBuildSettings.activeBuildTarget != currentParams.buildTarget)
                            {
                                EditorUserBuildSettings.SwitchActiveBuildTarget(UnityEditorUserBuildSettings.activeBuildTargetGroup, currentParams.buildTarget);
                            }
                        }

                        var    activeBuildTargetGroup = UnityEditorUserBuildSettings.activeBuildTargetGroup;
                        string symbol = PlayerSettings.GetScriptingDefineSymbolsForGroup(activeBuildTargetGroup);

                        symbol = string.Join(";", symbol, currentParams.scriptingDefineSymbols);

                        PlayerSettings.SetScriptingDefineSymbolsForGroup(activeBuildTargetGroup, symbol);

                        Log($"ActiveBuildTargetGroup: {activeBuildTargetGroup.ToString()}");
                        Log($"ScriptingDefineSymbols: {symbol}");
                        if (mode.Has(0x02))
                        {
                            BuildAssetBundle();
                        }
                        if (mode.Has(0x01))
                        {
                            BuildPackage();
                        }
                    }

            Log("Exit Build:");

            return("");
        }
        public BuildReport BuildPackage(string[] scenes)
        {
            var p    = P.GetActiveTargetParams();
            var path = $"{p.outputDirectory}/{P.GetOutputPackageName( p )}";

            //var scenes = BuildManagerCommand.GetBuildSceneName();
            try {
                B.development = p.development;
                //B.buildAppBundle = p.buildAppBundle;

                B.compressionType             = p.compression;
                B.il2CppCompilerConfiguration = p.il2CppCompilerConfiguration;
                B.scriptingBackend            = p.scriptingBackend;

                Log($"path: {path}");
                Log($"buildTarget: {p.buildTarget.ToString()}");
                return(BuildPipeline.BuildPlayer(scenes, path, p.buildTarget, p.options));
            }
            catch (System.Exception e) {
                Debug.LogException(e);
            }

            return(null);
        }