diff --git a/src/xenia/app/emulator_window.cc b/src/xenia/app/emulator_window.cc index 658303906..1b38a8f96 100644 --- a/src/xenia/app/emulator_window.cc +++ b/src/xenia/app/emulator_window.cc @@ -54,7 +54,12 @@ EmulatorWindow::EmulatorWindow(Emulator* emulator) " CHECKED" #endif #endif - " (" XE_BUILD_BRANCH "/" XE_BUILD_COMMIT_SHORT "/" XE_BUILD_DATE + " (" +#ifdef XE_BUILD_IS_PR + "PR#" XE_BUILD_PR_NUMBER " " XE_BUILD_PR_REPO + " " XE_BUILD_PR_BRANCH "@" XE_BUILD_PR_COMMIT_SHORT " against " +#endif + XE_BUILD_BRANCH "@" XE_BUILD_COMMIT_SHORT " on " XE_BUILD_DATE ")"; } @@ -426,8 +431,13 @@ void EmulatorWindow::ToggleFullscreen() { void EmulatorWindow::ShowHelpWebsite() { LaunchWebBrowser("https://xenia.jp"); } void EmulatorWindow::ShowCommitID() { +#ifdef XE_BUILD_IS_PR + LaunchWebBrowser( + "https://github.com/xenia-project/xenia/pull/" XE_BUILD_PR_NUMBER); +#else LaunchWebBrowser( "https://github.com/xenia-project/xenia/commit/" XE_BUILD_COMMIT "/"); +#endif } void EmulatorWindow::UpdateTitle() { diff --git a/src/xenia/base/main_win.cc b/src/xenia/base/main_win.cc index 6cbf8c9ae..5d68811f1 100644 --- a/src/xenia/base/main_win.cc +++ b/src/xenia/base/main_win.cc @@ -162,7 +162,13 @@ int Main() { } // Print version info. - XELOGI("Build: " XE_BUILD_BRANCH " / " XE_BUILD_COMMIT " on " XE_BUILD_DATE); + XELOGI( + "Build: " +#ifdef XE_BUILD_IS_PR + "PR#" XE_BUILD_PR_NUMBER " " XE_BUILD_PR_REPO " " XE_BUILD_PR_BRANCH + "@" XE_BUILD_PR_COMMIT_SHORT " against " +#endif + XE_BUILD_BRANCH "@" XE_BUILD_COMMIT_SHORT " on " XE_BUILD_DATE); // Request high performance timing. if (cvars::win32_high_freq) { diff --git a/xenia-build b/xenia-build index 6bba02562..7586582ab 100755 --- a/xenia-build +++ b/xenia-build @@ -262,13 +262,31 @@ def generate_version_h(): """Generates a build/version.h file that contains current git info. """ header_file = 'build/version.h' - if git_is_repository(): + pr_number = 0 + pr_repo_name = "" + pr_branch_name = "" + pr_commit = "" + pr_commit_short = "" + if os.getenv('APPVEYOR') == 'True': + branch_name = os.getenv('APPVEYOR_REPO_BRANCH') + commit = os.getenv('APPVEYOR_REPO_COMMIT') + commit_short = commit[:9] + pr_number = os.getenv('APPVEYOR_PULL_REQUEST_NUMBER') + if not pr_number: + pr_number = 0 + else: + pr_repo_name = os.getenv('APPVEYOR_PULL_REQUEST_HEAD_REPO_NAME') + pr_branch_name = os.getenv('APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH') + pr_commit = os.getenv('APPVEYOR_PULL_REQUEST_HEAD_COMMIT') + pr_commit_short = pr_commit[:9] + elif git_is_repository(): (branch_name, commit, commit_short) = git_get_head_info() else: branch_name = 'tarball' commit = ':(-dont-do-this' commit_short = ':(' + # header contents_new = '''// Autogenerated by `xb premake`. #ifndef GENERATED_VERSION_H_ #define GENERATED_VERSION_H_ @@ -276,9 +294,22 @@ def generate_version_h(): #define XE_BUILD_COMMIT "{}" #define XE_BUILD_COMMIT_SHORT "{}" #define XE_BUILD_DATE __DATE__ -#endif // GENERATED_VERSION_H_ '''.format(branch_name, commit, commit_short) + # PR info (if available) + if pr_number != 0: + contents_new += '''#define XE_BUILD_IS_PR +#define XE_BUILD_PR_NUMBER "{}" +#define XE_BUILD_PR_REPO "{}" +#define XE_BUILD_PR_BRANCH "{}" +#define XE_BUILD_PR_COMMIT "{}" +#define XE_BUILD_PR_COMMIT_SHORT "{}" +'''.format(pr_number, pr_repo_name, pr_branch_name, pr_commit, pr_commit_short) + + # footer + contents_new += '''#endif // GENERATED_VERSION_H_ +''' + contents_old = None if os.path.exists(header_file) and os.path.getsize(header_file) < 1024: with open(header_file, 'r') as f: