def main(): parser = argparse.ArgumentParser() parser.add_argument("-f", "--file", default="makefile.uni.py", help="sets the build script") parser.add_argument("-d", "--destination", default=".", help="output directory (base for download and build)") parser.add_argument("-s", "--set", action="append", help="set configuration parameters") parser.add_argument("-g", "--graph", action="store_true", help="update dependency graph") parser.add_argument("target", nargs="*", help="make target") args = parser.parse_args() init_config(args) script_dir = os.path.abspath(os.path.dirname(__file__)) config.cfg["paths"]["root"] = script_dir print(config.get("paths.root")) from buildtools import os_utils os_utils.getVSVars(config.get("paths.visual_studio"), os.path.join("build", "getvsvars.bat")) for d in ["download", "build", "progress"]: if not os.path.exists(config["paths"][d]): os.makedirs(config["paths"][d]) time_format = "%(asctime)-15s %(message)s" logging.basicConfig(format=time_format, level=logging.DEBUG) logging.debug("building dependency graph") manager = TaskManager() imp.load_source("build", args.file) build_graph = manager.create_graph({}) assert isinstance(build_graph, nx.DiGraph) if args.graph: draw_graph(build_graph, "graph") cycles = list(nx.simple_cycles(build_graph)) if cycles: logging.error("There are cycles in the build graph") for cycle in cycles: logging.info(", ".join(cycle)) return 1 if args.target: for target in args.target: manager.enable(build_graph, target) else: manager.enable_all(build_graph) logging.debug("processing tasks") independent = extract_independent(build_graph) while independent: for node in independent: task = build_graph.node[node]["task"] try: task.prepare() if build_graph.node[node]["enable"] and not task.already_processed(): progress = Progress() progress.set_change_callback(progress_callback) if isinstance(task, Project): logging.debug('finished project "{}"'.format(node)) else: logging.debug('run task "{}"'.format(node)) if task.process(progress): task.mark_success() else: if task.fail_behaviour == Task.FailBehaviour.FAIL: logging.critical("task %s failed", node) return 1 elif task.fail_behaviour == Task.FailBehaviour.SKIP_PROJECT: recursive_remove(build_graph, node) break elif task.fail_behaviour == Task.FailBehaviour.CONTINUE: # nothing to do pass sys.stdout.write("\n") except Exception, e: logging.error("Task {} failed: {}".format(task.name, e)) raise build_graph.remove_node(node) independent = extract_independent(build_graph)
], ), ] projectdefs = {} for projRepo, projdir, branch, _ in projs: projectdefs[projdir] = { "type": "git", "uri": "https://github.com/{}/{}".format("Viomi" if projdir != "game_skyrimse" else "TanninOne", projRepo), } if branch != "master": projectdefs[projdir]["branch"] = branch projectdefs = YAMLConfig("projects.yml", default=projectdefs, variables=ymlvars, ordered_dicts=True).cfg with log.info("Downloading projects..."): dlPackagesIn(projectdefs, superrepo=superrepo) os_utils.getVSVars(config.get("paths.visual-studio"), short_arch, os.path.join("build", "getvsvars.bat")) # print(ENV.get('LIBPATH')) # Fixes problems with the wrong Qt being on the PATH. (I usually dev with Qt4.8.7) ENV.prependTo("PATH", os.path.join(config.get("paths.qt-base"), "bin")) ENV.removeDuplicatedEntries("PATH", noisy=True) libdir = os.path.join(script_dir, "install", "lib") includedir = os.path.join(script_dir, "install", "include") ENV.prependTo("LIBPATH", libdir) ENV.prependTo("LIB", libdir) ENV.prependTo("INCLUDE", includedir) os_utils.ensureDirExists(libdir) # This part written mostly by Sebastian. (Qt profile detection) qtappdata_root = os.path.join(ENV.get("APPDATA"), "QtProject")