diff --git a/tests/ios/xcodeproj/Single-Static-Framework-Project.xcodeproj/bazelinstallers/lldb-settings.sh b/tests/ios/xcodeproj/Single-Static-Framework-Project.xcodeproj/bazelinstallers/lldb-settings.sh index ad83fd9af..12c85bb7f 100755 --- a/tests/ios/xcodeproj/Single-Static-Framework-Project.xcodeproj/bazelinstallers/lldb-settings.sh +++ b/tests/ios/xcodeproj/Single-Static-Framework-Project.xcodeproj/bazelinstallers/lldb-settings.sh @@ -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 diff --git a/tests/ios/xcodeproj/Single-Static-Framework-Project.xcodeproj/bazelinstallers/swiftmodules.sh b/tests/ios/xcodeproj/Single-Static-Framework-Project.xcodeproj/bazelinstallers/swiftmodules.sh index 0bb695905..92e5c4483 100755 --- a/tests/ios/xcodeproj/Single-Static-Framework-Project.xcodeproj/bazelinstallers/swiftmodules.sh +++ b/tests/ios/xcodeproj/Single-Static-Framework-Project.xcodeproj/bazelinstallers/swiftmodules.sh @@ -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`" diff --git a/tests/macos/xcodeproj/Single-Application-Project-AllTargets.xcodeproj/bazelinstallers/lldb-settings.sh b/tests/macos/xcodeproj/Single-Application-Project-AllTargets.xcodeproj/bazelinstallers/lldb-settings.sh index ad83fd9af..12c85bb7f 100755 --- a/tests/macos/xcodeproj/Single-Application-Project-AllTargets.xcodeproj/bazelinstallers/lldb-settings.sh +++ b/tests/macos/xcodeproj/Single-Application-Project-AllTargets.xcodeproj/bazelinstallers/lldb-settings.sh @@ -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 diff --git a/tests/macos/xcodeproj/Single-Application-Project-AllTargets.xcodeproj/bazelinstallers/swiftmodules.sh b/tests/macos/xcodeproj/Single-Application-Project-AllTargets.xcodeproj/bazelinstallers/swiftmodules.sh index 0bb695905..92e5c4483 100755 --- a/tests/macos/xcodeproj/Single-Application-Project-AllTargets.xcodeproj/bazelinstallers/swiftmodules.sh +++ b/tests/macos/xcodeproj/Single-Application-Project-AllTargets.xcodeproj/bazelinstallers/swiftmodules.sh @@ -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`" diff --git a/tests/macos/xcodeproj/Single-Application-Project-DirectTargetsOnly.xcodeproj/bazelinstallers/lldb-settings.sh b/tests/macos/xcodeproj/Single-Application-Project-DirectTargetsOnly.xcodeproj/bazelinstallers/lldb-settings.sh index ad83fd9af..12c85bb7f 100755 --- a/tests/macos/xcodeproj/Single-Application-Project-DirectTargetsOnly.xcodeproj/bazelinstallers/lldb-settings.sh +++ b/tests/macos/xcodeproj/Single-Application-Project-DirectTargetsOnly.xcodeproj/bazelinstallers/lldb-settings.sh @@ -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 diff --git a/tests/macos/xcodeproj/Single-Application-Project-DirectTargetsOnly.xcodeproj/bazelinstallers/swiftmodules.sh b/tests/macos/xcodeproj/Single-Application-Project-DirectTargetsOnly.xcodeproj/bazelinstallers/swiftmodules.sh index 0bb695905..92e5c4483 100755 --- a/tests/macos/xcodeproj/Single-Application-Project-DirectTargetsOnly.xcodeproj/bazelinstallers/swiftmodules.sh +++ b/tests/macos/xcodeproj/Single-Application-Project-DirectTargetsOnly.xcodeproj/bazelinstallers/swiftmodules.sh @@ -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`" diff --git a/tests/macos/xcodeproj/Test-Target-With-Test-Host-Project.xcodeproj/bazelinstallers/lldb-settings.sh b/tests/macos/xcodeproj/Test-Target-With-Test-Host-Project.xcodeproj/bazelinstallers/lldb-settings.sh index ad83fd9af..12c85bb7f 100755 --- a/tests/macos/xcodeproj/Test-Target-With-Test-Host-Project.xcodeproj/bazelinstallers/lldb-settings.sh +++ b/tests/macos/xcodeproj/Test-Target-With-Test-Host-Project.xcodeproj/bazelinstallers/lldb-settings.sh @@ -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 diff --git a/tests/macos/xcodeproj/Test-Target-With-Test-Host-Project.xcodeproj/bazelinstallers/swiftmodules.sh b/tests/macos/xcodeproj/Test-Target-With-Test-Host-Project.xcodeproj/bazelinstallers/swiftmodules.sh index 0bb695905..92e5c4483 100755 --- a/tests/macos/xcodeproj/Test-Target-With-Test-Host-Project.xcodeproj/bazelinstallers/swiftmodules.sh +++ b/tests/macos/xcodeproj/Test-Target-With-Test-Host-Project.xcodeproj/bazelinstallers/swiftmodules.sh @@ -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`" diff --git a/tools/xcodeproj_shims/installers/lldb-settings.sh b/tools/xcodeproj_shims/installers/lldb-settings.sh index ad83fd9af..12c85bb7f 100755 --- a/tools/xcodeproj_shims/installers/lldb-settings.sh +++ b/tools/xcodeproj_shims/installers/lldb-settings.sh @@ -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 diff --git a/tools/xcodeproj_shims/installers/swiftmodules.sh b/tools/xcodeproj_shims/installers/swiftmodules.sh index 0bb695905..92e5c4483 100755 --- a/tools/xcodeproj_shims/installers/swiftmodules.sh +++ b/tools/xcodeproj_shims/installers/swiftmodules.sh @@ -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`"