Example #1
0
        internal static void OnBuildEnded()
        {
            expectedScenesNames = null;
            if (s_buildSession == null)
            {
                throw new System.InvalidOperationException("Build was not in progress");
            }

            try
            {
                using (s_buildSession)
                {
                    if (s_buildSession.deferAnalysis)
                    {
                        s_buildSession.PostProcessBuild(s_buildSession.buildTarget, s_buildSession.buildPath, scenes =>
                        {
                            return(BuildLogParser.GetLastBuildAssetsSizes(EditorLogPath, scenes));
                        });
                    }
                    else if (s_buildSession.buildTimer.IsRunning)
                    {
                        Log.Warning("The build seems to have failed or been interrupted");
                    }
                }
            }
            finally
            {
                s_buildSession = null;
            }
        }
Example #2
0
        public static void OnPostprocessBuild(BuildTarget target, string path)
        {
            if (!BetterBuildInfo.IsEnabled)
            {
                return;
            }

            if (!BuildInfoSettings.Instance.useLegacyCallbacks)
            {
                return;
            }

            if (s_buildSession == null)
            {
                Log.Error("Somehow the tool hasn't recognized that the build is in progress");
                return;
            }

            if (UnityVersionAgnostic.AssetLogPrintedAfterPostProcessors)
            {
                Log.Debug("This Unity version prints assets usage *after* post processors are run (possibly a bug); deferring the analysis to the first editor update after the build.");
                s_buildSession.buildTarget   = target;
                s_buildSession.buildPath     = path;
                s_buildSession.deferAnalysis = true;
            }
            else
            {
                try
                {
                    using (s_buildSession)
                    {
                        s_buildSession.PostProcessBuild(target, path, scenes =>
                        {
                            return(BuildLogParser.GetLastBuildAssetsSizes(EditorLogPath, scenes));
                        });
                    }
                }
                finally
                {
                    s_buildSession = null;
                }
            }

            return;
        }