def update(project): try: project.generate except: project.generate = [] if "premake" in project.generate: generate(project) # can throw try: project.makepath = os.path.abspath(os.path.expanduser(Settings.get('make_path'))) except: project.makepath = "" # make sure theres a make step after premake make_step = Plugin("steps", "make", "makefile") conf_step = Plugin("steps", "make", "configure") if os.name == "nt": msb_step = Plugin("steps", "make", "msbuild") project.clean_commands = ["%s clean" % os.path.join(project.makepath,"make")] try: project.makefile_params except: project.makefile_params = [] if Args.option("debug"): project.makefile_params += ["config=debug"] else: project.makefile_params += ["config=release"] clean_step = Plugin("steps", "clean", "clean") if make_step in project.steps: project.steps.remove(make_step) if conf_step in project.steps: project.steps.remove(conf_step) if os.name == "nt": if msb_step in project.steps: project.steps.remove(msb_step) if clean_step in project.steps: project.steps.remove(clean_step) i = 0 if os.name == "nt": make_step = msb_step for s in project.steps: if s.type == "make" and s.name == "premake": # TODO: check for user support (because of -r flag) if clean.clean.compatible(project) & Support.USER: project.steps.insert(i, clean_step) project.steps.insert(i+2, make_step) else: project.steps.insert(i+1, make_step) break i += 1 make_step.call("update", project)
def event(plugin_type, args): r = [] try: for plugin in events.events[plugin_type]: e = Plugin("events", plugin_type, plugin) r += [e.call(plugin_type, None, args)] except TypeError: pass return r
def detect_project(): """ Detects the projects build steps and checks for step support """ #for plugin in steps.base.values(): # try: # if plugin.Project.compatible(): # return plugin.Project() # except: # pass project = Project() # Run all detection steps for plugin in steps.steps["detect"]: if not Plugin("steps", "detect", plugin).call("detect",project): return None #if not steps.step("detect", plugin, project): # Add required steps to project for plugin_type in steps.steps.iterkeys(): if plugin_type == "detect": continue for plugin in steps.steps[plugin_type]: #if steps.compatible(plugin_type, plugin, project) & Support.MASK == Support.MASK: plugin = Plugin("steps", plugin_type, plugin) if plugin.call("compatible", project) == Support.MASK: project.steps += [plugin] project.events = {} for plugin_type in events.events.iterkeys(): project.events[plugin_type] = [] for plugin in events.events[plugin_type]: plugin = Plugin("events", plugin_type, plugin) if plugin.call("compatible", project) == Support.MASK: project.events[plugin_type] += [plugin] # check if project meets standards for a sgmake project if is_project(project): return project # otherwise, no project detected return None
def detect_project(): """ Detects the projects build steps and checks for step support """ #for plugin in steps.base.values(): # try: # if plugin.Project.compatible(): # return plugin.Project() # except: # pass project = Project() # Run all detection steps for plugin in steps.steps["detect"]: if not Plugin("steps", "detect", plugin).call("detect", project): return None #if not steps.step("detect", plugin, project): # Add required steps to project for plugin_type in steps.steps.iterkeys(): if plugin_type == "detect": continue for plugin in steps.steps[plugin_type]: #if steps.compatible(plugin_type, plugin, project) & Support.MASK == Support.MASK: plugin = Plugin("steps", plugin_type, plugin) if plugin.call("compatible", project) == Support.MASK: project.steps += [plugin] project.events = {} for plugin_type in events.events.iterkeys(): project.events[plugin_type] = [] for plugin in events.events[plugin_type]: plugin = Plugin("events", plugin_type, plugin) if plugin.call("compatible", project) == Support.MASK: project.events[plugin_type] += [plugin] # check if project meets standards for a sgmake project if is_project(project): return project # otherwise, no project detected return None
def update(project): try: project.generate except: project.generate = [] if "premake" in project.generate: generate(project) # can throw try: project.makepath = os.path.abspath( os.path.expanduser(Settings.get('make_path'))) except: project.makepath = "" # make sure theres a make step after premake make_step = Plugin("steps", "make", "makefile") conf_step = Plugin("steps", "make", "configure") if os.name == "nt": msb_step = Plugin("steps", "make", "msbuild") project.clean_commands = [ "%s clean" % os.path.join(project.makepath, "make") ] try: project.makefile_params except: project.makefile_params = [] if Args.option("debug"): project.makefile_params += ["config=debug"] else: project.makefile_params += ["config=release"] clean_step = Plugin("steps", "clean", "clean") if make_step in project.steps: project.steps.remove(make_step) if conf_step in project.steps: project.steps.remove(conf_step) if os.name == "nt": if msb_step in project.steps: project.steps.remove(msb_step) if clean_step in project.steps: project.steps.remove(clean_step) i = 0 if os.name == "nt": make_step = msb_step for s in project.steps: if s.type == "make" and s.name == "premake": # TODO: check for user support (because of -r flag) if clean.clean.compatible(project) & Support.USER: project.steps.insert(i, clean_step) project.steps.insert(i + 2, make_step) else: project.steps.insert(i + 1, make_step) break i += 1 make_step.call("update", project)