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

Side by Side Diff: pylib/gyp/generator/scons.py

Issue 10909158: Add support for building targets directly from gyp. (Closed) Base URL: http://gyp.googlecode.com/svn/trunk
Patch Set: fix nits Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pylib/gyp/generator/ninja.py ('k') | pylib/gyp/generator/xcode.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 Google Inc. All rights reserved. 1 # Copyright (c) 2012 Google Inc. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import gyp 5 import gyp
6 import gyp.common 6 import gyp.common
7 import gyp.SCons as SCons 7 import gyp.SCons as SCons
8 import os.path 8 import os.path
9 import pprint 9 import pprint
10 import re 10 import re
11 import subprocess
11 12
12 13
13 # TODO: remove when we delete the last WriteList() call in this module 14 # TODO: remove when we delete the last WriteList() call in this module
14 WriteList = SCons.WriteList 15 WriteList = SCons.WriteList
15 16
16 17
17 generator_default_variables = { 18 generator_default_variables = {
18 'EXECUTABLE_PREFIX': '', 19 'EXECUTABLE_PREFIX': '',
19 'EXECUTABLE_SUFFIX': '', 20 'EXECUTABLE_SUFFIX': '',
20 'STATIC_LIB_PREFIX': '${LIBPREFIX}', 21 'STATIC_LIB_PREFIX': '${LIBPREFIX}',
(...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after
953 def TargetFilename(target, build_file=None, output_suffix=''): 954 def TargetFilename(target, build_file=None, output_suffix=''):
954 """Returns the .scons file name for the specified target. 955 """Returns the .scons file name for the specified target.
955 """ 956 """
956 if build_file is None: 957 if build_file is None:
957 build_file, target = gyp.common.ParseQualifiedTarget(target)[:2] 958 build_file, target = gyp.common.ParseQualifiedTarget(target)[:2]
958 output_file = os.path.join(os.path.dirname(build_file), 959 output_file = os.path.join(os.path.dirname(build_file),
959 target + output_suffix + '.scons') 960 target + output_suffix + '.scons')
960 return output_file 961 return output_file
961 962
962 963
964 def PerformBuild(data, configurations, params):
965 options = params['options']
966
967 # Due to the way we test gyp on the chromium typbots
968 # we need to look for 'scons.py' as well as the more common 'scons'
969 # TODO(sbc): update the trybots to have a more normal install
970 # of scons.
971 scons = 'scons'
972 paths = os.environ['PATH'].split(os.pathsep)
973 for scons_name in ['scons', 'scons.py']:
974 for path in paths:
975 test_scons = os.path.join(path, scons_name)
976 print 'looking for: %s' % test_scons
977 if os.path.exists(test_scons):
978 print "found scons: %s" % scons
979 scons = test_scons
980 break
981
982 for config in configurations:
983 arguments = [scons, '-C', options.toplevel_dir, '--mode=%s' % config]
984 print "Building [%s]: %s" % (config, arguments)
985 subprocess.check_call(arguments)
986
987
963 def GenerateOutput(target_list, target_dicts, data, params): 988 def GenerateOutput(target_list, target_dicts, data, params):
964 """ 989 """
965 Generates all the output files for the specified targets. 990 Generates all the output files for the specified targets.
966 """ 991 """
967 options = params['options'] 992 options = params['options']
968 993
969 if options.generator_output: 994 if options.generator_output:
970 def output_path(filename): 995 def output_path(filename):
971 return filename.replace(params['cwd'], options.generator_output) 996 return filename.replace(params['cwd'], options.generator_output)
972 else: 997 else:
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1038 bf, target = gyp.common.ParseQualifiedTarget(t)[:2] 1063 bf, target = gyp.common.ParseQualifiedTarget(t)[:2]
1039 target_filename = TargetFilename(target, bf, options.suffix) 1064 target_filename = TargetFilename(target, bf, options.suffix)
1040 tpath = gyp.common.RelativePath(target_filename, output_dir) 1065 tpath = gyp.common.RelativePath(target_filename, output_dir)
1041 sconscript_files[target] = tpath 1066 sconscript_files[target] = tpath
1042 1067
1043 output_filename = output_path(output_filename) 1068 output_filename = output_path(output_filename)
1044 if sconscript_files: 1069 if sconscript_files:
1045 GenerateSConscriptWrapper(build_file, data[build_file], basename, 1070 GenerateSConscriptWrapper(build_file, data[build_file], basename,
1046 output_filename, sconscript_files, 1071 output_filename, sconscript_files,
1047 default_configuration) 1072 default_configuration)
OLDNEW
« no previous file with comments | « pylib/gyp/generator/ninja.py ('k') | pylib/gyp/generator/xcode.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698