HarmonyOS 在ts代码中获取BuildProfile的自定义构建参数?

如何在ts代码中获取BuildProfile的自定义构建参数,比如像下面的BuildProfile.ets:

/**
 * Use these variables when you tailor your ArkTS code. They must be of the const type.
 */
export const BUNDLE_NAME = 'com.c2vl.kgamebox.hm';
export const BUNDLE_TYPE = 'app';
export const VERSION_CODE = 308060;
export const VERSION_NAME = '3.8.6';
export const TARGET_NAME = 'default';
export const PRODUCT_NAME = 'default';
export const BUILD_MODE_NAME = 'debugQA1';
export const DEBUG = true;
export const environment = 'debugQA1';
export const baseDomain = 'langren001.com';
export const baseSubDomain = 'qa-rancher.langren001.com';
export const tcpPort = '6656';

/**
 * BuildProfile Class is used only for compatibility purposes.
 */
export default class BuildProfile {
  static readonly BUNDLE_NAME = BUNDLE_NAME;
  static readonly BUNDLE_TYPE = BUNDLE_TYPE;
  static readonly VERSION_CODE = VERSION_CODE;
  static readonly VERSION_NAME = VERSION_NAME;
  static readonly TARGET_NAME = TARGET_NAME;
  static readonly PRODUCT_NAME = PRODUCT_NAME;
  static readonly BUILD_MODE_NAME = BUILD_MODE_NAME;
  static readonly DEBUG = DEBUG;
  static readonly environment = environment;
  static readonly baseDomain = baseDomain;
  static readonly baseSubDomain = baseSubDomain;
  static readonly tcpPort = tcpPort;
}
阅读 520
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进