Example #1
0
def prepare(items, rootPath):

    # copy source code to root path
    if os.path.isdir(os.path.join(rootPath, "samples")):
        build_common.deletePath(os.path.join(rootPath, "samples"))
    os.mkdir(os.path.join(rootPath, "samples"))

    sampleCodeRoot = os.path.join(build_common.rootPath, "sampleapp",
                                  build_common.branchName)
    build_common.copyPath(os.path.join(sampleCodeRoot, "util"),
                          os.path.join(rootPath, "samples", "util"))
    for item in items:
        os.mkdir(os.path.join(rootPath, "samples", item))
        build_common.copyPath(os.path.join(sampleCodeRoot, item),
                              os.path.join(rootPath, "samples", item),
                              ["startscript"])

    # copy library folder to ../../sampleapp
    tempLibraryFolder = os.path.join(build_common.curPath,
                                     "../../sampleapp/library")
    if os.path.isdir(tempLibraryFolder):
        build_common.deletePath(tempLibraryFolder)
    os.mkdir(tempLibraryFolder)

    if not os.path.isdir(os.path.join(rootPath, "library")):
        return False

    build_common.copyPath(os.path.join(rootPath, "library"), tempLibraryFolder)

    # get current server token from server_config.txt
    serverConfsFile = open(
        os.path.join(build_common.curPath, "server_configurations.txt"), "r")
    configs = serverConfsFile.readlines()
    serverConfsFile.close()

    token = ""
    if len(configs) > 0:
        token = configs[0].split(",")[1]
        token = token.strip().strip("\"")

    # generate servertoken.h
    tokenHeaderPath = os.path.join(sampleCodeRoot, "util", "include",
                                   "servertoken.h")
    if os.path.isfile(tokenHeaderPath):
        os.chmod(
            tokenHeaderPath, stat.S_IWRITE | stat.S_IWGRP | stat.S_IWOTH
            | stat.S_IREAD | stat.S_IRGRP | stat.S_IROTH)
        fileObj = open(tokenHeaderPath, 'r')
        content = fileObj.read()
        fileObj.close()
        content = content.replace("$YOUR_TOKEN", token)
        fileObj = open(tokenHeaderPath, 'w')
        fileObj.write(content)
        fileObj.close()

    return True
Example #2
0
def setup_environment():
    """"""
    global versionPath
    global versionFolder
    global versionLtk

    build_common.platform = "qnx"
    if len(sys.argv) > 1:
        build_common.platform = sys.argv[1]
    build_common.curPath = os.path.abspath(".")
    build_common.branchName = os.path.split(build_common.curPath)[1]
    build_common.rootPath = os.path.abspath("../../")
    build_common.outputRoot = os.path.join(build_common.rootPath, "build",
                                           build_common.branchName, "output")

    if build_common.platform == "linux":
        build_common.ltkItems = [
            "common", "locationkit", "mapkit3d", "navigationkit", "searchkit"
        ]
        build_common.sampleItems = [
            "qtnavigator_console_plugin", "qtnavigator_cluster_plugin",
            "qtnavigator_sampleApp", "mapviewplugin"
        ]
        build_common.thirdpartyItems = ["automotivedemo"]
    elif build_common.platform == "qnx":
        build_common.ltkItems = [
            "common", "locationkit", "mapkit3d", "navigationkit", "searchkit"
        ]
        build_common.sampleItems = ["mapkit3d_sample", "navkit_sample"]
        build_common.thirdpartyItems = []
    else:
        build_common.ltkItems = []
        build_common.sampleItems = []
        build_common.thirdpartyItems = []
    # read toolchain and architecture
    toolchain = "ubuntu"
    architecture = "x86_64"
    if len(sys.argv) > 3:
        toolchain = sys.argv[3].lower()
    if len(sys.argv) > 4:
        architecture = sys.argv[4].lower()

    print("here is .........." + toolchain + "_" + architecture)
    # read version.txt, create package folder
    versionLtk = open("version.txt", 'r').read()
    versionFolder = "ltk_" + versionLtk + "_" + toolchain + "_" + architecture
    if len(sys.argv) > 2 and sys.argv[2].lower() == "hybrid":
        versionFolder = versionFolder + "_hybrid"
    versionPath = os.path.join(build_common.curPath, versionFolder)

    if os.path.isdir(versionPath):
        build_common.deletePath(versionPath)
    os.mkdir(versionPath)

    return True
Example #3
0
def copy_libraries(items, targetPath, buildType):
    """"""
    if os.path.isdir(os.path.join(targetPath, "lib")):
        build_common.deletePath(os.path.join(targetPath, "lib"))

    os.mkdir(os.path.join(targetPath, "lib"))
    build_common.copyPath(
        os.path.join(build_common.outputRoot, buildType, "lib"),
        os.path.join(targetPath, "lib"))

    return True
