private String replaceMacros()

in flex/flex-shared/src/com/intellij/flex/build/AirDescriptorOptions.java [81:153]


  private String replaceMacros(final String descriptorText) {
    final Map<String, String> replacementMap = new HashMap<>();

    replacementMap.put("${air_version}", AIR_VERSION);
    replacementMap.put("${app_id}", APP_ID);
    replacementMap.put("${app_name}", APP_NAME);
    replacementMap.put("${app_version}", APP_VERSION);
    replacementMap.put("${swf_name}", SWF_NAME);

    if (EXTENSIONS.length == 0) {
      replacementMap.put("${extensions_comment_start}", "<!--");
      replacementMap.put("${extensions_comment_end}", "-->");
      replacementMap.put("${extensions_list}", "<extensionID></extensionID>");
    }
    else {
      final StringBuilder buf = new StringBuilder();
      for (String extensionId : EXTENSIONS) {
        if (buf.length() > 0) buf.append("\n        ");
        buf.append("<extensionID>").append(extensionId).append("</extensionID>");
      }

      replacementMap.put("${extensions_comment_start}", "");
      replacementMap.put("${extensions_comment_end}", "");
      replacementMap.put("${extensions_list}", buf.toString());
    }

    replacementMap.put("${auto_orients}", MOBILE ? String.valueOf(AUTO_ORIENTS) : "");
    replacementMap.put("${auto_orients_comment_start}", MOBILE ? "" : "<!--");
    replacementMap.put("${auto_orients_comment_end}", MOBILE ? "" : "-->");

    replacementMap.put("${full_screen}", MOBILE ? String.valueOf(FULL_SCREEN) : "");
    replacementMap.put("${full_screen_comment_start}", MOBILE ? "" : "<!--");
    replacementMap.put("${full_screen_comment_end}", MOBILE ? "" : "-->");

    replacementMap.put("${iOS_comment_start}", MOBILE && IOS ? "" : "<!--");
    replacementMap.put("${iOS_comment_end}", MOBILE && IOS ? "" : "-->");

    replacementMap.put("${iPhone_comment_start}", MOBILE && IOS && IPHONE ? "" : "<!--");
    replacementMap.put("${iPhone_comment_end}", MOBILE && IOS && IPHONE ? "" : "-->");
    replacementMap.put("${iPad_comment_start}", MOBILE && IOS && IPAD ? "" : "<!--");
    replacementMap.put("${iPad_comment_end}", MOBILE && IOS && IPAD ? "" : "-->");
    replacementMap.put("${iOS_high_resolution_comment_start}", MOBILE && IOS && IOS_HIGH_RESOLUTION ? "" : "<!--");
    replacementMap.put("${iOS_high_resolution_comment_end}", MOBILE && IOS && IOS_HIGH_RESOLUTION ? "" : "-->");

    replacementMap.put("${android_comment_start}", MOBILE && ANDROID ? "" : "<!--");
    replacementMap.put("${android_comment_end}", MOBILE && ANDROID ? "" : "-->");

    replacementMap.put("${android_internet_comment_start}",
                       MOBILE && ANDROID && (ANDROID_PERMISSIONS & ANDROID_PERMISSION_INTERNET) != 0 ? "" : "<!--");
    replacementMap.put("${android_internet_comment_end}",
                       MOBILE && ANDROID && (ANDROID_PERMISSIONS & ANDROID_PERMISSION_INTERNET) != 0 ? "" : "-->");

    replacementMap.put("${android_write_external_storage_comment_start}",
                       MOBILE && ANDROID && (ANDROID_PERMISSIONS & ANDROID_PERMISSION_WRITE_EXTERNAL_STORAGE) != 0
                       ? "" : "<!--");
    replacementMap.put("${android_write_external_storage_comment_end}",
                       MOBILE && ANDROID && (ANDROID_PERMISSIONS & ANDROID_PERMISSION_WRITE_EXTERNAL_STORAGE) != 0
                       ? "" : "-->");

    replacementMap.put("${android_access_fine_location_comment_start}",
                       MOBILE && ANDROID && (ANDROID_PERMISSIONS & ANDROID_PERMISSION_ACCESS_FINE_LOCATION) != 0
                       ? "" : "<!--");
    replacementMap.put("${android_access_fine_location_comment_end}",
                       MOBILE && ANDROID && (ANDROID_PERMISSIONS & ANDROID_PERMISSION_ACCESS_FINE_LOCATION) != 0
                       ? "" : "-->");

    replacementMap.put("${android_camera_comment_start}",
                       MOBILE && ANDROID && (ANDROID_PERMISSIONS & ANDROID_PERMISSION_CAMERA) != 0 ? "" : "<!--");
    replacementMap.put("${android_camera_comment_end}",
                       MOBILE && ANDROID && (ANDROID_PERMISSIONS & ANDROID_PERMISSION_CAMERA) != 0 ? "" : "-->");

    return FlexCommonUtils.replace(descriptorText, replacementMap);
  }