Skip to content

Commit 4787484

Browse files
committed
Merge pull request #1134 from NativeScript/fatme/fix-pod-install
Fail if sandbox install command fails
2 parents 96a484a + a3adf68 commit 4787484

File tree

4 files changed

+24
-3
lines changed

4 files changed

+24
-3
lines changed

lib/services/ios-project-service.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,27 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
514514

515515
this.$logger.info("Installing pods...");
516516
let podTool = this.$config.USE_POD_SANDBOX ? "sandbox-pod" : "pod";
517-
return this.$childProcess.spawnFromEvent(podTool, ["install"], "close", { cwd: this.platformData.projectRoot, stdio: 'inherit' }).wait();
517+
let childProcess = this.$childProcess.spawnFromEvent(podTool, ["install"], "close", { cwd: this.platformData.projectRoot, stdio: ['pipe', process.stdout, 'pipe'] }).wait();
518+
if (childProcess.stderr) {
519+
let warnings = childProcess.stderr.match(/(\u001b\[(?:\d*;){0,5}\d*m[\s\S]+?\u001b\[(?:\d*;){0,5}\d*m)|(\[!\].*?\n)/g);
520+
_.each(warnings, (warning: string) => {
521+
this.$logger.warnWithLabel(warning.replace("\n", ""));
522+
});
523+
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, "");
528+
_.each(warnings, warning => {
529+
errors = errors.replace(warning, "");
530+
});
531+
532+
if(errors.trim()) {
533+
this.$errors.failWithoutHelp(`Pod install command failed. Error output: ${errors}`);
534+
}
535+
}
536+
537+
return childProcess;
518538
}).future<any>()();
519539
}
520540

lib/services/platform-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ export class PlatformService implements IPlatformService {
209209
} catch(error) {
210210
this.$logger.debug(error);
211211
shell.rm("-rf", appResourcesDirectoryPath);
212-
this.$errors.fail(`Processing node_modules failed. Error:${error}`);
212+
this.$errors.failWithoutHelp(`Processing node_modules failed. ${error}`);
213213
}
214214

215215
// Process platform specific files

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)