def package(targetPath):
    """"""
    if os.path.isdir( os.path.join(targetPath,"assets") ):
        build_common.deletePath(os.path.join(targetPath,"assets"))
    os.mkdir(os.path.join(targetPath,"assets"))

    resourcePath = os.path.join(build_common.rootPath, "mapkit3d", build_common.branchName, "resource")
    build_common.copyPath(resourcePath, os.path.join(targetPath, "assets") )

    resourcePath = os.path.join(build_common.rootPath, "navigationkit", build_common.branchName, "resource")
    build_common.copyPath(resourcePath, os.path.join(targetPath, "assets"))

    return True
Example #5
0
def build_items(items, buildType):
    """"""
    testCodeRoot = os.path.join(build_common.rootPath, "testapp", build_common.branchName)

    for item in items:
        projectPath = os.path.join(testCodeRoot, item, "project")
        outputPath = os.path.join(projectPath, buildType)
        if os.path.isdir(os.path.join(outputPath)):
            build_common.deletePath(os.path.join(outputPath))

        if build_common.compileQtProject(projectPath, buildType) == False:
            print("!!!!!!!!!!Build LTK [" + item + "] failed.")
            return False;

    return True
Example #6
0
def copy_headers(items, targetPath):
    """"""
    if os.path.isdir(os.path.join(targetPath, "include")):
        build_common.deletePath(os.path.join(targetPath, "include"))
    os.mkdir(os.path.join(targetPath, "include"))

    for item in items:
        os.mkdir(os.path.join(targetPath, "include", item))
        itemInclude = os.path.join(build_common.rootPath, item,
                                   build_common.branchName, "include")
        build_common.copyPath(itemInclude,
                              os.path.join(targetPath, "include", item),
                              ["private", "protected"])

    return True
def generate_installer(zipFileName, targetPath):
    tmpfolder = os.path.join(targetPath, "temp")
    if os.path.isdir(tmpfolder):
        build_common.deletePath(tmpfolder)
    os.mkdir(tmpfolder)
    #shutil.copyfile(os.path.join(targetPath, zipFileName), os.path.join(tmpfolder, "ltk.zip"))
    if os.environ.get("BOARD") == "jetson":
        shutil.copyfile(os.path.join(build_common.curPath, "install_armhf.sh"),
                        os.path.join(tmpfolder, "install.sh"))
    else:  #linux x86
        shutil.copyfile(os.path.join(build_common.curPath, "install_x86.sh"),
                        os.path.join(tmpfolder, "install.sh"))
    os.chdir(targetPath)
    os.system("chmod +x temp/install.sh")
    os.system("makeself temp setup.bin LTKInstaller ./install.sh")
    os.chdir(build_common.curPath)
    build_common.deletePath(tmpfolder)
    return True
def package(targetPath, versionPath):
    """"""
    generate_document(versionPath)
    zipFileName = zip_version_folder(versionPath)

    if os.path.isdir(os.path.join(build_common.curPath, targetPath)):
        build_common.deletePath(os.path.join(build_common.curPath, targetPath))
    os.mkdir(targetPath)

    folder = os.path.split(versionPath)[1]
    shutil.move(zipFileName, targetPath)
    #shutil.move(folder, targetPath)
    build_common.deletePath(folder)
    if os.path.isdir(os.path.join(build_common.curPath, "tpslib")):
        shutil.move(os.path.join(build_common.curPath, "tpslib"), targetPath)
    if os.path.isdir(os.path.join(build_common.curPath, "testapp")):
        shutil.move(os.path.join(build_common.curPath, "testapp"),
                    os.path.join(targetPath, folder))

    if platform.system() == "Linux":
        generate_installer(zipFileName, targetPath)
    return True
Example #9
0
if __name__ == '__main__':

    build_common.curPath = os.path.abspath("./")
    build_common.branchName = os.path.split(build_common.curPath)[1]
    build_common.rootPath = os.path.abspath("../../")
    build_common.outputRoot = os.path.join(build_common.rootPath, "build",
                                           build_common.branchName, "output")

    # read version.txt, create package folder
    versionLtk = open("version.txt", 'r').read()
    versionFolder = "ltk_" + versionLtk
    versionPath = os.path.join(build_common.curPath, versionFolder)

    if os.path.isdir(versionPath):
        build_common.deletePath(versionPath)
    os.mkdir(versionPath)

    # buld ltk sdk
    print "package--creating LTK SDK"
    ltkItems = ["common", "locationkit", "mapkit3d"]
    targetPath = os.path.join(versionPath, "library")
    if os.path.isdir(targetPath):
        build_common.deletePath(targetPath)
    os.mkdir(targetPath)

    if not build_LTK.compileLTKs(ltkItems, targetPath):
        print "build ltk libraries failed"
        print "BUILD FAILED"
        exit()