getBuildProperty.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = getBuildProperty;
  6. /**
  7. * Copyright (c) Facebook, Inc. and its affiliates.
  8. *
  9. * This source code is licensed under the MIT license found in the
  10. * LICENSE file in the root directory of this source tree.
  11. *
  12. */
  13. /**
  14. * Gets build property from the main target build section
  15. *
  16. * It differs from the project.getBuildProperty exposed by xcode in the way that:
  17. * - it only checks for build property in the main target `Debug` section
  18. * - `xcode` library iterates over all build sections and because it misses
  19. * an early return when property is found, it will return undefined/wrong value
  20. * when there's another build section typically after the one you want to access
  21. * without the property defined (e.g. CocoaPods sections appended to project
  22. * miss INFOPLIST_FILE), see: https://github.com/alunny/node-xcode/blob/master/lib/pbxProject.js#L1765
  23. */
  24. function getBuildProperty(project, prop) {
  25. const target = project.getFirstTarget().firstTarget;
  26. const config = project.pbxXCConfigurationList()[target.buildConfigurationList];
  27. const buildSection = project.pbxXCBuildConfigurationSection()[config.buildConfigurations[0].value];
  28. return buildSection.buildSettings[prop];
  29. }
  30. //# sourceMappingURL=getBuildProperty.js.map