Exemplo n.º 1
0
def compare():
  afile = sys.argv[1]
  bfile = sys.argv[2]

  adata = utfile.loadJsonFile(afile)
  bdata = utfile.loadJsonFile(bfile)

  adict = common.transInfo(adata)
  bdict = common.transInfo(bdata)
  
  totalDiffSize = 0
  diffs = []
  for k, v in bdict.items():
    sz = v['S']
    szstr = '{:.2f}M'.format(v['S']/1024/1024)
    if k not in adict:
      totalDiffSize += sz
      diffs.append([k, szstr])
    elif v['H'] != adict[k]['H']:
      totalDiffSize += sz
      diffs.append([k, szstr])
  print('totalDiffSize = {:.2f}M'.format(totalDiffSize/1024/1024))
  if totalDiffSize > 0:
    for v in diffs:
      print(v)
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 getNasUabRoot():
    jd = utfile.loadJsonFile(os.path.join(workroot, WORKROOT_BUILTIN_CFG_PATH))
    root = NAS_FOLDER_UAB + '{}.{}'.format(jd['version'], svnversion)
    utfile.ensureDir(root)
    root = root + '\\{}'.format(platform)
    utfile.ensureDir(root)
    return root
Exemplo n.º 4
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.º 5
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.º 6
0
def _collectUabs(infopath, usegrps, info):
    jd = utfile.loadJsonFile(infopath)
    for v in jd['G']:
        grp = common.getUabGroup(v['N'])
        if grp in usegrps:
            info['G'].append(v)
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)