diff --git a/BuildChecker/.gitignore b/BuildChecker/.gitignore deleted file mode 100644 index 5eeecc18fc..0000000000 --- a/BuildChecker/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -INSTALLED_HOOKS_VERSION -DISABLE_SUBMODULE_AUTOUPDATE -*.nuget* -project.assets.json -project.packagespec.json \ No newline at end of file diff --git a/BuildChecker/BuildChecker.csproj b/BuildChecker/BuildChecker.csproj deleted file mode 100644 index 7acdbe9935..0000000000 --- a/BuildChecker/BuildChecker.csproj +++ /dev/null @@ -1,46 +0,0 @@ - - - - - python3 - py -3 - {C899FCA4-7037-4E49-ABC2-44DE72487110} - .NETFramework, Version=v4.7.2 - false - - - Library - - - - - - bin\Debug\ - - - bin\Release\ - - - - - - - - - - - - - diff --git a/BuildChecker/git_helper.py b/BuildChecker/git_helper.py deleted file mode 100644 index 00fd93a43d..0000000000 --- a/BuildChecker/git_helper.py +++ /dev/null @@ -1,104 +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 - -SOLUTION_PATH = Path("..") / "SpaceStation14.sln" -# If this doesn't match the saved version we overwrite them all. -CURRENT_HOOKS_VERSION = "2" -QUIET = len(sys.argv) == 2 and sys.argv[1] == "--quiet" - - -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="..", stdout=subprocess.PIPE) - else: - completed = subprocess.run(command, cwd="..") - - if completed.returncode != 0: - print("Error: command exited with code {}!".format(completed.returncode)) - - return completed - - -def update_submodules(): - """ - Updates all submodules. - """ - - if os.path.isfile("DISABLE_SUBMODULE_AUTOUPDATE"): - return - - # If the status doesn't match, force VS to reload the solution. - # status = run_command(["git", "submodule", "status"], capture=True) - run_command(["git", "submodule", "update", "--init", "--recursive"]) - # status2 = run_command(["git", "submodule", "status"], capture=True) - - # Something changed. - # if status.stdout != status2.stdout: - # print("Git submodules changed. Reloading solution.") - # reset_solution() - - -def install_hooks(): - """ - Installs the necessary git hooks into .git/hooks. - """ - - # Read version file. - if os.path.isfile("INSTALLED_HOOKS_VERSION"): - with open("INSTALLED_HOOKS_VERSION", "r") as f: - if f.read() == CURRENT_HOOKS_VERSION: - if not QUIET: - print("No hooks change detected.") - return - - with open("INSTALLED_HOOKS_VERSION", "w") as f: - f.write(CURRENT_HOOKS_VERSION) - - print("Hooks need updating.") - - hooks_target_dir = Path("..")/".git"/"hooks" - hooks_source_dir = Path("hooks") - - # 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) - - -if __name__ == '__main__': - install_hooks() - update_submodules() diff --git a/BuildChecker/hooks/post-checkout b/Hooks/post-checkout old mode 100755 new mode 100644 similarity index 100% rename from BuildChecker/hooks/post-checkout rename to Hooks/post-checkout diff --git a/BuildChecker/hooks/post-merge b/Hooks/post-merge old mode 100755 new mode 100644 similarity index 100% rename from BuildChecker/hooks/post-merge rename to Hooks/post-merge diff --git a/README.md b/README.md index 6332e7ccf0..8752889c2e 100644 --- a/README.md +++ b/README.md @@ -21,8 +21,9 @@ We are happy to accept contributions from anybody. Get in Discord if you want to ## Building 1. Clone this repo. -2. Run `RUN_THIS.py` to init submodules and download the engine. -3. Compile the solution. +2. In the root folder run `git submodule update --init --recursive` +3. Copy the two files from the `Hooks` folder to `.git/hooks` +4. Compile the solution. [More detailed instructions on building the project.](https://hackmd.io/@ss14/docs/%2FBZkI4RlUQbm09QWrXCZ3kg) diff --git a/RUN_THIS.py b/RUN_THIS.py deleted file mode 100755 index b7a8fcaa35..0000000000 --- a/RUN_THIS.py +++ /dev/null @@ -1,18 +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 sys -import subprocess - -IS_WINDOWS = sys.platform in ("win32", "cygwin") - -version = sys.version_info -if version.major < 3 or (version.major == 3 and version.minor < 5): - print("ERROR: You need at least Python 3.5 to build SS14.") - sys.exit(1) - -if IS_WINDOWS: - subprocess.run(["py", "-3", "git_helper.py"], cwd="BuildChecker") -else: - subprocess.run(["python3", "git_helper.py"], cwd="BuildChecker")