rork-xcode 0.8.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +59 -11
- package/dist/index.d.ts +379 -51
- package/dist/index.js +662 -124
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -10,33 +10,34 @@
|
|
|
10
10
|
* - `( item, item, ... )` parses to a {@link PbxprojArray}.
|
|
11
11
|
* - `<48656c6c6f>` data runs parse to `Uint8Array`.
|
|
12
12
|
* - Unquoted integers and decimals (`46`, `3.14`, `-12`) parse to `number`
|
|
13
|
-
* under one print-back rule
|
|
14
|
-
* formats back to the identical text.
|
|
13
|
+
* under one print-back rule, where the literal converts exactly when the
|
|
14
|
+
* number formats back to the identical text.
|
|
15
15
|
* - Everything else (quoted text, identifiers, uuids, paths) parses to
|
|
16
16
|
* `string`.
|
|
17
17
|
*
|
|
18
|
-
* The print-back rule is what keeps round-trips faithful
|
|
18
|
+
* The print-back rule is what keeps round-trips faithful. Any literal the
|
|
19
19
|
* conversion would reshape stays a string, so serializing never changes a
|
|
20
20
|
* scalar's bytes. Leading-zero runs like `0755` would corrupt file modes,
|
|
21
|
-
* trailing-zero decimals like `5.0` would drop the zero build
|
|
22
|
-
* written with, bare-dot decimals like `.5` would grow a
|
|
21
|
+
* trailing-zero decimals like `5.0` would drop the zero that build
|
|
22
|
+
* settings are written with, bare-dot decimals like `.5` would grow a
|
|
23
|
+
* leading zero, and
|
|
23
24
|
* digit runs beyond `Number.MAX_SAFE_INTEGER` would lose precision (a
|
|
24
|
-
* 24-character identifier can be all digits)
|
|
25
|
-
*
|
|
25
|
+
* 24-character identifier can be all digits), so all of these parse as
|
|
26
|
+
* strings.
|
|
26
27
|
*
|
|
27
28
|
* @module
|
|
28
29
|
*/
|
|
29
30
|
/**
|
|
30
31
|
* A value representable in a `project.pbxproj` document.
|
|
31
32
|
*
|
|
32
|
-
* Notably absent are booleans and null
|
|
33
|
+
* Notably absent are booleans and null. The format has no notation for
|
|
33
34
|
* either, and Xcode models flags as the strings `"YES"` and `"NO"`.
|
|
34
35
|
*/
|
|
35
36
|
type PbxprojValue = string | number | Uint8Array | PbxprojArray | PbxprojObject;
|
|
36
37
|
/**
|
|
37
38
|
* A `( ... )` list: an ordered array of values.
|
|
38
39
|
*
|
|
39
|
-
* This is a plain JavaScript array
|
|
40
|
+
* This is a plain JavaScript array. The interface exists only to give the
|
|
40
41
|
* recursive {@link PbxprojValue} type a name.
|
|
41
42
|
*/
|
|
42
43
|
interface PbxprojArray extends Array<PbxprojValue> {}
|
|
@@ -55,18 +56,18 @@ interface PbxprojObject {
|
|
|
55
56
|
/**
|
|
56
57
|
* Serializes a project document to `project.pbxproj` text.
|
|
57
58
|
*
|
|
58
|
-
* The input is the same shape {@link parsePbxproj} produces
|
|
59
|
-
* documentation of `types.ts` for the value model. Output is stable
|
|
59
|
+
* The input is the same shape {@link parsePbxproj} produces. See the module
|
|
60
|
+
* documentation of `types.ts` for the value model. Output is stable, so two
|
|
60
61
|
* calls with semantically equal documents produce identical text, and the
|
|
61
62
|
* layout matches what Xcode itself writes so diffs stay minimal.
|
|
62
63
|
*
|
|
63
64
|
* @param root The document root. Real project documents carry `objects`,
|
|
64
65
|
* `rootObject`, and the version fields, but any dictionary serializes.
|
|
65
66
|
* @returns The document text, terminated by a newline.
|
|
66
|
-
* @throws PbxprojBuildError when a value has no pbxproj representation
|
|
67
|
-
* `null`, `undefined`, booleans, bigints, functions, symbols,
|
|
68
|
-
* instances, or non-finite numbers. The error names the path of
|
|
69
|
-
* offending value.
|
|
67
|
+
* @throws PbxprojBuildError when a value has no pbxproj representation,
|
|
68
|
+
* meaning `null`, `undefined`, booleans, bigints, functions, symbols,
|
|
69
|
+
* class instances, or non-finite numbers. The error names the path of
|
|
70
|
+
* the offending value.
|
|
70
71
|
*/
|
|
71
72
|
declare function buildPbxproj(root: PbxprojObject): string;
|
|
72
73
|
//#endregion
|
|
@@ -107,7 +108,7 @@ declare class PbxprojParseError extends Error {
|
|
|
107
108
|
/** Where in the source text parsing failed. */
|
|
108
109
|
readonly position: PbxprojErrorPosition;
|
|
109
110
|
/**
|
|
110
|
-
* @param message Failure description without location
|
|
111
|
+
* @param message Failure description without location. The location is
|
|
111
112
|
* appended automatically.
|
|
112
113
|
* @param source Full source text, used to compute the position.
|
|
113
114
|
* @param offset Character offset of the failure inside `source`.
|
|
@@ -126,7 +127,26 @@ declare class XcschemeParseError extends Error {
|
|
|
126
127
|
/** Where in the source text parsing failed. */
|
|
127
128
|
readonly position: PbxprojErrorPosition;
|
|
128
129
|
/**
|
|
129
|
-
* @param message Failure description without location
|
|
130
|
+
* @param message Failure description without location. The location is
|
|
131
|
+
* appended automatically.
|
|
132
|
+
* @param source Full source text, used to compute the position.
|
|
133
|
+
* @param offset Character offset of the failure inside `source`.
|
|
134
|
+
*/
|
|
135
|
+
constructor(message: string, source: string, offset: number);
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Thrown when the source text is not a well-formed build configuration
|
|
139
|
+
* file (the line-based format of `.xcconfig` files).
|
|
140
|
+
*
|
|
141
|
+
* The message always embeds the line and column of the failure, and the
|
|
142
|
+
* same information is available in structured form on {@link position}
|
|
143
|
+
* for programmatic use.
|
|
144
|
+
*/
|
|
145
|
+
declare class XcconfigParseError extends Error {
|
|
146
|
+
/** Where in the source text parsing failed. */
|
|
147
|
+
readonly position: PbxprojErrorPosition;
|
|
148
|
+
/**
|
|
149
|
+
* @param message Failure description without location. The location is
|
|
130
150
|
* appended automatically.
|
|
131
151
|
* @param source Full source text, used to compute the position.
|
|
132
152
|
* @param offset Character offset of the failure inside `source`.
|
|
@@ -144,14 +164,14 @@ declare class XcschemeBuildError extends Error {
|
|
|
144
164
|
/** Path to the offending element from the root, e.g. `Scheme.BuildAction[0]`. */
|
|
145
165
|
readonly path: string;
|
|
146
166
|
/**
|
|
147
|
-
* @param message Failure description without location
|
|
167
|
+
* @param message Failure description without location. The element path
|
|
148
168
|
* is appended automatically.
|
|
149
169
|
* @param path Path to the offending element from the root.
|
|
150
170
|
*/
|
|
151
171
|
constructor(message: string, path: string);
|
|
152
172
|
}
|
|
153
173
|
/**
|
|
154
|
-
* Thrown by the object model when an operation cannot proceed
|
|
174
|
+
* Thrown by the object model when an operation cannot proceed, because the
|
|
155
175
|
* document lacks the structure the operation needs (no objects dictionary,
|
|
156
176
|
* no root project object), a view's object was removed from the document,
|
|
157
177
|
* or a creation request names a product type the model cannot scaffold.
|
|
@@ -180,7 +200,7 @@ declare class PbxprojBuildError extends Error {
|
|
|
180
200
|
/** Path to the offending value from the root, e.g. `$.objects.13B07F86.name`. */
|
|
181
201
|
readonly path: string;
|
|
182
202
|
/**
|
|
183
|
-
* @param message Failure description without location
|
|
203
|
+
* @param message Failure description without location. The value path is
|
|
184
204
|
* appended automatically.
|
|
185
205
|
* @param path Path to the offending value from the root, `$`.
|
|
186
206
|
*/
|
|
@@ -191,15 +211,15 @@ declare class PbxprojBuildError extends Error {
|
|
|
191
211
|
/**
|
|
192
212
|
* Names and well-known values of the pbxproj object vocabulary.
|
|
193
213
|
*
|
|
194
|
-
* Everything here mirrors strings Xcode itself writes
|
|
195
|
-
* Centralizing them keeps the object model free of string
|
|
196
|
-
* gives call sites one place to import from.
|
|
214
|
+
* Everything here mirrors strings Xcode itself writes, and nothing is
|
|
215
|
+
* invented. Centralizing them keeps the object model free of string
|
|
216
|
+
* literals and gives call sites one place to import from.
|
|
197
217
|
*
|
|
198
218
|
* @module
|
|
199
219
|
*/
|
|
200
220
|
/**
|
|
201
221
|
* The `isa` names the object model works with. The parser and serializer
|
|
202
|
-
* accept any isa
|
|
222
|
+
* accept any isa, and this list only covers the kinds the model creates or
|
|
203
223
|
* gives typed access to.
|
|
204
224
|
*/
|
|
205
225
|
declare const Isa: {
|
|
@@ -608,8 +628,13 @@ declare class Target<Properties extends TargetProperties = TargetProperties> ext
|
|
|
608
628
|
* generated app templates set values like `SDKROOT` only at the project
|
|
609
629
|
* level.
|
|
610
630
|
*
|
|
611
|
-
*
|
|
612
|
-
*
|
|
631
|
+
* Configurations based on `.xcconfig` files take part once the files
|
|
632
|
+
* are registered through {@link XcodeProject.registerXcconfig}, in
|
|
633
|
+
* Xcode's order of target settings, then the target's xcconfig, then
|
|
634
|
+
* project settings, then the project's xcconfig.
|
|
635
|
+
*
|
|
636
|
+
* Only string values are returned, so a list- or number-valued setting
|
|
637
|
+
* reads as `undefined`.
|
|
613
638
|
*/
|
|
614
639
|
getBuildSetting(key: string): string | undefined;
|
|
615
640
|
/**
|
|
@@ -855,7 +880,7 @@ declare class Group<Properties extends GroupProperties = GroupProperties> extend
|
|
|
855
880
|
* it to the group's children.
|
|
856
881
|
*
|
|
857
882
|
* The reference's `lastKnownFileType` derives from the file extension
|
|
858
|
-
* when it is a known kind
|
|
883
|
+
* when it is a known kind. Otherwise the reference carries no type and
|
|
859
884
|
* Xcode re-derives one on open.
|
|
860
885
|
*
|
|
861
886
|
* @param path File path relative to the group, for example
|
|
@@ -881,8 +906,8 @@ declare class VariantGroup extends Group {
|
|
|
881
906
|
declare class BuildPhase<Properties extends BuildPhaseProperties = BuildPhaseProperties> extends XcodeObject<Properties> {
|
|
882
907
|
/**
|
|
883
908
|
* The phase's display name, when it carries an explicit one. Xcode names
|
|
884
|
-
* copy-files and shell-script phases
|
|
885
|
-
* names from their isa.
|
|
909
|
+
* copy-files and shell-script phases, while the standard phases derive
|
|
910
|
+
* their names from their isa.
|
|
886
911
|
*/
|
|
887
912
|
get name(): string | undefined;
|
|
888
913
|
/**
|
|
@@ -910,7 +935,7 @@ declare class BuildPhase<Properties extends BuildPhaseProperties = BuildPhasePro
|
|
|
910
935
|
* @param reference The file reference or package product the build file
|
|
911
936
|
* should point at.
|
|
912
937
|
* @param options.referenceKey Which build-file field carries the
|
|
913
|
-
* reference
|
|
938
|
+
* reference, either `fileRef` for file references (the default) or
|
|
914
939
|
* `productRef` for Swift package products.
|
|
915
940
|
* @param options.settings Optional per-file settings, for example
|
|
916
941
|
* `{ ATTRIBUTES: ["RemoveHeadersOnCopy"] }`.
|
|
@@ -1005,7 +1030,7 @@ declare class BuildFile extends XcodeObject<BuildFileProperties> {
|
|
|
1005
1030
|
/**
|
|
1006
1031
|
* The view of the file reference the build file points at, when it
|
|
1007
1032
|
* points at one. Build files for Swift package products carry a
|
|
1008
|
-
* `productRef` instead
|
|
1033
|
+
* `productRef` instead, resolved through {@link productDependency}.
|
|
1009
1034
|
*/
|
|
1010
1035
|
fileReference(): XcodeObject | undefined;
|
|
1011
1036
|
/**
|
|
@@ -1031,12 +1056,12 @@ declare class SyncRootGroup extends XcodeObject<SyncRootGroupProperties> {
|
|
|
1031
1056
|
*
|
|
1032
1057
|
* Xcode keeps one exception set per target and folder, so when this
|
|
1033
1058
|
* group already carries a set for the target, the file names merge into
|
|
1034
|
-
* it instead of creating a second set
|
|
1035
|
-
* duplicated.
|
|
1059
|
+
* it instead of creating a second set, and names already excluded are
|
|
1060
|
+
* not duplicated.
|
|
1036
1061
|
*
|
|
1037
1062
|
* The standard use is keeping a scaffolded `Info.plist` from being
|
|
1038
|
-
* double-copied
|
|
1039
|
-
* `INFOPLIST_FILE` setting.
|
|
1063
|
+
* double-copied, since the build already processes it through the
|
|
1064
|
+
* target's `INFOPLIST_FILE` setting.
|
|
1040
1065
|
*
|
|
1041
1066
|
* @param target The target whose membership the exceptions restrict.
|
|
1042
1067
|
* @param membershipExceptions File names inside the folder to exclude.
|
|
@@ -1128,6 +1153,13 @@ declare class BuildConfiguration extends XcodeObject<BuildConfigurationPropertie
|
|
|
1128
1153
|
* document.
|
|
1129
1154
|
*/
|
|
1130
1155
|
get buildSettings(): BuildSettings | undefined;
|
|
1156
|
+
/**
|
|
1157
|
+
* The view of the `.xcconfig` file reference this configuration is
|
|
1158
|
+
* based on, when the configuration has one and it resolves. The file's
|
|
1159
|
+
* settings sit below the configuration's own `buildSettings` in
|
|
1160
|
+
* Xcode's resolution order.
|
|
1161
|
+
*/
|
|
1162
|
+
baseConfigurationReference(): FileReference | undefined;
|
|
1131
1163
|
}
|
|
1132
1164
|
/**
|
|
1133
1165
|
* A `PBXBuildStyle` is the pre-Xcode-2 predecessor of
|
|
@@ -1270,6 +1302,227 @@ declare class ReferenceProxy extends XcodeObject<ReferenceProxyProperties> {
|
|
|
1270
1302
|
remoteReference(): ContainerItemProxy | undefined;
|
|
1271
1303
|
}
|
|
1272
1304
|
//#endregion
|
|
1305
|
+
//#region src/xcconfig/types.d.ts
|
|
1306
|
+
/**
|
|
1307
|
+
* Document types for Xcode build configuration files (`.xcconfig`).
|
|
1308
|
+
*
|
|
1309
|
+
* The format is line based, so the document is the ordered list of parsed
|
|
1310
|
+
* lines. Every statement keeps the exact text it was parsed from (`raw`)
|
|
1311
|
+
* and its line terminator (`eol`), which is what lets an untouched
|
|
1312
|
+
* document rebuild byte for byte even though the format is hand-authored
|
|
1313
|
+
* and has no canonical layout.
|
|
1314
|
+
*
|
|
1315
|
+
* @module
|
|
1316
|
+
*/
|
|
1317
|
+
/**
|
|
1318
|
+
* One `[name=value]` condition attached to a setting assignment, as in
|
|
1319
|
+
* `LDFLAGS[sdk=iphoneos*] = -lfoo`.
|
|
1320
|
+
*/
|
|
1321
|
+
interface XcconfigCondition {
|
|
1322
|
+
/** The condition name, for example `sdk`, `arch`, or `config`. */
|
|
1323
|
+
name: string;
|
|
1324
|
+
/** The condition value, which may carry a trailing `*` wildcard. */
|
|
1325
|
+
value: string;
|
|
1326
|
+
}
|
|
1327
|
+
/**
|
|
1328
|
+
* A `KEY = value` line, optionally with conditions between the key and
|
|
1329
|
+
* the equals sign. The value has surrounding whitespace, an optional
|
|
1330
|
+
* trailing semicolon, and any trailing `//` comment removed.
|
|
1331
|
+
*/
|
|
1332
|
+
interface XcconfigAssignment {
|
|
1333
|
+
kind: "assignment";
|
|
1334
|
+
/** The setting name. */
|
|
1335
|
+
key: string;
|
|
1336
|
+
/** The `[name=value]` conditions, in written order. Usually empty. */
|
|
1337
|
+
conditions: readonly XcconfigCondition[];
|
|
1338
|
+
/** The assigned value with comment, semicolon, and padding stripped. */
|
|
1339
|
+
value: string;
|
|
1340
|
+
/** The exact source line, without its terminator. */
|
|
1341
|
+
raw: string;
|
|
1342
|
+
/** The line terminator, `"\n"`, `"\r\n"`, or `""` on a final line. */
|
|
1343
|
+
eol: string;
|
|
1344
|
+
}
|
|
1345
|
+
/**
|
|
1346
|
+
* An `#include "path"` line. The optional form `#include? "path"` tells
|
|
1347
|
+
* Xcode to ignore a missing file, and callers should mirror that when
|
|
1348
|
+
* resolving includes.
|
|
1349
|
+
*/
|
|
1350
|
+
interface XcconfigInclude {
|
|
1351
|
+
kind: "include";
|
|
1352
|
+
/** The include path exactly as written between the quotes. */
|
|
1353
|
+
path: string;
|
|
1354
|
+
/** True for the `#include?` form. */
|
|
1355
|
+
optional: boolean;
|
|
1356
|
+
/** The exact source line, without its terminator. */
|
|
1357
|
+
raw: string;
|
|
1358
|
+
/** The line terminator, `"\n"`, `"\r\n"`, or `""` on a final line. */
|
|
1359
|
+
eol: string;
|
|
1360
|
+
}
|
|
1361
|
+
/**
|
|
1362
|
+
* A line holding only a `//` comment.
|
|
1363
|
+
*/
|
|
1364
|
+
interface XcconfigComment {
|
|
1365
|
+
kind: "comment";
|
|
1366
|
+
/** The comment text after `//`, untrimmed. */
|
|
1367
|
+
text: string;
|
|
1368
|
+
/** The exact source line, without its terminator. */
|
|
1369
|
+
raw: string;
|
|
1370
|
+
/** The line terminator, `"\n"`, `"\r\n"`, or `""` on a final line. */
|
|
1371
|
+
eol: string;
|
|
1372
|
+
}
|
|
1373
|
+
/**
|
|
1374
|
+
* A line that is empty or holds only whitespace.
|
|
1375
|
+
*/
|
|
1376
|
+
interface XcconfigBlank {
|
|
1377
|
+
kind: "blank";
|
|
1378
|
+
/** The exact source line, without its terminator. */
|
|
1379
|
+
raw: string;
|
|
1380
|
+
/** The line terminator, `"\n"`, `"\r\n"`, or `""` on a final line. */
|
|
1381
|
+
eol: string;
|
|
1382
|
+
}
|
|
1383
|
+
/**
|
|
1384
|
+
* Any parsed `.xcconfig` line.
|
|
1385
|
+
*/
|
|
1386
|
+
type XcconfigStatement = XcconfigAssignment | XcconfigBlank | XcconfigComment | XcconfigInclude;
|
|
1387
|
+
/**
|
|
1388
|
+
* A parsed `.xcconfig` file: its lines in order.
|
|
1389
|
+
*/
|
|
1390
|
+
interface XcconfigDocument {
|
|
1391
|
+
statements: XcconfigStatement[];
|
|
1392
|
+
}
|
|
1393
|
+
//#endregion
|
|
1394
|
+
//#region src/xcconfig/model.d.ts
|
|
1395
|
+
/**
|
|
1396
|
+
* Resolves an `#include` path to the included file's model. Returning
|
|
1397
|
+
* `undefined` skips the include, which is always legal for the
|
|
1398
|
+
* `#include?` form and mirrors a missing file for the strict form.
|
|
1399
|
+
*
|
|
1400
|
+
* Cycles are detected while a file is being expanded, by the include
|
|
1401
|
+
* path exactly as written and by model instance. A cycle reached through
|
|
1402
|
+
* two different spellings of the same path escapes the path check, so
|
|
1403
|
+
* resolvers that memoize per path make the instance check catch it.
|
|
1404
|
+
*/
|
|
1405
|
+
type XcconfigIncludeResolver = (path: string, optional: boolean) => Xcconfig | undefined;
|
|
1406
|
+
/**
|
|
1407
|
+
* The build context conditional assignments are matched against. Keys
|
|
1408
|
+
* mirror the condition names of the format, so `KEY[sdk=iphoneos*]`
|
|
1409
|
+
* matches against {@link sdk}.
|
|
1410
|
+
*/
|
|
1411
|
+
interface XcconfigBuildContext {
|
|
1412
|
+
/** The SDK identifier, for example `iphoneos` or `appletvsimulator`. */
|
|
1413
|
+
sdk?: string;
|
|
1414
|
+
/** The architecture, for example `arm64`. */
|
|
1415
|
+
arch?: string;
|
|
1416
|
+
/** The configuration name, for example `Debug`. */
|
|
1417
|
+
config?: string;
|
|
1418
|
+
}
|
|
1419
|
+
/**
|
|
1420
|
+
* Options for {@link Xcconfig.settings}.
|
|
1421
|
+
*/
|
|
1422
|
+
interface XcconfigSettingsOptions {
|
|
1423
|
+
/**
|
|
1424
|
+
* Called for every `#include` directive, in document order. Without a
|
|
1425
|
+
* resolver, includes contribute nothing.
|
|
1426
|
+
*/
|
|
1427
|
+
resolveInclude?: XcconfigIncludeResolver;
|
|
1428
|
+
/**
|
|
1429
|
+
* The build context conditional assignments apply under. An assignment
|
|
1430
|
+
* takes part when every one of its conditions matches, with trailing
|
|
1431
|
+
* `*` wildcards honored the way Xcode matches SDK names. Without a
|
|
1432
|
+
* context, and for dimensions the context leaves out, conditional
|
|
1433
|
+
* assignments are skipped.
|
|
1434
|
+
*/
|
|
1435
|
+
context?: XcconfigBuildContext;
|
|
1436
|
+
}
|
|
1437
|
+
/**
|
|
1438
|
+
* A build configuration file with typed, mutable access to its settings.
|
|
1439
|
+
*
|
|
1440
|
+
* ```ts
|
|
1441
|
+
* const config = Xcconfig.parse(text);
|
|
1442
|
+
* config.get("PRODUCT_BUNDLE_IDENTIFIER");
|
|
1443
|
+
* config.set("MARKETING_VERSION", "1.2.0");
|
|
1444
|
+
* const updated = config.build();
|
|
1445
|
+
* ```
|
|
1446
|
+
*/
|
|
1447
|
+
declare class Xcconfig {
|
|
1448
|
+
/** The parsed document this model wraps. */
|
|
1449
|
+
readonly document: XcconfigDocument;
|
|
1450
|
+
private constructor();
|
|
1451
|
+
/**
|
|
1452
|
+
* Parses `.xcconfig` text and wraps it in a model.
|
|
1453
|
+
*
|
|
1454
|
+
* @throws XcconfigParseError when the text is malformed.
|
|
1455
|
+
*/
|
|
1456
|
+
static parse(text: string): Xcconfig;
|
|
1457
|
+
/**
|
|
1458
|
+
* Creates an empty configuration file.
|
|
1459
|
+
*/
|
|
1460
|
+
static create(): Xcconfig;
|
|
1461
|
+
/**
|
|
1462
|
+
* Serializes the current document state to `.xcconfig` text.
|
|
1463
|
+
*/
|
|
1464
|
+
build(): string;
|
|
1465
|
+
/**
|
|
1466
|
+
* The names of the settings this file assigns unconditionally, in
|
|
1467
|
+
* first-assignment order. Conditional assignments such as
|
|
1468
|
+
* `KEY[sdk=iphoneos*]` are reachable through {@link assignments}.
|
|
1469
|
+
*/
|
|
1470
|
+
keys(): string[];
|
|
1471
|
+
/**
|
|
1472
|
+
* Every assignment of this file, conditional ones included, in
|
|
1473
|
+
* document order. The items are the document's own nodes, not copies,
|
|
1474
|
+
* so treat them as read-only views. Writes belong on {@link set},
|
|
1475
|
+
* which keeps a statement's value and its source text in step.
|
|
1476
|
+
*/
|
|
1477
|
+
assignments(): readonly XcconfigAssignment[];
|
|
1478
|
+
/**
|
|
1479
|
+
* The `#include` directives of this file, in document order. The items
|
|
1480
|
+
* are the document's own nodes, not copies, so treat them as read-only
|
|
1481
|
+
* views.
|
|
1482
|
+
*/
|
|
1483
|
+
includes(): readonly XcconfigInclude[];
|
|
1484
|
+
/**
|
|
1485
|
+
* Reads the value of a setting from this file alone. When the key is
|
|
1486
|
+
* assigned more than once the last assignment wins, matching how Xcode
|
|
1487
|
+
* reads the file top to bottom. Conditional assignments are ignored.
|
|
1488
|
+
*/
|
|
1489
|
+
get(key: string): string | undefined;
|
|
1490
|
+
/**
|
|
1491
|
+
* Writes a setting. The last unconditional assignment of the key is
|
|
1492
|
+
* rewritten in place as a canonical `KEY = value` line, replacing any
|
|
1493
|
+
* trailing comment the line carried. A key the file does not assign
|
|
1494
|
+
* yet is appended at the end, following the document's line-ending
|
|
1495
|
+
* convention.
|
|
1496
|
+
*/
|
|
1497
|
+
set(key: string, value: string): void;
|
|
1498
|
+
/**
|
|
1499
|
+
* Removes every unconditional assignment of a setting.
|
|
1500
|
+
*
|
|
1501
|
+
* @returns True when at least one assignment was removed.
|
|
1502
|
+
*/
|
|
1503
|
+
remove(key: string): boolean;
|
|
1504
|
+
/**
|
|
1505
|
+
* Flattens the file into a settings dictionary the way Xcode reads it:
|
|
1506
|
+
* top to bottom with later assignments winning, and every `#include`
|
|
1507
|
+
* contributing its settings at the point of the directive, so lines
|
|
1508
|
+
* after an include override it.
|
|
1509
|
+
*
|
|
1510
|
+
* Conditional assignments apply when every condition matches
|
|
1511
|
+
* {@link XcconfigSettingsOptions.context}; without a context they are
|
|
1512
|
+
* skipped. `$(inherited)` references splice in the value accumulated
|
|
1513
|
+
* earlier in the chain, and stay literal when there is none, since
|
|
1514
|
+
* they then refer to layers below the file, which resolve later.
|
|
1515
|
+
*
|
|
1516
|
+
* Includes only take part when {@link XcconfigSettingsOptions.resolveInclude}
|
|
1517
|
+
* is provided, since the library never touches the filesystem itself.
|
|
1518
|
+
* A file included again later re-applies, exactly like pasting its text
|
|
1519
|
+
* a second time. Only re-entry while a file is still being expanded is
|
|
1520
|
+
* skipped, tracked by include path and by instance, so cyclic includes
|
|
1521
|
+
* terminate even when the resolver parses a fresh instance per call.
|
|
1522
|
+
*/
|
|
1523
|
+
settings(options?: XcconfigSettingsOptions): Record<string, string>;
|
|
1524
|
+
}
|
|
1525
|
+
//#endregion
|
|
1273
1526
|
//#region src/model/project.d.ts
|
|
1274
1527
|
/**
|
|
1275
1528
|
* The `PBXProject` object at the document root. It owns the target list,
|
|
@@ -1288,7 +1541,7 @@ declare class RootProject extends XcodeObject<RootProjectProperties> {
|
|
|
1288
1541
|
mainGroup(): Group | undefined;
|
|
1289
1542
|
/**
|
|
1290
1543
|
* The settings dictionary of the project-level default configuration.
|
|
1291
|
-
* Targets inherit from these settings
|
|
1544
|
+
* Targets inherit from these settings, as described on
|
|
1292
1545
|
* {@link NativeTarget.getBuildSetting}.
|
|
1293
1546
|
*/
|
|
1294
1547
|
defaultConfigurationSettings(): PbxprojObject | undefined;
|
|
@@ -1351,6 +1604,12 @@ declare class XcodeProject {
|
|
|
1351
1604
|
* access, so views of the same object compare with `===`.
|
|
1352
1605
|
*/
|
|
1353
1606
|
private readonly views;
|
|
1607
|
+
/**
|
|
1608
|
+
* Flattened settings of registered `.xcconfig` files, keyed by the id
|
|
1609
|
+
* of the file reference configurations name in
|
|
1610
|
+
* `baseConfigurationReference`.
|
|
1611
|
+
*/
|
|
1612
|
+
private readonly xcconfigSettings;
|
|
1354
1613
|
private constructor();
|
|
1355
1614
|
/**
|
|
1356
1615
|
* Parses pbxproj text and wraps it in a model.
|
|
@@ -1361,7 +1620,7 @@ declare class XcodeProject {
|
|
|
1361
1620
|
static parse(text: string): XcodeProject;
|
|
1362
1621
|
/**
|
|
1363
1622
|
* Wraps an already parsed document in a model. The document is used in
|
|
1364
|
-
* place
|
|
1623
|
+
* place rather than copied, so model mutations write into it.
|
|
1365
1624
|
*/
|
|
1366
1625
|
static fromDocument(document: PbxprojObject): XcodeProject;
|
|
1367
1626
|
/**
|
|
@@ -1372,7 +1631,7 @@ declare class XcodeProject {
|
|
|
1372
1631
|
/**
|
|
1373
1632
|
* The raw properties dictionary of an object.
|
|
1374
1633
|
*
|
|
1375
|
-
* @throws XcodeModelError when no object with the id exists
|
|
1634
|
+
* @throws XcodeModelError when no object with the id exists. Views use
|
|
1376
1635
|
* this accessor, so a view of a deleted object fails loudly instead of
|
|
1377
1636
|
* resurrecting the entry.
|
|
1378
1637
|
*/
|
|
@@ -1395,8 +1654,8 @@ declare class XcodeProject {
|
|
|
1395
1654
|
objects(): IterableIterator<[string, XcodeObject]>;
|
|
1396
1655
|
/**
|
|
1397
1656
|
* Generates a deterministic 24-character id from a seed, avoiding every
|
|
1398
|
-
* id the document currently contains. The id is not reserved
|
|
1399
|
-
* object with it (see {@link add})
|
|
1657
|
+
* id the document currently contains. The id is not reserved, and only
|
|
1658
|
+
* adding an object with it (see {@link add}) claims it.
|
|
1400
1659
|
*/
|
|
1401
1660
|
generateId(seed: string): string;
|
|
1402
1661
|
/**
|
|
@@ -1414,6 +1673,22 @@ declare class XcodeProject {
|
|
|
1414
1673
|
* @returns The view of the created object.
|
|
1415
1674
|
*/
|
|
1416
1675
|
add<I extends string>(isa: I, properties: PbxprojObject, seed?: string): ViewOf<I>;
|
|
1676
|
+
/**
|
|
1677
|
+
* Registers the contents of a `.xcconfig` file so build-setting reads
|
|
1678
|
+
* can layer it below the configurations that are based on it. The
|
|
1679
|
+
* library never touches the filesystem, so the caller loads the file
|
|
1680
|
+
* and hands it over together with the file reference that
|
|
1681
|
+
* configurations name in `baseConfigurationReference`. Included files
|
|
1682
|
+
* take part through {@link XcconfigSettingsOptions.resolveInclude};
|
|
1683
|
+
* the settings are flattened once, at registration.
|
|
1684
|
+
*/
|
|
1685
|
+
registerXcconfig(reference: FileReference, config: Xcconfig, options?: XcconfigSettingsOptions): void;
|
|
1686
|
+
/**
|
|
1687
|
+
* The flattened settings registered for the `.xcconfig` file a
|
|
1688
|
+
* configuration is based on, or `undefined` when the configuration
|
|
1689
|
+
* names none or the file was not registered.
|
|
1690
|
+
*/
|
|
1691
|
+
xcconfigSettingsOf(configuration: BuildConfiguration): Record<string, string> | undefined;
|
|
1417
1692
|
/**
|
|
1418
1693
|
* The view of the document's root `PBXProject` object.
|
|
1419
1694
|
*
|
|
@@ -1449,7 +1724,8 @@ declare class XcodeProject {
|
|
|
1449
1724
|
* and Resources build phases, and registers it on the project.
|
|
1450
1725
|
*
|
|
1451
1726
|
* @throws XcodeModelError for product types the model cannot create a
|
|
1452
|
-
* product reference for
|
|
1727
|
+
* product reference for, listed on
|
|
1728
|
+
* {@link AddNativeTargetOptions.productType}.
|
|
1453
1729
|
*/
|
|
1454
1730
|
addNativeTarget(options: AddNativeTargetOptions): NativeTarget;
|
|
1455
1731
|
/**
|
|
@@ -1459,7 +1735,7 @@ declare class XcodeProject {
|
|
|
1459
1735
|
/**
|
|
1460
1736
|
* Adds a remote Swift package reference and registers it on the project.
|
|
1461
1737
|
* When the project already references the repository, the existing
|
|
1462
|
-
* reference is returned unchanged, requirement included
|
|
1738
|
+
* reference is returned unchanged, requirement included. Adjust an
|
|
1463
1739
|
* existing requirement through the reference's properties. Link products
|
|
1464
1740
|
* to targets with {@link NativeTarget.addSwiftPackageProduct}.
|
|
1465
1741
|
*
|
|
@@ -1512,7 +1788,7 @@ declare class XcodeProject {
|
|
|
1512
1788
|
* list containing it, or a nested dictionary carrying it as a key or
|
|
1513
1789
|
* string value.
|
|
1514
1790
|
*
|
|
1515
|
-
* The scan is linear over the document
|
|
1791
|
+
* The scan is linear over the document. Removal flows call it once per
|
|
1516
1792
|
* removed object, which keeps teardown proportional to what is actually
|
|
1517
1793
|
* removed.
|
|
1518
1794
|
*/
|
|
@@ -1524,7 +1800,7 @@ declare class XcodeProject {
|
|
|
1524
1800
|
* (such as `TargetAttributes`) drop its entry.
|
|
1525
1801
|
*
|
|
1526
1802
|
* Removing an id the document does not contain is a no-op. This is the
|
|
1527
|
-
* low-level removal
|
|
1803
|
+
* low-level removal, and {@link removeTarget} composes it into a full
|
|
1528
1804
|
* teardown.
|
|
1529
1805
|
*/
|
|
1530
1806
|
removeObject(id: string): void;
|
|
@@ -1537,7 +1813,7 @@ declare class XcodeProject {
|
|
|
1537
1813
|
* dependencies on others), its membership exception sets, and
|
|
1538
1814
|
* synchronized folders no remaining target links.
|
|
1539
1815
|
*
|
|
1540
|
-
* On-disk sources are untouched
|
|
1816
|
+
* On-disk sources are untouched. The removal is document-only, like
|
|
1541
1817
|
* deleting a target in Xcode and keeping its folder.
|
|
1542
1818
|
*
|
|
1543
1819
|
* @throws XcodeModelError when the target belongs to another project,
|
|
@@ -1545,13 +1821,33 @@ declare class XcodeProject {
|
|
|
1545
1821
|
* objects that happen to share them.
|
|
1546
1822
|
*/
|
|
1547
1823
|
removeTarget(target: Target): void;
|
|
1824
|
+
/**
|
|
1825
|
+
* Renames a target and every place the document knows it by name. That
|
|
1826
|
+
* covers the target's `name` and `productName`, its product file
|
|
1827
|
+
* reference (`OldName.app` becomes `NewName.app`, whatever the
|
|
1828
|
+
* extension), the `remoteInfo` of container item proxies pointing at
|
|
1829
|
+
* the target, `TEST_TARGET_NAME` settings naming it, and the path
|
|
1830
|
+
* segments of `TEST_HOST` and `BUNDLE_LOADER` settings that name the
|
|
1831
|
+
* target or its product. A `PRODUCT_NAME` of the target's own
|
|
1832
|
+
* configurations is rewritten only when it spells the old name
|
|
1833
|
+
* literally. The usual `$(TARGET_NAME)` follows by itself.
|
|
1834
|
+
*
|
|
1835
|
+
* Scheme files live outside the pbxproj, so buildable references are
|
|
1836
|
+
* renamed separately through `Xcscheme.renameTarget`. On-disk renames
|
|
1837
|
+
* (source folders, entitlements files) and the group paths pointing at
|
|
1838
|
+
* those folders stay with the caller. Sibling targets such as
|
|
1839
|
+
* `OldNameTests` are renamed with their own calls.
|
|
1840
|
+
*
|
|
1841
|
+
* @throws XcodeModelError when the target belongs to another project.
|
|
1842
|
+
*/
|
|
1843
|
+
renameTarget(target: Target, newName: string): void;
|
|
1548
1844
|
/**
|
|
1549
1845
|
* Finds a file reference by its project-relative path, resolving each
|
|
1550
1846
|
* reference's location through the group tree from the main group
|
|
1551
1847
|
* (nested group `path` components join with `/`).
|
|
1552
1848
|
*
|
|
1553
1849
|
* Members of file-system-synchronized folders are not listed in the
|
|
1554
|
-
* document and therefore cannot be found
|
|
1850
|
+
* document and therefore cannot be found. Check
|
|
1555
1851
|
* {@link NativeTarget.syncGroupPaths} for folder-level containment
|
|
1556
1852
|
* instead.
|
|
1557
1853
|
*/
|
|
@@ -1713,8 +2009,8 @@ declare class XcodeObject<Properties extends PbxprojObject = PbxprojObject> {
|
|
|
1713
2009
|
* nested dictionaries keyed by object id (such as the root project's
|
|
1714
2010
|
* `TargetAttributes`) drop its entry.
|
|
1715
2011
|
*
|
|
1716
|
-
* This is the low-level removal
|
|
1717
|
-
* made sense alongside this one. Higher-level operations like
|
|
2012
|
+
* This is the low-level removal, so it does not cascade to objects that
|
|
2013
|
+
* only made sense alongside this one. Higher-level operations like
|
|
1718
2014
|
* {@link XcodeProject.removeTarget} compose it into full teardowns.
|
|
1719
2015
|
*/
|
|
1720
2016
|
removeFromProject(): void;
|
|
@@ -1732,7 +2028,7 @@ declare class XcodeObject<Properties extends PbxprojObject = PbxprojObject> {
|
|
|
1732
2028
|
* @param text Source text of the document.
|
|
1733
2029
|
* @returns The document's root value. For real project files this is the
|
|
1734
2030
|
* root dictionary with `objects`, `rootObject`, and version fields.
|
|
1735
|
-
* @throws PbxprojParseError when the document is malformed
|
|
2031
|
+
* @throws PbxprojParseError when the document is malformed. The error
|
|
1736
2032
|
* carries the line and column of the failure.
|
|
1737
2033
|
*/
|
|
1738
2034
|
declare function parsePbxproj(text: string): PbxprojValue;
|
|
@@ -1904,6 +2200,22 @@ declare class Xcscheme {
|
|
|
1904
2200
|
* of these, so rename flows iterate this list.
|
|
1905
2201
|
*/
|
|
1906
2202
|
buildableReferences(): BuildableReference[];
|
|
2203
|
+
/**
|
|
2204
|
+
* Renames every buildable reference pointing at a target. The blueprint
|
|
2205
|
+
* name is matched whole, and the buildable name is matched by its stem,
|
|
2206
|
+
* so `OldApp.app` becomes `NewApp.app` while `OldAppTests.xctest`, a
|
|
2207
|
+
* different target's product, stays untouched. This is the scheme-file
|
|
2208
|
+
* side of `XcodeProject.renameTarget`. Returns whether anything
|
|
2209
|
+
* changed, so callers can skip rewriting untouched files.
|
|
2210
|
+
*/
|
|
2211
|
+
renameTarget(oldName: string, newName: string): boolean;
|
|
2212
|
+
/**
|
|
2213
|
+
* Rewrites every buildable reference's container after the
|
|
2214
|
+
* `.xcodeproj` directory itself is renamed, so `container:Old.xcodeproj`
|
|
2215
|
+
* becomes `container:New.xcodeproj`. The project names are matched
|
|
2216
|
+
* exactly. Returns whether anything changed.
|
|
2217
|
+
*/
|
|
2218
|
+
renameContainer(oldProjectName: string, newProjectName: string): boolean;
|
|
1907
2219
|
}
|
|
1908
2220
|
/**
|
|
1909
2221
|
* Options for {@link createXcscheme}.
|
|
@@ -1946,7 +2258,7 @@ declare function parseXcscheme(text: string): XcschemeDocument;
|
|
|
1946
2258
|
* Deterministic object identifiers for generated pbxproj objects.
|
|
1947
2259
|
*
|
|
1948
2260
|
* Xcode identifies every object with 24 hexadecimal characters. Generated
|
|
1949
|
-
* ids here are deterministic
|
|
2261
|
+
* ids here are deterministic. The same seed always produces the same id, so
|
|
1950
2262
|
* programmatic edits are reproducible and diffs stay minimal across runs.
|
|
1951
2263
|
* The format is `XX` + the first 20 characters of `md5(seed)` + `XX`, which
|
|
1952
2264
|
* is a valid identifier that remains recognizable as generated.
|
|
@@ -1968,4 +2280,20 @@ declare function parseXcscheme(text: string): XcschemeDocument;
|
|
|
1968
2280
|
*/
|
|
1969
2281
|
declare function generateObjectId(seed: string, existing: ReadonlySet<string>): string;
|
|
1970
2282
|
//#endregion
|
|
1971
|
-
|
|
2283
|
+
//#region src/xcconfig/build.d.ts
|
|
2284
|
+
/**
|
|
2285
|
+
* Serializes a document back to `.xcconfig` text.
|
|
2286
|
+
*/
|
|
2287
|
+
declare function buildXcconfig(document: XcconfigDocument): string;
|
|
2288
|
+
//#endregion
|
|
2289
|
+
//#region src/xcconfig/parse.d.ts
|
|
2290
|
+
/**
|
|
2291
|
+
* Parses `.xcconfig` text into its document form.
|
|
2292
|
+
*
|
|
2293
|
+
* @throws XcconfigParseError when a line is not a blank, a comment, an
|
|
2294
|
+
* include, or a well-formed assignment. The error carries the line and
|
|
2295
|
+
* column of the failure.
|
|
2296
|
+
*/
|
|
2297
|
+
declare function parseXcconfig(source: string): XcconfigDocument;
|
|
2298
|
+
//#endregion
|
|
2299
|
+
export { type AddNativeTargetOptions, AggregateTarget, type ApplePlatform, AppleScriptBuildPhase, BuildConfiguration, type BuildConfigurationProperties, BuildFile, BuildFileExceptionSet, type BuildFileProperties, BuildPhase, type BuildPhaseIsa, BuildPhaseMembershipExceptionSet, type BuildPhaseMembershipExceptionSetProperties, type BuildPhaseOf, type BuildPhaseProperties, BuildRule, type BuildRuleProperties, type BuildSettings, BuildStyle, type BuildStyleProperties, BuildableReference, ConfigurationList, type ConfigurationListProperties, ContainerItemProxy, type ContainerItemProxyProperties, CopyFilesBuildPhase, type CopyFilesBuildPhaseProperties, CopyFilesDestination, type CreateXcschemeOptions, ExceptionSet, type ExceptionSetProperties, FileReference, type FileReferenceProperties, FrameworksBuildPhase, Group, type GroupProperties, HeadersBuildPhase, Isa, type IsaValue, LegacyTarget, type LegacyTargetProperties, LocalSwiftPackageReference, type LocalSwiftPackageReferenceProperties, NativeTarget, type NativeTargetProperties, type PbxprojArray, PbxprojBuildError, type PbxprojErrorPosition, type PbxprojObject, PbxprojParseError, type PbxprojValue, ProductType, type ProjectIssue, type ProjectIssueKind, ReferenceProxy, type ReferenceProxyProperties, RemoteSwiftPackageReference, type RemoteSwiftPackageReferenceProperties, ResourcesBuildPhase, RezBuildPhase, RootProject, type RootProjectProperties, ShellScriptBuildPhase, type ShellScriptBuildPhaseProperties, SourcesBuildPhase, SwiftPackageProductDependency, type SwiftPackageProductDependencyProperties, SwiftPackageReference, type SwiftPackageReferenceProperties, SyncRootGroup, type SyncRootGroupProperties, Target, TargetDependency, type TargetDependencyProperties, type TargetProperties, VariantGroup, VersionGroup, type VersionGroupProperties, type ViewByIsa, type ViewOf, Xcconfig, type XcconfigAssignment, type XcconfigBlank, type XcconfigComment, type XcconfigCondition, type XcconfigDocument, type XcconfigInclude, type XcconfigIncludeResolver, XcconfigParseError, type XcconfigSettingsOptions, type XcconfigStatement, XcodeModelError, XcodeObject, XcodeProject, Xcscheme, XcschemeBuildError, type XcschemeComment, type XcschemeDocument, type XcschemeElement, type XcschemeNode, XcschemeParseError, buildPbxproj, buildXcconfig, buildXcscheme, createXcscheme, generateObjectId, isXcschemeElement, parseApplePlatform, parsePbxproj, parseXcconfig, parseXcscheme, xcschemeElements };
|