Пример #1
0
def installToDevices(devices, doParallel):
    padLen = max([len(device.model) for device in devices]) + 1
    if doParallel:
        common.parallelApply(installToDevice,
                             [(device,
                               ("(%s):%s" % (device.model, ' ' *
                                             (padLen - len(device.model)))))
                              for device in devices])
    else:
        common.serialApply(installToDevice, [(device, ) for device in devices])
Пример #2
0
def build(buildRoot=common.ANDROID_DIR,
          androidBuildType='debug',
          nativeBuildType="Release",
          javaApi=common.ANDROID_JAVA_API,
          doParallelBuild=False,
          package="package",
          gtfTarget='gles32'):
    curDir = os.getcwd()

    try:
        assetsSrcDir = getAssetsDir(buildRoot, common.NATIVE_LIBS[0],
                                    nativeBuildType)
        assetsDstDir = os.path.join(buildRoot, package, "assets")

        # Remove assets from the first build dir where we copy assets from
        # to avoid collecting cruft there.
        if os.path.exists(assetsSrcDir):
            shutil.rmtree(assetsSrcDir)
        if os.path.exists(assetsDstDir):
            shutil.rmtree(assetsDstDir)

        # Remove old libs dir to avoid collecting out-of-date versions
        # of libs for ABIs not built this time.
        libTargetDir = os.path.join(buildRoot, package, "libs")
        if os.path.exists(libTargetDir):
            shutil.rmtree(libTargetDir)

        # Build native code
        nativeBuildArgs = [(buildRoot, libTargetDir, nativeLib,
                            nativeBuildType, gtfTarget)
                           for nativeLib in common.NATIVE_LIBS]
        if doParallelBuild:
            common.parallelApply(buildNative, nativeBuildArgs)
        else:
            common.serialApply(buildNative, nativeBuildArgs)

        # Copy assets
        if os.path.exists(assetsSrcDir):
            shutil.copytree(assetsSrcDir, assetsDstDir)

        # Build java code and .apk
        buildApp(buildRoot, androidBuildType, javaApi, package)

    finally:
        # Restore working dir
        os.chdir(curDir)
Пример #3
0
def build (buildRoot=common.ANDROID_DIR, androidBuildType='debug', nativeBuildType="Release", javaApi=common.ANDROID_JAVA_API, doParallelBuild=False):
	curDir = os.getcwd()

	try:
		assetsSrcDir = getAssetsDir(buildRoot, common.NATIVE_LIBS[0], nativeBuildType)
		assetsDstDir = os.path.join(buildRoot, "package", "assets")

		# Remove assets from the first build dir where we copy assets from
		# to avoid collecting cruft there.
		if os.path.exists(assetsSrcDir):
			shutil.rmtree(assetsSrcDir)
		if os.path.exists(assetsDstDir):
			shutil.rmtree(assetsDstDir)

		# Remove old libs dir to avoid collecting out-of-date versions
		# of libs for ABIs not built this time.
		libTargetDir = os.path.join(buildRoot, "package", "libs")
		if os.path.exists(libTargetDir):
			shutil.rmtree(libTargetDir)

		# Build native code
		nativeBuildArgs = [(buildRoot, libTargetDir, nativeLib, nativeBuildType) for nativeLib in common.NATIVE_LIBS]
		if doParallelBuild:
			common.parallelApply(buildNative, nativeBuildArgs)
		else:
			common.serialApply(buildNative, nativeBuildArgs)

		# Copy assets
		if os.path.exists(assetsSrcDir):
			shutil.copytree(assetsSrcDir, assetsDstDir)

		# Build java code and .apk
		buildApp(buildRoot, androidBuildType, javaApi)

	finally:
		# Restore working dir
		os.chdir(curDir)
Пример #4
0
def installToDevices (devices, doParallel):
	padLen = max([len(device.model) for device in devices])+1
	if doParallel:
		common.parallelApply(installToDevice, [(device, ("(%s):%s" % (device.model, ' ' * (padLen - len(device.model))))) for device in devices]);
	else:
		common.serialApply(installToDevice, [(device, ) for device in devices]);