示例#1
0
文件: Build.py 项目: harrisont/Mario
def main():
    print("Building")
    print("-" * 100)
    result, duration = FunctionTiming.time_function(build)
    duration_str = FunctionTiming.get_duration_str(duration)
    print("Build duration: {}".format(duration_str))
    exit(result)
示例#2
0
def main():
    print("Running CMake")
    print("-" * 100)
    result, duration = FunctionTiming.time_function(generate)
    duration_str = FunctionTiming.get_duration_str(duration)
    print("CMake duration: {}".format(duration_str))
    exit(result)
示例#3
0
import shutil

def setup_workspace():
	""" Returns 0 on success, non-0 on failure.
	"""
	Clean.clean()

	# Copy Git hooks.
	try:
		# First, remove any existing hooks.
		shutil.rmtree(Directories.GIT_HOOKS_ROOT_DIR, ignore_errors=True)

		# Next, use the hooks specified in the depot.
		shutil.copytree(src=Directories.GIT_HOOKS_DEPOT_DIR, dst=Directories.GIT_HOOKS_ROOT_DIR)
	except Error as err:
		print("Error copying Git hooks: '{}'.".format(err))

	# Generate and build
	result = GenerateAndBuild.generate_and_build()
	if result != 0:
		print("generate_and_build failed with return value '{}'".format(result))
		return result

	return 0

if __name__ == "__main__":
	result, duration = FunctionTiming.time_function(setup_workspace)
	duration_str = FunctionTiming.get_duration_str(duration)
	print("Setup workspace duration: {}".format(duration_str))
	exit(result)
示例#4
0
文件: Generate.py 项目: Raagesh/Mario
            format(generator, Directories.BUILD_SCRIPTS_DIR))
    elif generator_validity == CMake.GeneratorValidity.MISSING:
        sys.exit(
            "The CMake generator '{}', set in '{}/Config.py', cannot be found."
            .format(generator, Directories.BUILD_SCRIPTS_DIR))

    # Run from the build directory.
    os.makedirs(build_dir, exist_ok=True)
    os.chdir(build_dir)

    # CMake args:
    #  -Wdev enable developer warnings
    #  -G specifies the generator
    return CMake.run_cmake(["-Wdev", "-G", generator, depot_dir])


def generate():
    """ Returns 0 on success, non-0 on failure.
	"""
    return run_cmake(Config.CMAKE_GENERATOR, Directories.BUILD_DIR,
                     Directories.DEPOT_DIR)


if __name__ == "__main__":
    print("Running CMake")
    print("-" * 100)
    result, duration = FunctionTiming.time_function(generate)
    duration_str = FunctionTiming.get_duration_str(duration)
    print("CMake duration: {}".format(duration_str))
    exit(result)
示例#5
0
def main():
    result, duration = FunctionTiming.time_function(generate_and_build)
    duration_str = FunctionTiming.get_duration_str(duration)
    print("Generate and build duration: {}".format(duration_str))
    exit(result)
示例#6
0
import Build
import FunctionTiming
import Generate


def generate_and_build():
    """ Returns 0 on success, non-0 on failure.
	"""
    generate_result = Generate.generate()
    if generate_result != 0:
        print("Generate failed with return value '{}'".format(generate_result))
        return generate_result

    build_result = Build.build()
    if build_result != 0:
        print("Build failed with return value '{}'".format(build_result))
        return build_result

    return 0


if __name__ == "__main__":
    result, duration = FunctionTiming.time_function(generate_and_build)
    duration_str = FunctionTiming.get_duration_str(duration)
    print("Generate and build duration: {}".format(duration_str))
    exit(result)
示例#7
0
def main():
    result, duration = FunctionTiming.time_function(setup_workspace)
    duration_str = FunctionTiming.get_duration_str(duration)
    print("Setup workspace duration: {}".format(duration_str))
    exit(result)
示例#8
0
import Build
import FunctionTiming
import Generate

def generate_and_build():
	""" Returns 0 on success, non-0 on failure.
	"""
	generate_result = Generate.generate()
	if generate_result != 0:
		print("Generate failed with return value '{}'".format(generate_result))
		return generate_result

	build_result = Build.build()
	if build_result != 0:
		print("Build failed with return value '{}'".format(build_result))
		return build_result

	return 0

if __name__ == "__main__":
	result, duration = FunctionTiming.time_function(generate_and_build)
	duration_str = FunctionTiming.get_duration_str(duration)
	print("Generate and build duration: {}".format(duration_str))
	exit(result)
示例#9
0
import CMake
import CommonDirectories as Directories
import FunctionTiming

def build():
	""" Returns 0 on success, non-0 on failure.
	"""
	return build_helper(Directories.BUILD_DIR)

def build_helper(build_dir):
	""" Returns 0 on success, non-0 on failure.
	"""
	# TODO(HTing): Add support for:
	#   - building differnt configurations ("--config <cfg>")
	#   - cleaning first ("--clean-first")
	return CMake.run_cmake(["--build", build_dir])

if __name__ == "__main__":
	print("Building")
	print("-" * 100)
	result, duration = FunctionTiming.time_function(build)
	duration_str = FunctionTiming.get_duration_str(duration)
	print("Build duration: {}".format(duration_str))
	exit(result)