summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJulgodis <>2021-09-26 12:11:21 +0200
committerJulgodis <>2021-09-26 12:11:21 +0200
commitbf12ea7a1111fd57bb38c9f2f8076da6894cd146 (patch)
tree8d05f635966d98788d8d7a9fbfdb142c86147f79 /tools
parentfa19d7a32e0ed5b8ff1909661220cad8fd2251b4 (diff)
Removed JUtility.h and added './tp format'
Diffstat (limited to 'tools')
-rw-r--r--tools/tp.py45
1 files changed, 35 insertions, 10 deletions
diff --git a/tools/tp.py b/tools/tp.py
index 9cbe91f342..58b21848ca 100644
--- a/tools/tp.py
+++ b/tools/tp.py
@@ -343,6 +343,31 @@ def remove_unused_asm():
text.stylize("bold green")
CONSOLE.print(text)
+@tp.command(name="format")
+@click.option('--debug/--no-debug')
+@click.option('--thread-count', '-j', 'thread_count', help="This option is passed forward to all 'make' commands.", default=4)
+@click.option('--game-path', default=DEFAULT_GAME_PATH, required=True)
+@click.option('--build-path', default=DEFAULT_BUILD_PATH, required=True)
+def format(debug, thread_count, game_path, build_path):
+ """ Format all .cpp/.h files using clang-format """
+
+ if debug:
+ LOG.setLevel(logging.DEBUG)
+
+ text = Text("--- Clang-Format")
+ text.stylize("bold magenta")
+ CONSOLE.print(text)
+
+ if clang_format(thread_count):
+ text = Text(" OK")
+ text.stylize("bold green")
+ CONSOLE.print(text)
+ else:
+ text = Text(" ERR")
+ text.stylize("bold red")
+ CONSOLE.print(text)
+ sys.exit(1)
+
@tp.command(name="pull-request")
@click.option('--debug/--no-debug')
@click.option('--thread-count', '-j', 'thread_count', help="This option is passed forward to all 'make' commands.", default=4)
@@ -361,11 +386,11 @@ def pull_request(debug, thread_count, game_path, build_path):
remove_unused_asm()
#
- text = Text("--- Full Rebuild")
+ text = Text("--- Clang-Format")
text.stylize("bold magenta")
CONSOLE.print(text)
- if rebuild(thread_count):
+ if clang_format(thread_count):
text = Text(" OK")
text.stylize("bold green")
CONSOLE.print(text)
@@ -376,32 +401,32 @@ def pull_request(debug, thread_count, game_path, build_path):
sys.exit(1)
#
- text = Text("--- Check")
+ text = Text("--- Full Rebuild")
text.stylize("bold magenta")
CONSOLE.print(text)
- try:
- check_sha1(game_path, build_path)
+ if rebuild(thread_count):
text = Text(" OK")
text.stylize("bold green")
CONSOLE.print(text)
- except CheckException as e:
- LOG.error(e)
+ else:
text = Text(" ERR")
text.stylize("bold red")
CONSOLE.print(text)
sys.exit(1)
#
- text = Text("--- Clang-Format")
+ text = Text("--- Check")
text.stylize("bold magenta")
CONSOLE.print(text)
- if clang_format(thread_count):
+ try:
+ check_sha1(game_path, build_path)
text = Text(" OK")
text.stylize("bold green")
CONSOLE.print(text)
- else:
+ except CheckException as e:
+ LOG.error(e)
text = Text(" ERR")
text.stylize("bold red")
CONSOLE.print(text)