comm.doRemove([cordova_android_path]) os.system("git clone https://github.com/apache/cordova-android.git") project_path = os.path.join(current_path_tmp, app_name) if os.path.exists(project_path): comm.doRemove([project_path]) os.system("cordova-android/bin/create %s %s %s" % (app_name, pkg_name, app_name)) os.chdir(project_path) os.system("plugman install --platform android --plugin ../../../tools/cordova-plugin-crosswalk-webview/ --project .") pkg_mode_tmp = "shared" if BUILD_PARAMETERS.pkgmode == "embedded": pkg_mode_tmp = "core" xwalk_version = "%s" % comm.CROSSWALK_VERSION if comm.CROSSWALK_BRANCH == "beta": xwalk_version = "org.xwalk:xwalk_%s_library_beta:%s" % (pkg_mode_tmp, comm.CROSSWALK_VERSION) os.system('sed -i "s/<preference default=\\".*\\" name=\\"xwalkVersion\\"/<preference default=\\"%s\\" name=\\"xwalkVersion\\"/g" res/xml/config.xml' % xwalk_version) if BUILD_PARAMETERS.pkgmode == "shared": os.system('sed -i "s/<preference default=\\"embedded\\" name=\\"xwalkMode\\"/<preference default=\\"shared\\" name=\\"xwalkMode\\"/g" res/xml/config.xml') os.system("./cordova/build") os.system("./cordova/run") comm.checkApkExist("./build/outputs/apk/*.apk") comm.checkApkRun(pkg_name)
print version_tmp print EXCEPTED_VERSIONS[index] comm.installWebviewPlugin(BUILD_PARAMETERS.pkgmode, version_tmp) comm.build(app_name) apk_source = os.path.join(project_path, "platforms", "android", "build", "outputs", "apk", "android-%s-debug.apk" % pkg_arch_tmp) apk_dest = os.path.join( current_path_tmp, "CrosswalkVersion_%s_%d.apk" % (comm.CROSSWALK_BRANCH, count)) comm.doCopy(apk_source, apk_dest) count = count + 1 comm.removeWebviewPlugin() comm.installWebviewPlugin(BUILD_PARAMETERS.pkgmode) os.system('sed -i "s/<preference name=\\"xwalkVersion\\" value=\\".*/<preference name=\\"xwalkVersion\\"' \ ' value=\\"%s\\" \/>/g" config.xml' % version_tmp) comm.build(app_name) os.system( 'cp platforms/android/build/outputs/apk/android-%s-debug.apk ../CrosswalkVersion_%s_%d.apk' % (pkg_arch_tmp, comm.CROSSWALK_BRANCH, count)) count = count + 1 comm.removeWebviewPlugin() index = index + 1 for i in range(count - 1): comm.checkApkExist("../CrosswalkVersion_%s_%d.apk" % (comm.CROSSWALK_BRANCH, (i + 1)))
print version_tmp print EXCEPTED_VERSIONS[index] comm.installWebviewPlugin(BUILD_PARAMETERS.pkgmode, version_tmp) comm.build(app_name, pack_arch_tmp) apk_source = os.path.join(project_path, "platforms", "android", "build", "outputs", "apk", "android%sdebug.apk" % apk_name_arch) apk_dest = os.path.join(current_path_tmp, "CrosswalkVersion_%s_%d.apk" % (comm.CROSSWALK_BRANCH, count)) if not comm.doCopy(apk_source, apk_dest): sys.exit(1) count = count + 1 comm.removeWebviewPlugin() comm.installWebviewPlugin(BUILD_PARAMETERS.pkgmode) os.system('sed -i "s/<preference name=\\"xwalkVersion\\" value=\\".*/<preference name=\\"xwalkVersion\\"' \ ' value=\\"%s\\" \/>/g" config.xml' % version_tmp) comm.build(app_name, pack_arch_tmp) apk_dest = os.path.join(current_path_tmp, "CrosswalkVersion_%s_%d.apk" % (comm.CROSSWALK_BRANCH, count)) if not comm.doCopy(apk_source, apk_dest): sys.exit(1) count = count + 1 comm.removeWebviewPlugin() index = index + 1 for i in range(count - 1): comm.checkApkExist("../CrosswalkVersion_%s_%d.apk" % (comm.CROSSWALK_BRANCH, (i + 1)))
for node in preferences: if node.nodeName == "xwalkVersion": if node.nodeValue != xwalk_version: print "Incorrect xwalk version in config.xml: %s, exit ..." % node.nodeValue sys.exit(1) if node.nodeName == "xwalkMode": if node.nodeValue != BUILD_PARAMETERS.pkgmode: print "Incorrect xwalk mode in config.xml: %s, exit ..." % node.nodeValue sys.exit(1) pack_arch_opt = "" if BUILD_PARAMETERS.pkgarch and BUILD_PARAMETERS.pkgmode == "embedded": pack_arch_type = BUILD_PARAMETERS.pkgarch if BUILD_PARAMETERS.pkgarch == "x86": pack_arch_type = "x86" elif BUILD_PARAMETERS.pkgarch == "x86_64": pack_arch_type = "x86 --xwalk64bit" elif BUILD_PARAMETERS.pkgarch == "arm": pack_arch_type = "armv7" elif BUILD_PARAMETERS.pkgarch == "arm64": pack_arch_type = "armv7 --xwalk64bit" pack_arch_opt = "-- --gradleArg=-PcdvBuildArch=%s" % pack_arch_type os.system("cordova build android %s" % pack_arch_opt) os.system("cordova run android %s" % pack_arch_opt) comm.checkApkExist("./platforms/android/build/outputs/apk/*.apk") comm.checkApkRun(pkg_name)
# check the xwalk version set correctly by "--variable XWALK_VERSION" # check the xwalk mode set correctly by "--variable XWALK_MODE" for node in preferences: if node.nodeName == "xwalkVersion": if node.nodeValue != xwalk_version: print "Incorrect xwalk version in config.xml: %s, exit ..." % node.nodeValue sys.exit(1) if node.nodeName == "xwalkMode": if node.nodeValue != BUILD_PARAMETERS.pkgmode: print "Incorrect xwalk mode in config.xml: %s, exit ..." % node.nodeValue sys.exit(1) pack_arch_opt = "" if BUILD_PARAMETERS.pkgarch and BUILD_PARAMETERS.pkgmode == "embedded": pack_arch_type = BUILD_PARAMETERS.pkgarch if BUILD_PARAMETERS.pkgarch == "x86": pack_arch_type = "x86" elif BUILD_PARAMETERS.pkgarch == "x86_64": pack_arch_type = "x86 --xwalk64bit" elif BUILD_PARAMETERS.pkgarch == "arm": pack_arch_type = "armv7" elif BUILD_PARAMETERS.pkgarch == "arm64": pack_arch_type = "armv7 --xwalk64bit" pack_arch_opt = "-- --gradleArg=-PcdvBuildArch=%s" % pack_arch_type os.system("cordova build android %s" % pack_arch_opt) os.system("cordova run android %s" % pack_arch_opt) comm.checkApkExist("./platforms/android/build/outputs/apk/*.apk") comm.checkApkRun(pkg_name)