def packAPP(build_json=None, app_src=None, app_dest=None, app_name=None): LOG.info("Packing %s(%s)" % (app_name, app_src)) if not os.path.exists(app_dest): try: os.makedirs(app_dest) except Exception as e: LOG.error("Fail to init package install dest dir: %s" % e) return False app_tpye = utils.safelyGetValue(build_json, "app-type") if utils.checkContains(BUILD_PARAMETERS.pkgtype, "APK") and app_tpye == "EXTENSION": if not build_extension.packExtension(build_json, app_src, app_dest, app_name): return False if not build_android.packAPK(build_json, app_src, app_dest, app_name): return False elif utils.checkContains(BUILD_PARAMETERS.pkgtype, "APK") and app_tpye != "EMBEDDINGAPI": if not build_android.packAPK(build_json, app_src, app_dest, app_name): return False elif utils.checkContains(BUILD_PARAMETERS.pkgtype, "CORDOVA"): if BUILD_PARAMETERS.subversion == "4.x": if not build_cordova.packCordova_cli(build_json, app_src, app_dest, app_name): return False else: if not build_cordova.packCordova(build_json, app_src, app_dest, app_name): return False elif utils.checkContains(BUILD_PARAMETERS.pkgtype, "EMBEDDINGAPI") or app_tpye == "EMBEDDINGAPI": app_version = None if "_" in app_name: index_flag = app_name.index("_") app_version = app_name[index_flag + 1 :] if app_version: utils.replaceUserString( app_src, "AndroidManifest.xml", "org.xwalk.embedding.test", "org.xwalk.embedding.test." + app_version ) utils.replaceUserString( app_src, "AndroidManifest.xml", "EmbeddingApiTestUnit", "EmbeddingApiTestUnit" + app_version ) main_dest = os.path.join(app_src, "src/org/xwalk/embedding") utils.replaceUserString( main_dest, "MainActivity.java", "org.xwalk.embedding.test", "org.xwalk.embedding.test." + app_version ) if BUILD_PARAMETERS.packtype and utils.checkContains(BUILD_PARAMETERS.packtype, "GRADLE"): if not build_embeddingapi.packEmbeddingAPI_gradle(build_json, app_src, app_dest, app_name, app_version): return False elif BUILD_PARAMETERS.packtype and utils.checkContains(BUILD_PARAMETERS.packtype, "MAVEN"): if not build_embeddingapi.packEmbeddingAPI_maven(build_json, app_src, app_dest, app_name, app_version): return False else: if not build_embeddingapi.packEmbeddingAPI_ant(build_json, app_src, app_dest, app_name, app_version): return False elif utils.checkContains(BUILD_PARAMETERS.pkgtype, "DEB"): if not build_deb.packDeb(build_json, app_src, app_dest, app_name): return False else: LOG.error("Got wrong pkg type: %s" % BUILD_PARAMETERS.pkgtype) return False LOG.info("Success to pack APP: %s" % app_name) return True
def buildPKGAPP(build_json=None): LOG.info("+Building package APP ...") if not utils.doCopy(os.path.join(BUILD_ROOT_SRC, "icon.png"), os.path.join(BUILD_ROOT_SRC_PKG_APP, "icon.png")): return False if utils.checkContains(BUILD_PARAMETERS.pkgtype, "XPK"): if not utils.doCopy( os.path.join(BUILD_ROOT_SRC, "manifest.json"), os.path.join(BUILD_ROOT_SRC_PKG_APP, "manifest.json") ): return False elif utils.checkContains(BUILD_PARAMETERS.pkgtype, "WGT"): if not utils.doCopy( os.path.join(BUILD_ROOT_SRC, "config.xml"), os.path.join(BUILD_ROOT_SRC_PKG_APP, "config.xml") ): return False hosted_app = False if utils.safelyGetValue(build_json, "hosted-app") == "true": hosted_app = True if not createIndexFile(os.path.join(BUILD_ROOT_SRC_PKG_APP, "index.html"), hosted_app): return False if not hosted_app: if "blacklist" not in build_json: build_json.update({"blacklist": []}) build_json["blacklist"].extend(PKG_BLACK_LIST) if not buildSRC(BUILD_ROOT_SRC, BUILD_ROOT_PKG_APP, build_json): return False if "subapp-list" in build_json: for i_sub_app in build_json["subapp-list"].keys(): if not buildSubAPP(i_sub_app, build_json["subapp-list"][i_sub_app], BUILD_ROOT_PKG_APP): return False if not packAPP(build_json, BUILD_ROOT_SRC_PKG_APP, BUILD_ROOT_PKG, PKG_NAME): return False return True
def packAPP(build_json=None, app_src=None, app_dest=None, app_name=None): LOG.info("Packing %s(%s)" % (app_name, app_src)) if not os.path.exists(app_dest): try: os.makedirs(app_dest) except Exception as e: LOG.error("Fail to init package install dest dir: %s" % e) return False app_tpye = utils.safelyGetValue(build_json, 'app-type') if utils.checkContains(BUILD_PARAMETERS.pkgtype, "APK") and app_tpye == "EXTENSION": if not build_extension.packExtension(build_json, app_src, app_dest, app_name): return False if not build_android.packAPK(build_json, app_src, app_dest, app_name): return False elif utils.checkContains(BUILD_PARAMETERS.pkgtype, "APK") and app_tpye != "EMBEDDINGAPI": if not build_android.packAPK(build_json, app_src, app_dest, app_name): return False elif utils.checkContains(BUILD_PARAMETERS.pkgtype, "CORDOVA"): if BUILD_PARAMETERS.subversion == '4.x': if not build_cordova.packCordova_cli(build_json, app_src, app_dest, app_name): return False else: if not build_cordova.packCordova(build_json, app_src, app_dest, app_name): return False elif utils.checkContains(BUILD_PARAMETERS.pkgtype, "EMBEDDINGAPI") or app_tpye == "EMBEDDINGAPI": app_version = None if "_" in app_name: index_flag = app_name.index("_") app_version = app_name[index_flag + 1:] if app_version: utils.replaceUserString(app_src, 'AndroidManifest.xml', 'org.xwalk.embedding.test', "org.xwalk.embedding.test." + app_version) utils.replaceUserString(app_src, 'AndroidManifest.xml', 'EmbeddingApiTestUnit', "EmbeddingApiTestUnit" + app_version) main_dest = os.path.join(app_src, "src/org/xwalk/embedding") utils.replaceUserString(main_dest, 'MainActivity.java', 'org.xwalk.embedding.test', "org.xwalk.embedding.test." + app_version) if BUILD_PARAMETERS.packtype and utils.checkContains( BUILD_PARAMETERS.packtype, "GRADLE"): if not build_embeddingapi.packEmbeddingAPI_gradle( build_json, app_src, app_dest, app_name, app_version): return False elif BUILD_PARAMETERS.packtype and utils.checkContains( BUILD_PARAMETERS.packtype, "MAVEN"): if not build_embeddingapi.packEmbeddingAPI_maven( build_json, app_src, app_dest, app_name, app_version): return False else: if not build_embeddingapi.packEmbeddingAPI_ant( build_json, app_src, app_dest, app_name, app_version): return False elif utils.checkContains(BUILD_PARAMETERS.pkgtype, "DEB"): if not build_deb.packDeb(build_json, app_src, app_dest, app_name): return False else: LOG.error("Got wrong pkg type: %s" % BUILD_PARAMETERS.pkgtype) return False LOG.info("Success to pack APP: %s" % app_name) return True
def packAPP(build_json=None, app_src=None, app_dest=None, app_name=None): LOG.info("Packing %s(%s)" % (app_name, app_src)) if not os.path.exists(app_dest): try: os.makedirs(app_dest) except Exception as e: LOG.error("Fail to init package install dest dir: %s" % e) return False app_tpye = utils.safelyGetValue(build_json, 'app-type') if utils.checkContains(BUILD_PARAMETERS.pkgtype, "APK") and app_tpye == "EXTENSION": if not build_extension.packExtension(build_json, app_src, app_dest, app_name): return False if not build_android.packAPK(build_json, app_src, app_dest, app_name): return False elif utils.checkContains(BUILD_PARAMETERS.pkgtype, "APK") and app_tpye != "EMBEDDINGAPI": if not build_android.packAPK(build_json, app_src, app_dest, app_name): return False elif utils.checkContains(BUILD_PARAMETERS.pkgtype, "CORDOVA"): if not build_cordova.packCordova(build_json, app_src, app_dest, app_name): return False elif utils.checkContains(BUILD_PARAMETERS.pkgtype, "EMBEDDINGAPI") or app_tpye == "EMBEDDINGAPI": app_version = None if "_" in app_name: index_flag = app_name.index("_") app_version = app_name[index_flag + 1:] if app_version: utils.replaceUserString( app_src, 'AndroidManifest.xml', 'org.xwalk.embedding.test', "org.xwalk.embedding.test." + app_version) utils.replaceUserString( app_src, 'AndroidManifest.xml', 'org.xwalk.embedding.asynctest', "org.xwalk.embedding.asynctest." + app_version) utils.replaceUserString( app_src, 'AndroidManifest.xml', 'EmbeddingApiTestUnit', "EmbeddingApiTestUnit" + app_version) utils.replaceUserString( app_src, 'AndroidManifest.xml', 'EmbeddingApiAsynctestUnit', "EmbeddingApiAsynctestUnit" + app_version) if app_version != "v6": utils.replaceUserString( app_src, 'AndroidManifest.xml', '<provider android:name=\"org.xwalk.embedding.base.TestContentProvider\"' + ' android:authorities=\"org.xwalk.embedding.base.TestContentProvider\" />', "") main_dest = os.path.join(app_src, "src/org/xwalk/embedding") utils.replaceUserString( main_dest, 'MainActivity.java', 'org.xwalk.embedding.test', "org.xwalk.embedding.test." + app_version) utils.replaceUserString( main_dest, 'MainActivity.java', 'org.xwalk.embedding.asynctest', "org.xwalk.embedding.asynctest." + app_version) if BUILD_PARAMETERS.packtype and utils.checkContains( BUILD_PARAMETERS.packtype, "GRADLE"): if not build_embeddingapi.packEmbeddingAPI_gradle( build_json, app_src, app_dest, app_name, app_version): return False elif BUILD_PARAMETERS.packtype and utils.checkContains(BUILD_PARAMETERS.packtype, "MAVEN"): if not build_embeddingapi.packEmbeddingAPI_maven( build_json, app_src, app_dest, app_name, app_version): return False else: if not build_embeddingapi.packEmbeddingAPI_ant( build_json, app_src, app_dest, app_name, app_version): return False elif utils.checkContains(BUILD_PARAMETERS.pkgtype, "DEB"): if not build_deb.packDeb(build_json, app_src, app_dest, app_name): return False elif utils.checkContains(BUILD_PARAMETERS.pkgtype, "MSI"): if not build_msi.packMsi(build_json, app_src, app_dest, app_name): return False elif utils.checkContains(BUILD_PARAMETERS.pkgtype, "ios"): if not build_ios.packIOS(build_json, app_src, app_dest, app_name): return False elif utils.checkContains(BUILD_PARAMETERS.pkgtype, "iot"): if not build_iot.packIoT(build_json, app_src, app_dest, app_name): return False else: LOG.error("Got wrong pkg type: %s" % BUILD_PARAMETERS.pkgtype) return False LOG.info("Success to pack APP: %s" % app_name) return True