From f2b779d96436bfb7ad4848ac3376be09e838d6d7 Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Thu, 30 Jul 2020 18:45:55 +0200 Subject: [PATCH] Remove engine BuildChecker. It apparently has been broken for over a year and I trust anybody working on the engine to be smart enough to not need it. --- BuildChecker/.gitignore | 1 - BuildChecker/BuildChecker.csproj | 41 ------------ BuildChecker/git_helper.py | 105 ------------------------------- BuildChecker/hooks/post-checkout | 19 ------ BuildChecker/hooks/post-merge | 5 -- RUN_THIS.py | 41 ------------ RobustToolbox.sln | 9 --- 7 files changed, 221 deletions(-) delete mode 100644 BuildChecker/.gitignore delete mode 100644 BuildChecker/BuildChecker.csproj delete mode 100755 BuildChecker/git_helper.py delete mode 100644 BuildChecker/hooks/post-checkout delete mode 100644 BuildChecker/hooks/post-merge delete mode 100755 RUN_THIS.py diff --git a/BuildChecker/.gitignore b/BuildChecker/.gitignore deleted file mode 100644 index 9e51762ac..000000000 --- a/BuildChecker/.gitignore +++ /dev/null @@ -1 +0,0 @@ -INSTALLED_HOOKS_VERSION diff --git a/BuildChecker/BuildChecker.csproj b/BuildChecker/BuildChecker.csproj deleted file mode 100644 index fca9580d8..000000000 --- a/BuildChecker/BuildChecker.csproj +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - python3 - py -3 - - - - - {D0DA124B-5580-4345-A02B-9F051F78915F} - Library - .NETFramework, Version=v4.6.1 - - - - - - - - - - - - - - \ No newline at end of file diff --git a/BuildChecker/git_helper.py b/BuildChecker/git_helper.py deleted file mode 100755 index ef46978e1..000000000 --- a/BuildChecker/git_helper.py +++ /dev/null @@ -1,105 +0,0 @@ -#!/usr/bin/env python3 -# Installs git hooks, updates them, updates submodules, that kind of thing. - -import subprocess -import sys -import os -import shutil -from pathlib import Path -from typing import List - -BUILD_CHECKER_PATH = Path(Path(__file__).resolve().parent) -SS14_ROOT_PATH = Path(BUILD_CHECKER_PATH.parent) -SOLUTION_PATH = Path(SS14_ROOT_PATH/"SpaceStation14.sln") -CURRENT_HOOKS_VERSION = "2" # If this doesn't match the saved version we overwrite them all. -QUIET = "--quiet" in sys.argv -NO_HOOKS = "--nohooks" in sys.argv - -def run_command(command: List[str], capture: bool = False) -> subprocess.CompletedProcess: - """ - Runs a command with pretty output. - """ - text = ' '.join(command) - if not QUIET: - print("$ {}".format(text)) - - sys.stdout.flush() - - completed = None - - if capture: - completed = subprocess.run(command, cwd=str(SS14_ROOT_PATH), stdout=subprocess.PIPE) - else: - completed = subprocess.run(command, cwd=str(SS14_ROOT_PATH)) - - if completed.returncode != 0: - raise RuntimeError("Error: command exited with code {}!".format(completed.returncode)) - - return completed - - -def update_submodules(): - """ - Updates all submodules. - """ - - status = run_command(["git", "submodule", "update", "--init", "--recursive"], capture=True) - - if status.stdout.decode().strip(): - print("Git submodules changed. Reloading solution.") - reset_solution() - -def install_hooks(): - """ - Installs the necessary git hooks into .git/hooks. - """ - - # Read version file. - hooks_version_file = BUILD_CHECKER_PATH/"INSTALLED_HOOKS_VERSION" - - if os.path.isfile(str(hooks_version_file)): - with open(str(hooks_version_file), "r") as f: - if f.read() == CURRENT_HOOKS_VERSION: - if not QUIET: - print("No hooks change detected.") - return - - with open(str(hooks_version_file), "w") as f: - f.write(CURRENT_HOOKS_VERSION) - - print("Hooks need updating.") - - hooks_target_dir = SS14_ROOT_PATH/".git"/"hooks" - hooks_source_dir = BUILD_CHECKER_PATH/"hooks" - - if not os.path.exists(str(hooks_target_dir)): - os.makedirs(str(hooks_target_dir)) - - # Clear entire tree since we need to kill deleted files too. - for filename in os.listdir(str(hooks_target_dir)): - os.remove(str(hooks_target_dir/filename)) - - for filename in os.listdir(str(hooks_source_dir)): - print("Copying hook {}".format(filename)) - shutil.copy2(str(hooks_source_dir/filename), str(hooks_target_dir/filename)) - - -def reset_solution(): - """ - Force VS to think the solution has been changed to prompt the user to reload it, - thus fixing any load errors. - """ - - with SOLUTION_PATH.open("r") as f: - content = f.read() - - with SOLUTION_PATH.open("w") as f: - f.write(content) - -def main(): - if not NO_HOOKS: - install_hooks() - update_submodules() - -if __name__ == '__main__': - main() diff --git a/BuildChecker/hooks/post-checkout b/BuildChecker/hooks/post-checkout deleted file mode 100644 index 1d22b35b6..000000000 --- a/BuildChecker/hooks/post-checkout +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -gitroot=`git rev-parse --show-toplevel` - -cd "$gitroot/BuildChecker" - -if [ -f "git_helper.py" ] -then - if [[ `uname` == MINGW* || `uname` == CYGWIN* ]]; then - # Windows - # Can't update hooks from here because we are a hook, - # and the file is read only while it's used. - # Thanks Windows. - py -3 git_helper.py --quiet --nohooks - else - # Not Windows, so probably some other Unix thing. - python3 git_helper.py --quiet - fi -fi diff --git a/BuildChecker/hooks/post-merge b/BuildChecker/hooks/post-merge deleted file mode 100644 index 85fe61d96..000000000 --- a/BuildChecker/hooks/post-merge +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -# Just call post-checkout since it does the same thing. -gitroot=`git rev-parse --show-toplevel` -bash "$gitroot/.git/hooks/post-checkout" diff --git a/RUN_THIS.py b/RUN_THIS.py deleted file mode 100755 index a953f8c01..000000000 --- a/RUN_THIS.py +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env python3 - -# Import future so people on py2 still get the clear error that they need to upgrade. -from __future__ import print_function -import os -import sys -import traceback - -VERSION = sys.version_info -NO_PROMPT = "--no-prompt" in sys.argv - -sane_input = raw_input if VERSION.major < 3 else input - -def main(): - if VERSION.major < 3 or (VERSION.major == 3 and VERSION.minor < 5): - print("ERROR: You need at least Python 3.5 to build SS14.") - # Need "press enter to exit" stuff because Windows just immediately closes conhost. - if not NO_PROMPT: - sane_input("Press enter to exit...") - exit(1) - - # Import git_helper by modifying the path. - ss14_dir = os.path.dirname(os.path.abspath(__file__)) - sys.path.append(os.path.join(ss14_dir, "BuildChecker")) - - try: - import git_helper - git_helper.main() - - except Exception as e: - print("ERROR:") - traceback.print_exc() - print("This was NOT intentional. If the error is not immediately obvious, ask on Discord or IRC for help.") - if not NO_PROMPT: - sane_input("Press enter to exit...") - exit(1) - -if __name__ == "__main__": - main() - if not NO_PROMPT: - sane_input("Success! Press enter to exit...") diff --git a/RobustToolbox.sln b/RobustToolbox.sln index f9ddd1a82..8cd435d95 100644 --- a/RobustToolbox.sln +++ b/RobustToolbox.sln @@ -11,10 +11,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Robust.Shared", "Robust.Sha EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Robust.UnitTesting", "Robust.UnitTesting\Robust.UnitTesting.csproj", "{F0ADA779-40B8-4F7E-BA6C-CDB19F3065D9}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BuildChecker", "BuildChecker\BuildChecker.csproj", "{D0DA124B-5580-4345-A02B-9F051F78915F}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{795D76AB-19B5-4682-B51F-6DB148024A0C}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Robust.Client", "Robust.Client\Robust.Client.csproj", "{83429BD6-6358-4B18-BE51-401DF8EA2673}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Robust.Shared.Maths", "Robust.Shared.Maths\Robust.Shared.Maths.csproj", "{93F23A82-00C5-4572-964E-E7C9457726D4}" @@ -49,10 +45,6 @@ Global {F0ADA779-40B8-4F7E-BA6C-CDB19F3065D9}.Debug|x64.Build.0 = Debug|x64 {F0ADA779-40B8-4F7E-BA6C-CDB19F3065D9}.Release|x64.ActiveCfg = Release|x64 {F0ADA779-40B8-4F7E-BA6C-CDB19F3065D9}.Release|x64.Build.0 = Release|x64 - {D0DA124B-5580-4345-A02B-9F051F78915F}.Debug|x64.ActiveCfg = Debug|x64 - {D0DA124B-5580-4345-A02B-9F051F78915F}.Debug|x64.Build.0 = Debug|x64 - {D0DA124B-5580-4345-A02B-9F051F78915F}.Release|x64.ActiveCfg = Release|x64 - {D0DA124B-5580-4345-A02B-9F051F78915F}.Release|x64.Build.0 = Release|x64 {83429BD6-6358-4B18-BE51-401DF8EA2673}.Debug|x64.ActiveCfg = Debug|x64 {83429BD6-6358-4B18-BE51-401DF8EA2673}.Debug|x64.Build.0 = Debug|x64 {83429BD6-6358-4B18-BE51-401DF8EA2673}.Release|x64.ActiveCfg = Release|x64 @@ -78,7 +70,6 @@ Global HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution - {D0DA124B-5580-4345-A02B-9F051F78915F} = {795D76AB-19B5-4682-B51F-6DB148024A0C} {ECBCE1D8-05C2-4881-9446-197C4C8E1C14} = {9143C8DD-A989-4089-9149-C50D12189FE4} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution