getTargets.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = getTargets;
  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. * Given xcodeproj it returns list of targets
  15. */
  16. function getTargets(project) {
  17. const {
  18. firstProject: {
  19. targets
  20. }
  21. } = project.getFirstProject();
  22. const nativeTargetSection = project.pbxNativeTargetSection();
  23. return targets.filter(target => nativeTargetSection[target.value] !== undefined).map(target => {
  24. const key = target.value;
  25. const configurationListId = nativeTargetSection[key].buildConfigurationList;
  26. const configurationList = project.pbxXCConfigurationList()[configurationListId];
  27. const buildConfigurationId = configurationList.buildConfigurations[0].value;
  28. const buildConfiguration = project.pbxXCBuildConfigurationSection()[buildConfigurationId];
  29. return {
  30. uuid: key,
  31. target: nativeTargetSection[key],
  32. name: nativeTargetSection[key].productReference_comment,
  33. isTVOS: buildConfiguration.buildSettings.SDKROOT && buildConfiguration.buildSettings.SDKROOT.indexOf('appletv') !== -1 || false
  34. };
  35. });
  36. }
  37. //# sourceMappingURL=getTargets.js.map