Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions rules/xcodeproj.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ def _xcodeproj_impl(ctx):
set -euxo pipefail
cd $BAZEL_WORKSPACE_ROOT

export BAZEL_BUILD_EVENT_TEXT_FILENAME=$(mktemp -d)/build_event.txt
$BAZEL_BUILD_EXEC {bazel_build_target_name}
$BAZEL_INSTALLER
""".format(bazel_build_target_name = target_info.bazel_build_target_name),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,23 @@ set -euo pipefail

# See `_indexstore.sh` for full details.

# Make sure add these to bazel build target copts for objective-c
find "$BAZEL_WORKSPACE_ROOT/bazel-out"/*/bin/ \
-type d \
-name "*.indexstore" \
-print0 \
| xargs -0 "$BAZEL_INSTALLERS_DIR/_indexstore.sh"

echo "Finish remapping index files"
echo "Start remapping index files at `date`"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

debugging?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I put that in here intentionally, because it made it easy for me to look inside the bazel-xcode-diagnostics directory to see if my index remapping was in progress.


FOUND_INDEXSTORES=`pcregrep -o1 'command_line: "(.*\.indexstore)' $BAZEL_BUILD_EVENT_TEXT_FILENAME || true`
declare -a EXISTING_INDEXSTORES=()
for i in $FOUND_INDEXSTORES
do
Comment thread
segiddins marked this conversation as resolved.
if [ -d $i ]
then
EXISTING_INDEXSTORES+=($i)
fi
done

if [ ${#EXISTING_INDEXSTORES[@]} -ne 0 ]
then
"$BAZEL_INSTALLERS_DIR/_indexstore.sh" $EXISTING_INDEXSTORES
else
echo "No indexstores found"
fi

echo "Finish remapping index files at `date`"
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\nset -euxo pipefail\ncd $BAZEL_WORKSPACE_ROOT\n\n$BAZEL_BUILD_EXEC tests/macos/xcodeproj:Single-Application-RunnableTestSuite_iPad-Air-2__12.4\n$BAZEL_INSTALLER\n";
shellScript = "\nset -euxo pipefail\ncd $BAZEL_WORKSPACE_ROOT\n\nexport BAZEL_BUILD_EVENT_TEXT_FILENAME=$(mktemp -d)/build_event.txt\n$BAZEL_BUILD_EXEC tests/macos/xcodeproj:Single-Application-RunnableTestSuite_iPad-Air-2__12.4\n$BAZEL_INSTALLER\n";
};
8C9FD347EEDF21022077C21D /* Build with bazel */ = {
isa = PBXShellScriptBuildPhase;
Expand All @@ -222,7 +222,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\nset -euxo pipefail\ncd $BAZEL_WORKSPACE_ROOT\n\n$BAZEL_BUILD_EXEC rules/test_host_app:iOS-12.0-AppHost\n$BAZEL_INSTALLER\n";
shellScript = "\nset -euxo pipefail\ncd $BAZEL_WORKSPACE_ROOT\n\nexport BAZEL_BUILD_EVENT_TEXT_FILENAME=$(mktemp -d)/build_event.txt\n$BAZEL_BUILD_EXEC rules/test_host_app:iOS-12.0-AppHost\n$BAZEL_INSTALLER\n";
};
CEFFC66550AFA438E8952334 /* Build with bazel */ = {
isa = PBXShellScriptBuildPhase;
Expand All @@ -240,7 +240,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\nset -euxo pipefail\ncd $BAZEL_WORKSPACE_ROOT\n\n$BAZEL_BUILD_EXEC tests/macos/xcodeproj:Single-Application-UnitTests\n$BAZEL_INSTALLER\n";
shellScript = "\nset -euxo pipefail\ncd $BAZEL_WORKSPACE_ROOT\n\nexport BAZEL_BUILD_EVENT_TEXT_FILENAME=$(mktemp -d)/build_event.txt\n$BAZEL_BUILD_EXEC tests/macos/xcodeproj:Single-Application-UnitTests\n$BAZEL_INSTALLER\n";
};
/* End PBXShellScriptBuildPhase section */

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,23 @@ set -euo pipefail

# See `_indexstore.sh` for full details.

# Make sure add these to bazel build target copts for objective-c
find "$BAZEL_WORKSPACE_ROOT/bazel-out"/*/bin/ \
-type d \
-name "*.indexstore" \
-print0 \
| xargs -0 "$BAZEL_INSTALLERS_DIR/_indexstore.sh"

echo "Finish remapping index files"
echo "Start remapping index files at `date`"

FOUND_INDEXSTORES=`pcregrep -o1 'command_line: "(.*\.indexstore)' $BAZEL_BUILD_EVENT_TEXT_FILENAME || true`
declare -a EXISTING_INDEXSTORES=()
for i in $FOUND_INDEXSTORES
do
if [ -d $i ]
then
EXISTING_INDEXSTORES+=($i)
fi
done

if [ ${#EXISTING_INDEXSTORES[@]} -ne 0 ]
then
"$BAZEL_INSTALLERS_DIR/_indexstore.sh" $EXISTING_INDEXSTORES
else
echo "No indexstores found"
fi

echo "Finish remapping index files at `date`"
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\nset -euxo pipefail\ncd $BAZEL_WORKSPACE_ROOT\n\n$BAZEL_BUILD_EXEC tests/macos/xcodeproj:Single-Application-RunnableTestSuite_iPad-Air-2__12.4\n$BAZEL_INSTALLER\n";
shellScript = "\nset -euxo pipefail\ncd $BAZEL_WORKSPACE_ROOT\n\nexport BAZEL_BUILD_EVENT_TEXT_FILENAME=$(mktemp -d)/build_event.txt\n$BAZEL_BUILD_EXEC tests/macos/xcodeproj:Single-Application-RunnableTestSuite_iPad-Air-2__12.4\n$BAZEL_INSTALLER\n";
};
B6158A7B27A31249CCAFEC9E /* Build with bazel */ = {
isa = PBXShellScriptBuildPhase;
Expand All @@ -222,7 +222,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\nset -euxo pipefail\ncd $BAZEL_WORKSPACE_ROOT\n\n$BAZEL_BUILD_EXEC rules/test_host_app:iOS-12.0-AppHost\n$BAZEL_INSTALLER\n";
shellScript = "\nset -euxo pipefail\ncd $BAZEL_WORKSPACE_ROOT\n\nexport BAZEL_BUILD_EVENT_TEXT_FILENAME=$(mktemp -d)/build_event.txt\n$BAZEL_BUILD_EXEC rules/test_host_app:iOS-12.0-AppHost\n$BAZEL_INSTALLER\n";
};
D318F6F09E06731B996B9EF2 /* Build with bazel */ = {
isa = PBXShellScriptBuildPhase;
Expand All @@ -240,7 +240,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\nset -euxo pipefail\ncd $BAZEL_WORKSPACE_ROOT\n\n$BAZEL_BUILD_EXEC tests/macos/xcodeproj:Single-Application-UnitTests\n$BAZEL_INSTALLER\n";
shellScript = "\nset -euxo pipefail\ncd $BAZEL_WORKSPACE_ROOT\n\nexport BAZEL_BUILD_EVENT_TEXT_FILENAME=$(mktemp -d)/build_event.txt\n$BAZEL_BUILD_EXEC tests/macos/xcodeproj:Single-Application-UnitTests\n$BAZEL_INSTALLER\n";
};
/* End PBXShellScriptBuildPhase section */

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,23 @@ set -euo pipefail

# See `_indexstore.sh` for full details.

# Make sure add these to bazel build target copts for objective-c
find "$BAZEL_WORKSPACE_ROOT/bazel-out"/*/bin/ \
-type d \
-name "*.indexstore" \
-print0 \
| xargs -0 "$BAZEL_INSTALLERS_DIR/_indexstore.sh"

echo "Finish remapping index files"
echo "Start remapping index files at `date`"

FOUND_INDEXSTORES=`pcregrep -o1 'command_line: "(.*\.indexstore)' $BAZEL_BUILD_EVENT_TEXT_FILENAME || true`
declare -a EXISTING_INDEXSTORES=()
for i in $FOUND_INDEXSTORES
do
if [ -d $i ]
then
EXISTING_INDEXSTORES+=($i)
fi
done

if [ ${#EXISTING_INDEXSTORES[@]} -ne 0 ]
then
"$BAZEL_INSTALLERS_DIR/_indexstore.sh" $EXISTING_INDEXSTORES
else
echo "No indexstores found"
fi

echo "Finish remapping index files at `date`"
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\nset -euxo pipefail\ncd $BAZEL_WORKSPACE_ROOT\n\n$BAZEL_BUILD_EXEC tests/ios/unit-test/test-imports-app:TestImports-Unit-Tests\n$BAZEL_INSTALLER\n";
shellScript = "\nset -euxo pipefail\ncd $BAZEL_WORKSPACE_ROOT\n\nexport BAZEL_BUILD_EVENT_TEXT_FILENAME=$(mktemp -d)/build_event.txt\n$BAZEL_BUILD_EXEC tests/ios/unit-test/test-imports-app:TestImports-Unit-Tests\n$BAZEL_INSTALLER\n";
};
2756FB505F15157D82C9069E /* Build with bazel */ = {
isa = PBXShellScriptBuildPhase;
Expand All @@ -288,7 +288,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\nset -euxo pipefail\ncd $BAZEL_WORKSPACE_ROOT\n\n$BAZEL_BUILD_EXEC rules/test_host_app:iOS-10.0-AppHost\n$BAZEL_INSTALLER\n";
shellScript = "\nset -euxo pipefail\ncd $BAZEL_WORKSPACE_ROOT\n\nexport BAZEL_BUILD_EVENT_TEXT_FILENAME=$(mktemp -d)/build_event.txt\n$BAZEL_BUILD_EXEC rules/test_host_app:iOS-10.0-AppHost\n$BAZEL_INSTALLER\n";
};
3D60A491CE72F7D799EC0383 /* Build with bazel */ = {
isa = PBXShellScriptBuildPhase;
Expand All @@ -306,7 +306,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\nset -euxo pipefail\ncd $BAZEL_WORKSPACE_ROOT\n\n$BAZEL_BUILD_EXEC tests/ios/unit-test/test-imports-app:TestImports-App\n$BAZEL_INSTALLER\n";
shellScript = "\nset -euxo pipefail\ncd $BAZEL_WORKSPACE_ROOT\n\nexport BAZEL_BUILD_EVENT_TEXT_FILENAME=$(mktemp -d)/build_event.txt\n$BAZEL_BUILD_EXEC tests/ios/unit-test/test-imports-app:TestImports-App\n$BAZEL_INSTALLER\n";
};
6DBC122A6C2C8B5D5805E16D /* Build with bazel */ = {
isa = PBXShellScriptBuildPhase;
Expand All @@ -324,7 +324,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\nset -euxo pipefail\ncd $BAZEL_WORKSPACE_ROOT\n\n$BAZEL_BUILD_EXEC tests/ios/unit-test:DefaultHosted\n$BAZEL_INSTALLER\n";
shellScript = "\nset -euxo pipefail\ncd $BAZEL_WORKSPACE_ROOT\n\nexport BAZEL_BUILD_EVENT_TEXT_FILENAME=$(mktemp -d)/build_event.txt\n$BAZEL_BUILD_EXEC tests/ios/unit-test:DefaultHosted\n$BAZEL_INSTALLER\n";
};
/* End PBXShellScriptBuildPhase section */

Expand Down
2 changes: 1 addition & 1 deletion tools/xcodeproj_shims/build-wrapper.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
set -euxo pipefail

$BAZEL_PATH build $1 2>&1 | $BAZEL_OUTPUT_PROCESSOR
$BAZEL_PATH build --build_event_text_file=$BAZEL_BUILD_EVENT_TEXT_FILENAME --build_event_publish_all_actions $1 2>&1 | $BAZEL_OUTPUT_PROCESSOR
31 changes: 23 additions & 8 deletions tools/xcodeproj_shims/installers/indexstores.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,26 @@ set -euo pipefail

# See `_indexstore.sh` for full details.

# Make sure add these to bazel build target copts for objective-c
find "$BAZEL_WORKSPACE_ROOT/bazel-out"/*/bin/ \
-type d \
-name "*.indexstore" \
-print0 \
| xargs -0 "$BAZEL_INSTALLERS_DIR/_indexstore.sh"

echo "Finish remapping index files"
echo "Start remapping index files at `date`"

FOUND_INDEXSTORES=`pcregrep -o1 'command_line: "(.*\.indexstore)' $BAZEL_BUILD_EVENT_TEXT_FILENAME || true`

declare -a EXISTING_INDEXSTORES=()
for i in $FOUND_INDEXSTORES
do
if [ -d $i ]
then
EXISTING_INDEXSTORES+=($i)
fi
done

echo "Found ${#EXISTING_INDEXSTORES[@]} existing indexstores"

if [ ${#EXISTING_INDEXSTORES[@]} -ne 0 ]
then
"$BAZEL_INSTALLERS_DIR/_indexstore.sh" $EXISTING_INDEXSTORES
else
echo "No indexstores found"
fi

echo "Finish remapping index files at `date`"