UNPKG

@sentry/wizard

Version:

Sentry wizard helping you to configure your project

70 lines 3.25 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.searchXcodeProjectAtPath = void 0; const fs = __importStar(require("fs")); const path = __importStar(require("path")); const debug_1 = require("../utils/debug"); const find_files_with_extension_1 = require("../utils/find-files-with-extension"); function searchXcodeProjectAtPath(searchPath) { (0, debug_1.debug)('Searching for Xcode project at path: ' + searchPath); const projs = (0, find_files_with_extension_1.findFilesWithExtension)(searchPath, '.xcodeproj'); if (projs.length > 0) { (0, debug_1.debug)('Found Xcode project at paths:'); projs.forEach((proj) => (0, debug_1.debug)(' ' + proj)); return projs; } (0, debug_1.debug)('Searching for Xcode workspace at path: ' + searchPath); const workspace = (0, find_files_with_extension_1.findFilesWithExtension)(searchPath, '.xcworkspace'); if (workspace.length == 0) { (0, debug_1.debug)('No Xcode workspace found at path: ' + searchPath); return []; } (0, debug_1.debug)('Found Xcode workspace at path: ' + workspace[0]); const xsworkspacedata = path.join(searchPath, workspace[0], 'contents.xcworkspacedata'); if (!fs.existsSync(xsworkspacedata)) { (0, debug_1.debug)('No Xcode workspace data found at path: ' + xsworkspacedata); return []; } (0, debug_1.debug)('Parsing Xcode workspace data at path: ' + xsworkspacedata); const groupRegex = /location *= *"group:([^"]+)"/gim; const content = fs.readFileSync(xsworkspacedata, 'utf8'); let matches = groupRegex.exec(content); while (matches) { const group = matches[1]; const groupPath = path.join(searchPath, group); if (!group.endsWith('Pods.xcodeproj') && group.endsWith('.xcodeproj') && fs.existsSync(groupPath)) { projs.push(group); } matches = groupRegex.exec(content); } (0, debug_1.debug)('Found Xcode project at paths:'); projs.forEach((proj) => (0, debug_1.debug)(' ' + proj)); return projs; } exports.searchXcodeProjectAtPath = searchXcodeProjectAtPath; //# sourceMappingURL=search-xcode-project-at-path.js.map