1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.getBuildConfigurationFromXcScheme = getBuildConfigurationFromXcScheme;
|
7 | function _cliTools() {
|
8 | const data = require("@react-native-community/cli-tools");
|
9 | _cliTools = function () {
|
10 | return data;
|
11 | };
|
12 | return data;
|
13 | }
|
14 | function _fastXmlParser() {
|
15 | const data = require("fast-xml-parser");
|
16 | _fastXmlParser = function () {
|
17 | return data;
|
18 | };
|
19 | return data;
|
20 | }
|
21 | function _fs() {
|
22 | const data = _interopRequireDefault(require("fs"));
|
23 | _fs = function () {
|
24 | return data;
|
25 | };
|
26 | return data;
|
27 | }
|
28 | function _path() {
|
29 | const data = _interopRequireDefault(require("path"));
|
30 | _path = function () {
|
31 | return data;
|
32 | };
|
33 | return data;
|
34 | }
|
35 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
36 | const xmlParser = new (_fastXmlParser().XMLParser)({
|
37 | ignoreAttributes: false
|
38 | });
|
39 | function getBuildConfigurationFromXcScheme(scheme, configuration, sourceDir) {
|
40 | try {
|
41 | const xcProject = _fs().default.readdirSync(sourceDir).find(dir => dir.includes('.xcodeproj'));
|
42 | if (xcProject) {
|
43 | const xmlScheme = _fs().default.readFileSync(_path().default.join(sourceDir, xcProject, 'xcshareddata', 'xcschemes', `${scheme}.xcscheme`), {
|
44 | encoding: 'utf-8'
|
45 | });
|
46 | const {
|
47 | Scheme
|
48 | } = xmlParser.parse(xmlScheme);
|
49 | return Scheme.LaunchAction['@_buildConfiguration'];
|
50 | }
|
51 | } catch {
|
52 | throw new (_cliTools().CLIError)(`Could not find scheme ${scheme}. Please make sure the schema you want to run exists.`);
|
53 | }
|
54 | return configuration;
|
55 | }
|
56 |
|
57 |
|
\ | No newline at end of file |