예제 #1
0
	def new_execute_build(self):
		"""
		Invoke clangdb command before build
		"""
		if type(self) == Build.BuildContext:
			Scripting.run_command('clangdb')

		old_execute_build(self)
    def new_execute_build(self):
        """
		Invoke clangdb command before build
		"""
        if self.cmd.startswith('build'):
            Scripting.run_command('clangdb')

        old_execute_build(self)
예제 #3
0
def build(bld, trees=[]):
	if bld.variant:
		libs = bld.env.CCROSS[bld.variant]['shlib']
		for lib in libs:
			bld.read_shlib(lib, paths=bld.env.LIBPATH)

	if bld.options.all and not bld.variant:
		if bld.cmd in ('build', 'clean', 'install', 'uninstall', 'codeblocks', 'makefile', 'eclipse'):
			for variant in bld.env.CCROSS.keys():
				Scripting.run_command('%s_%s' % (bld.cmd, variant))

	for tree in trees:
		for script in waftools.get_scripts(tree, 'wscript'):
			bld.recurse(script)
    def run(self, perf_run, available_params, configurations):
        test_build_path = self.path.make_node(self.bldnode.name + '_tests')
       
        Options.lockfile = Options.lockfile + '_tests'
        Options.options.out = test_build_path.abspath()
        Options.options.profiling = self.env.profiling
        Options.options.input_file = os.path.relpath(self.env.INPUT_FILE, self.path.abspath())
        Options.options.reference_file = os.path.relpath(self.env.REFERENCE_FILE, self.path.abspath())

        for configuration in configurations:
            for configuration_param in available_params:
                setattr(Options.options, configuration_param, configuration_param in configuration['modules'])

            Logs.pprint('PINK', 'Testing %s build...' % configuration['id'])
      
            Scripting.run_command('configure')
            Scripting.run_command('build')
            Scripting.run_command('perf' if perf_run else 'debug')

            self.exec_command('cp %s %s' % (
                test_build_path.find_node('current_profile.txt').abspath(),
                self.bldnode.make_node('%s_profile.txt' % configuration['id']).abspath()))

            if perf_run:
                self.exec_command('cp %s %s' % (
                    test_build_path.find_node('current_profile_detailed.json').abspath(),
                    self.bldnode.make_node('%s_profile_detailed.json' % configuration['id']).abspath()))
         

        Scripting.run_command('distclean')
예제 #5
0
파일: orchlib.py 프로젝트: brettviren/worch
def start(cwd, version, wafdir):
    print ("cwd: %s" % cwd)
    print ("version: %s" % version)
    print ("wafdir: %s" % wafdir)
    Logs.init_log()
    Context.waf_dir = wafdir
    Context.launch_dir = Context.out_dir = Context.top_dir = Context.run_dir = cwd
    Context.g_module = imp.new_module('wscript')
    Context.g_module.root_path = cwd
    Context.Context.recurse = recurse_rep

    Context.g_module.configure = configure
    Context.g_module.build = build
    Context.g_module.options = options
    Context.g_module.top = Context.g_module.out = '.'

    Options.OptionsContext().execute()

    do_config = 'configure' in sys.argv
    try:
        os.stat(cwd + os.sep + 'c4che')
    except:
        do_config = True
    if do_config:
        Scripting.run_command('configure')

    if 'clean' in sys.argv:
        Scripting.run_command('clean')

    if 'build' in sys.argv:
        Scripting.run_command('build')
예제 #6
0
파일: makefile.py 프로젝트: michelm/beehive
	def execute(self, *k, **kw):
		self.failure = None
		self.commands = []
		self.targets = []

		old_exec = Task.TaskBase.exec_command
		def exec_command(self, *k, **kw):
			ret = old_exec(self, *k, **kw)
			try:
				cmd = k[0]
			except IndexError:
				cmd = ''
			finally:
				self.command_executed = cmd
			try:
				cwd = kw['cwd']
			except KeyError:
				cwd = self.generator.bld.cwd
			finally:
				self.path = cwd
			return ret
		Task.TaskBase.exec_command = exec_command

		old_process = Task.TaskBase.process
		def process(self):
			old_process(self)
			task_process(self)
		Task.TaskBase.process = process

		def postfun(self):
			if self.failure:
				build_show_failure(self)
			elif not len(self.targets):
				Logs.warn('makefile export failed: no C/C++ targets found')
			else:
				build_postfun(self)
		super(MakefileContext, self).add_post_fun(postfun)

		Scripting.run_command('clean')
		super(MakefileContext, self).execute(*k, **kw)
