GN: add default target.
Previously, invoking ninja without specifying a target would cause it to try to
build a number of unused and broken targets carried over from Chrome. This was
worked around by building an explicit "root" target that contained only the
targets needed by Mojo. The default (no target) build is now equivalent to
"root". The "root" target still exists, but is now deprecated.
BUG=https://code.google.com/p/chromium/issues/detail?id=401761
R=jamesr@chromium.org
Review URL: https://codereview.chromium.org/809583002
diff --git a/BUILD.gn b/BUILD.gn
index 5660b42..f5bfe76 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -2,7 +2,8 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-group("root") {
+# This target will be built if no target is specified when invoking ninja.
+group("default") {
testonly = true
deps = [
@@ -17,3 +18,11 @@
deps += [ "//tools/xdisplaycheck" ]
}
}
+
+# Deprecated name for the default build target.
+group("root") {
+ testonly = true
+ deps = [
+ ":default",
+ ]
+}
diff --git a/README.md b/README.md
index 62587a7..25c6ad7 100644
--- a/README.md
+++ b/README.md
@@ -35,11 +35,9 @@
Build Mojo by running:
```
-$ ninja -C out/Debug -j 10 root
+$ ninja -C out/Debug -j 10
```
-The "root" parameter specifies the target to build, it's not a special keyword. You can find the "root" target in src/BUILD.gn.
-
(If you are a Googler, see the section at the end of this document for faster builds.)
You can also use the mojob.py script for building. This script automatically calls ninja and sets -j to an appropriate value based on whether Goma is present. You cannot specify a target name with this script.
@@ -150,5 +148,5 @@
Now you can dramatically increase the number of parallel tasks:
```
-$ ninja -C out/Debug -j 1000 root
+$ ninja -C out/Debug -j 1000
```
diff --git a/mojo/tools/mojob.py b/mojo/tools/mojob.py
index b773417..2e33c39 100755
--- a/mojo/tools/mojob.py
+++ b/mojo/tools/mojob.py
@@ -140,10 +140,9 @@
if exit_code:
return exit_code
- return subprocess.call(['ninja', '-j', '1000', '-l', '100', '-C', out_dir,
- 'root'])
+ return subprocess.call(['ninja', '-j', '1000', '-l', '100', '-C', out_dir])
else:
- return subprocess.call(['ninja', '-C', out_dir, 'root'])
+ return subprocess.call(['ninja', '-C', out_dir])
def _run_tests(config, test_types):