def build(self, message): Log.p('ExeTask: ' + self.target) Log.v(' <== ' + message) result_code = BuildUtility.ExecCommand(self.command) if result_code == 0: Log.v(' Ok ' + self.target) return result_code
def build(self, message): Log.p('LibTask: ' + self.target) Log.v(' <== ' + message) result_code = BuildUtility.ExecCommand(self.command) self.tool.timestamp_cache.removeEntry(self.target) if result_code == 0: Log.v(' Ok ' + self.target) return result_code
def dump(self): Log.p('-------------------') Log.p('SourceFile cache:') for l_name in self.cache: file = self.cache[l_name] Log.p('* %s' % l_name) for src in file.src_list: Log.p(' include "%s"' % src) Log.p('-------------------')
def build(self, message): Log.p('ObjTask: ' + self.target) Log.v(' <== ' + message) self.env.makeOutputDirectory(self.target) result_code = BuildUtility.ExecCommand(self.command) self.tool.timestamp_cache.removeEntry(self.target) if result_code == 0: Log.v(' Ok ' + self.target) return self.completeTask(result_code)
def dump(self): Log.p('-------------------') Log.p('TimeStamp cache:') for l_name in self.cache: file_time = self.cache[l_name] ts = time.localtime(file_time) Log.p('* %s %s' % (time.strftime('%Y/%m/%d %H:%M:%S', ts), l_name)) Log.p('-------------------')
def build(self, message): Log.p('ExeTask: ' + self.target) Log.v(' <== ' + message) self.env.makeOutputDirectory(self.target) #self.tool.thread_pool.addJob( CompileJob( self.tool, self.env, self.command ) ) command_list = commandSplitter(self.command) #print( command_list ) for command in command_list: if not isinstance(command[0], str): command[0](*command[1:]) else: result_code = BuildUtility.ExecCommand(command) if result_code != 0: return self.completeTask(result_code) self.tool.timestamp_cache.removeEntry(self.target) if result_code == 0: Log.v(' Ok ' + self.target) return self.completeTask(result_code)
def list(self): for l_name in self.cache: task = self.cache[l_name] Log.p('Task: "%s"' % l_name) #Log.p( ' target: %s' % task.target ) #if getattr( task, 'command', None ): # Log.p( ' cmd %s' % task.command ) for dep in task.task_list: Log.p(' --> ', dep.cache_name) for comp in task.callback_task: Log.p(' OC> ', comp.cache_name)
def summary(self): super().summary() Log.p('MSVC = %d' % self.MSVC_VERSION) Log.p('SDK = ', self.WINDOWS_SDK_DIR) Log.p('SDK Version = ', self.WINDOWS_SDK_VERSION) Log.p('CPU Arch = ', ','.join(self.ARCH_LIST))
def dumpQueue(self): Log.p('JobQueue:') with self.lock: for job in self.queue: Log.p(str(job))
def main(argv): makefile = 'FLB_Makefile.py' default_task = 'build' debug_flag = False dump_flag = False func_command = None env_dump = False job_count = 0 action_list = [] opt_dict = load_config() acount = len(argv) ai = 1 while ai < acount: arg = argv[ai] if arg[0] == '-': if arg == '-f': ai += 1 if ai < acount: makefile = argv[ai] elif arg == '--env': ai += 1 if ai < acount: platform = argv[ai] env_dump = True elif arg == '--opt': ai += 1 if ai < acount: opts = argv[ai].split('=') opt_dict[opts[0]] = opts[1] elif arg == '--job': ai += 1 if ai < acount: job_count = int(argv[ai]) elif arg == '--debug': debug_flag = True Log.DebugLevel = 2 elif arg == '-v' or arg == '--verbose': debug_flag = True Log.DebugLevel = 1 elif arg == '--dump': dump_flag = True elif arg == '--list': func_command = 'f_list' elif arg == '--platforms': func_command = 'f_platforms' else: usage() else: default_task = None action_list.append(arg) ai += 1 if default_task: action_list.append(default_task) if makefile != None: start_time_real = time.perf_counter() try: tool = BuildTool(job_count, opt_dict) tool.execScript(makefile) if func_command: getattr(tool, func_command)() else: for task_name in action_list: actions = task_name.split(',') tool.runSequentialTask(tool.nameToTaskList(actions)) tool.wait() if dump_flag: tool.dump() if tool.result_code: return tool.result_code except Exception as e: if not debug_flag: print(e) else: raise finally: Log.p('time %f' % (time.perf_counter() - start_time_real)) else: usage() Log.d('OK') return 0
def usage(): Log.p('FlatBuildTool v1.43 Hiroyuki Ogasawara') Log.p('usage: python FlatBuildTool.py [<options>] [<target>...]') Log.p(' -f <BuildFile.py> default : FLB_Makefile.py') Log.p(' --dump') Log.p(' --job <thread> default : system thread count') Log.p(' --list display all targets') Log.p(' --platforms') Log.p(' --opt <env_name>=<value>') Log.p(' -v, --verbose') Log.p(' --debug') Log.p('parallel action: target1 target2 ...') Log.p('sequential action: target1,target2,...') sys.exit(0)
def f_platforms(self): for platform in self.platform_table: env = self.createTargetEnvironment(platform) if env.isValid(): Log.p('[%s]--------' % platform) env.summary()
def command(task): Log.p('Clean: ' + os.path.join(task.cwd, task.env.OUTPUT_OBJ_DIR)) BuildUtility.RemoveTree( os.path.join(task.cwd, task.env.OUTPUT_OBJ_DIR))
def summary(self): Log.p('HostArch = ' + self.getHostArch()) Log.p('HostPlatform = ' + self.getHostPlatform())
def dump(self): Log.p('-------------------') Log.p('Task cache:') for l_name in self.cache: task = self.cache[l_name] Log.p('TASK: ' + l_name) for src in task.src_list: Log.p(' src "%s"' % src) if getattr(task, 'command', None): Log.p(' cmd %s' % task.command) for dep in task.task_list: Log.p(' dep %s' % str(dep)) for comp in task.callback_task: Log.p(' oc %s' % str(comp)) Log.p('-------------------')