Skip to content

Commit

Permalink
Merge pull request #97 from bazel-ios/amber/fix-lldb-swiftmodules-scr…
Browse files Browse the repository at this point in the history
…ipts

Fix LLDB, swiftmodules xcode installers
  • Loading branch information
amberdixon authored Aug 3, 2020
2 parents 47fec4a + d3c4c2a commit 9b9f158
Show file tree
Hide file tree
Showing 10 changed files with 110 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,8 @@ set -euo pipefail
#
# command source ~/.lldbinit-source-map
cat <<-END > ~/.lldbinit-source-map
settings set target.source-map ./ "$BAZEL_WORKSPACE_ROOT/"
settings set target.source-map ./external/ "$BAZEL_WORKSPACE_ROOT/bazel-$(basename "$BAZEL_WORKSPACE_ROOT")/external"
settings append target.source-map ./ "$BAZEL_WORKSPACE_ROOT/"
settings set target.sdk-path $SDKROOT
settings set target.swift-framework-search-paths $FRAMEWORK_SEARCH_PATHS
END
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,21 @@ set -euo pipefail

# Copy Bazel build `.swiftmodule` files to `DerivedData`. This is used by Xcode
# and its indexing.
find "$BAZEL_WORKSPACE_ROOT/bazel-out"/*/bin/ \
-name "*.swiftmodule" \
-not -path "*/_swift_module_cache/*" \
-print0 \
| xargs -0 "$BAZEL_INSTALLERS_DIR/_swiftmodule.sh"
echo "Start copying swiftmodules at `date`"
FOUND_SWIFTMODULES=`pcregrep -o1 'primary_output: "(.*\.swiftmodule)' $BAZEL_BUILD_EVENT_TEXT_FILENAME | uniq`
declare -a EXISTING_SWIFTMODULES=()
for i in $FOUND_SWIFTMODULES
do
if [[ -f $i ]]
then
EXISTING_SWIFTMODULES+=($i)
fi
done
echo "Found ${#EXISTING_SWIFTMODULES[@]} existing SWIFTMODULES"
if [ ${#EXISTING_SWIFTMODULES[@]} -ne 0 ]
then
"$BAZEL_INSTALLERS_DIR/_swiftmodule.sh" ${EXISTING_SWIFTMODULES[*]}
else
echo "No SWIFTMODULES found"
fi
echo "Finish copying swiftmodules at `date`"
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,8 @@ set -euo pipefail
#
# command source ~/.lldbinit-source-map
cat <<-END > ~/.lldbinit-source-map
settings set target.source-map ./ "$BAZEL_WORKSPACE_ROOT/"
settings set target.source-map ./external/ "$BAZEL_WORKSPACE_ROOT/bazel-$(basename "$BAZEL_WORKSPACE_ROOT")/external"
settings append target.source-map ./ "$BAZEL_WORKSPACE_ROOT/"
settings set target.sdk-path $SDKROOT
settings set target.swift-framework-search-paths $FRAMEWORK_SEARCH_PATHS
END
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,21 @@ set -euo pipefail

# Copy Bazel build `.swiftmodule` files to `DerivedData`. This is used by Xcode
# and its indexing.
find "$BAZEL_WORKSPACE_ROOT/bazel-out"/*/bin/ \
-name "*.swiftmodule" \
-not -path "*/_swift_module_cache/*" \
-print0 \
| xargs -0 "$BAZEL_INSTALLERS_DIR/_swiftmodule.sh"
echo "Start copying swiftmodules at `date`"
FOUND_SWIFTMODULES=`pcregrep -o1 'primary_output: "(.*\.swiftmodule)' $BAZEL_BUILD_EVENT_TEXT_FILENAME | uniq`
declare -a EXISTING_SWIFTMODULES=()
for i in $FOUND_SWIFTMODULES
do
if [[ -f $i ]]
then
EXISTING_SWIFTMODULES+=($i)
fi
done
echo "Found ${#EXISTING_SWIFTMODULES[@]} existing SWIFTMODULES"
if [ ${#EXISTING_SWIFTMODULES[@]} -ne 0 ]
then
"$BAZEL_INSTALLERS_DIR/_swiftmodule.sh" ${EXISTING_SWIFTMODULES[*]}
else
echo "No SWIFTMODULES found"
fi
echo "Finish copying swiftmodules at `date`"
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,8 @@ set -euo pipefail
#
# command source ~/.lldbinit-source-map
cat <<-END > ~/.lldbinit-source-map
settings set target.source-map ./ "$BAZEL_WORKSPACE_ROOT/"
settings set target.source-map ./external/ "$BAZEL_WORKSPACE_ROOT/bazel-$(basename "$BAZEL_WORKSPACE_ROOT")/external"
settings append target.source-map ./ "$BAZEL_WORKSPACE_ROOT/"
settings set target.sdk-path $SDKROOT
settings set target.swift-framework-search-paths $FRAMEWORK_SEARCH_PATHS
END
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,21 @@ set -euo pipefail

# Copy Bazel build `.swiftmodule` files to `DerivedData`. This is used by Xcode
# and its indexing.
find "$BAZEL_WORKSPACE_ROOT/bazel-out"/*/bin/ \
-name "*.swiftmodule" \
-not -path "*/_swift_module_cache/*" \
-print0 \
| xargs -0 "$BAZEL_INSTALLERS_DIR/_swiftmodule.sh"
echo "Start copying swiftmodules at `date`"
FOUND_SWIFTMODULES=`pcregrep -o1 'primary_output: "(.*\.swiftmodule)' $BAZEL_BUILD_EVENT_TEXT_FILENAME | uniq`
declare -a EXISTING_SWIFTMODULES=()
for i in $FOUND_SWIFTMODULES
do
if [[ -f $i ]]
then
EXISTING_SWIFTMODULES+=($i)
fi
done
echo "Found ${#EXISTING_SWIFTMODULES[@]} existing SWIFTMODULES"
if [ ${#EXISTING_SWIFTMODULES[@]} -ne 0 ]
then
"$BAZEL_INSTALLERS_DIR/_swiftmodule.sh" ${EXISTING_SWIFTMODULES[*]}
else
echo "No SWIFTMODULES found"
fi
echo "Finish copying swiftmodules at `date`"
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,8 @@ set -euo pipefail
#
# command source ~/.lldbinit-source-map
cat <<-END > ~/.lldbinit-source-map
settings set target.source-map ./ "$BAZEL_WORKSPACE_ROOT/"
settings set target.source-map ./external/ "$BAZEL_WORKSPACE_ROOT/bazel-$(basename "$BAZEL_WORKSPACE_ROOT")/external"
settings append target.source-map ./ "$BAZEL_WORKSPACE_ROOT/"
settings set target.sdk-path $SDKROOT
settings set target.swift-framework-search-paths $FRAMEWORK_SEARCH_PATHS
END
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,21 @@ set -euo pipefail

# Copy Bazel build `.swiftmodule` files to `DerivedData`. This is used by Xcode
# and its indexing.
find "$BAZEL_WORKSPACE_ROOT/bazel-out"/*/bin/ \
-name "*.swiftmodule" \
-not -path "*/_swift_module_cache/*" \
-print0 \
| xargs -0 "$BAZEL_INSTALLERS_DIR/_swiftmodule.sh"
echo "Start copying swiftmodules at `date`"
FOUND_SWIFTMODULES=`pcregrep -o1 'primary_output: "(.*\.swiftmodule)' $BAZEL_BUILD_EVENT_TEXT_FILENAME | uniq`
declare -a EXISTING_SWIFTMODULES=()
for i in $FOUND_SWIFTMODULES
do
if [[ -f $i ]]
then
EXISTING_SWIFTMODULES+=($i)
fi
done
echo "Found ${#EXISTING_SWIFTMODULES[@]} existing SWIFTMODULES"
if [ ${#EXISTING_SWIFTMODULES[@]} -ne 0 ]
then
"$BAZEL_INSTALLERS_DIR/_swiftmodule.sh" ${EXISTING_SWIFTMODULES[*]}
else
echo "No SWIFTMODULES found"
fi
echo "Finish copying swiftmodules at `date`"
5 changes: 4 additions & 1 deletion tools/xcodeproj_shims/installers/lldb-settings.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,8 @@ set -euo pipefail
#
# command source ~/.lldbinit-source-map
cat <<-END > ~/.lldbinit-source-map
settings set target.source-map ./ "$BAZEL_WORKSPACE_ROOT/"
settings set target.source-map ./external/ "$BAZEL_WORKSPACE_ROOT/bazel-$(basename "$BAZEL_WORKSPACE_ROOT")/external"
settings append target.source-map ./ "$BAZEL_WORKSPACE_ROOT/"
settings set target.sdk-path $SDKROOT
settings set target.swift-framework-search-paths $FRAMEWORK_SEARCH_PATHS
END
23 changes: 18 additions & 5 deletions tools/xcodeproj_shims/installers/swiftmodules.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,21 @@ set -euo pipefail

# Copy Bazel build `.swiftmodule` files to `DerivedData`. This is used by Xcode
# and its indexing.
find "$BAZEL_WORKSPACE_ROOT/bazel-out"/*/bin/ \
-name "*.swiftmodule" \
-not -path "*/_swift_module_cache/*" \
-print0 \
| xargs -0 "$BAZEL_INSTALLERS_DIR/_swiftmodule.sh"
echo "Start copying swiftmodules at `date`"
FOUND_SWIFTMODULES=`pcregrep -o1 'primary_output: "(.*\.swiftmodule)' $BAZEL_BUILD_EVENT_TEXT_FILENAME | uniq`
declare -a EXISTING_SWIFTMODULES=()
for i in $FOUND_SWIFTMODULES
do
if [[ -f $i ]]
then
EXISTING_SWIFTMODULES+=($i)
fi
done
echo "Found ${#EXISTING_SWIFTMODULES[@]} existing SWIFTMODULES"
if [ ${#EXISTING_SWIFTMODULES[@]} -ne 0 ]
then
"$BAZEL_INSTALLERS_DIR/_swiftmodule.sh" ${EXISTING_SWIFTMODULES[*]}
else
echo "No SWIFTMODULES found"
fi
echo "Finish copying swiftmodules at `date`"

0 comments on commit 9b9f158

Please sign in to comment.