@Nullable
  private static String getAirVersionIfCustomDescriptor(final JpsFlexBuildConfiguration bc) {
    if (bc.getTargetPlatform() == TargetPlatform.Desktop) {
      final JpsAirDesktopPackagingOptions packagingOptions = bc.getAirDesktopPackagingOptions();
      if (!packagingOptions.isUseGeneratedDescriptor()) {
        return FlexCommonUtils.parseAirVersionFromDescriptorFile(
            packagingOptions.getCustomDescriptorPath());
      }
    } else if (bc.getTargetPlatform() == TargetPlatform.Mobile) {
      final JpsAndroidPackagingOptions androidOptions = bc.getAndroidPackagingOptions();
      final JpsIosPackagingOptions iosPackagingOptions = bc.getIosPackagingOptions();

      // if at least one of descriptors is generated - return null
      if (androidOptions.isEnabled() && androidOptions.isUseGeneratedDescriptor()
          || iosPackagingOptions.isEnabled() && iosPackagingOptions.isUseGeneratedDescriptor()) {
        return null;
      }

      String androidAirVersion = null;
      String iosAirVersion = null;

      if (androidOptions.isEnabled() && !androidOptions.isUseGeneratedDescriptor()) {
        androidAirVersion =
            FlexCommonUtils.parseAirVersionFromDescriptorFile(
                androidOptions.getCustomDescriptorPath());
      }

      if (iosPackagingOptions.isEnabled() && !iosPackagingOptions.isUseGeneratedDescriptor()) {
        iosAirVersion =
            FlexCommonUtils.parseAirVersionFromDescriptorFile(
                iosPackagingOptions.getCustomDescriptorPath());
      }

      if (androidAirVersion == null) return iosAirVersion;
      if (iosAirVersion == null) return androidAirVersion;

      // return minimal
      return StringUtil.compareVersionNumbers(androidAirVersion, iosAirVersion) > 0
          ? iosAirVersion
          : androidAirVersion;
    }
    return null;
  }