selenium-chromedriverchromiumgn

How to build with targets with Google Chromium GN?


I'm trying to build the executable target for ChromeDriver from source with GN, which I installed in a directory on my PATH with Depot Tools, but when I run gn BUILD.gn I'm getting this error:

gn.py: Could not find checkout in any parent of the current path.
This must be run inside a checkout.

I'm not sure if I need to checkout the entire Chromium directory, if I'm not setting this up correctly?

UPDATE

I've downloaded a working binary of gn with the help of gn_tool.

I'm still unsure what command I'm supposed to run for "building the chromedriver target", because right now every command I try seems to give me this error:

ERROR Can't find source root. I could not find a ".gn" file in the current directory or any parent,and the --root command-line argument was not specified.

...even though there is a BUILD.gn file in the directory where I'm running gn...


Solution

  • Looks like some dependencies are missing. You can pull the dependencies by running

    gclient sync
    

    which should download the required dependencies for Chrome driver to compile. Then run the following commands to start compiling Chrome driver:

    gn gen out/YourBuildFolder
    ninja -C out/YourBuildFolder chromedriver
    

    The above gn gen... command will basically prepare the build folder for the ninja build system to compile by copying the dependencies and preparing necessary files. And ninja -C... command will actually start compiling the files

    Hope that works. Thanks