Question on Ninja target chrome_public_apk/compile.stamp

243 views
Skip to first unread message

MinhHoang To

unread,
May 29, 2015, 6:34:30 AM5/29/15
to chromi...@chromium.org


While looking at what is compiled when we run the command:  ninja -C out/Release chrome_public_apk , i fell into the dependency target 'chrome_public_apk/compile.stamp' and what i noticed on this Ninja target is the two lines from screenshot which are marked by Vim cursor

../../build/android/gyp/util/build_utils.py
../../build/android/gyp/javac.py

AFAIK, Ninja interprets those two lines as two explicit dependency targets but i could not find definitions for those two targets. On the other hand, i did try with some sample .ninja script and could confirm that the missing of definitions for dependency targets results in build failure. 

Hence, my question is how Ninja processes the two links to Python scripts in this case?

Thiago Farina

unread,
May 29, 2015, 10:18:33 AM5/29/15
to MinhHoang To, Chromium-dev
On Fri, May 29, 2015 at 7:34 AM, MinhHoang To <hoang...@gmail.com> wrote:


While looking at what is compiled when we run the command:  ninja -C out/Release chrome_public_apk ,
You can see the full command ninja is running by passing -v like this:

$ ninja -C out/Release -v chrome_public_apk
 
i fell into the dependency target 'chrome_public_apk/compile.stamp' and what i noticed on this Ninja target is the two lines from screenshot which are marked by Vim cursor

../../build/android/gyp/util/build_utils.py
../../build/android/gyp/javac.py

AFAIK, Ninja interprets those two lines as two explicit dependency targets
I dont't think it is like that. I think build_utils.py and javac.py are just inputs to chrome_public_apk.javac.jar. But I could be wrong.
 
but i could not find definitions for those two targets. On the other hand, i did try with some sample .ninja script and could confirm that the missing of definitions for dependency targets results in build failure. 

Hence, my question is how Ninja processes the two links to Python scripts in this case?

You can also ask Ninja questions in their forum ninja-build. https://groups.google.com/forum/#!forum/ninja-build

--
Thiago Farina

Newton Allen

unread,
May 29, 2015, 11:57:20 AM5/29/15
to MinhHoang To, Chromium-dev
Are you hitting compile failures, or just curious about the inner workings of ninja?

This is really a question about how ninja works. I'm not a ninja expert, but I believe that build_utils.py, javac.py and all the other files listed alongside them are the input files for compile.stamp. They're not targets; just files. If one of those files changes, then ninja will regenerate compile.stamp.

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

Nico Weber

unread,
May 29, 2015, 12:27:13 PM5/29/15
to MinhHoang To, Chromium-dev
ninja tracks dependencies between files. The code you pointed to means that compile.stamp depends on these two .py files. Paths are relative to the build directory, which for Chromium is out/Release, so this refers to the files build/android/gyp/util/build_utils.py and javac.py. If you touch either of these files then this build rule will run again.

MinhHoang To

unread,
May 29, 2015, 1:13:39 PM5/29/15
to chromi...@chromium.org, hoang...@gmail.com
@newt:
Ninja scripts are the most reliable source for me to understand what is compiled/packaged in Android Chromium. So i feel uncomfortable while hitting the scripts that seem to be out of logic.

@Nico:

The syntax of build statement in Ninja is as following:

build  out_put_files_separated_by_spaces   name_of_rule : input_files_separated_by_spaces

https://martine.github.io/ninja/manual.html#ref_dependencies

I read the reference guide of Ninja and tried some tests with some simple Ninja scripts and i experienced that the input_files_separated_by_spaces is also interpreted as list of dependency targets. And following this logic, the two links to Python scripts refer to dependency targets, which is actually not the case.


Nico Weber

unread,
May 29, 2015, 1:19:02 PM5/29/15
to MinhHoang To, Chromium-dev
On Fri, May 29, 2015 at 10:13 AM, MinhHoang To <hoang...@gmail.com> wrote:
@newt:
Ninja scripts are the most reliable source for me to understand what is compiled/packaged in Android Chromium. So i feel uncomfortable while hitting the scripts that seem to be out of logic.

@Nico:

The syntax of build statement in Ninja is as following:

build  out_put_files_separated_by_spaces   name_of_rule : input_files_separated_by_spaces

https://martine.github.io/ninja/manual.html#ref_dependencies

I read the reference guide of Ninja and tried some tests with some simple Ninja scripts and i experienced that the input_files_separated_by_spaces is also interpreted as list of dependency targets.

It's a list of files the build edge depends on. "dependency targets" are also just files.
 
And following this logic, the two links to Python scripts refer to dependency targets, which is actually not the case.

The documentation you linked to says "input files separated by spaces". The two .py files are input files.
Reply all
Reply to author
Forward
0 new messages