removeProjectFromProject.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = removeProjectFromProject;
  6. function _pbxFile() {
  7. const data = _interopRequireDefault(require("xcode/lib/pbxFile"));
  8. _pbxFile = function () {
  9. return data;
  10. };
  11. return data;
  12. }
  13. var _removeFromPbxItemContainerProxySection = _interopRequireDefault(require("./removeFromPbxItemContainerProxySection"));
  14. var _removeFromProjectReferences = _interopRequireDefault(require("./removeFromProjectReferences"));
  15. var _removeProductGroup = _interopRequireDefault(require("./removeProductGroup"));
  16. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17. /**
  18. * Copyright (c) Facebook, Inc. and its affiliates.
  19. *
  20. * This source code is licensed under the MIT license found in the
  21. * LICENSE file in the root directory of this source tree.
  22. *
  23. */
  24. /**
  25. * Given xcodeproj and filePath, it creates new file
  26. * from path provided and removes it. That operation is required since
  27. * underlying method requires PbxFile instance to be passed (it does not
  28. * have to have uuid or fileRef defined since it will do equality check
  29. * by path)
  30. *
  31. * Returns removed file (that one will have UUID)
  32. */
  33. function removeProjectFromProject(project, filePath) {
  34. const file = project.removeFromPbxFileReferenceSection(new (_pbxFile().default)(filePath));
  35. const projectRef = (0, _removeFromProjectReferences.default)(project, file);
  36. if (projectRef) {
  37. (0, _removeProductGroup.default)(project, projectRef.ProductGroup);
  38. }
  39. (0, _removeFromPbxItemContainerProxySection.default)(project, file);
  40. return file;
  41. }
  42. //# sourceMappingURL=removeProjectFromProject.js.map