-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
3 changed files
with
23 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,15 @@ | ||
#include <stdlib.h> | ||
|
||
int main(int ac, char** av) { | ||
// Run a bash script "stub" adjacent to the binary | ||
system("/bin/bash -c \"$(dirname $XCBBUILDSERVICE_PATH)/BuildServiceShim.runfiles/__main__/BuildServiceShim/stub.sh\""); | ||
return 0; | ||
// FIXME: not good assumptions: | ||
// - the BUILDSERVICE_PATH ( self ) is deep in bazel-out | ||
// https://github.com/jerrymarino/xcbuildkit/issues/36 | ||
int st = system("/bin/bash -c \"$(dirname $(dirname $(dirname $XCBBUILDSERVICE_PATH)))/BuildServiceShim/stub.sh\""); | ||
|
||
// This atleast crashes it if its wrong | ||
if (WEXITSTATUS(st) == 0x10) { | ||
return 0; | ||
} else { | ||
return 1; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,22 @@ | ||
#!/bin/bash | ||
|
||
# The service is adjacent to this program | ||
# The layer of indirection is useful for debugging and not | ||
# a production component | ||
SERVICE="$(dirname $(dirname $XCBBUILDSERVICE_PATH))/BazelBuildService_app_dir/BazelBuildService.app/Contents/MacOS/BazelBuildService" | ||
|
||
function redirect() { | ||
#tee >($SERVICE) /tmp/xcbuild.out | ||
/usr/bin/env - XCBUILD_TRACING_URL=/tmp/xcbuild.trace TERM="${TERM}" SHELL="${SHELL}" PATH="${PATH}" HOME="${HOME}" \ | ||
tee /tmp/xcbuild.in | \ | ||
$XCODE/Contents/SharedFrameworks/XCBuild.framework/PlugIns/XCBBuildService.bundle/Contents/MacOS/XCBBuildService | \ | ||
tee /tmp/xcbuild.out | ||
} | ||
|
||
function replace() { | ||
local SERVICE="$DEBUG_BUILDSERVICE_PATH" | ||
/usr/bin/env - TERM="${TERM}" SHELL="${SHELL}" PATH="${PATH}" HOME="${HOME}" \ | ||
tee /tmp/xcbuild.in | $SERVICE | tee /tmp/xcbuild.out | ||
} | ||
|
||
# This simply redirects stdin and stdout of Xcode's build service | ||
if [[ "${BUILD_SERVICE_REDIRECT:-false}" == "true" ]]; then | ||
redirect | ||
else | ||
if [[ -n "$DEBUG_BUILDSERVICE_PATH" ]]; then | ||
echo "[stub.sh] Replacing ($DEBUG_BUILDSERVICE_PATH)" >> /tmp/xcbuild.log | ||
replace | ||
else | ||
echo "[stub.sh] Shimming" >> /tmp/xcbuild.log | ||
redirect | ||
fi |