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

Unified Diff: pylib/gyp/generator/ninja.py

Issue 27418008: ninja: Write gypcmd files into the output directory instead of the tree. (Closed) Base URL: http://gyp.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 2 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 | « pylib/gyp/__init__.py ('k') | pylib/gyp/input.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pylib/gyp/generator/ninja.py
===================================================================
--- pylib/gyp/generator/ninja.py (revision 1758)
+++ pylib/gyp/generator/ninja.py (working copy)
@@ -58,6 +58,7 @@
generator_additional_non_configuration_keys = []
generator_additional_path_sections = []
generator_extra_sources_for_rules = []
+generator_filelist_path = None
# TODO: figure out how to not build extra host objects in the non-cross-compile
# case when this is enabled, and enable unconditionally.
@@ -1458,7 +1459,38 @@
default_variables.setdefault('LIB_DIR',
os.path.join('$!PRODUCT_DIR', 'obj'))
+def ComputeOutputDir(params):
+ """Returns the path from the toplevel_dir to the build output directory."""
+ # generator_dir: relative path from pwd to where make puts build files.
+ # Makes migrating from make to ninja easier, ninja doesn't put anything here.
+ generator_dir = os.path.relpath(params['options'].generator_output or '.')
+ # output_dir: relative path from generator_dir to the build directory.
+ output_dir = params.get('generator_flags', {}).get('output_dir', 'out')
+
+ # Relative path from source root to our output files. e.g. "out"
+ return os.path.normpath(os.path.join(generator_dir, output_dir))
+
+
+def CalculateGeneratorInputInfo(params):
+ """Called by __init__ to initialize generator values based on params."""
+ # E.g. "out/gypfiles"
+ qualified_out_dir = os.path.normpath(os.path.join(
+ params['options'].toplevel_dir, ComputeOutputDir(params), 'gypfiles'))
+
+ def gypfile_path(build_file_dir, name):
+ # build_file_dir is absolute, make it relative to toplevel
+ if os.path.isabs(build_file_dir):
+ build_file_dir = gyp.common.RelativePath(build_file_dir, toplevel)
+ name = os.path.join(qualified_out_dir, build_file_dir, name)
+ if not os.path.isdir(os.path.dirname(name)):
+ os.makedirs(os.path.dirname(name))
+ return name
+
+ global generator_filelist_path
+ generator_filelist_path = gypfile_path
+
+
def OpenOutput(path, mode='w'):
"""Open |path| for writing, creating directories if necessary."""
try:
@@ -1608,18 +1640,10 @@
flavor = gyp.common.GetFlavor(params)
generator_flags = params.get('generator_flags', {})
- # generator_dir: relative path from pwd to where make puts build files.
- # Makes migrating from make to ninja easier, ninja doesn't put anything here.
- generator_dir = os.path.relpath(params['options'].generator_output or '.')
-
- # output_dir: relative path from generator_dir to the build directory.
- output_dir = generator_flags.get('output_dir', 'out')
-
# build_dir: relative path from source root to our output files.
# e.g. "out/Debug"
- build_dir = os.path.normpath(os.path.join(generator_dir,
- output_dir,
- config_name))
+ build_dir = os.path.normpath(
+ os.path.join(ComputeOutputDir(params), config_name))
toplevel_build = os.path.join(options.toplevel_dir, build_dir)
« no previous file with comments | « pylib/gyp/__init__.py ('k') | pylib/gyp/input.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698