UNPKG

nativescript

Version:

Command-line interface for building NativeScript projects

53 lines 2.81 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AndroidBundleValidatorHelper = void 0; const util = require("util"); const constants_1 = require("../constants"); const version_validator_helper_1 = require("./version-validator-helper"); const semver = require("semver"); const yok_1 = require("../common/yok"); class AndroidBundleValidatorHelper extends version_validator_helper_1.VersionValidatorHelper { constructor($projectData, $errors, $options, $projectDataService, $mobileHelper) { super(); this.$projectData = $projectData; this.$errors = $errors; this.$options = $options; this.$projectDataService = $projectDataService; this.$mobileHelper = $mobileHelper; } validateNoAab() { if (this.$options.aab) { this.$errors.failWithHelp(constants_1.AndroidBundleValidatorMessages.AAB_NOT_SUPPORTED_BY_COMMNAND_MESSAGE); } } validateRuntimeVersion(projectData) { if (this.$options.aab) { const runtimePackage = this.$projectDataService.getRuntimePackage(projectData.projectDir, "android" /* PlatformTypes.android */); const androidRuntimeVersion = runtimePackage ? runtimePackage.version : ""; const shouldThrowError = androidRuntimeVersion && this.isValidVersion(androidRuntimeVersion) && this.isVersionLowerThan(androidRuntimeVersion, AndroidBundleValidatorHelper.MIN_RUNTIME_VERSION); if (shouldThrowError) { this.$errors.fail(util.format(constants_1.AndroidBundleValidatorMessages.NOT_SUPPORTED_RUNTIME_VERSION, AndroidBundleValidatorHelper.MIN_RUNTIME_VERSION)); } } } validateDeviceApiLevel(device, buildData) { if (this.$mobileHelper.isAndroidPlatform(device.deviceInfo.platform)) { const androidBuildData = buildData; if (androidBuildData.androidBundle) { if (!!device.deviceInfo.version && semver.lt(semver.coerce(device.deviceInfo.version), AndroidBundleValidatorHelper.MIN_ANDROID_WITH_AAB_SUPPORT)) { this.$errors.fail(util.format(constants_1.AndroidBundleValidatorMessages.NOT_SUPPORTED_ANDROID_VERSION, device.deviceInfo.identifier, device.deviceInfo.version, AndroidBundleValidatorHelper.MIN_ANDROID_WITH_AAB_SUPPORT)); } } } } } exports.AndroidBundleValidatorHelper = AndroidBundleValidatorHelper; AndroidBundleValidatorHelper.MIN_RUNTIME_VERSION = "5.0.0"; AndroidBundleValidatorHelper.MIN_ANDROID_WITH_AAB_SUPPORT = "4.4.0"; yok_1.injector.register("androidBundleValidatorHelper", AndroidBundleValidatorHelper); //# sourceMappingURL=android-bundle-validator-helper.js.map