예제 #7
0
파일: ccenv.py 프로젝트: m-grabner/jack2
def build(bld, trees=[]):
	'''Performs build context commands for one or more C/C++
	build environments using the trees argument as list of source
	directories.
	
	:param bld: build context 
	:type bld: waflib.Build.BuildContext
	:param trees: top level directories containing projects to build
	:type trees: list
	'''
	if bld.variant:
		libs = bld.env.CCENV[bld.variant]['shlib']
		for lib in libs:
			bld.read_shlib(lib, paths=bld.env.LIBPATH)

	if bld.options.all and not bld.variant:
		if bld.cmd in ('build', 'clean', 'install', 'uninstall', 'codeblocks', 'makefile', 'eclipse'):
			for variant in bld.env.CCENV.keys():
				Scripting.run_command('%s_%s' % (bld.cmd, variant))

	for tree in trees:
		for script in waftools.get_scripts(tree, 'wscript'):
			bld.recurse(script)
예제 #8
0
파일: ccenv.py 프로젝트: jameslin2014/xskit
def build(bld, trees=[]):
	'''Performs build context commands for one or more C/C++
	build environments using the trees argument as list of source
	directories.
	
	:param bld: build context 
	:type bld: waflib.Build.BuildContext
	:param trees: top level directories containing projects to build
	:type trees: list
	'''
	if bld.variant:
		libs = bld.env.CCENV[bld.variant]['shlib']
		for lib in libs:
			bld.read_shlib(lib, paths=bld.env.LIBPATH)

	if bld.options.all and not bld.variant:
		if bld.cmd in ('build', 'clean', 'install', 'uninstall', 'codeblocks', 'makefile', 'eclipse'):
			for variant in bld.env.CCENV.keys():
				Scripting.run_command('%s_%s' % (bld.cmd, variant))

	for tree in trees:
		for script in waftools.get_scripts(tree, 'wscript'):
			bld.recurse(script)
예제 #9
0
def waf_entry_point(directory=None):
    import os
    import sys
    import traceback

    import zippy
    import waflib
    from waflib import Logs
    from waflib import Errors
    from waflib import Options
    from waflib import Context
    from waflib import Scripting
    from waflib import Configure
    from waflib import Build

    Logs.init_log()

    directory = os.path.abspath(directory or os.getcwd())
    name = __package__.title()

    Context.WSCRIPT_FILE = 'zscript.py'
    Context.g_module = __import__(__name__)
    Context.g_module.root_path = __file__
    Context.cache_modules[Context.g_module.root_path] = Context.g_module

    Context.launch_dir = directory
    Context.run_dir = directory
    Context.top_dir = directory
    Context.out_dir = directory + os.sep + out
    Context.waf_dir = os.path.abspath(os.path.dirname(waflib.__path__[0]))
    for key in ('update', 'dist', 'distclean', 'distcheck'):
        attr = getattr(Scripting, key)
        if attr.__name__ not in Context.g_module.__dict__:
            setattr(Context.g_module, attr.__name__, attr)
        if key not in Context.g_module.__dict__:
            setattr(Context.g_module, key, attr)

    def pre_recurse(self, node, _pre_recurse=Context.Context.pre_recurse):
        _pre_recurse(self, node)
        if node.abspath() == Context.g_module.root_path:
            self.path = self.root.find_dir(Context.run_dir)

    def recurse(self, dirs, **kwds):
        if Context.run_dir in dirs:
            dirs[dirs.index(Context.run_dir)] = os.path.dirname(__file__)
        _recurse(self, dirs, **kwds)

    _pre_recurse = Context.Context.pre_recurse
    _recurse = Context.Context.recurse
    Context.Context.pre_recurse = pre_recurse
    Context.Context.recurse = recurse

    try:
        os.chdir(Context.run_dir)
    except OSError:
        Logs.error('%s: The directory %r is unreadable' %
                   (name, Context.run_dir))
        return 1

    try:
        Scripting.parse_options()
        Scripting.run_command('init')
        try:
            os.stat(Context.out_dir + os.sep + Build.CACHE_DIR)
        except Exception:
            if 'configure' not in Options.commands:
                Options.commands.insert(0, 'configure')
        while Options.commands:
            cmd_name = Options.commands.pop(0)
            ctx = Scripting.run_command(cmd_name)
            Logs.info('%r finished successfully (%s)' % (
                cmd_name,
                str(ctx.log_timer),
            ))
        Scripting.run_command('shutdown')
    except Errors.WafError as e:
        if Logs.verbose > 1:
            Logs.pprint('RED', e.verbose_msg)
        Logs.error(e.msg)
        return 1
    except SystemExit:
        raise
    except Exception as e:
        traceback.print_exc(file=sys.stdout)
        return 2
    except KeyboardInterrupt:
        Logs.pprint('RED', 'Interrupted')
        return 68

    return 0
