Skip to content

Commit a3adf68

Browse files
rosen-vladimirovDimitar Kerezov
authored andcommitted
Print cocoa pods warnings with labels
Includes + A hack for silencing irrelevant warning messages from xcode's linker when running `pod install` with cocoa pods version 0.38.2 and Mac OS El Capitan. There is a [github issue](CocoaPods/CocoaPods#4302) with more information available
1 parent 71f2ca6 commit a3adf68

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

lib/services/ios-project-service.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -517,16 +517,19 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
517517
let childProcess = this.$childProcess.spawnFromEvent(podTool, ["install"], "close", { cwd: this.platformData.projectRoot, stdio: ['pipe', process.stdout, 'pipe'] }).wait();
518518
if (childProcess.stderr) {
519519
let warnings = childProcess.stderr.match(/(\u001b\[(?:\d*;){0,5}\d*m[\s\S]+?\u001b\[(?:\d*;){0,5}\d*m)|(\[!\].*?\n)/g);
520-
let result = _.reduce(warnings, (result: string, warning: string) => {
521-
return result + `[Warning]${warning.replace("\n", "")}${os.EOL}`.yellow;
522-
}, "");
523-
this.$logger.info(result);
520+
_.each(warnings, (warning: string) => {
521+
this.$logger.warnWithLabel(warning.replace("\n", ""));
522+
});
524523

525-
let errors = childProcess.stderr;
524+
// HACK for silencing irrelevant linking warnings when pod installing on
525+
// El Capitan with cocoa pods version 0.38.2
526+
// Reference https://github.com/CocoaPods/CocoaPods/issues/4302
527+
let errors = childProcess.stderr.replace(/dyld: warning, LC_RPATH @executable_path.*?@executable_path/g, "");
526528
_.each(warnings, warning => {
527529
errors = errors.replace(warning, "");
528530
});
529-
if(errors) {
531+
532+
if(errors.trim()) {
530533
this.$errors.failWithoutHelp(`Pod install command failed. Error output: ${errors}`);
531534
}
532535
}

test/stubs.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export class LoggerStub implements ILogger {
1111
fatal(...args: string[]): void {}
1212
error(...args: string[]): void {}
1313
warn(...args: string[]): void {}
14+
warnWithLabel(...args: string[]): void {}
1415
info(...args: string[]): void {}
1516
debug(...args: string[]): void {}
1617
trace(...args: string[]): void {}

0 commit comments

Comments
 (0)