Exemplo n.º 1
0
def _buildFromConfig():
    global _binaryinfo
    global _currgrp
    jd = utfile.loadJsonFile(
        os.path.join(common.workroot, common.WORKROOT_CONFIG_PATH))
    for _, v in enumerate(jd['G']):
        if not common.IS_BINARY_KEY in v or not v[common.IS_BINARY_KEY]:
            continue
        _currgrp = v
        assetroot = os.path.join(common.workroot, common.WORKROOT_ASSETS_PATH,
                                 v[common.ASSET_PATH_KEY]).replace(
                                     common.KEY_RESOURCESROOT,
                                     common.RESOURCESROOT)
        uabcount = v[common.UAB_COUNT_KEY]
        if uabcount < 0:
            tarroot = os.path.join(common.getBuildRoot(),
                                   common.UAB_BUNDLE_ROOT)
            utfile.copyfolder(assetroot, tarroot, v[common.EXTENSION_KEY],
                              common.UAB_EXT, preprocess, postprocess)
        else:
            target = os.path.join(
                common.getBuildRoot(), common.UAB_BUNDLE_ROOT,
                _currgrp[common.UAB_NAME_KEY] + common.UAB_EXT)
            utfile.zipfolder(assetroot, target, v[common.EXTENSION_KEY])
            postprocess(target)
Exemplo n.º 2
0
def _uab(onlyBinary, onlyBuiltin):
    buildRoot = common.getBuildRoot()
    cfgpath = os.path.join(buildRoot, common.CONFIG_NAME)
    jdcfg = utfile.loadJsonFile(cfgpath)
    usegrps = {}
    for v in jdcfg['G']:
        if (not onlyBinary or
            (common.IS_BINARY_KEY in v and v[common.IS_BINARY_KEY])) and (
                not onlyBuiltin or
                (common.BUILTIN_KEY in v and v[common.BUILTIN_KEY])):
            usegrps[v['name']] = True

    info = {'G': []}
    assetpath = os.path.join(buildRoot, common.ASSET_INFO_NAME)
    if not onlyBinary:
        _collectUabs(assetpath, usegrps, info)
    binarypath = os.path.join(buildRoot, common.BINARY_INFO_NAME)
    _collectUabs(binarypath, usegrps, info)

    for v in info['G']:
        v['V'] = common.svnversion
        if 'R' in v:
            del (v['R'])

    utfile.writeJsonToFile(os.path.join(buildRoot, common.INFO_NAME), info)
Exemplo n.º 3
0
def _copyUab():
    buildRoot = common.getBuildRoot()
    streamingRoot = common.getStreamingRoot()

    utfile.copy(os.path.join(buildRoot, common.INFO_NAME),
                os.path.join(streamingRoot, common.INFO_NAME))
    # utfile.copy(os.path.join(buildRoot, common.INFO_VER_NAME), os.path.join(streamingRoot, common.INFO_VER_NAME))

    jdinfo = utfile.loadJsonFile(os.path.join(streamingRoot, common.INFO_NAME))
    for v in jdinfo['G']:
        file = v['N']
        utfile.copy(os.path.join(buildRoot, common.UAB_BUNDLE_ROOT, file),
                    os.path.join(streamingRoot, common.UAB_BUNDLE_ROOT, file))
Exemplo n.º 4
0
def build():
    global _binaryinfo

    buildRoot = common.getBuildRoot()
    utfile.ensureDir(buildRoot)
    utfile.ensureDir(os.path.join(buildRoot, common.UAB_BUNDLE_ROOT), False)

    _binaryinfo = {'G': []}
    _buildFromConfig()

    _createConfig()
    _createInfo()

    print('done build binary ...')
Exemplo n.º 5
0
def _copyCfg():
    buildRoot = common.getBuildRoot()
    streamingRoot = common.getStreamingRoot()

    utfile.copy(os.path.join(buildRoot, common.CONFIG_NAME),
                os.path.join(streamingRoot, common.CONFIG_NAME))
Exemplo n.º 6
0
def _ver():
    buildRoot = common.getBuildRoot()
    verpath = os.path.join(buildRoot, common.VER_NAME)
    utfile.writeToFile(verpath, common.svnversion)
Exemplo n.º 7
0
def _config():
    buildRoot = common.getBuildRoot()
    cfgpath = os.path.join(buildRoot, common.CONFIG_NAME)
    jdcfg = utfile.loadJsonFile(cfgpath)
    jdcfg['G'] = sorted(jdcfg['G'], key=lambda x: x['name'])
    utfile.writeJsonToFile(cfgpath, jdcfg)
Exemplo n.º 8
0
def _createInfo():
    infopath = os.path.join(common.getBuildRoot(), common.BINARY_INFO_NAME)
    utfile.writeJsonToFile(infopath, _binaryinfo)
Exemplo n.º 9
0
def _createConfig():
    cfgpath = os.path.join(common.workroot, common.WORKROOT_CONFIG_PATH)
    tarpath = os.path.join(common.getBuildRoot(), common.CONFIG_NAME)
    utfile.copy(cfgpath, tarpath)