def do(args): """Main entry point""" if args.build_directory and not args.single: raise Exception("You should use --single when specifying a build directory") if not args.cmake_flags: args.cmake_flags = list() if args.effective_cplusplus: args.cmake_flags.append("QI_EFFECTIVE_CPP=ON") if args.werror: args.cmake_flags.append("QI_WERROR=ON") logger = logging.getLogger(__name__) toc = qibuild.toc_open(args.work_tree, args) (project_names, _, _) = toc.resolve_deps() projects = [toc.get_project(name) for name in project_names] if args.build_directory: projects[0].set_custom_build_directory(args.build_directory) if args.debug_trycompile: print "--debug-trycompile ON" if toc.active_config: logger.info("Active configuration: %s", toc.active_config) for project in projects: logger.info("Configuring %s", project.name) toc.configure_project(project, clean_first=args.clean_first, debug_trycompile=args.debug_trycompile)
def do(args): """Main entry point""" logger = logging.getLogger(__name__) toc = qibuild.toc_open(args.work_tree, args) if not args.project: project_name = qibuild.toc.project_from_cwd() else: project_name = args.project project = toc.get_project(project_name) logger.info("Testing %s in %s", project.name, toc.build_folder_name) toc.test_project(project, test_name=args.test_name)
def do(args): """Main entry point""" logger = qibuild.log.get_logger(__name__) toc = qibuild.toc_open(args.worktree, args) qibuild.ui.info("legend:", qibuild.ui.red , "buildtime", qibuild.ui.white, "buildtime+runtime", qibuild.ui.green, "runtime") qibuild.ui.info() active_projects = toc.active_projects if args.deep and not args.reverse: (active_projects, _, _) = toc.resolve_deps() elif args.deep and args.reverse: qibuild.ui.error("you can't use --deep with --reverse.") exit(1) for pname in active_projects: project = toc.get_project(pname) if args.reverse: qibuild.ui.info(qibuild.ui.green, "*", qibuild.ui.blue, project.name, qibuild.ui.reset, "reverse dependencies:") else: qibuild.ui.info(qibuild.ui.green, "*", qibuild.ui.blue, project.name, qibuild.ui.reset, "dependencies:") if args.reverse: (bproject_names, rproject_names, bpackage_names, rpackage_names) = get_reverse_deps(toc, pname) else: (bproject_names, rproject_names, bpackage_names, rpackage_names) = get_deps(toc, pname) bproject_names = set(bproject_names) - set([pname]) rproject_names = set(rproject_names) - set([pname]) brproject_names = set(bproject_names).intersection(set(rproject_names)) brpackage_names = set(bpackage_names).intersection(set(rpackage_names)) bproject_names = set(bproject_names) - set(brproject_names) rproject_names = set(rproject_names) - set(brproject_names) bpackage_names = set(bpackage_names) - set(brpackage_names) rpackage_names = set(rpackage_names) - set(brpackage_names) qibuild.ui.info(" projects:", qibuild.ui.red , " ".join(bproject_names), qibuild.ui.white, " ".join(brproject_names), qibuild.ui.green, " ".join(rproject_names)) qibuild.ui.info(" packages:", qibuild.ui.red , " ".join(bpackage_names), qibuild.ui.white, " ".join(brpackage_names), qibuild.ui.green, " ".join(rpackage_names))
def do(args): """Main entry point""" fail = list() qiwt = qibuild.worktree_open(args.work_tree) toc = qibuild.toc_open(args.work_tree, args) manifest = toc.config.local.manifest if manifest: try: qibuild.run_action("qisrc.actions.fetch", args=[manifest.url], forward_args=args) except Exception, e: mess = "Could not run qisrc fetch\n" mess += "Error was: %s\n" % e LOGGER.warning(mess)
def do(args): """Main entry point""" toc = qibuild.toc_open(args.worktree, args) # Compute final destination: prefix = args.prefix[1:] destdir = qibuild.sh.to_native_path(args.destdir) dest = os.path.join(destdir, prefix) # Resolve deps: (project_names, package_names, _) = toc.resolve_deps(runtime=args.runtime) if toc.active_config: ui.info(ui.green, "Active configuration: ", ui.blue, "%s (%s)" % (toc.active_config, toc.build_type)) ui.info(ui.green, "The following projects") for project_name in project_names: ui.info(ui.green, " *", ui.blue, project_name) if args.include_deps and package_names: ui.info(ui.green, "and the following packages") for package_name in package_names: ui.info(" *", ui.blue, package_name) ui.info(ui.green, "will be installed to", ui.blue, dest) if args.runtime: ui.info(ui.green, "(runtime components only)") # Install packages to destdir: if args.include_deps and package_names: print ui.info(ui.green, ":: ", "Installing packages") for (i, package_name) in enumerate(package_names): ui.info(ui.green, "*", ui.reset, "(%i/%i)" % (i+1, len(package_names)), ui.green, "Installing package", ui.blue, package_name) toc.toolchain.install_package(package_name, dest, runtime=args.runtime) print # Install projects to destdir: ui.info(ui.green, ":: ", "Installing projects") projects = [toc.get_project(name) for name in project_names] for (i, project) in enumerate(projects): ui.info(ui.green, "*", ui.reset, "(%i/%i)" % (i+1, len(projects)), ui.green, "Installing project", ui.blue, project.name) toc.install_project(project, args.destdir, prefix=args.prefix, runtime=args.runtime, num_jobs=args.num_jobs, split_debug=args.split_debug)
def do(args): """Main entry point""" toc = qibuild.toc_open(args.worktree, args) config = toc.active_config if not args.project: project_name = qibuild.project.project_from_cwd() else: project_name = args.project project = toc.get_project(project_name) package_name = get_package_name(project, version=args.version, config=config) destdir = os.path.join(toc.worktree.root, "package") destdir = os.path.join(destdir, package_name) if args.internal: args.cmake_flags.append('QI_INSTALL_INTERNAL=ON') if sys.platform.startswith("win") and not args.runtime: # Ignore the --release flag and always build in debug and in release: _do_package(args, project_name, destdir, debug=True) _do_package(args, project_name, destdir, debug=False) else: ui.info(ui.green, "> Configuring ...") qibuild.run_action("qibuild.actions.configure", [project_name, "--no-clean-first"], forward_args=args) print ui.info(ui.green, "> Building ...") qibuild.run_action("qibuild.actions.make", [project_name, "--no-fix-shared-libs"], forward_args=args) print ui.info(ui.green, "> Installing ...") qibuild.run_action("qibuild.actions.install", [project_name, destdir], forward_args=args) print if args.compress: ui.info(ui.green, "> Compressing package ...") archive = qibuild.archive.compress(destdir, algo="zip", quiet=True) ui.info(ui.green, "Package generated in", ui.reset, ui.bold, archive) # Now, clean the destdir. qibuild.sh.rm(destdir) return archive else: return destdir
def do(args): """Main entry point""" if args.build_directory and not args.single: raise Exception("You should use --single when specifying a build directory") logger = logging.getLogger(__name__) toc = qibuild.toc_open(args.work_tree, args) (project_names, _, _) = toc.resolve_deps() projects = [toc.get_project(name) for name in project_names] if args.build_directory: projects[0].set_custom_build_directory(args.build_directory) if toc.active_config: logger.info("Active configuration: %s", toc.active_config) for project in projects: logger.info("Configuring %s", project.name) toc.configure_project(project, clean_first=args.clean_first)
def do(args): """Main entry point""" toc = qibuild.toc_open(args.worktree, args) if not args.project: project_name = qibuild.project.project_from_cwd() else: project_name = args.project project = toc.get_project(project_name) build_dir = project.build_directory cmake_cache = os.path.join(build_dir, "CMakeCache.txt") if not os.path.exists(cmake_cache): qibuild.toc.advise_using_configure(toc, project) res = qibuild.ctest.run_tests(project, toc.build_env, pattern=args.pattern, slow=args.slow, dry_run=args.dry_run, valgrind=args.valgrind, verbose=args.verbose_tests) if not res: sys.exit(1)
def do(args): """Main entry point""" toc = qibuild.toc_open(args.work_tree, args) config = toc.active_config if not args.project: project_name = qibuild.toc.project_from_cwd() else: project_name = args.project project = toc.get_project(project_name) package_name = get_package_name(project, version=args.version, config=config) destdir = os.path.join(toc.work_tree, "package") destdir = os.path.join(destdir, package_name) if args.internal: args.cmake_flags.append('QI_INSTALL_INTERNAL=ON') if sys.platform.startswith("win") and not args.runtime: # Ignore the --release flag and always build in debug and in release: _do_package(args, project_name, destdir, debug=True) _do_package(args, project_name, destdir, debug=False) else: qibuild.run_action("qibuild.actions.configure", [project_name, "--no-clean-first"], forward_args=args) qibuild.run_action("qibuild.actions.make", [project_name], forward_args=args) qibuild.run_action("qibuild.actions.install", [project_name, destdir], forward_args=args) if args.compress: LOGGER.info("Compressing package") archive = qibuild.archive.zip(destdir) LOGGER.info("Package generated in %s", archive) # Now, clean the destdir. qibuild.sh.rm(destdir) return archive else: return destdir
def do(args): """Main entry point""" if args.build_directory and not args.single: raise Exception("You should use --single when specifying a build directory") if not args.cmake_flags: args.cmake_flags = list() if args.effective_cplusplus: args.cmake_flags.append("QI_EFFECTIVE_CPP=ON") if args.werror: args.cmake_flags.append("QI_WERROR=ON") toc = qibuild.toc_open(args.worktree, args) (project_names, _, _) = toc.resolve_deps() projects = [toc.get_project(name) for name in project_names] if args.build_directory: projects[0].set_custom_build_directory(args.build_directory) if args.debug_trycompile: print "--debug-trycompile ON" ui.info(ui.green, "Current worktree:", ui.reset, ui.bold, toc.worktree.root) if toc.active_config: ui.info(ui.green, "Active configuration:", ui.blue, toc.active_config) project_count = len(projects) i = 0 for project in projects: i = i + 1 ui.info(ui.green, "*", ui.reset, "(%i/%i)" % (i, project_count), ui.green, "Configuring", ui.blue, project.name) toc.configure_project(project, clean_first=args.clean_first, debug_trycompile=args.debug_trycompile, profile=args.profile)
def do(args): """Main entry point""" url = args.url (username, server, remote_directory) = qibuild.deploy.parse_url(url) toc = qibuild.toc_open(args.worktree, args) ui.info(ui.green, "Current worktree:", ui.reset, ui.bold, toc.worktree.root) if toc.active_config: ui.info(ui.green, "Active configuration: ", ui.blue, "%s (%s)" % (toc.active_config, toc.build_type)) rsync = qibuild.command.find_program("rsync", env=toc.build_env) use_rsync = False if rsync: use_rsync = True else: ui.warning("Please install rsync to get faster synchronisation") scp = qibuild.command.find_program("scp", env=toc.build_env) if not scp: raise Exception("Could not find rsync or scp") # Resolve deps: (project_names, package_names, _) = toc.resolve_deps(runtime=True) projects = [toc.get_project(name) for name in project_names] if not args.single: ui.info(ui.green, "The following projects") for project_name in project_names: ui.info(ui.green, " *", ui.blue, project_name) if not args.single and package_names: ui.info(ui.green, "and the following packages") for package_name in package_names: ui.info(" *", ui.blue, package_name) ui.info(ui.green, "will be deployed to", ui.blue, url) # Deploy packages: install all of them in the same temp dir, then # deploy this temp dir to the target if not args.single and package_names: print ui.info(ui.green, ":: ", "Deploying packages") with qibuild.sh.TempDir() as tmp: for (i, package_name) in enumerate(package_names): ui.info(ui.green, "*", ui.reset, "(%i/%i)" % (i+1, len(package_names)), ui.green, "Deploying package", ui.blue, package_name, ui.green, "to", ui.blue, url) toc.toolchain.install_package(package_name, tmp, runtime=True) qibuild.deploy.deploy(tmp, args.url, use_rsync=use_rsync, port=args.port) print if not args.single: ui.info(ui.green, ":: ", "Deploying projects") # Deploy projects: install them inside a 'deploy' dir inside the build dir, # then deploy this dir to the target for (i, project) in enumerate(projects): ui.info(ui.green, "*", ui.reset, "(%i/%i)" % (i+1, len(projects)), ui.green, "Deploying project", ui.blue, project.name, ui.green, "to", ui.blue, url) destdir = os.path.join(project.build_directory, "deploy") #create folder for project without install rules qibuild.sh.mkdir(destdir, recursive=True) toc.install_project(project, destdir, prefix="/", runtime=True, num_jobs=args.num_jobs, split_debug=True) qibuild.deploy.deploy(destdir, args.url, use_rsync=use_rsync, port=args.port) qibuild.deploy.generate_debug_scripts(toc, project.name, args.url)
def do(args): """Main entry point""" toc = qibuild.toc_open(args.work_tree, args) (project_names, package_names, _) = toc.resolve_deps(runtime=args.runtime) # Why do we call cmake here? # If CMAKE_INSTALL_PREFIX was never set by the user, it # defaults to /usr/local. # If the destdir given by the user is /tmp/foo/, files will be installed in # /tmp/foo/usr/local. # So, if we want packages to be installed to /tmp/usr/local too we need to # know what was the value of CMAKE_INSTALL_PREFIX, and better be sure # that it has the same value for every project. # A simple way to do this is to re-call cmake on every dependency, # without cleaning the cache (or else we would not use user's previous # settings) # DESTDIR=/tmp/foo and CMAKE_PREFIX="/usr/local" means # dest = /tmp/foo/usr/local prefix = args.prefix[1:] destdir = qibuild.sh.to_native_path(args.destdir) dest = os.path.join(args.destdir, prefix) dest = qibuild.sh.to_native_path(dest) LOGGER.info("Setting CMAKE_INSTALL_PREFIX=%s on every project", args.prefix) for project_name in project_names: project = toc.get_project(project_name) # note: cmake will emit warnings at this time when using NMake makefiles # because LIBPATH, INCLUDE et al. are not set. # this is because we do NOT mess with os.environ ... # This is why we need to re-read env from toc.build_env so that no warning # appears. qibuild.cmake.cmake( project.directory, project.build_directory, ["-DCMAKE_INSTALL_PREFIX=%s" % args.prefix], clean_first=False, env=toc.build_env, ) if not args.include_deps: project_names = [project_name] if project_names: LOGGER.info("Installing %s to %s (%s)", ", ".join([n for n in project_names]), dest, toc.build_type) for project_name in project_names: project = toc.get_project(project_name) # Build target preinstall on the project (not always called for some reason) if not toc.using_visual_studio: toc.build_project(project, target="preinstall") toc.install_project(project, destdir, runtime=args.runtime) if not args.include_deps: return if package_names: LOGGER.info("Installing %s to %s (%s)", ", ".join([p for p in package_names]), dest, toc.build_type) for package_name in package_names: toc.toolchain.install_package(package_name, dest, runtime=args.runtime)
def do(args): """Main entry point""" toc = qibuild.toc_open(args.work_tree, args) (project_names, package_names, _) = toc.resolve_deps(runtime=args.runtime) # Why do we call cmake here? # If CMAKE_INSTALL_PREFIX was never set by the user, it # defaults to /usr/local. # If the destdir given by the user is /tmp/foo/, files will be installed in # /tmp/foo/usr/local. # So, if we want packages to be installed to /tmp/usr/local too we need to # know what was the value of CMAKE_INSTALL_PREFIX, and better be sure # that it has the same value for every project. # A simple way to do this is to re-call cmake on every dependency, # without cleaning the cache (or else we would not use user's previous # settings) # DESTDIR=/tmp/foo and CMAKE_PREFIX="/usr/local" means # dest = /tmp/foo/usr/local prefix = args.prefix[1:] destdir = qibuild.sh.to_native_path(args.destdir) dest = os.path.join(args.destdir, prefix) dest = qibuild.sh.to_native_path(dest) LOGGER.info("Setting CMAKE_INSTALL_PREFIX=%s on every project", args.prefix) for project_name in project_names: project = toc.get_project(project_name) # note: cmake will emit warnings at this time when using NMake makefiles # because LIBPATH, INCLUDE et al. are not set. # this is because we do NOT mess with os.environ ... # This is why we need to re-read env from toc.build_env so that no warning # appears. qibuild.cmake.cmake(project.directory, project.build_directory, ['-DCMAKE_INSTALL_PREFIX=%s' % args.prefix], clean_first=False, env=toc.build_env) if not args.include_deps: project_names = [project_name] if project_names: LOGGER.info("Installing %s to %s (%s)", ", ".join([n for n in project_names]), dest, toc.build_type) for project_name in project_names: project = toc.get_project(project_name) # Build target preinstall on the project (not always called for some reason) if toc.cmake_generator == "Unix Makefiles": toc.build_project(project, target="preinstall") toc.install_project(project, destdir, runtime=args.runtime) if not args.include_deps: return if package_names: LOGGER.info("Installing %s to %s (%s)", ", ".join([p for p in package_names]), dest, toc.build_type) for package_name in package_names: toc.toolchain.install_package(package_name, dest, runtime=args.runtime)