Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

tools: update gyp to r1426

  • Loading branch information...
commit fc4e12b8f1d6e3ea010d575504011deee2a97b16 1 parent 5da7890
@bnoordhuis bnoordhuis authored
Showing with 2,950 additions and 14,046 deletions.
  1. +4 −0 tools/gyp/DEPS
  2. +60 −2 tools/gyp/PRESUBMIT.py
  3. +1 −0  tools/gyp/buildbot/buildbot_run.py
  4. +7 −4 tools/gyp/pylib/gyp/MSVSNew.py
  5. +2 −2 tools/gyp/pylib/gyp/MSVSProject.py
  6. +2 −2 tools/gyp/pylib/gyp/MSVSSettings.py
  7. +9 −8 tools/gyp/pylib/gyp/MSVSSettings_test.py
  8. +2 −2 tools/gyp/pylib/gyp/MSVSToolFile.py
  9. +3 −2 tools/gyp/pylib/gyp/MSVSUserFile.py
  10. +103 −42 tools/gyp/pylib/gyp/MSVSVersion.py
  11. +2 −2 tools/gyp/pylib/gyp/SCons.py
  12. +53 −3 tools/gyp/pylib/gyp/common.py
  13. +44 −0 tools/gyp/pylib/gyp/common_test.py
  14. +2 −0  tools/gyp/pylib/gyp/generator/dump_dependency_json.py
  15. +271 −0 tools/gyp/pylib/gyp/generator/eclipse.py
  16. +80 −98 tools/gyp/pylib/gyp/generator/make.py
  17. +267 −76 tools/gyp/pylib/gyp/generator/msvs.py
  18. +548 −167 tools/gyp/pylib/gyp/generator/ninja.py
  19. +25 −23 tools/gyp/pylib/gyp/generator/ninja_test.py
  20. +6 −3 tools/gyp/pylib/gyp/generator/scons.py
  21. +18 −14 tools/gyp/pylib/gyp/generator/xcode.py
  22. +388 −285 tools/gyp/pylib/gyp/input.py
  23. +19 −14 tools/gyp/pylib/gyp/mac_tool.py
  24. +642 −0 tools/gyp/pylib/gyp/msvs_emulation.py
  25. +15 −5 tools/gyp/pylib/gyp/ninja_syntax.py
  26. +161 −0 tools/gyp/pylib/gyp/win_tool.py
  27. +195 −129 tools/gyp/pylib/gyp/xcode_emulation.py
  28. +21 −23 tools/gyp/pylib/gyp/xcodeproj_file.py
  29. +0 −23 tools/gyp/test/actions-bare/gyptest-bare.py
  30. +0 −25 tools/gyp/test/actions-bare/src/bare.gyp
  31. +0 −11 tools/gyp/test/actions-bare/src/bare.py
  32. +0 −42 tools/gyp/test/actions-multiple/gyptest-all.py
  33. +0 −165 tools/gyp/test/actions-multiple/src/actions.gyp
  34. +0 −9 tools/gyp/test/actions-multiple/src/copy.py
  35. +0 −12 tools/gyp/test/actions-multiple/src/filter.py
  36. +0 −11 tools/gyp/test/actions-multiple/src/foo.c
  37. +0 −1  tools/gyp/test/actions-multiple/src/input.txt
  38. +0 −22 tools/gyp/test/actions-multiple/src/main.c
  39. +0 −26 tools/gyp/test/actions-subdir/gyptest-action.py
  40. +0 −11 tools/gyp/test/actions-subdir/src/make-file.py
  41. +0 −31 tools/gyp/test/actions-subdir/src/none.gyp
  42. +0 −11 tools/gyp/test/actions-subdir/src/subdir/make-subdir-file.py
  43. +0 −28 tools/gyp/test/actions-subdir/src/subdir/subdir.gyp
  44. +0 −101 tools/gyp/test/actions/gyptest-all.py
  45. +0 −68 tools/gyp/test/actions/gyptest-default.py
  46. +0 −24 tools/gyp/test/actions/gyptest-errors.py
  47. +0 −24 tools/gyp/test/actions/src/action_missing_name.gyp
  48. +0 −114 tools/gyp/test/actions/src/actions.gyp
  49. +0 −21 tools/gyp/test/actions/src/confirm-dep-files.py
  50. +0 −46 tools/gyp/test/actions/src/subdir1/counter.py
  51. +0 −74 tools/gyp/test/actions/src/subdir1/executable.gyp
  52. +0 −20 tools/gyp/test/actions/src/subdir1/make-prog1.py
  53. +0 −20 tools/gyp/test/actions/src/subdir1/make-prog2.py
  54. +0 −12 tools/gyp/test/actions/src/subdir1/program.c
  55. +0 −11 tools/gyp/test/actions/src/subdir2/make-file.py
  56. +0 −33 tools/gyp/test/actions/src/subdir2/none.gyp
  57. +0 −21 tools/gyp/test/actions/src/subdir3/generate_main.py
  58. +0 −29 tools/gyp/test/actions/src/subdir3/null_input.gyp
  59. +0 −55 tools/gyp/test/additional-targets/gyptest-additional.py
  60. +0 −13 tools/gyp/test/additional-targets/src/all.gyp
  61. +0 −56 tools/gyp/test/additional-targets/src/dir1/actions.gyp
  62. +0 −11 tools/gyp/test/additional-targets/src/dir1/emit.py
  63. +0 −6 tools/gyp/test/additional-targets/src/dir1/lib1.c
  64. +0 −31 tools/gyp/test/assembly/gyptest-assembly.py
  65. +0 −4 tools/gyp/test/assembly/src/as.bat
  66. +0 −59 tools/gyp/test/assembly/src/assembly.gyp
  67. +0 −10 tools/gyp/test/assembly/src/lib1.S
  68. +0 −3  tools/gyp/test/assembly/src/lib1.c
  69. +0 −12 tools/gyp/test/assembly/src/program.c
  70. +0 −77 tools/gyp/test/builddir/gyptest-all.py
  71. +0 −77 tools/gyp/test/builddir/gyptest-default.py
  72. +0 −21 tools/gyp/test/builddir/src/builddir.gypi
  73. +0 −6 tools/gyp/test/builddir/src/func1.c
  74. +0 −6 tools/gyp/test/builddir/src/func2.c
  75. +0 −6 tools/gyp/test/builddir/src/func3.c
  76. +0 −6 tools/gyp/test/builddir/src/func4.c
  77. +0 −6 tools/gyp/test/builddir/src/func5.c
  78. +0 −10 tools/gyp/test/builddir/src/prog1.c
  79. +0 −30 tools/gyp/test/builddir/src/prog1.gyp
  80. +0 −10 tools/gyp/test/builddir/src/subdir2/prog2.c
  81. +0 −19 tools/gyp/test/builddir/src/subdir2/prog2.gyp
  82. +0 −10 tools/gyp/test/builddir/src/subdir2/subdir3/prog3.c
  83. +0 −19 tools/gyp/test/builddir/src/subdir2/subdir3/prog3.gyp
  84. +0 −10 tools/gyp/test/builddir/src/subdir2/subdir3/subdir4/prog4.c
  85. +0 −19 tools/gyp/test/builddir/src/subdir2/subdir3/subdir4/prog4.gyp
  86. +0 −10 tools/gyp/test/builddir/src/subdir2/subdir3/subdir4/subdir5/prog5.c
  87. +0 −19 tools/gyp/test/builddir/src/subdir2/subdir3/subdir4/subdir5/prog5.gyp
  88. +0 −15 tools/gyp/test/cflags/cflags.c
  89. +0 −16 tools/gyp/test/cflags/cflags.gyp
  90. +0 −65 tools/gyp/test/cflags/gyptest-cflags.py
  91. +0 −29 tools/gyp/test/compilable/gyptest-headers.py
  92. +0 −26 tools/gyp/test/compilable/src/headers.gyp
  93. +0 −7 tools/gyp/test/compilable/src/lib1.cpp
  94. +0 −6 tools/gyp/test/compilable/src/lib1.hpp
  95. +0 −9 tools/gyp/test/compilable/src/program.cpp
  96. +0 −15 tools/gyp/test/configurations/basics/configurations.c
  97. +0 −32 tools/gyp/test/configurations/basics/configurations.gyp
  98. +0 −29 tools/gyp/test/configurations/basics/gyptest-configurations.py
  99. +0 −21 tools/gyp/test/configurations/inheritance/configurations.c
  100. +0 −40 tools/gyp/test/configurations/inheritance/configurations.gyp
  101. +0 −33 tools/gyp/test/configurations/inheritance/gyptest-inheritance.py
  102. +0 −18 tools/gyp/test/configurations/invalid/actions.gyp
  103. +0 −18 tools/gyp/test/configurations/invalid/all_dependent_settings.gyp
  104. +0 −18 tools/gyp/test/configurations/invalid/configurations.gyp
  105. +0 −18 tools/gyp/test/configurations/invalid/dependencies.gyp
  106. +0 −18 tools/gyp/test/configurations/invalid/direct_dependent_settings.gyp
  107. +0 −38 tools/gyp/test/configurations/invalid/gyptest-configurations.py
  108. +0 −18 tools/gyp/test/configurations/invalid/libraries.gyp
  109. +0 −18 tools/gyp/test/configurations/invalid/link_settings.gyp
  110. +0 −18 tools/gyp/test/configurations/invalid/sources.gyp
  111. +0 −18 tools/gyp/test/configurations/invalid/target_name.gyp
  112. +0 −18 tools/gyp/test/configurations/invalid/type.gyp
  113. +0 −58 tools/gyp/test/configurations/target_platform/configurations.gyp
  114. +0 −8 tools/gyp/test/configurations/target_platform/front.c
  115. +0 −40 tools/gyp/test/configurations/target_platform/gyptest-target_platform.py
  116. +0 −3  tools/gyp/test/configurations/target_platform/left.c
  117. +0 −3  tools/gyp/test/configurations/target_platform/right.c
  118. +0 −12 tools/gyp/test/configurations/x64/configurations.c
  119. +0 −26 tools/gyp/test/configurations/x64/configurations.gyp
  120. +0 −29 tools/gyp/test/configurations/x64/gyptest-x86.py
  121. +0 −40 tools/gyp/test/copies/gyptest-all.py
  122. +0 −40 tools/gyp/test/copies/gyptest-default.py
  123. +0 −38 tools/gyp/test/copies/gyptest-slash.py
  124. +0 −36 tools/gyp/test/copies/src/copies-slash.gyp
  125. +0 −70 tools/gyp/test/copies/src/copies.gyp
  126. +0 −1  tools/gyp/test/copies/src/directory/file3
  127. +0 −1  tools/gyp/test/copies/src/directory/file4
  128. +0 −1  tools/gyp/test/copies/src/directory/subdir/file5
  129. +0 −1  tools/gyp/test/copies/src/file1
  130. +0 −1  tools/gyp/test/copies/src/file2
  131. +0 −1  tools/gyp/test/copies/src/parentdir/subdir/file6
  132. +0 −15 tools/gyp/test/cxxflags/cxxflags.cc
  133. +0 −16 tools/gyp/test/cxxflags/cxxflags.gyp
  134. +0 −65 tools/gyp/test/cxxflags/gyptest-cxxflags.py
  135. +0 −11 tools/gyp/test/defines-escaping/defines-escaping.c
  136. +0 −19 tools/gyp/test/defines-escaping/defines-escaping.gyp
  137. +0 −184 tools/gyp/test/defines-escaping/gyptest-defines-escaping.py
  138. +0 −22 tools/gyp/test/defines/defines-env.gyp
  139. +0 −18 tools/gyp/test/defines/defines.c
  140. +0 −37 tools/gyp/test/defines/defines.gyp
  141. +0 −34 tools/gyp/test/defines/gyptest-define-override.py
  142. +0 −50 tools/gyp/test/defines/gyptest-defines-env-regyp.py
  143. +0 −85 tools/gyp/test/defines/gyptest-defines-env.py
  144. +0 −26 tools/gyp/test/defines/gyptest-defines.py
  145. +0 −9 tools/gyp/test/dependencies/a.c
  146. +0 −3  tools/gyp/test/dependencies/b/b.c
  147. +0 −22 tools/gyp/test/dependencies/b/b.gyp
  148. +0 −9 tools/gyp/test/dependencies/b/b3.c
  149. +0 −4 tools/gyp/test/dependencies/c/c.c
  150. +0 −22 tools/gyp/test/dependencies/c/c.gyp
  151. +0 −3  tools/gyp/test/dependencies/c/d.c
  152. +0 −18 tools/gyp/test/dependencies/extra_targets.gyp
  153. +0 −21 tools/gyp/test/dependencies/gyptest-extra-targets.py
  154. +0 −39 tools/gyp/test/dependencies/gyptest-lib-only.py
  155. +0 −25 tools/gyp/test/dependencies/gyptest-none-traversal.py
  156. +0 −16 tools/gyp/test/dependencies/lib_only.gyp
  157. +0 −14 tools/gyp/test/dependencies/main.c
  158. +0 −46 tools/gyp/test/dependencies/none_traversal.gyp
  159. +0 −26 tools/gyp/test/dependency-copy/gyptest-copy.py
  160. +0 −25 tools/gyp/test/dependency-copy/src/copies.gyp
  161. +0 −7 tools/gyp/test/dependency-copy/src/file1.c
  162. +0 −7 tools/gyp/test/dependency-copy/src/file2.c
  163. +0 −23 tools/gyp/test/exclusion/exclusion.gyp
  164. +0 −22 tools/gyp/test/exclusion/gyptest-exclusion.py
  165. +0 −15 tools/gyp/test/exclusion/hello.c
  166. +0 −16 tools/gyp/test/generator-output/actions/actions.gyp
  167. +0 −4 tools/gyp/test/generator-output/actions/build/README.txt
  168. +0 −4 tools/gyp/test/generator-output/actions/subdir1/actions-out/README.txt
  169. +0 −4 tools/gyp/test/generator-output/actions/subdir1/build/README.txt
  170. +0 −44 tools/gyp/test/generator-output/actions/subdir1/executable.gyp
  171. +0 −20 tools/gyp/test/generator-output/actions/subdir1/make-prog1.py
  172. +0 −20 tools/gyp/test/generator-output/actions/subdir1/make-prog2.py
  173. +0 −12 tools/gyp/test/generator-output/actions/subdir1/program.c
  174. +0 −4 tools/gyp/test/generator-output/actions/subdir2/actions-out/README.txt
  175. +0 −4 tools/gyp/test/generator-output/actions/subdir2/build/README.txt
  176. +0 −11 tools/gyp/test/generator-output/actions/subdir2/make-file.py
  177. +0 −31 tools/gyp/test/generator-output/actions/subdir2/none.gyp
  178. +0 −4 tools/gyp/test/generator-output/copies/build/README.txt
  179. +0 −4 tools/gyp/test/generator-output/copies/copies-out/README.txt
  180. +0 −50 tools/gyp/test/generator-output/copies/copies.gyp
  181. +0 −1  tools/gyp/test/generator-output/copies/file1
  182. +0 −1  tools/gyp/test/generator-output/copies/file2
  183. +0 −4 tools/gyp/test/generator-output/copies/subdir/build/README.txt
  184. +0 −4 tools/gyp/test/generator-output/copies/subdir/copies-out/README.txt
  185. +0 −1  tools/gyp/test/generator-output/copies/subdir/file3
  186. +0 −1  tools/gyp/test/generator-output/copies/subdir/file4
  187. +0 −32 tools/gyp/test/generator-output/copies/subdir/subdir.gyp
  188. +0 −58 tools/gyp/test/generator-output/gyptest-actions.py
  189. +0 −59 tools/gyp/test/generator-output/gyptest-copies.py
  190. +0 −60 tools/gyp/test/generator-output/gyptest-relocate.py
  191. +0 −58 tools/gyp/test/generator-output/gyptest-rules.py
  192. +0 −36 tools/gyp/test/generator-output/gyptest-subdir2-deep.py
  193. +0 −53 tools/gyp/test/generator-output/gyptest-top-all.py
  194. +0 −4 tools/gyp/test/generator-output/rules/build/README.txt
  195. +0 −12 tools/gyp/test/generator-output/rules/copy-file.py
  196. +0 −16 tools/gyp/test/generator-output/rules/rules.gyp
  197. +0 −4 tools/gyp/test/generator-output/rules/subdir1/build/README.txt
  198. +0 −1  tools/gyp/test/generator-output/rules/subdir1/define3.in0
  199. +0 −1  tools/gyp/test/generator-output/rules/subdir1/define4.in0
  200. +0 −59 tools/gyp/test/generator-output/rules/subdir1/executable.gyp
  201. +0 −6 tools/gyp/test/generator-output/rules/subdir1/function1.in1
  202. +0 −6 tools/gyp/test/generator-output/rules/subdir1/function2.in1
  203. +0 −18 tools/gyp/test/generator-output/rules/subdir1/program.c
  204. +0 −4 tools/gyp/test/generator-output/rules/subdir2/build/README.txt
  205. +0 −1  tools/gyp/test/generator-output/rules/subdir2/file1.in0
  206. +0 −1  tools/gyp/test/generator-output/rules/subdir2/file2.in0
  207. +0 −1  tools/gyp/test/generator-output/rules/subdir2/file3.in1
  208. +0 −1  tools/gyp/test/generator-output/rules/subdir2/file4.in1
  209. +0 −49 tools/gyp/test/generator-output/rules/subdir2/none.gyp
  210. +0 −4 tools/gyp/test/generator-output/rules/subdir2/rules-out/README.txt
  211. +0 −4 tools/gyp/test/generator-output/src/build/README.txt
  212. +0 −1  tools/gyp/test/generator-output/src/inc.h
  213. +0 −1  tools/gyp/test/generator-output/src/inc1/include1.h
  214. +0 −18 tools/gyp/test/generator-output/src/prog1.c
  215. +0 −28 tools/gyp/test/generator-output/src/prog1.gyp
  216. +0 −4 tools/gyp/test/generator-output/src/subdir2/build/README.txt
  217. +0 −4 tools/gyp/test/generator-output/src/subdir2/deeper/build/README.txt
  218. +0 −7 tools/gyp/test/generator-output/src/subdir2/deeper/deeper.c
  219. +0 −18 tools/gyp/test/generator-output/src/subdir2/deeper/deeper.gyp
  220. +0 −1  tools/gyp/test/generator-output/src/subdir2/deeper/deeper.h
  221. +0 −1  tools/gyp/test/generator-output/src/subdir2/inc2/include2.h
  222. +0 −18 tools/gyp/test/generator-output/src/subdir2/prog2.c
  223. +0 −28 tools/gyp/test/generator-output/src/subdir2/prog2.gyp
  224. +0 −4 tools/gyp/test/generator-output/src/subdir3/build/README.txt
  225. +0 −1  tools/gyp/test/generator-output/src/subdir3/inc3/include3.h
  226. +0 −18 tools/gyp/test/generator-output/src/subdir3/prog3.c
  227. +0 −25 tools/gyp/test/generator-output/src/subdir3/prog3.gyp
  228. +0 −16 tools/gyp/test/generator-output/src/symroot.gypi
  229. +0 −37 tools/gyp/test/hard_dependency/gyptest-exported-hard-dependency.py
  230. +0 −36 tools/gyp/test/hard_dependency/gyptest-no-exported-hard-dependency.py
  231. +0 −9 tools/gyp/test/hard_dependency/src/a.c
  232. +0 −12 tools/gyp/test/hard_dependency/src/a.h
  233. +0 −9 tools/gyp/test/hard_dependency/src/b.c
  234. +0 −12 tools/gyp/test/hard_dependency/src/b.h
  235. +0 −9 tools/gyp/test/hard_dependency/src/c.c
  236. +0 −10 tools/gyp/test/hard_dependency/src/c.h
  237. +0 −9 tools/gyp/test/hard_dependency/src/d.c
  238. +0 −11 tools/gyp/test/hard_dependency/src/emit.py
  239. +0 −78 tools/gyp/test/hard_dependency/src/hard_dependency.gyp
  240. +0 −24 tools/gyp/test/hello/gyptest-all.py
  241. +0 −24 tools/gyp/test/hello/gyptest-default.py
  242. +0 −32 tools/gyp/test/hello/gyptest-disable-regyp.py
  243. +0 −32 tools/gyp/test/hello/gyptest-regyp.py
  244. +0 −24 tools/gyp/test/hello/gyptest-target.py
  245. +0 −11 tools/gyp/test/hello/hello.c
  246. +0 −15 tools/gyp/test/hello/hello.gyp
  247. +0 −11 tools/gyp/test/hello/hello2.c
  248. +0 −15 tools/gyp/test/hello/hello2.gyp
  249. +0 −44 tools/gyp/test/home_dot_gyp/gyptest-home-includes-regyp.py
  250. +0 −30 tools/gyp/test/home_dot_gyp/gyptest-home-includes.py
  251. +0 −5 tools/gyp/test/home_dot_gyp/home/.gyp/include.gypi
  252. +0 −5 tools/gyp/test/home_dot_gyp/home2/.gyp/include.gypi
  253. +0 −22 tools/gyp/test/home_dot_gyp/src/all.gyp
  254. +0 −7 tools/gyp/test/home_dot_gyp/src/printfoo.c
  255. +0 −46 tools/gyp/test/include_dirs/gyptest-all.py
  256. +0 −46 tools/gyp/test/include_dirs/gyptest-default.py
  257. +0 −1  tools/gyp/test/include_dirs/src/inc.h
  258. +0 −1  tools/gyp/test/include_dirs/src/inc1/include1.h
  259. +0 −19 tools/gyp/test/include_dirs/src/includes.c
  260. +0 −27 tools/gyp/test/include_dirs/src/includes.gyp
  261. +0 −1  tools/gyp/test/include_dirs/src/shadow1/shadow.h
  262. +0 −1  tools/gyp/test/include_dirs/src/shadow2/shadow.h
  263. +0 −1  tools/gyp/test/include_dirs/src/subdir/inc.h
  264. +0 −1  tools/gyp/test/include_dirs/src/subdir/inc2/include2.h
  265. +0 −14 tools/gyp/test/include_dirs/src/subdir/subdir_includes.c
  266. +0 −20 tools/gyp/test/include_dirs/src/subdir/subdir_includes.gyp
  267. +0 −45 tools/gyp/test/intermediate_dir/gyptest-intermediate-dir.py
  268. +0 −24 tools/gyp/test/intermediate_dir/src/script.py
  269. +0 −40 tools/gyp/test/intermediate_dir/src/test.gyp
  270. +0 −40 tools/gyp/test/intermediate_dir/src/test2.gyp
  271. +0 −17 tools/gyp/test/lib/README.txt
  272. +0 −1,594 tools/gyp/test/lib/TestCmd.py
  273. +0 −581 tools/gyp/test/lib/TestCommon.py
  274. +0 −808 tools/gyp/test/lib/TestGyp.py
  275. +0 −37 tools/gyp/test/library/gyptest-shared-obj-install-path.py
  276. +0 −84 tools/gyp/test/library/gyptest-shared.py
  277. +0 −84 tools/gyp/test/library/gyptest-static.py
  278. +0 −10 tools/gyp/test/library/src/lib1.c
  279. +0 −10 tools/gyp/test/library/src/lib1_moveable.c
  280. +0 −10 tools/gyp/test/library/src/lib2.c
  281. +0 −10 tools/gyp/test/library/src/lib2_moveable.c
  282. +0 −58 tools/gyp/test/library/src/library.gyp
  283. +0 −15 tools/gyp/test/library/src/program.c
  284. +0 −33 tools/gyp/test/library/src/shared_dependency.gyp
  285. +0 −6 tools/gyp/test/link-objects/base.c
  286. +0 −5 tools/gyp/test/link-objects/extra.c
  287. +0 −28 tools/gyp/test/link-objects/gyptest-all.py
  288. +0 −24 tools/gyp/test/link-objects/link-objects.gyp
  289. +0 −34 tools/gyp/test/mac/action-envvars/action/action.gyp
  290. +0 −8 tools/gyp/test/mac/action-envvars/action/action.sh
  291. +0 −3  tools/gyp/test/mac/app-bundle/TestApp/English.lproj/InfoPlist.strings
  292. +0 −4,119 tools/gyp/test/mac/app-bundle/TestApp/English.lproj/MainMenu.xib
  293. +0 −32 tools/gyp/test/mac/app-bundle/TestApp/TestApp-Info.plist
  294. +0 −13 tools/gyp/test/mac/app-bundle/TestApp/TestAppAppDelegate.h
  295. +0 −15 tools/gyp/test/mac/app-bundle/TestApp/TestAppAppDelegate.m
  296. +0 −10 tools/gyp/test/mac/app-bundle/TestApp/main.m
  297. 0  tools/gyp/test/mac/app-bundle/empty.c
  298. +0 −39 tools/gyp/test/mac/app-bundle/test.gyp
  299. +0 −4 tools/gyp/test/mac/archs/my_file.cc
  300. +0 −9 tools/gyp/test/mac/archs/my_main_file.cc
