summaryrefslogtreecommitdiff
path: root/tools/build.py
diff options
context:
space:
mode:
authorBert Belder <bertbelder@gmail.com>2018-07-25 10:17:44 +0200
committerBert Belder <bertbelder@gmail.com>2018-07-25 20:13:17 +0200
commit4d08bb85a4276292c2121b221b4840865a13cd42 (patch)
treed7da20a39432ddcfb9e43c4e1ad010d8db310230 /tools/build.py
parent0875411267d62a0fdcaf762657f19082b440fe36 (diff)
Clean up and fix tools
* Make sync_third_party work in general * Un-break build.py and run_hooks.py on windows * Partially fix format.py on windows * Reduce code duplication between run_hooks and sync_third_party
Diffstat (limited to 'tools/build.py')
-rwxr-xr-xtools/build.py21
1 files changed, 8 insertions, 13 deletions
diff --git a/tools/build.py b/tools/build.py
index fb061eae3..8b33cef89 100755
--- a/tools/build.py
+++ b/tools/build.py
@@ -4,7 +4,8 @@ import argparse
import os
import sys
from os.path import join
-from util import run
+from third_party import depot_tools_path, third_party_path, fix_symlinks, google_env
+from util import root_path, run
import distutils.spawn
parser = argparse.ArgumentParser(description='')
@@ -16,19 +17,13 @@ parser.add_argument(
'--mode', default='debug', help='Build configuration: debug, release.')
options, targets = parser.parse_known_args()
-root_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
-third_party_path = join(root_path, "third_party")
-depot_tools_path = join(third_party_path, "depot_tools")
-gn_path = join(depot_tools_path, "gn")
-ninja_path = join(depot_tools_path, "ninja")
-
-# Add third_party/depot_tools to PATH because some google tools (e.g.
-# tool_wrapper, download_from_google_storage) use some google specific python
-# wrapper.
-os.environ["PATH"] = depot_tools_path + os.pathsep + os.environ["PATH"]
+fix_symlinks()
os.chdir(root_path)
+gn_path = join(depot_tools_path, "gn")
+ninja_path = join(depot_tools_path, "ninja")
+
if options.build_path:
build_path = options.build_path
else:
@@ -63,7 +58,7 @@ if not os.path.exists(args_filename) or options.args:
with open(args_filename, "w+") as f:
f.write("\n".join(gn_args) + "\n")
-run([gn_path, "gen", build_path])
+run([gn_path, "gen", build_path], env=google_env())
target = " ".join(targets) if targets else ":all"
-run([ninja_path, "-C", build_path, target])
+run([ninja_path, "-C", build_path, target], env=google_env())