Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(349)

Unified Diff: tools/gn/command_gyp.cc

Issue 165823003: GN: Change gen command syntax, support relative dirs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review comments fixes Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/gn/command_gen.cc ('k') | tools/gn/command_refs.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/command_gyp.cc
diff --git a/tools/gn/command_gyp.cc b/tools/gn/command_gyp.cc
index 5ed445260e95d8bd399b86cc2f41a3aea5b8692f..011f158446fe33fb3a0da37c37c72e11449f7deb 100644
--- a/tools/gn/command_gyp.cc
+++ b/tools/gn/command_gyp.cc
@@ -424,6 +424,24 @@ int RunGyp(const std::vector<std::string>& args) {
base::ElapsedTimer timer;
Setups setups;
+ const CommandLine* cmdline = CommandLine::ForCurrentProcess();
+
+ // Compute output directory.
+ std::string build_dir;
+ if (args.size() == 1) {
+ build_dir = args[0];
+ } else {
+ // Backwards-compat code for the old invocation that uses
+ // "gn gyp --output=foo"
+ // TODO(brettw) This should be removed when gyp_chromium has been updated.
+
+ // Switch to set the build output directory.
+ const char kSwitchBuildOutput[] = "output";
+ build_dir = cmdline->GetSwitchValueASCII(kSwitchBuildOutput);
+ if (build_dir.empty())
+ build_dir = "//out/Default/";
+ }
+
// Deliberately leaked to avoid expensive process teardown. We also turn off
// unused override checking since we want to merge all declared arguments and
// check those, rather than check each build individually. Otherwise, you
@@ -431,7 +449,7 @@ int RunGyp(const std::vector<std::string>& args) {
// because some args are build-type specific.
setups.debug = new Setup;
setups.debug->set_check_for_unused_overrides(false);
- if (!setups.debug->DoSetup())
+ if (!setups.debug->DoSetup(build_dir))
return 1;
const char kIsDebug[] = "is_debug";
@@ -515,7 +533,7 @@ int RunGyp(const std::vector<std::string>& args) {
base::TimeDelta elapsed_time = timer.Elapsed();
- if (!CommandLine::ForCurrentProcess()->HasSwitch(kSwitchQuiet)) {
+ if (!cmdline->HasSwitch(kSwitchQuiet)) {
OutputString("Done. ", DECORATION_GREEN);
std::string stats = "Wrote " +
« no previous file with comments | « tools/gn/command_gen.cc ('k') | tools/gn/command_refs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698