Sorry, we could not display the entire diff because too many files (611) changed.
View
4 tools/gyp/DEPS
@@ -4,6 +4,7 @@
vars = {
"chrome_trunk": "http://src.chromium.org/svn/trunk",
+ "googlecode_url": "http://%s.googlecode.com/svn",
}
deps = {
@@ -18,5 +19,8 @@ deps_os = {
"third_party/python_26":
Var("chrome_trunk") + "/tools/third_party/python_26@89111",
+
+ "src/third_party/pefile":
+ (Var("googlecode_url") % "pefile") + "/trunk@63",
},
}
View
62 tools/gyp/PRESUBMIT.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2011 Google Inc. All rights reserved.
+# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -10,6 +10,62 @@
"""
+PYLINT_BLACKLIST = [
+ # TODO: fix me.
+ # From SCons, not done in google style.
+ 'test/lib/TestCmd.py',
+ 'test/lib/TestCommon.py',
+ 'test/lib/TestGyp.py',
+ # Needs style fix.
+ 'pylib/gyp/generator/scons.py',
+ 'pylib/gyp/generator/xcode.py',
+]
+
+
+PYLINT_DISABLED_WARNINGS = [
+ # TODO: fix me.
+ # Many tests include modules they don't use.
+ 'W0611',
+ # Include order doesn't properly include local files?
+ 'F0401',
+ # Some use of built-in names.
+ 'W0622',
+ # Some unused variables.
+ 'W0612',
+ # Operator not preceded/followed by space.
+ 'C0323',
+ 'C0322',
+ # Unnecessary semicolon.
+ 'W0301',
+ # Unused argument.
+ 'W0613',
+ # String has no effect (docstring in wrong place).
+ 'W0105',
+ # Comma not followed by space.
+ 'C0324',
+ # Access to a protected member.
+ 'W0212',
+ # Bad indent.
+ 'W0311',
+ # Line too long.
+ 'C0301',
+ # Undefined variable.
+ 'E0602',
+ # Not exception type specified.
+ 'W0702',
+ # No member of that name.
+ 'E1101',
+ # Dangerous default {}.
+ 'W0102',
+ # Others, too many to sort.
+ 'W0201', 'W0232', 'E1103', 'W0621', 'W0108', 'W0223', 'W0231',
+ 'R0201', 'E0101', 'C0321',
+ # ************* Module copy
+ # W0104:427,12:_test.odict.__setitem__: Statement seems to have no effect
+ 'W0104',
+]
+
+
def CheckChangeOnUpload(input_api, output_api):
report = []
report.extend(input_api.canned_checks.PanProjectChecks(
@@ -41,7 +97,9 @@ def CheckChangeOnCommit(input_api, output_api):
sys.path = ['pylib', 'test/lib'] + sys.path
report.extend(input_api.canned_checks.RunPylint(
input_api,
- output_api))
+ output_api,
+ black_list=PYLINT_BLACKLIST,
+ disabled_warnings=PYLINT_DISABLED_WARNINGS))
finally:
sys.path = old_sys_path
return report
View
1  tools/gyp/buildbot/buildbot_run.py
@@ -79,6 +79,7 @@ def GypBuild():
retcode += GypTestFormat('xcode')
retcode += GypTestFormat('make')
elif sys.platform == 'win32':
+ retcode += GypTestFormat('ninja')
retcode += GypTestFormat('msvs-2008', format='msvs', msvs_version='2008')
if os.environ['BUILDBOT_BUILDERNAME'] == 'gyp-win64':
retcode += GypTestFormat('msvs-2010', format='msvs', msvs_version='2010')
View
11 tools/gyp/pylib/gyp/MSVSNew.py
@@ -1,10 +1,9 @@
-# Copyright (c) 2011 Google Inc. All rights reserved.
+# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""New implementation of Visual Studio project generation for SCons."""
-import common
import os
import random
@@ -139,10 +138,11 @@ def __init__(self, path, name = None, dependencies = None, guid = None,
else:
self.config_platform_overrides = {}
self.fixpath_prefix = fixpath_prefix
+ self.msbuild_toolset = None
def set_dependencies(self, dependencies):
self.dependencies = list(dependencies or [])
-
+
def get_guid(self):
if self.guid is None:
# Set GUID from path
@@ -160,6 +160,9 @@ def get_guid(self):
self.guid = MakeGuid(self.name)
return self.guid
+ def set_msbuild_toolset(self, msbuild_toolset):
+ self.msbuild_toolset = msbuild_toolset
+
#------------------------------------------------------------------------------
@@ -204,7 +207,7 @@ def __init__(self, path, version, entries=None, variants=None,
self.Write()
- def Write(self, writer=common.WriteOnDiff):
+ def Write(self, writer=gyp.common.WriteOnDiff):
"""Writes the solution file to disk.
Raises:
View
4 tools/gyp/pylib/gyp/MSVSProject.py
@@ -1,10 +1,10 @@
-# Copyright (c) 2011 Google Inc. All rights reserved.
+# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Visual Studio project reader/writer."""
-import common
+import gyp.common
import gyp.easy_xml as easy_xml
#------------------------------------------------------------------------------
View
4 tools/gyp/pylib/gyp/MSVSSettings.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2011 The Chromium Authors. All rights reserved.
+# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -481,7 +481,7 @@ def _ValidateSettings(validators, settings, stderr):
_midl = _Tool('VCMIDLTool', 'Midl')
_rc = _Tool('VCResourceCompilerTool', 'ResourceCompile')
_lib = _Tool('VCLibrarianTool', 'Lib')
-_manifest = _Tool('VCManifestTool', 'Mt')
+_manifest = _Tool('VCManifestTool', 'Manifest')
_AddTool(_compile)
View
17 tools/gyp/pylib/gyp/MSVSSettings_test.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-# Copyright (c) 2011 Google Inc. All rights reserved.
+# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -514,7 +514,7 @@ def testValidateMSBuildSettings_settings(self):
'TreatLibWarningAsErrors': 'true',
'UseUnicodeResponseFiles': 'true',
'Verbose': 'true'},
- 'Mt': {
+ 'Manifest': {
'AdditionalManifestFiles': 'file1;file2',
'AdditionalOptions': 'a string1',
'AssemblyIdentity': 'a string1',
@@ -550,11 +550,12 @@ def testValidateMSBuildSettings_settings(self):
self._ExpectedWarnings([
'Warning: unrecognized setting ClCompile/Enableprefast',
'Warning: unrecognized setting ClCompile/ZZXYZ',
- 'Warning: unrecognized setting Mt/notgood3',
- "Warning: for Mt/GenerateCatalogFiles, expected bool; got 'truel'",
+ 'Warning: unrecognized setting Manifest/notgood3',
+ 'Warning: for Manifest/GenerateCatalogFiles, '
+ "expected bool; got 'truel'",
'Warning: for Lib/TargetMachine, unrecognized enumerated value '
'MachineX86i',
- "Warning: for Mt/EnableDPIAwareness, expected bool; got 'fal'"])
+ "Warning: for Manifest/EnableDPIAwareness, expected bool; got 'fal'"])
def testConvertToMSBuildSettings_empty(self):
"""Tests an empty conversion."""
@@ -1054,7 +1055,7 @@ def testConvertToMSBuildSettings_full_synthetic(self):
'OutputFile': 'a_file_name',
'SuppressStartupBanner': 'true',
'UseUnicodeResponseFiles': 'true'},
- 'Mt': {
+ 'Manifest': {
'AdditionalManifestFiles': 'file1;file2;file3',
'AdditionalOptions': 'a_string',
'AssemblyIdentity': 'a_string',
@@ -1124,7 +1125,7 @@ def testConvertToMSBuildSettings_actual(self):
AdditionalIncludeDirectories: ';%(AdditionalIncludeDirectories)',
AdditionalOptions: ' %(AdditionalOptions)',
PreprocessorDefinitions: ';%(PreprocessorDefinitions)',
- Mt:
+ Manifest:
AdditionalManifestFiles: ';%(AdditionalManifestFiles)',
AdditionalOptions: ' %(AdditionalOptions)',
InputResourceManifests: ';%(InputResourceManifests)',
@@ -1442,7 +1443,7 @@ def testConvertToMSBuildSettings_actual(self):
'PreprocessorDefinitions': '_UNICODE;UNICODE2',
'ResourceOutputFileName': '$(IntDir)%(Filename)3.res',
'ShowProgress': 'true'},
- 'Mt': {
+ 'Manifest': {
'AdditionalManifestFiles': 'sfsdfsd',
'AdditionalOptions': 'afdsdafsd',
'AssemblyIdentity': 'sddfdsadfsa',
View
4 tools/gyp/pylib/gyp/MSVSToolFile.py
@@ -1,10 +1,10 @@
-# Copyright (c) 2009 Google Inc. All rights reserved.
+# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Visual Studio project reader/writer."""
-import common
+import gyp.common
import gyp.easy_xml as easy_xml
View
5 tools/gyp/pylib/gyp/MSVSUserFile.py
@@ -1,13 +1,14 @@
-# Copyright (c) 2009 Google Inc. All rights reserved.
+# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Visual Studio user preferences file writer."""
-import common
import os
import re
import socket # for gethostname
+
+import gyp.common
import gyp.easy_xml as easy_xml
View
145 tools/gyp/pylib/gyp/MSVSVersion.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2011 The Chromium Authors. All rights reserved.
+# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -15,13 +15,16 @@ class VisualStudioVersion(object):
"""Information regarding a version of Visual Studio."""
def __init__(self, short_name, description,
- solution_version, project_version, flat_sln, uses_vcxproj):
+ solution_version, project_version, flat_sln, uses_vcxproj,
+ path, sdk_based):
self.short_name = short_name
self.description = description
self.solution_version = solution_version
self.project_version = project_version
self.flat_sln = flat_sln
self.uses_vcxproj = uses_vcxproj
+ self.path = path
+ self.sdk_based = sdk_based
def ShortName(self):
return self.short_name
@@ -49,6 +52,43 @@ def ProjectExtension(self):
"""Returns the file extension for the project."""
return self.uses_vcxproj and '.vcxproj' or '.vcproj'
+ def Path(self):
+ """Returns the path to Visual Studio installation."""
+ return self.path
+
+ def ToolPath(self, tool):
+ """Returns the path to a given compiler tool. """
+ return os.path.normpath(os.path.join(self.path, "VC/bin", tool))
+
+ def SetupScript(self, target_arch):
+ """Returns a command (with arguments) to be used to set up the
+ environment."""
+ # Check if we are running in the SDK command line environment and use
+ # the setup script from the SDK if so. |target_arch| should be either
+ # 'x86' or 'x64'.
+ assert target_arch in ('x86', 'x64')
+ sdk_dir = os.environ.get('WindowsSDKDir')
+ if self.sdk_based and sdk_dir:
+ return [os.path.normpath(os.path.join(sdk_dir, 'Bin/SetEnv.Cmd')),
+ '/' + target_arch]
+ else:
+ # We don't use VC/vcvarsall.bat for x86 because vcvarsall calls
+ # vcvars32, which it can only find if VS??COMNTOOLS is set, which it
+ # isn't always.
+ if target_arch == 'x86':
+ return [os.path.normpath(
+ os.path.join(self.path, 'Common7/Tools/vsvars32.bat'))]
+ else:
+ assert target_arch == 'x64'
+ arg = 'x86_amd64'
+ if (os.environ.get('PROCESSOR_ARCHITECTURE') == 'AMD64' or
+ os.environ.get('PROCESSOR_ARCHITEW6432') == 'AMD64'):
+ # Use the 64-on-64 compiler if we can.
+ arg = 'amd64'
+ return [os.path.normpath(
+ os.path.join(self.path, 'VC/vcvarsall.bat')), arg]
+
+
def _RegistryQueryBase(sysdir, key, value):
"""Use reg.exe to read a particular key.
@@ -140,7 +180,7 @@ def _RegistryKeyExists(key):
return True
-def _CreateVersion(name):
+def _CreateVersion(name, path, sdk_based=False):
"""Sets up MSVS project generation.
Setup is based off the GYP_MSVS_VERSION environment variable or whatever is
@@ -153,42 +193,54 @@ def _CreateVersion(name):
solution_version='11.00',
project_version='4.0',
flat_sln=False,
- uses_vcxproj=True),
+ uses_vcxproj=True,
+ path=path,
+ sdk_based=sdk_based),
'2010e': VisualStudioVersion('2010e',
'Visual Studio 2010',
solution_version='11.00',
project_version='4.0',
flat_sln=True,
- uses_vcxproj=True),
+ uses_vcxproj=True,
+ path=path,
+ sdk_based=sdk_based),
'2008': VisualStudioVersion('2008',
'Visual Studio 2008',
solution_version='10.00',
project_version='9.00',
flat_sln=False,
- uses_vcxproj=False),
+ uses_vcxproj=False,
+ path=path,
+ sdk_based=sdk_based),
'2008e': VisualStudioVersion('2008e',
'Visual Studio 2008',
solution_version='10.00',
project_version='9.00',
flat_sln=True,
- uses_vcxproj=False),
+ uses_vcxproj=False,
+ path=path,
+ sdk_based=sdk_based),
'2005': VisualStudioVersion('2005',
'Visual Studio 2005',
solution_version='9.00',
project_version='8.00',
flat_sln=False,
- uses_vcxproj=False),
+ uses_vcxproj=False,
+ path=path,
+ sdk_based=sdk_based),
'2005e': VisualStudioVersion('2005e',
'Visual Studio 2005',
solution_version='9.00',
project_version='8.00',
flat_sln=True,
- uses_vcxproj=False),
+ uses_vcxproj=False,
+ path=path,
+ sdk_based=sdk_based),
}
return versions[str(name)]
-def _DetectVisualStudioVersions():
+def _DetectVisualStudioVersions(versions_to_check, force_express):
"""Collect the list of installed visual studio versions.
Returns:
@@ -204,25 +256,10 @@ def _DetectVisualStudioVersions():
"""
version_to_year = {'8.0': '2005', '9.0': '2008', '10.0': '2010'}
versions = []
- # For now, prefer versions before VS2010
- for version in ('9.0', '8.0', '10.0'):
- # Check if VS2010 and later is installed as specified by
- # http://msdn.microsoft.com/en-us/library/bb164659.aspx
- keys = [r'HKLM\SOFTWARE\Microsoft\DevDiv\VS\Servicing\%s' % version,
- r'HKLM\SOFTWARE\Wow6432Node\Microsoft\DevDiv\VS\Servicing\%s' % (
- version)]
- for index in range(len(keys)):
- if not _RegistryKeyExists(keys[index]):
- continue
- # Check for express
- if _RegistryKeyExists(keys[index] + '\\expbsln'):
- # Add this one
- versions.append(_CreateVersion(version_to_year[version] + 'e'))
- else:
- # Add this one
- versions.append(_CreateVersion(version_to_year[version]))
-
- # Old (pre-VS2010) method of searching for which VS version is installed
+ for version in versions_to_check:
+ # Old method of searching for which VS version is installed
+ # We don't use the 2010-encouraged-way because we also want to get the
+ # path to the binaries, which it doesn't offer.
keys = [r'HKLM\Software\Microsoft\VisualStudio\%s' % version,
r'HKLM\Software\Wow6432Node\Microsoft\VisualStudio\%s' % version,
r'HKLM\Software\Microsoft\VCExpress\%s' % version,
@@ -232,13 +269,28 @@ def _DetectVisualStudioVersions():
if not path:
continue
# Check for full.
- if os.path.exists(os.path.join(path, 'devenv.exe')):
+ full_path = os.path.join(path, 'devenv.exe')
+ express_path = os.path.join(path, 'vcexpress.exe')
+ if not force_express and os.path.exists(full_path):
# Add this one.
- versions.append(_CreateVersion(version_to_year[version]))
+ versions.append(_CreateVersion(version_to_year[version],
+ os.path.join(path, '..', '..')))
# Check for express.
- elif os.path.exists(os.path.join(path, 'vcexpress.exe')):
+ elif os.path.exists(express_path):
# Add this one.
- versions.append(_CreateVersion(version_to_year[version] + 'e'))
+ versions.append(_CreateVersion(version_to_year[version] + 'e',
+ os.path.join(path, '..', '..')))
+
+ # The old method above does not work when only SDK is installed.
+ keys = [r'HKLM\Software\Microsoft\VisualStudio\SxS\VC7',
+ r'HKLM\Software\Wow6432Node\Microsoft\VisualStudio\SxS\VC7']
+ for index in range(len(keys)):
+ path = _RegistryGetValue(keys[index], version)
+ if not path:
+ continue
+ versions.append(_CreateVersion(version_to_year[version] + 'e',
+ os.path.join(path, '..'), sdk_based=True))
+
return versions
@@ -253,12 +305,21 @@ def SelectVisualStudioVersion(version='auto'):
# In auto mode, check environment variable for override.
if version == 'auto':
version = os.environ.get('GYP_MSVS_VERSION', 'auto')
- # In auto mode, pick the most preferred version present.
- if version == 'auto':
- versions = _DetectVisualStudioVersions()
- if not versions:
- # Default to 2005.
- return _CreateVersion('2005')
- return versions[0]
- # Convert version string into a version object.
- return _CreateVersion(version)
+ version_map = {
+ 'auto': ('10.0', '9.0', '8.0'),
+ '2005': ('8.0',),
+ '2005e': ('8.0',),
+ '2008': ('9.0',),
+ '2008e': ('9.0',),
+ '2010': ('10.0',),
+ '2010e': ('10.0',),
+ }
+ version = str(version)
+ versions = _DetectVisualStudioVersions(version_map[version], 'e' in version)
+ if not versions:
+ if version == 'auto':
+ # Default to 2005 if we couldn't find anything
+ return _CreateVersion('2005', None)
+ else:
+ return _CreateVersion(version, None)
+ return versions[0]
View
4 tools/gyp/pylib/gyp/SCons.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2011 Google Inc. All rights reserved.
+# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -84,7 +84,7 @@ class NoneTarget(TargetBase):
"""
A GYP target type of 'none', implicitly or explicitly.
"""
- def write_target(self, fp, pre=''):
+ def write_target(self, fp, src_dir='', pre=''):
fp.write('\ntarget_files.extend(input_files)\n')
View
56 tools/gyp/pylib/gyp/common.py
@@ -355,15 +355,16 @@ def GetFlavor(params):
'sunos5': 'solaris',
'freebsd7': 'freebsd',
'freebsd8': 'freebsd',
+ 'freebsd9': 'freebsd',
}
flavor = flavors.get(sys.platform, 'linux')
return params.get('flavor', flavor)
def CopyTool(flavor, out_path):
- """Finds (mac|sun)_tool.gyp in the gyp directory and copies it
+ """Finds (mac|sun|win)_tool.gyp in the gyp directory and copies it
to |out_path|."""
- prefix = { 'solaris': 'sun', 'mac': 'mac' }.get(flavor, None)
+ prefix = { 'solaris': 'sun', 'mac': 'mac', 'win': 'win' }.get(flavor, None)
if not prefix:
return
@@ -391,7 +392,7 @@ def CopyTool(flavor, out_path):
def uniquer(seq, idfun=None):
if idfun is None:
- def idfun(x): return x
+ idfun = lambda x: x
seen = {}
result = []
for item in seq:
@@ -400,3 +401,52 @@ def idfun(x): return x
seen[marker] = 1
result.append(item)
return result
+
+
+class CycleError(Exception):
+ """An exception raised when an unexpected cycle is detected."""
+ def __init__(self, nodes):
+ self.nodes = nodes
+ def __str__(self):
+ return 'CycleError: cycle involving: ' + str(self.nodes)
+
+
+def TopologicallySorted(graph, get_edges):
+ """Topologically sort based on a user provided edge definition.
+
+ Args:
+ graph: A list of node names.
+ get_edges: A function mapping from node name to a hashable collection
+ of node names which this node has outgoing edges to.
+ Returns:
+ A list containing all of the node in graph in topological order.
+ It is assumed that calling get_edges once for each node and caching is
+ cheaper than repeatedly calling get_edges.
+ Raises:
+ CycleError in the event of a cycle.
+ Example:
+ graph = {'a': '$(b) $(c)', 'b': 'hi', 'c': '$(b)'}
+ def GetEdges(node):
+ return re.findall(r'\$\(([^))]\)', graph[node])
+ print TopologicallySorted(graph.keys(), GetEdges)
+ ==>
+ ['a', 'c', b']
+ """
+ get_edges = memoize(get_edges)
+ visited = set()
+ visiting = set()
+ ordered_nodes = []
+ def Visit(node):
+ if node in visiting:
+ raise CycleError(visiting)
+ if node in visited:
+ return
+ visited.add(node)
+ visiting.add(node)
+ for neighbor in get_edges(node):
+ Visit(neighbor)
+ visiting.remove(node)
+ ordered_nodes.insert(0, node)
+ for node in sorted(graph):
+ Visit(node)
+ return ordered_nodes
View
44 tools/gyp/pylib/gyp/common_test.py
@@ -0,0 +1,44 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2012 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Unit tests for the common.py file."""
+
+import gyp.common
+import unittest
+
+
+class TestTopologicallySorted(unittest.TestCase):
+ def test_Valid(self):
+ """Test that sorting works on a valid graph with one possible order."""
+ graph = {
+ 'a': ['b', 'c'],
+ 'b': [],
+ 'c': ['d'],
+ 'd': ['b'],
+ }
+ def GetEdge(node):
+ return tuple(graph[node])
+ self.assertEqual(
+ gyp.common.TopologicallySorted(graph.keys(), GetEdge),
+ ['a', 'c', 'd', 'b'])
+
+ def test_Cycle(self):
+ """Test that an exception is thrown on a cyclic graph."""
+ graph = {
+ 'a': ['b'],
+ 'b': ['c'],
+ 'c': ['d'],
+ 'd': ['a'],
+ }
+ def GetEdge(node):
+ return tuple(graph[node])
+ self.assertRaises(
+ gyp.common.CycleError, gyp.common.TopologicallySorted,
+ graph.keys(), GetEdge)
+
+
+if __name__ == '__main__':
+ unittest.main()
View
2  tools/gyp/pylib/gyp/generator/dump_dependency_json.py
@@ -8,6 +8,8 @@
import json
import sys
+generator_supports_multiple_toolsets = True
+
generator_wants_static_library_dependencies_adjusted = False
generator_default_variables = {
View
271 tools/gyp/pylib/gyp/generator/eclipse.py
@@ -0,0 +1,271 @@
+# Copyright (c) 2012 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""GYP backend that generates Eclipse CDT settings files.
+
+This backend DOES NOT generate Eclipse CDT projects. Instead, it generates XML
+files that can be imported into an Eclipse CDT project. The XML file contains a
+list of include paths and symbols (i.e. defines).
+
+Because a full .cproject definition is not created by this generator, it's not
+possible to properly define the include dirs and symbols for each file
+individually. Instead, one set of includes/symbols is generated for the entire
+project. This works fairly well (and is a vast improvement in general), but may
+still result in a few indexer issues here and there.
+
+This generator has no automated tests, so expect it to be broken.
+"""
+
+import os.path
+import subprocess
+import gyp
+import gyp.common
+import shlex
+
+generator_wants_static_library_dependencies_adjusted = False
+
+generator_default_variables = {
+}
+
+for dirname in ['INTERMEDIATE_DIR', 'PRODUCT_DIR', 'LIB_DIR', 'SHARED_LIB_DIR']:
+ # Some gyp steps fail if these are empty(!).
+ generator_default_variables[dirname] = 'dir'
+
+for unused in ['RULE_INPUT_PATH', 'RULE_INPUT_ROOT', 'RULE_INPUT_NAME',
+ 'RULE_INPUT_DIRNAME', 'RULE_INPUT_EXT',
+ 'EXECUTABLE_PREFIX', 'EXECUTABLE_SUFFIX',
+ 'STATIC_LIB_PREFIX', 'STATIC_LIB_SUFFIX',
+ 'SHARED_LIB_PREFIX', 'SHARED_LIB_SUFFIX']:
+ generator_default_variables[unused] = ''
+
+# Include dirs will occasionaly use the SHARED_INTERMEDIATE_DIR variable as
+# part of the path when dealing with generated headers. This value will be
+# replaced dynamically for each configuration.
+generator_default_variables['SHARED_INTERMEDIATE_DIR'] = \
+ '$SHARED_INTERMEDIATES_DIR'
+
+
+def CalculateVariables(default_variables, params):
+ generator_flags = params.get('generator_flags', {})
+ for key, val in generator_flags.items():
+ default_variables.setdefault(key, val)
+ default_variables.setdefault('OS', gyp.common.GetFlavor(params))
+
+
+def CalculateGeneratorInputInfo(params):
+ """Calculate the generator specific info that gets fed to input (called by
+ gyp)."""
+ generator_flags = params.get('generator_flags', {})
+ if generator_flags.get('adjust_static_libraries', False):
+ global generator_wants_static_library_dependencies_adjusted
+ generator_wants_static_library_dependencies_adjusted = True
+
+
+def GetAllIncludeDirectories(target_list, target_dicts,
+ shared_intermediates_dir, config_name):
+ """Calculate the set of include directories to be used.
+
+ Returns:
+ A list including all the include_dir's specified for every target followed
+ by any include directories that were added as cflag compiler options.
+ """
+
+ gyp_includes_set = set()
+ compiler_includes_list = []
+
+ for target_name in target_list:
+ target = target_dicts[target_name]
+ if config_name in target['configurations']:
+ config = target['configurations'][config_name]
+
+ # Look for any include dirs that were explicitly added via cflags. This
+ # may be done in gyp files to force certain includes to come at the end.
+ # TODO(jgreenwald): Change the gyp files to not abuse cflags for this, and
+ # remove this.
+ cflags = config['cflags']
+ for cflag in cflags:
+ include_dir = ''
+ if cflag.startswith('-I'):
+ include_dir = cflag[2:]
+ if include_dir and not include_dir in compiler_includes_list:
+ compiler_includes_list.append(include_dir)
+
+ # Find standard gyp include dirs.
+ if config.has_key('include_dirs'):
+ include_dirs = config['include_dirs']
+ for include_dir in include_dirs:
+ include_dir = include_dir.replace('$SHARED_INTERMEDIATES_DIR',
+ shared_intermediates_dir)
+ if not os.path.isabs(include_dir):
+ base_dir = os.path.dirname(target_name)
+
+ include_dir = base_dir + '/' + include_dir
+ include_dir = os.path.abspath(include_dir)
+
+ if not include_dir in gyp_includes_set:
+ gyp_includes_set.add(include_dir)
+
+
+ # Generate a list that has all the include dirs.
+ all_includes_list = list(gyp_includes_set)
+ all_includes_list.sort()
+ for compiler_include in compiler_includes_list:
+ if not compiler_include in gyp_includes_set:
+ all_includes_list.append(compiler_include)
+
+ # All done.
+ return all_includes_list
+
+
+def GetCompilerPath(target_list, target_dicts, data):
+ """Determine a command that can be used to invoke the compiler.
+
+ Returns:
+ If this is a gyp project that has explicit make settings, try to determine
+ the compiler from that. Otherwise, see if a compiler was specified via the
+ CC_target environment variable.
+ """
+
+ # First, see if the compiler is configured in make's settings.
+ build_file, _, _ = gyp.common.ParseQualifiedTarget(target_list[0])
+ make_global_settings_dict = data[build_file].get('make_global_settings', {})
+ for key, value in make_global_settings_dict:
+ if key in ['CC', 'CXX']:
+ return value
+
+ # Check to see if the compiler was specified as an environment variable.
+ for key in ['CC_target', 'CC', 'CXX']:
+ compiler = os.environ.get(key)
+ if compiler:
+ return compiler
+
+ return 'gcc'
+
+
+def GetAllDefines(target_list, target_dicts, data, config_name):
+ """Calculate the defines for a project.
+
+ Returns:
+ A dict that includes explict defines declared in gyp files along with all of
+ the default defines that the compiler uses.
+ """
+
+ # Get defines declared in the gyp files.
+ all_defines = {}
+ for target_name in target_list:
+ target = target_dicts[target_name]
+
+ if config_name in target['configurations']:
+ config = target['configurations'][config_name]
+ for define in config['defines']:
+ split_define = define.split('=', 1)
+ if len(split_define) == 1:
+ split_define.append('1')
+ if split_define[0].strip() in all_defines:
+ # Already defined
+ continue
+
+ all_defines[split_define[0].strip()] = split_define[1].strip()
+
+ # Get default compiler defines (if possible).
+ cc_target = GetCompilerPath(target_list, target_dicts, data)
+ if cc_target:
+ command = shlex.split(cc_target)
+ command.extend(['-E', '-dM', '-'])
+ cpp_proc = subprocess.Popen(args=command, cwd='.',
+ stdin=subprocess.PIPE, stdout=subprocess.PIPE)
+ cpp_output = cpp_proc.communicate()[0]
+ cpp_lines = cpp_output.split('\n')
+ for cpp_line in cpp_lines:
+ if not cpp_line.strip():
+ continue
+ cpp_line_parts = cpp_line.split(' ', 2)
+ key = cpp_line_parts[1]
+ if len(cpp_line_parts) >= 3:
+ val = cpp_line_parts[2]
+ else:
+ val = '1'
+ all_defines[key] = val
+
+ return all_defines
+
+
+def WriteIncludePaths(out, eclipse_langs, include_dirs):
+ """Write the includes section of a CDT settings export file."""
+
+ out.write(' <section name="org.eclipse.cdt.internal.ui.wizards.' \
+ 'settingswizards.IncludePaths">\n')
+ out.write(' <language name="holder for library settings"></language>\n')
+ for lang in eclipse_langs:
+ out.write(' <language name="%s">\n' % lang)
+ for include_dir in include_dirs:
+ out.write(' <includepath workspace_path="false">%s</includepath>\n' %
+ include_dir)
+ out.write(' </language>\n')
+ out.write(' </section>\n')
+
+
+def WriteMacros(out, eclipse_langs, defines):
+ """Write the macros section of a CDT settings export file."""
+
+ out.write(' <section name="org.eclipse.cdt.internal.ui.wizards.' \
+ 'settingswizards.Macros">\n')
+ out.write(' <language name="holder for library settings"></language>\n')
+ for lang in eclipse_langs:
+ out.write(' <language name="%s">\n' % lang)
+ for key in sorted(defines.iterkeys()):
+ out.write(' <macro><name>%s</name><value>%s</value></macro>\n' %
+ (key, defines[key]))
+ out.write(' </language>\n')
+ out.write(' </section>\n')
+
+
+def GenerateOutputForConfig(target_list, target_dicts, data, params,
+ config_name):
+ options = params['options']
+ generator_flags = params.get('generator_flags', {})
+
+ # build_dir: relative path from source root to our output files.
+ # e.g. "out/Debug"
+ build_dir = os.path.join(generator_flags.get('output_dir', 'out'),
+ config_name)
+
+ toplevel_build = os.path.join(options.toplevel_dir, build_dir)
+ shared_intermediate_dir = os.path.join(toplevel_build, 'obj', 'gen')
+
+ if not os.path.exists(toplevel_build):
+ os.makedirs(toplevel_build)
+ out = open(os.path.join(toplevel_build, 'eclipse-cdt-settings.xml'), 'w')
+
+ out.write('<?xml version="1.0" encoding="UTF-8"?>\n')
+ out.write('<cdtprojectproperties>\n')
+
+ eclipse_langs = ['C++ Source File', 'C Source File', 'Assembly Source File',
+ 'GNU C++', 'GNU C', 'Assembly']
+ include_dirs = GetAllIncludeDirectories(target_list, target_dicts,
+ shared_intermediate_dir, config_name)
+ WriteIncludePaths(out, eclipse_langs, include_dirs)
+ defines = GetAllDefines(target_list, target_dicts, data, config_name)
+ WriteMacros(out, eclipse_langs, defines)
+
+ out.write('</cdtprojectproperties>\n')
+ out.close()
+
+
+def GenerateOutput(target_list, target_dicts, data, params):
+ """Generate an XML settings file that can be imported into a CDT project."""
+
+ if params['options'].generator_output:
+ raise NotImplementedError, "--generator_output not implemented for eclipse"
+
+ user_config = params.get('generator_flags', {}).get('config', None)
+ if user_config:
+ GenerateOutputForConfig(target_list, target_dicts, data, params,
+ user_config)
+ else:
+ config_names = target_dicts[target_list[0]]['configurations'].keys()
+ for config_name in config_names:
+ GenerateOutputForConfig(target_list, target_dicts, data, params,
+ config_name)
+
View
178 tools/gyp/pylib/gyp/generator/make.py
@@ -43,8 +43,6 @@
'RULE_INPUT_PATH': '$(abspath $<)',
'RULE_INPUT_EXT': '$(suffix $<)',
'RULE_INPUT_NAME': '$(notdir $<)',
-
- # This appears unused --- ?
'CONFIGURATION_NAME': '$(BUILDTYPE)',
}
@@ -54,6 +52,11 @@
# Request sorted dependencies in the order from dependents to dependencies.
generator_wants_sorted_dependencies = False
+# Placates pylint.
+generator_additional_non_configuration_keys = []
+generator_additional_path_sections = []
+generator_extra_sources_for_rules = []
+
def CalculateVariables(default_variables, params):
"""Calculate additional variables for use in the build (called by gyp)."""
@@ -79,7 +82,6 @@ def CalculateVariables(default_variables, params):
global generator_extra_sources_for_rules
generator_extra_sources_for_rules = getattr(xcode_generator,
'generator_extra_sources_for_rules', [])
- global COMPILABLE_EXTENSIONS
COMPILABLE_EXTENSIONS.update({'.m': 'objc', '.mm' : 'objcxx'})
else:
operating_system = flavor
@@ -438,6 +440,11 @@ def ensure_directory_exists(path):
.PHONY: %(default_target)s
%(default_target)s:
+# make looks for ways to re-generate included makefiles, but in our case, we
+# don't have a direct way. Explicitly telling make that it has nothing to do
+# for them makes it go faster.
+%%.d: ;
+
# Use FORCE_DO_CMD to force a target to run. Should be coupled with
# do_cmd.
.PHONY: FORCE_DO_CMD
@@ -523,18 +530,7 @@ def WriteRootHeaderSuffixRules(writer):
# target in our tree. Only consider the ones with .d (dependency) info:
d_files := $(wildcard $(foreach f,$(all_deps),$(depsdir)/$(f).d))
ifneq ($(d_files),)
- # Rather than include each individual .d file, concatenate them into a
- # single file which make is able to load faster. We split this into
- # commands that take 512 files at a time to avoid overflowing the
- # command line.
- $(shell cat $(wordlist 1,512,$(d_files)) > $(depsdir)/all.deps)
-%(generate_all_deps)s
- # make looks for ways to re-generate included makefiles, but in our case, we
- # don't have a direct way. Explicitly telling make that it has nothing to do
- # for them makes it go faster.
- $(depsdir)/all.deps: ;
-
- include $(depsdir)/all.deps
+ include $(d_files)
endif
"""
@@ -589,7 +585,9 @@ def EscapeCppDefine(s):
"""Escapes a CPP define so that it will reach the compiler unaltered."""
s = EscapeShellArgument(s)
s = EscapeMakeVariableExpansion(s)
- return s
+ # '#' characters must be escaped even embedded in a string, else Make will
+ # treat it as the start of a comment.
+ return s.replace('#', r'\#')
def QuoteIfNecessary(string):
@@ -602,8 +600,7 @@ def QuoteIfNecessary(string):
def StringToMakefileVariable(string):
"""Convert a string to a value that is acceptable as a make variable name."""
- # TODO: replace other metacharacters that we encounter.
- return re.sub('[ {}$]', '_', string)
+ return re.sub('[^a-zA-Z0-9_]', '_', string)
srcdir_prefix = ''
@@ -620,6 +617,21 @@ def QuoteSpaces(s, quote=r'\ '):
return s.replace(' ', quote)
+def InvertRelativePath(path):
+ """Given a relative path like foo/bar, return the inverse relative path:
+ the path from the relative path back to the origin dir.
+
+ E.g. os.path.normpath(os.path.join(path, InvertRelativePath(path)))
+ should always produce the empty string."""
+
+ if not path:
+ return path
+ # Only need to handle relative paths into subdirectories for now.
+ assert '..' not in path, path
+ depth = len(path.split(os.path.sep))
+ return os.path.sep.join(['..'] * depth)
+
+
# Map from qualified target to path to output.
target_outputs = {}
# Map from qualified target to any linkable output. A subset
@@ -638,8 +650,6 @@ class MakefileWriter:
def __init__(self, generator_flags, flavor):
self.generator_flags = generator_flags
self.flavor = flavor
- # Keep track of the total number of outputs for this makefile.
- self._num_outputs = 0
self.suffix_rules_srcdir = {}
self.suffix_rules_objdir1 = {}
@@ -664,10 +674,6 @@ def __init__(self, generator_flags, flavor):
""" % (ext, COMPILABLE_EXTENSIONS[ext]))})
- def NumOutputs(self):
- return self._num_outputs
-
-
def Write(self, qualified_target, base_path, output_filename, spec, configs,
part_of_all):
"""The main entry point: writes a .mk file for a single target.
@@ -686,6 +692,7 @@ def Write(self, qualified_target, base_path, output_filename, spec, configs,
self.fp.write(header)
+ self.qualified_target = qualified_target
self.path = base_path
self.target = spec['target_name']
self.type = spec['type']
@@ -753,7 +760,8 @@ def Write(self, qualified_target, base_path, output_filename, spec, configs,
configs, deps, all_sources, extra_outputs,
extra_link_deps, part_of_all,
gyp.xcode_emulation.MacPrefixHeader(
- self.xcode_settings, self.Absolutify, self.Pchify))
+ self.xcode_settings, lambda p: Sourceify(self.Absolutify(p)),
+ self.Pchify))
sources = filter(Compilable, all_sources)
if sources:
self.WriteLn(SHARED_HEADER_SUFFIX_RULES_COMMENT1)
@@ -831,7 +839,8 @@ def WriteActions(self, actions, extra_sources, extra_outputs,
part_of_all: flag indicating this target is part of 'all'
"""
for action in actions:
- name = self.target + '_' + StringToMakefileVariable(action['action_name'])
+ name = StringToMakefileVariable('%s_%s' % (self.qualified_target,
+ action['action_name']))
self.WriteLn('### Rules for action "%s":' % action['action_name'])
inputs = action['inputs']
outputs = action['outputs']
@@ -888,7 +897,7 @@ def WriteActions(self, actions, extra_sources, extra_outputs,
# Same for environment.
self.WriteLn("%s: obj := $(abs_obj)" % QuoteSpaces(outputs[0]))
self.WriteLn("%s: builddir := $(abs_builddir)" % QuoteSpaces(outputs[0]))
- self.WriteXcodeEnv(outputs[0], self.GetXcodeEnv())
+ self.WriteSortedXcodeEnv(outputs[0], self.GetSortedXcodeEnv())
for input in inputs:
assert ' ' not in input, (
@@ -898,7 +907,7 @@ def WriteActions(self, actions, extra_sources, extra_outputs,
"Spaces in action output filenames not supported (%s)" % output)
# See the comment in WriteCopies about expanding env vars.
- env = self.GetXcodeEnv()
+ env = self.GetSortedXcodeEnv()
outputs = [gyp.xcode_emulation.ExpandEnvVars(o, env) for o in outputs]
inputs = [gyp.xcode_emulation.ExpandEnvVars(i, env) for i in inputs]
@@ -925,7 +934,8 @@ def WriteRules(self, rules, extra_sources, extra_outputs,
part_of_all: flag indicating this target is part of 'all'
"""
for rule in rules:
- name = self.target + '_' + StringToMakefileVariable(rule['rule_name'])
+ name = StringToMakefileVariable('%s_%s' % (self.qualified_target,
+ rule['rule_name']))
count = 0
self.WriteLn('### Generated for rule %s:' % name)
@@ -941,12 +951,6 @@ def WriteRules(self, rules, extra_sources, extra_outputs,
rule_source_dirname)
for out in rule['outputs']]
- # If an output is just the file name, turn it into a path so
- # FixupArgPath() will know to Absolutify() it.
- outputs = map(
- lambda x : os.path.dirname(x) and x or os.path.join('.', x),
- outputs)
-
for out in outputs:
dir = os.path.dirname(out)
if dir:
@@ -955,7 +959,6 @@ def WriteRules(self, rules, extra_sources, extra_outputs,
extra_sources += outputs
if int(rule.get('process_outputs_as_mac_bundle_resources', False)):
extra_mac_bundle_resources += outputs
- all_outputs += outputs
inputs = map(Sourceify, map(self.Absolutify, [rule_source] +
rule.get('inputs', [])))
actions = ['$(call do_cmd,%s_%d)' % (name, count)]
@@ -969,6 +972,8 @@ def WriteRules(self, rules, extra_sources, extra_outputs,
# amount of pain.
actions += ['@touch --no-create $@']
+ outputs = map(self.Absolutify, outputs)
+ all_outputs += outputs
# Only write the 'obj' and 'builddir' rules for the "primary" output
# (:1); it's superfluous for the "extra outputs", and this avoids
# accidentally writing duplicate dummy rules for those outputs.
@@ -979,7 +984,6 @@ def WriteRules(self, rules, extra_sources, extra_outputs,
assert ' ' not in output, (
"Spaces in rule filenames not yet supported (%s)" % output)
self.WriteLn('all_deps += %s' % ' '.join(outputs))
- self._num_outputs += len(outputs)
action = [self.ExpandInputRoot(ac, rule_source_root,
rule_source_dirname)
@@ -1041,7 +1045,7 @@ def WriteCopies(self, copies, extra_outputs, part_of_all):
"""
self.WriteLn('### Generated for copy rule.')
- variable = self.target + '_copies'
+ variable = StringToMakefileVariable(self.qualified_target + '_copies')
outputs = []
for copy in copies:
for path in copy['files']:
@@ -1060,7 +1064,7 @@ def WriteCopies(self, copies, extra_outputs, part_of_all):
# As a workaround, manually expand variables at gyp time. Since 'copies'
# can't run scripts, there's no need to write the env then.
# WriteDoCmd() will escape spaces for .d files.
- env = self.GetXcodeEnv()
+ env = self.GetSortedXcodeEnv()
output = gyp.xcode_emulation.ExpandEnvVars(output, env)
path = gyp.xcode_emulation.ExpandEnvVars(path, env)
self.WriteDoCmd([output], [path], 'copy', part_of_all)
@@ -1086,7 +1090,7 @@ def WriteMacInfoPlist(self, bundle_deps):
"""Write Makefile code for bundle Info.plist files."""
info_plist, out, defines, extra_env = gyp.xcode_emulation.GetMacInfoPlist(
generator_default_variables['PRODUCT_DIR'], self.xcode_settings,
- self.Absolutify)
+ lambda p: Sourceify(self.Absolutify(p)))
if not info_plist:
return
if defines:
@@ -1102,7 +1106,8 @@ def WriteMacInfoPlist(self, bundle_deps):
'@plutil -convert xml1 $@ $@'])
info_plist = intermediate_plist
# plists can contain envvars and substitute them into the file.
- self.WriteXcodeEnv(out, self.GetXcodeEnv(additional_settings=extra_env))
+ self.WriteSortedXcodeEnv(
+ out, self.GetSortedXcodeEnv(additional_settings=extra_env))
self.WriteDoCmd([out], [info_plist], 'mac_tool,,,copy-info-plist',
part_of_all=True)
bundle_deps.append(out)
@@ -1165,7 +1170,6 @@ def WriteSources(self, configs, deps, sources,
self.WriteLn('# Add to the list of files we specially track '
'dependencies for.')
self.WriteLn('all_deps += $(OBJS)')
- self._num_outputs += len(objs)
self.WriteLn()
# Make sure our dependencies are built first.
@@ -1225,7 +1229,7 @@ def WriteSources(self, configs, deps, sources,
"$(CFLAGS_CC_$(BUILDTYPE)) "
"$(CFLAGS_OBJCC_$(BUILDTYPE))")
- self.WritePchTargets(precompiled_header.GetGchBuildCommands())
+ self.WritePchTargets(precompiled_header.GetPchBuildCommands())
# If there are any object files in our input file list, link them into our
# output.
@@ -1384,8 +1388,7 @@ def WriteTarget(self, spec, configs, deps, link_deps, bundle_deps,
self.WriteMakeRule(extra_outputs, deps,
comment=('Preserve order dependency of '
'special output on deps.'),
- order_only = True,
- multiple_output_trick = False)
+ order_only = True)
target_postbuilds = {}
if self.type != 'none':
@@ -1393,13 +1396,17 @@ def WriteTarget(self, spec, configs, deps, link_deps, bundle_deps,
config = configs[configname]
if self.flavor == 'mac':
ldflags = self.xcode_settings.GetLdflags(configname,
- generator_default_variables['PRODUCT_DIR'], self.Absolutify)
+ generator_default_variables['PRODUCT_DIR'],
+ lambda p: Sourceify(self.Absolutify(p)))
# TARGET_POSTBUILDS_$(BUILDTYPE) is added to postbuilds later on.
+ gyp_to_build = InvertRelativePath(self.path)
target_postbuild = self.xcode_settings.GetTargetPostbuilds(
configname,
- QuoteSpaces(self.output),
- QuoteSpaces(self.output_binary))
+ QuoteSpaces(os.path.normpath(os.path.join(gyp_to_build,
+ self.output))),
+ QuoteSpaces(os.path.normpath(os.path.join(gyp_to_build,
+ self.output_binary))))
if target_postbuild:
target_postbuilds[configname] = target_postbuild
else:
@@ -1430,13 +1437,13 @@ def WriteTarget(self, spec, configs, deps, link_deps, bundle_deps,
if target_postbuilds:
postbuilds.append('$(TARGET_POSTBUILDS_$(BUILDTYPE))')
postbuilds.extend(
- gyp.xcode_emulation.GetSpecPostbuildCommands(spec, self.Absolutify))
+ gyp.xcode_emulation.GetSpecPostbuildCommands(spec))
if postbuilds:
# Envvars may be referenced by TARGET_POSTBUILDS_$(BUILDTYPE),
# so we must output its definition first, since we declare variables
# using ":=".
- self.WriteXcodeEnv(self.output, self.GetXcodePostbuildEnv())
+ self.WriteSortedXcodeEnv(self.output, self.GetSortedXcodePostbuildEnv())
for configname in target_postbuilds:
self.WriteLn('%s: TARGET_POSTBUILDS_%s := %s' %
@@ -1444,6 +1451,9 @@ def WriteTarget(self, spec, configs, deps, link_deps, bundle_deps,
configname,
gyp.common.EncodePOSIXShellList(target_postbuilds[configname])))
+ # Postbuilds expect to be run in the gyp file's directory, so insert an
+ # implicit postbuild to cd to there.
+ postbuilds.insert(0, gyp.common.EncodePOSIXShellList(['cd', self.path]))
for i in xrange(len(postbuilds)):
if not postbuilds[i].startswith('$'):
postbuilds[i] = EscapeShellArgument(postbuilds[i])
@@ -1555,7 +1565,8 @@ def WriteTarget(self, spec, configs, deps, link_deps, bundle_deps,
file_desc = 'executable'
install_path = self._InstallableTargetInstallPath()
installable_deps = [self.output]
- if self.flavor == 'mac' and not 'product_dir' in spec:
+ if (self.flavor == 'mac' and not 'product_dir' in spec and
+ self.toolset == 'target'):
# On mac, products are created in install_path immediately.
assert install_path == self.output, '%s != %s' % (
install_path, self.output)
@@ -1614,12 +1625,10 @@ def WriteDoCmd(self, outputs, inputs, command, part_of_all, comment=None,
# other functions.
outputs = [QuoteSpaces(o, SPACE_REPLACEMENT) for o in outputs]
self.WriteLn('all_deps += %s' % ' '.join(outputs))
- self._num_outputs += len(outputs)
def WriteMakeRule(self, outputs, inputs, actions=None, comment=None,
- order_only=False, force=False, phony=False,
- multiple_output_trick=True):
+ order_only=False, force=False, phony=False):
"""Write a Makefile rule, with some extra tricks.
outputs: a list of outputs for the rule (note: this is not directly
@@ -1632,8 +1641,6 @@ def WriteMakeRule(self, outputs, inputs, actions=None, comment=None,
force: if true, include FORCE_DO_CMD as an order-only dep
phony: if true, the rule does not actually generate the named output, the
output is just a name to run the rule
- multiple_output_trick: if true (the default), perform tricks such as dummy
- rules to avoid problems with multiple outputs.
"""
outputs = map(QuoteSpaces, outputs)
inputs = map(QuoteSpaces, inputs)
@@ -1645,20 +1652,22 @@ def WriteMakeRule(self, outputs, inputs, actions=None, comment=None,
# TODO(evanm): just make order_only a list of deps instead of these hacks.
if order_only:
order_insert = '| '
+ pick_output = ' '.join(outputs)
else:
order_insert = ''
+ pick_output = outputs[0]
if force:
force_append = ' FORCE_DO_CMD'
else:
force_append = ''
if actions:
self.WriteLn("%s: TOOLSET := $(TOOLSET)" % outputs[0])
- self.WriteLn('%s: %s%s%s' % (outputs[0], order_insert, ' '.join(inputs),
+ self.WriteLn('%s: %s%s%s' % (pick_output, order_insert, ' '.join(inputs),
force_append))
if actions:
for action in actions:
self.WriteLn('\t%s' % action)
- if multiple_output_trick and len(outputs) > 1:
+ if not order_only and len(outputs) > 1:
# If we have more than one output, a rule like
# foo bar: baz
# that for *each* output we must run the action, potentially
@@ -1768,37 +1777,33 @@ def WriteLn(self, text=''):
self.fp.write(text + '\n')
- def GetXcodeEnv(self, additional_settings=None):
- return gyp.xcode_emulation.GetXcodeEnv(
+ def GetSortedXcodeEnv(self, additional_settings=None):
+ return gyp.xcode_emulation.GetSortedXcodeEnv(
self.xcode_settings, "$(abs_builddir)",
os.path.join("$(abs_srcdir)", self.path), "$(BUILDTYPE)",
additional_settings)
- def GetXcodePostbuildEnv(self):
+ def GetSortedXcodePostbuildEnv(self):
# CHROMIUM_STRIP_SAVE_FILE is a chromium-specific hack.
# TODO(thakis): It would be nice to have some general mechanism instead.
strip_save_file = self.xcode_settings.GetPerTargetSetting(
- 'CHROMIUM_STRIP_SAVE_FILE')
- if strip_save_file:
- strip_save_file = self.Absolutify(strip_save_file)
- else:
- # Explicitly clear this out, else a postbuild might pick up an export
- # from an earlier target.
- strip_save_file = ''
- return self.GetXcodeEnv(
+ 'CHROMIUM_STRIP_SAVE_FILE', '')
+ # Even if strip_save_file is empty, explicitly write it. Else a postbuild
+ # might pick up an export from an earlier target.
+ return self.GetSortedXcodeEnv(
additional_settings={'CHROMIUM_STRIP_SAVE_FILE': strip_save_file})
- def WriteXcodeEnv(self, target, env):
- for k in gyp.xcode_emulation.TopologicallySortedEnvVarKeys(env):
+ def WriteSortedXcodeEnv(self, target, env):
+ for k, v in env:
# For
# foo := a\ b
# the escaped space does the right thing. For
# export foo := a\ b
# it does not -- the backslash is written to the env as literal character.
# So don't escape spaces in |env[k]|.
- self.WriteLn('%s: export %s := %s' % (QuoteSpaces(target), k, env[k]))
+ self.WriteLn('%s: export %s := %s' % (QuoteSpaces(target), k, v))
def Objectify(self, path):
@@ -1829,12 +1834,6 @@ def Absolutify(self, path):
return os.path.normpath(os.path.join(self.path, path))
- def FixupArgPath(self, arg):
- if '/' in arg or '.h.' in arg:
- return self.Absolutify(arg)
- return arg
-
-
def ExpandInputRoot(self, template, expansion, dirname):
if '%(INPUT_ROOT)s' not in template and '%(INPUT_DIRNAME)s' not in template:
return template
@@ -1849,7 +1848,8 @@ def _InstallableTargetInstallPath(self):
"""Returns the location of the final output for an installable target."""
# Xcode puts shared_library results into PRODUCT_DIR, and some gyp files
# rely on this. Emulate this behavior for mac.
- if self.type == 'shared_library' and self.flavor != 'mac':
+ if (self.type == 'shared_library' and
+ (self.flavor != 'mac' or self.toolset != 'target')):
# Install all shared libs into a common directory (per toolset) for
# convenient access with LD_LIBRARY_PATH.
return '$(builddir)/lib.%s/%s' % (self.toolset, self.alias)
@@ -2040,7 +2040,6 @@ def CalculateMakefilePath(build_file, base_name):
for target in gyp.common.AllTargets(target_list, target_dicts, build_file):
needed_targets.add(target)
- num_outputs = 0
build_files = set()
include_list = set()
for qualified_target in target_list:
@@ -2081,7 +2080,6 @@ def CalculateMakefilePath(build_file, base_name):
writer = MakefileWriter(generator_flags, flavor)
writer.Write(qualified_target, base_path, output_file, spec, configs,
part_of_all=qualified_target in needed_targets)
- num_outputs += writer.NumOutputs()
# Our root_makefile lives at the source root. Compute the relative path
# from there to the output_file for including.
@@ -2128,22 +2126,6 @@ def CalculateMakefilePath(build_file, base_name):
if generator_flags.get('auto_regeneration', True):
WriteAutoRegenerationRule(params, root_makefile, makefile_name, build_files)
- # Write the rule to load dependencies. We batch 512 files at a time to
- # avoid overflowing the command line.
- all_deps = ""
- for i in range(513, num_outputs, 512):
- all_deps += ("""
- ifneq ($(word %(start)d,$(d_files)),)
- $(shell cat $(wordlist %(start)d,%(end)d,$(d_files)) >> $(depsdir)/all.deps)
- endif""" % { 'start': i, 'end': i + 999 })
-
- # Add a check to make sure we tried to process all the .d files.
- all_deps += """
- ifneq ($(word %(last)d,$(d_files)),)
- $(error Found unprocessed dependency files (gyp didn't generate enough rules!))
- endif
-""" % { 'last': ((num_outputs / 512) + 1) * 512 + 1 }
-
- root_makefile.write(SHARED_FOOTER % { 'generate_all_deps': all_deps })
+ root_makefile.write(SHARED_FOOTER)
root_makefile.close()
View
343 tools/gyp/pylib/gyp/generator/msvs.py
@@ -42,19 +42,7 @@
'SHARED_INTERMEDIATE_DIR': '$(OutDir)/obj/global_intermediate',
'OS': 'win',
'PRODUCT_DIR': '$(OutDir)',
-
- # TODO(jeanluc) The way we currently generate libraries makes Visual
- # Studio 2010 unhappy. We get a lot of warnings like:
- # warning MSB8012: TargetPath(...\Debug\gles2_c_lib.lib) does not match
- # the Library's OutputFile property value (...\Debug\lib\gles2_c_lib.lib).
- # This may cause your project to build incorrectly. To correct this,
- # please make sure that $(OutDir), $(TargetName) and $(TargetExt) property
- # values match the value specified in %(Lib.OutputFile).
- # Despite the warnings, this compile correctly. It would be nice to get rid
- # of the warnings.
-
- # TODO(jeanluc) I had: 'LIB_DIR': '$(OutDir)lib',
- 'LIB_DIR': '$(OutDir)/lib',
+ 'LIB_DIR': '$(OutDir)\\lib',
'RULE_INPUT_ROOT': '$(InputName)',
'RULE_INPUT_DIRNAME': '$(InputDir)',
'RULE_INPUT_EXT': '$(InputExt)',
@@ -254,7 +242,7 @@ def _ConfigFullName(config_name, config_data):
def _BuildCommandLineForRuleRaw(spec, cmd, cygwin_shell, has_input_path,
- quote_cmd):
+ quote_cmd, do_setup_env):
if [x for x in cmd if '$(InputDir)' in x]:
input_dir_preamble = (
@@ -285,9 +273,10 @@ def _BuildCommandLineForRuleRaw(spec, cmd, cygwin_shell, has_input_path,
#direct_cmd = gyp.common.EncodePOSIXShellList(direct_cmd)
direct_cmd = ' '.join(direct_cmd)
# TODO(quote): regularize quoting path names throughout the module
- cmd = (
- 'call "$(ProjectDir)%(cygwin_dir)s\\setup_env.bat" && '
- 'set CYGWIN=nontsec&& ')
+ cmd = ''
+ if do_setup_env:
+ cmd += 'call "$(ProjectDir)%(cygwin_dir)s\\setup_env.bat" && '
+ cmd += 'set CYGWIN=nontsec&& '
if direct_cmd.find('NUMBER_OF_PROCESSORS') >= 0:
cmd += 'set /a NUMBER_OF_PROCESSORS_PLUS_1=%%NUMBER_OF_PROCESSORS%%+1&& '
if direct_cmd.find('INTDIR') >= 0:
@@ -319,10 +308,7 @@ def _BuildCommandLineForRuleRaw(spec, cmd, cygwin_shell, has_input_path,
return input_dir_preamble + ' '.join(command + arguments)
-def _BuildCommandLineForRule(spec, rule, has_input_path):
- # Find path to cygwin.
- cygwin_dir = _FixPath(spec.get('msvs_cygwin_dirs', ['.'])[0])
-
+def _BuildCommandLineForRule(spec, rule, has_input_path, do_setup_env):
# Currently this weird argument munging is used to duplicate the way a
# python script would need to be run as part of the chrome tree.
# Eventually we should add some sort of rule_default option to set this
@@ -334,7 +320,7 @@ def _BuildCommandLineForRule(spec, rule, has_input_path):
mcs = int(mcs)
quote_cmd = int(rule.get('msvs_quote_cmd', 1))
return _BuildCommandLineForRuleRaw(spec, rule['action'], mcs, has_input_path,
- quote_cmd)
+ quote_cmd, do_setup_env=do_setup_env)
def _AddActionStep(actions_dict, inputs, outputs, description, command):
@@ -503,7 +489,11 @@ def _GenerateNativeRulesForMSVS(p, rules, output_dir, spec, options):
rule_ext = r['extension']
inputs = _FixPaths(r.get('inputs', []))
outputs = _FixPaths(r.get('outputs', []))
- cmd = _BuildCommandLineForRule(spec, r, has_input_path=True)
+ # Skip a rule with no action and no inputs.
+ if 'action' not in r and not r.get('rule_sources', []):
+ continue
+ cmd = _BuildCommandLineForRule(spec, r, has_input_path=True,
+ do_setup_env=True)
rules_file.AddCustomBuildRule(name=rule_name,
description=r.get('message', rule_name),
extensions=[rule_ext],
@@ -591,7 +581,7 @@ def _GenerateExternalRules(rules, output_dir, spec,
'IntDir=$(IntDir)',
'-j', '${NUMBER_OF_PROCESSORS_PLUS_1}',
'-f', filename]
- cmd = _BuildCommandLineForRuleRaw(spec, cmd, True, False, True)
+ cmd = _BuildCommandLineForRuleRaw(spec, cmd, True, False, True, True)
# Insert makefile as 0'th input, so it gets the action attached there,
# as this is easier to understand from in the IDE.
all_inputs = list(all_inputs)
@@ -599,7 +589,8 @@ def _GenerateExternalRules(rules, output_dir, spec,
_AddActionStep(actions_to_add,
inputs=_FixPaths(all_inputs),
outputs=_FixPaths(all_outputs),
- description='Running %s' % cmd,
+ description='Running external rules for %s' %
+ spec['target_name'],
command=cmd)
@@ -707,6 +698,9 @@ def _EscapeCppDefineForMSVS(s):
s = _EscapeEnvironmentVariableExpansion(s)
s = _EscapeCommandLineArgumentForMSVS(s)
s = _EscapeVCProjCommandLineArgListItem(s)
+ # cl.exe replaces literal # characters with = in preprocesor definitions for
+ # some reason. Octal-encode to work around that.
+ s = s.replace('#',