Skip to content

Commit

Permalink
[WIP] Fixes problems with debugging
Browse files Browse the repository at this point in the history
This needs a formal PR
#36
  • Loading branch information
jerrymarino committed Aug 2, 2022
1 parent 82dcd69 commit cf75279
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 13 deletions.
3 changes: 2 additions & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ build \
--spawn_strategy=standalone \
--strategy=SwiftCompile=worker \
--incompatible_strict_action_env=1 \
--build_event_binary_file=/tmp/bep.bep
--build_event_binary_file=/tmp/bep.bep \
--experimental_worker_allow_json_protocol
6 changes: 3 additions & 3 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ macos_application(
name = "BSBuildService",
bundle_id = "com.xcbuildkit.example",
infoplists = ["Examples/BSBuildService/Info.plist"],
minimum_os_version = "10.14",
minimum_os_version = "10.15.4",
version = ":XCBuildKitVersion",
deps = [":BSBuildServiceLib"],
)
Expand All @@ -69,7 +69,7 @@ macos_application(
name = "HybridBuildService",
bundle_id = "com.xcbuildkit.example",
infoplists = ["Examples/HybridBuildService/Info.plist"],
minimum_os_version = "10.14",
minimum_os_version = "10.15.4",
version = ":XCBuildKitVersion",
deps = [":HybridBuildServiceLib"],
)
Expand Down Expand Up @@ -100,7 +100,7 @@ macos_application(
"Examples/BazelBuildService/Info.plist",
":BuildInfo",
],
minimum_os_version = "10.14",
minimum_os_version = "10.15.4",
version = ":XCBuildKitVersion",
deps = [":BazelBuildServiceLib"],
)
Expand Down
7 changes: 6 additions & 1 deletion BuildServiceShim/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@ cc_binary(
srcs = ["main.c"],
)

sh_library(
name = "BuildServiceShim_deps",
data = ["stub.sh"],
)

sh_binary(
name = "BuildServiceShim",
srcs = [":main"],
data = glob(["*.sh"]),
deps = [":BuildServiceShim_deps"]
)
2 changes: 1 addition & 1 deletion BuildServiceShim/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

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\"");
system("/bin/bash -c \"set -e; /Users/jmarino/Development/xcbuildkit/BuildServiceShim/stub.sh \"");
return 0;
}
20 changes: 13 additions & 7 deletions BuildServiceShim/stub.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
# 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"
# FIXME(https://github.com/jerrymarino/xcbuildkit/issues/36)
SERVICE="/private/var/tmp/_bazel_jmarino/2d5afbd2e45fa256f993768c937cd6e8/execroot/__main__/bazel-out/applebin_macos-darwin_x86_64-fastbuild-ST-73b41d209e9d/bin/BazelBuildService_archive-root/BazelBuildService.app/Contents/MacOS/BazelBuildService"

function redirect() {
#tee >($SERVICE) /tmp/xcbuild.out
Expand All @@ -18,9 +19,14 @@ function replace() {
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
replace
fi
# FIXME(https://github.com/jerrymarino/xcbuildkit/issues/36)
# Forcing `replace` for the purposes of what is being tested here on indexing
replace
# redirect

# # This simply redirects stdin and stdout of Xcode's build service
# if [[ "${BUILD_SERVICE_REDIRECT:-false}" == "true" ]]; then
# redirect
# else
# replace
# fi

0 comments on commit cf75279

Please sign in to comment.