Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMOB-25576] Ensuring usage of macos bundled core utilities and shells when adding to iOS buildPhases #9639

Merged
merged 8 commits into from
Jan 20, 2018
2 changes: 1 addition & 1 deletion iphone/cli/commands/_build.js
Original file line number Diff line number Diff line change
Expand Up @@ -3177,7 +3177,7 @@ iOSBuilder.prototype.createXcodeProject = function createXcodeProject(next) {
outputPaths: [],
runOnlyForDeploymentPostprocessing: 0,
shellPath: '/bin/sh',
shellScript: '"cp -rf \\"$PROJECT_DIR/ArchiveStaging\\"/ \\"$TARGET_BUILD_DIR/$PRODUCT_NAME.app/\\""',
shellScript: '"/bin/cp -rf \\"$PROJECT_DIR/ArchiveStaging\\"/ \\"$TARGET_BUILD_DIR/$PRODUCT_NAME.app/\\""',
Copy link
Collaborator

@hansemannn hansemannn Dec 1, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a possible performance issue with standalone commands. Apple even recommends to not use them and gives some intersting benchmarking-tests. I don't this issue is present for many users, but @janvennemann or @sgtcoolguy may have some more insight here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was unaware of a performance difference. Being that it's called a "shellScript", I assumed Xcode was just spawning the command in a shell in which case I don't see why /bin/cp would be significantly slower than cp. In the Apple docs, they use the example of the echo command which writes to stdout and perhaps that's where the speed issue is. cp doesn't output anything unless the verbose flag is set. So, I'm not terribly concerned with performance.

I guess I'm more concerned why /bin isn't in your PATH.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, we are talking about one iteration of the command here, i think we can neglect the performance impact (if there even is one). We are talking about a few ms at most according to @rlustemberg benches.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then let‘s take it for 7.0.1!

showEnvVarsInLog: 0
};
xobjs.PBXShellScriptBuildPhase[buildPhaseUuid + '_comment'] = '"' + name + '"';
Expand Down
2 changes: 1 addition & 1 deletion iphone/cli/hooks/frameworks.js
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ class FrameworkIntegrator {

let scriptPhaseUuid = this._builder.generateXcodeUuid();
let shellPath = '/bin/sh';
let shellScript = 'bash "' + stripFrameworksScriptPath + '"';
let shellScript = '/bin/bash "' + stripFrameworksScriptPath + '"';

this._xobjs.PBXShellScriptBuildPhase = this._xobjs.PBXShellScriptBuildPhase || {};
this._xobjs.PBXShellScriptBuildPhase[scriptPhaseUuid] = {
Expand Down