gn gen with --args

3,532 views
Skip to first unread message

Vincent Scheib

unread,
Mar 25, 2015, 6:23:59 PM3/25/15
to Chromium-dev
In working to create a GN based Android build I used a recent main waterfall build to find a gn command line:

python -u /b/depot_tools/gn.py --root=/b/build/slave/Android_GN/build/src gen //out/Release --args=symbol_level=1 is_debug=false target_os="android" target_cpu="arm" use_goma=true goma_dir="/b/build/goma"

However, 
gn gen outandroidgn/Debug --args=target_os="android" target_cpu="arm"

fails for me with:
ERROR Need exactly one build directory to generate.
I expected something more like "gn gen out/foo"

I worked around easily by calling "gn args outandroidgn/Debug", but I'm confused why I can't reproduce the waterfall command line with gen and --args.

Dirk Pranke

unread,
Mar 25, 2015, 6:26:53 PM3/25/15
to Vincent Scheib, Chromium-dev
The build lies to you, by not showing how things are actually tokenized in the command line.

It's actually gn.py --root=... gen //out/Release '--args=symbol_level=1 is_debug=false ...' . i.e., all of the variables are a single quoted string.

-- Dirk

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev

Scott Graham

unread,
Mar 25, 2015, 6:26:55 PM3/25/15
to Vincent Scheib, Chromium-dev
On Wed, Mar 25, 2015 at 3:22 PM, Vincent Scheib <sch...@chromium.org> wrote:
In working to create a GN based Android build I used a recent main waterfall build to find a gn command line:

python -u /b/depot_tools/gn.py --root=/b/build/slave/Android_GN/build/src gen //out/Release --args=symbol_level=1 is_debug=false target_os="android" target_cpu="arm" use_goma=true goma_dir="/b/build/goma"

However, 
gn gen outandroidgn/Debug --args=target_os="android" target_cpu="arm"

--args takes just one argument, so you need to put that whole thing in " and escape the sub ones. (or use ' if you're on linux)
 

fails for me with:
ERROR Need exactly one build directory to generate.
I expected something more like "gn gen out/foo"

I worked around easily by calling "gn args outandroidgn/Debug", but I'm confused why I can't reproduce the waterfall command line with gen and --args.

--

Thiago Farina

unread,
Mar 25, 2015, 6:27:41 PM3/25/15
to Vincent Scheib, Chromium-dev
On Wed, Mar 25, 2015 at 7:22 PM, Vincent Scheib <sch...@chromium.org> wrote:
In working to create a GN based Android build I used a recent main waterfall build to find a gn command line:

python -u /b/depot_tools/gn.py --root=/b/build/slave/Android_GN/build/src gen //out/Release --args=symbol_level=1 is_debug=false target_os="android" target_cpu="arm" use_goma=true goma_dir="/b/build/goma"

However, 
gn gen outandroidgn/Debug --args=target_os="android" target_cpu="arm"

try putting --args= between ' ' like:

--args='target_os="android" target_cpu="arm"' 

-- 
Thiago Farina

Chris Hopman

unread,
Mar 25, 2015, 6:30:30 PM3/25/15
to sch...@chromium.org, Chromium-dev
Also, having the string 'android' in your output directory name may run into an issue. At one point the sources_assignment_filter was applied to the path relative to the root of the repo when, for things in the output directory it should be relative to the root build dir (or some such). I thought there was a bug about that behavior, but I can't find it now (and so I don't know if it is fixed or not).

--
Reply all
Reply to author
Forward
0 new messages