예제 #10
0
def waf_entry_point(directory=None):
    import os
    import sys
    import traceback

    import zippy
    import waflib
    from waflib import Logs
    from waflib import Errors
    from waflib import Options
    from waflib import Context
    from waflib import Scripting
    from waflib import Configure
    from waflib import Build

    Logs.init_log()

    directory = os.path.abspath(directory or os.getcwd())
    name = __package__.title()

    Context.WSCRIPT_FILE = 'zscript.py'
    Context.g_module = __import__(__name__)
    Context.g_module.root_path = __file__
    Context.cache_modules[Context.g_module.root_path] = Context.g_module

    Context.launch_dir = directory
    Context.run_dir = directory
    Context.top_dir = directory
    Context.out_dir = directory + os.sep + out
    Context.waf_dir = os.path.abspath(os.path.dirname(waflib.__path__[0]))
    for key in ('update', 'dist', 'distclean', 'distcheck'):
        attr = getattr(Scripting, key)
        if attr.__name__ not in Context.g_module.__dict__:
            setattr(Context.g_module, attr.__name__, attr)
        if key not in Context.g_module.__dict__:
            setattr(Context.g_module, key, attr)

    def pre_recurse(self, node, _pre_recurse=Context.Context.pre_recurse):
        _pre_recurse(self, node)
        if node.abspath() == Context.g_module.root_path:
            self.path = self.root.find_dir(Context.run_dir)
    def recurse(self, dirs, **kwds):
        if Context.run_dir in dirs:
            dirs[dirs.index(Context.run_dir)] = os.path.dirname(__file__)
        _recurse(self, dirs, **kwds)
    _pre_recurse = Context.Context.pre_recurse
    _recurse = Context.Context.recurse
    Context.Context.pre_recurse = pre_recurse
    Context.Context.recurse = recurse

    try:
        os.chdir(Context.run_dir)
    except OSError:
        Logs.error('%s: The directory %r is unreadable' % (name, Context.run_dir))
        return 1

    try:
        Scripting.parse_options()
        Scripting.run_command('init')
        try:
            os.stat(Context.out_dir + os.sep + Build.CACHE_DIR)
        except Exception:
            if 'configure' not in Options.commands:
                Options.commands.insert(0, 'configure')
        while Options.commands:
            cmd_name = Options.commands.pop(0)
            ctx = Scripting.run_command(cmd_name)
            Logs.info('%r finished successfully (%s)' % (
                cmd_name, str(ctx.log_timer),
                ))
        Scripting.run_command('shutdown')
    except Errors.WafError as e:
        if Logs.verbose > 1:
            Logs.pprint('RED', e.verbose_msg)
        Logs.error(e.msg)
        return 1
    except SystemExit:
        raise
    except Exception as e:
        traceback.print_exc(file=sys.stdout)
        return 2
    except KeyboardInterrupt:
        Logs.pprint('RED', 'Interrupted')
        return 68

    return 0