Skip to content

Commit

Permalink
Merge and bugfix, make unrecognized options in BUILD file as error
Browse files Browse the repository at this point in the history
  • Loading branch information
chen3feng committed Dec 18, 2014
1 parent f3b9ce0 commit e877c4f
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 11 deletions.
1 change: 0 additions & 1 deletion blade.conf
Expand Up @@ -49,7 +49,6 @@ cc_config(
'-Woverloaded-virtual',
'-Wvla',
'-Werror=non-virtual-dtor',
'-Werror=non-virtual-dtor',
'-Werror=overloaded-virtual',
'-Werror=vla',
],
Expand Down
Binary file modified blade.zip
Binary file not shown.
3 changes: 1 addition & 2 deletions dist_blade
@@ -1,6 +1,5 @@
#!/bin/bash
#make_blade_zip
# SCRIPT: dist_blade
# make_blade_zip
# AUTHOR: Michael
# DATE: Dec 17 2011
# REV: 1.1.A (Valid are A, B, D, T and P)
Expand Down
19 changes: 19 additions & 0 deletions src/blade/blade_util.py
Expand Up @@ -127,3 +127,22 @@ def cpu_count():
return multiprocessing.cpu_count()
except ImportError:
return int(os.sysconf('SC_NPROCESSORS_ONLN'))


def regular_variable_name(var):
"""regular_variable_name.
Parameters
-----------
var: the variable to be modified
Returns
-----------
s: the variable modified
Description
-----------
Replace the chars that scons doesn't regconize.
"""
return var.translate(string.maketrans(',-/.+*', '______'))
1 change: 1 addition & 0 deletions src/blade/resource_library_target.py
Expand Up @@ -68,6 +68,7 @@ def scons_rules(self):
(out_dir, res_file_index) = self._resource_library_rules_helper()
self.data['res_srcs'] = [os.path.join(out_dir, res_file_index + '.c')]
for src in self.srcs:
src = os.path.normpath(src)
src_path = os.path.join(self.path, src)
c_src_name = '%s.c' % self._regular_variable_name(src)
c_src_path = os.path.join(out_dir, c_src_name)
Expand Down
10 changes: 6 additions & 4 deletions src/blade/scons_helper.py
Expand Up @@ -195,6 +195,7 @@ def generate_resource_index(target, source, env):
print >>c, ' { "%s", RESOURCE_%s, %s },' % (org_src, var_name, s.get_size())
print >>c, '};'
print >>c, 'const unsigned %s_len = %s;' % (res_index_name, len(source))
print >>h, '// Resource index'
print >>h, 'extern const struct BladeResourceEntry %s[];' % res_index_name
print >>h, 'extern const unsigned %s_len;' % res_index_name
print >>h, '\n#ifdef __cplusplus\n} // extern "C"\n#endif\n'
Expand All @@ -217,10 +218,11 @@ def generate_resource_file(target, source, env):
shell=True,
universal_newlines=True)
std_out, std_err = p.communicate()
if p.returncode:
console.info(std_out)
console.info(std_err)
console.error_exit('failed to generate resource file')
if p.returncode or std_err:
error = 'failed to generate resource file'
if std_err:
error = error + ': ' + std_err
console.error_exit(error)
return p.returncode


Expand Down
4 changes: 2 additions & 2 deletions src/blade/target.py
Expand Up @@ -77,8 +77,8 @@ def _check_name(self):

def _check_kwargs(self, kwargs):
if kwargs:
console.warning('//%s:%s: unrecognized options %s' % (
self.path, self.name, kwargs))
console.error_exit('//%s:%s: unrecognized options %s' % (
self.path, self.name, kwargs))

# Keep the relationship of all src -> target.
# Used by build rules to ensure that a source file occurres in
Expand Down
4 changes: 2 additions & 2 deletions vim/syntax/blade.vim
Expand Up @@ -31,10 +31,10 @@ syn case match
" Sorted by alphabet order
syn keyword bladeTarget cc_binary cc_library cc_plugin cc_test cc_benchmark cu_binary cu_library
syn keyword bladeTarget enable_if gen_rule lex_yacc_library proto_library java_jar
syn keyword resource_library swig_library
syn keyword bladeTarget resource_library swig_library

" Sorted by alphabet order
syn keyword bladeArg always_run cmd defs deprecated deps dynamic_link
syn keyword bladeArg always_run cmd defs deprecated deps dynamic_link export_incs
syn keyword bladeArg exclusive export_dynamic extra_cppflags extra_linkflags
syn keyword bladeArg heap_check heap_check_debug incs link_all_symbols
syn keyword bladeArg name optimize outs prebuilt prefix srcs suffix testdata warning
Expand Down

0 comments on commit e877c4f

Please sign in to comment.