Skip to content

Commit f219cd5

Browse files
committed
feat(ios): warn when an xcconfig setting is discarded
A dropped key was indistinguishable from one that was never written, so a plugin pinning something like CLANG_CXX_LANGUAGE_STANDARD could hold an entire app below a required standard with no indication of which plugin was responsible. Only conflicts whose values actually differ are reported; two files agreeing on a key is not worth a warning.
1 parent e8296ed commit f219cd5

1 file changed

Lines changed: 12 additions & 13 deletions

File tree

lib/services/xcconfig-service.ts

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,15 @@ export class XcconfigService implements IXcconfigService {
1515
constructor(
1616
private $childProcess: IChildProcess,
1717
private $fs: IFileSystem,
18-
private $logger: ILogger
18+
private $logger: ILogger,
1919
) {}
2020

2121
public getPluginsXcconfigFilePaths(projectRoot: string): IStringDictionary {
2222
return {
23-
[Configurations.Debug.toLowerCase()]: this.getPluginsDebugXcconfigFilePath(
24-
projectRoot
25-
),
26-
[Configurations.Release.toLowerCase()]: this.getPluginsReleaseXcconfigFilePath(
27-
projectRoot
28-
),
23+
[Configurations.Debug.toLowerCase()]:
24+
this.getPluginsDebugXcconfigFilePath(projectRoot),
25+
[Configurations.Release.toLowerCase()]:
26+
this.getPluginsReleaseXcconfigFilePath(projectRoot),
2927
};
3028
}
3129

@@ -39,7 +37,7 @@ export class XcconfigService implements IXcconfigService {
3937

4038
public async mergeFiles(
4139
sourceFile: string,
42-
destinationFile: string
40+
destinationFile: string,
4341
): Promise<void> {
4442
if (!this.$fs.exists(destinationFile)) {
4543
this.$fs.writeFile(destinationFile, "");
@@ -72,7 +70,8 @@ export class XcconfigService implements IXcconfigService {
7270
}
7371

7472
private warnAboutConflicts(sourceFile: string, output: any): void {
75-
const text: string = output === null || output === undefined ? "" : `${output}`;
73+
const text: string =
74+
output === null || output === undefined ? "" : `${output}`;
7675
const markerIndex = text.lastIndexOf(XcconfigService.CONFLICT_MARKER);
7776
if (markerIndex === -1) {
7877
return;
@@ -81,12 +80,12 @@ export class XcconfigService implements IXcconfigService {
8180
let conflicts: { key: string; kept: string; ignored: string }[];
8281
try {
8382
conflicts = JSON.parse(
84-
text.substring(markerIndex + XcconfigService.CONFLICT_MARKER.length)
83+
text.substring(markerIndex + XcconfigService.CONFLICT_MARKER.length),
8584
);
8685
} catch (err) {
8786
// Never let a reporting problem fail the merge itself.
8887
this.$logger.trace(
89-
`Unable to read xcconfig conflicts for ${sourceFile}: ${err}`
88+
`Unable to read xcconfig conflicts for ${sourceFile}: ${err}`,
9089
);
9190
return;
9291
}
@@ -95,14 +94,14 @@ export class XcconfigService implements IXcconfigService {
9594
this.$logger.warn(
9695
`Ignoring ${conflict.key} = ${conflict.ignored} from ${sourceFile}: ` +
9796
`already set to ${conflict.kept} by a higher precedence xcconfig. ` +
98-
`The app's App_Resources xcconfig wins over any plugin's.`
97+
`The app's App_Resources xcconfig wins over any plugin's.`,
9998
);
10099
}
101100
}
102101

103102
public readPropertyValue(
104103
xcconfigFilePath: string,
105-
propertyName: string
104+
propertyName: string,
106105
): string {
107106
if (this.$fs.exists(xcconfigFilePath)) {
108107
const text = this.$fs.readText(xcconfigFilePath);

0 commit comments

Comments
 (0)