Esempio n. 1
0
    public static void RunBuildSequnce(BuildManagerSettings settings, BuildSequence sequence, ChangelogData changelog)
    {
        // Start init
        usedChangelog = changelog;
        ChangelogData.ChangelogVersionEntry usedChangelogEntry = changelog.GetLastVersion();
        buildNameString = usedChangelogEntry.GetVersionHeader();

#if GAME_TEMPLATE
        TemplateGameManager.Instance.buildNameString = buildNameString;
        TemplateGameManager.Instance.productName     = PlayerSettings.productName;
        EditorUtility.SetDirty(TemplateGameManager.Instance);
#endif
        usedDate = DateTime.Now;
        //End init

        Debug.Log("Start building all");
        DateTime startTime = DateTime.Now;

        //Crete release here, because build's not get pushed
        CreateGitHubReleaseIfNeeded(settings, sequence);

        Build(settings, sequence);
        PostBuild(sequence);

        Compress(sequence);

        ItchioPush(settings, sequence, changelog);
        GithubPush(settings, sequence, changelog);

        Debug.Log($"End building all. Elapsed time: {string.Format("{0:mm\\:ss}", DateTime.Now - startTime)}");

#if UNITY_EDITOR_WIN
        ShowExplorer(sequence.builds[sequence.builds.Count - 1].outputRoot);
#endif
    }
    void DrawChangelogInfo()
    {
        bool oldChangelogFoldoutValue = changelogFoldout;

        changelogFoldout = EditorGUILayout.BeginFoldoutHeaderGroup(changelogFoldout, "Changelog");
        EditorGUILayout.EndFoldoutHeaderGroup();

        if (changelogFoldout)
        {
            scrollPosChangelog = EditorGUILayout.BeginScrollView(scrollPosChangelog /*, GUILayout.Height(800f)*/);
            ++EditorGUI.indentLevel;

            EditorGUILayout.LabelField("Readme");
            changelog.readme = EditorGUILayout.TextArea(changelog.readme);
            GUILayout.Space(10f);

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Changelog file:", GUILayout.Width(100));
            if (GUILayout.Button($"Add version"))
            {
                changelog.versions.Add(new ChangelogData.ChangelogVersionEntry());
            }
            EditorGUILayout.EndHorizontal();

            for (int i = changelog.versions.Count - 1; i >= 0; --i)
            {
                ChangelogData.ChangelogVersionEntry version = changelog.versions[i];

                EditorGUILayout.BeginHorizontal();
                version.foldout = EditorGUILayout.BeginFoldoutHeaderGroup(version.foldout, $"{version.version} - {version.date}");
                EditorGUILayout.EndFoldoutHeaderGroup();
                if (GUILayout.Button($"Remove version", GUILayout.Width(100)))
                {
                    changelog.versions.RemoveAt(i);
                    return;
                }
                EditorGUILayout.EndHorizontal();

                if (string.IsNullOrEmpty(version.version))
                {
                    version.version = PlayerSettings.bundleVersion;
                }
                if (string.IsNullOrEmpty(version.date))
                {
                    version.date = System.DateTime.Now.ToShortDateString();
                }

                if (version.foldout)
                {
                    ++EditorGUI.indentLevel;

                    EditorGUILayout.BeginHorizontal();
                    version.version = EditorGUILayout.TextField("Version", version.version);
                    if (GUILayout.Button($"Curr", GUILayout.Width(70)))
                    {
                        version.version = PlayerSettings.bundleVersion;
                    }
                    EditorGUILayout.EndHorizontal();

                    EditorGUILayout.BeginHorizontal();
                    version.date = EditorGUILayout.TextField("Date", version.date);
                    if (GUILayout.Button($"Now", GUILayout.Width(70)))
                    {
                        version.date = System.DateTime.Now.ToShortDateString();
                    }
                    EditorGUILayout.EndHorizontal();

                    version.updateName      = EditorGUILayout.TextField("Update name", version.updateName);
                    version.descriptionText = EditorGUILayout.TextField("Description", version.descriptionText);

                    EditorGUILayout.LabelField("Notes: ");

                    ++EditorGUI.indentLevel;
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField("Type", GUILayout.Width(150));
                    EditorGUILayout.LabelField("Scope", GUILayout.Width(125));
                    EditorGUILayout.LabelField("Community", GUILayout.Width(100));
                    EditorGUILayout.LabelField("Description");
                    EditorGUILayout.EndHorizontal();

                    for (int j = 0; j < version.notes.Count; ++j)
                    {
                        ChangelogData.ChangelogNoteEntry note = version.notes[j];
                        EditorGUILayout.BeginHorizontal();

                        ChangelogData.ChangelogEntryType  newType  = (ChangelogData.ChangelogEntryType)EditorGUILayout.EnumPopup(note.type, GUILayout.Width(150));
                        ChangelogData.ChangelogEntryScope newScope = (ChangelogData.ChangelogEntryScope)EditorGUILayout.EnumPopup(note.scope, GUILayout.Width(150));
                        note.isCommunityFeedback = EditorGUILayout.Toggle(note.isCommunityFeedback, GUILayout.Width(70));
                        note.text = EditorGUILayout.TextField(note.text);

                        if (note.type != newType || note.scope != newScope)
                        {
                            note.type     = newType;
                            note.scope    = newScope;
                            version.notes = version.notes.OrderBy(_note => _note.type).ThenBy(_note => _note.scope).ToList();
                            return;
                        }

                        if (GUILayout.Button($"-", GUILayout.Width(25)))
                        {
                            version.notes.RemoveAt(j);
                            return;
                        }

                        EditorGUILayout.EndHorizontal();
                    }
                    --EditorGUI.indentLevel;

                    if (GUILayout.Button($"Add note"))
                    {
                        version.notes.Add(new ChangelogData.ChangelogNoteEntry());
                    }

                    --EditorGUI.indentLevel;
                }

                EditorGUILayout.Space(10);
            }

            --EditorGUI.indentLevel;
            EditorGUILayout.EndScrollView();
        }

        if (oldChangelogFoldoutValue != changelogFoldout)
        {
            ChangelogData.SaveChangelog(changelog);

#if GAME_TEMPLATE
            TemplateGameManager.Instance.buildNameString = changelog.GetLastVersion().GetVersionHeader();;
            TemplateGameManager.Instance.productName     = PlayerSettings.productName;
            EditorUtility.SetDirty(TemplateGameManager.Instance);
#endif
        }

        if (changelogFoldout)
        {
            EditorGUILayout.Space(20);
        }
    }