Skip to content

Commit 031b401

Browse files
author
Karim Alweheshy
committed
draft
1 parent 92a825d commit 031b401

File tree

5 files changed

+24
-5
lines changed

5 files changed

+24
-5
lines changed

tools/generators/pbxproj_prefix/src/Generator/PBXProjectBuildSettings.swift

+11
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,17 @@ extension Generator {
9797
value: #""$(INDEX_DATA_STORE_DIR)""#
9898
),
9999
.init(key: "INDEX_FORCE_SCRIPT_EXECUTION", value: "YES"),
100+
// .init(key: "CC", value: #""$(BAZEL_INTEGRATION_DIR)/clang.sh""#),
101+
// .init(key: "CXX", value: #""$(BAZEL_INTEGRATION_DIR)/clang.sh""#),
102+
// .init(key: "LD", value: #""$(BAZEL_INTEGRATION_DIR)/ld""#),
103+
// .init(
104+
// key: "LDPLUSPLUS",
105+
// value: #""$(BAZEL_INTEGRATION_DIR)/ld""#
106+
// ),
107+
// .init(
108+
// key: "LIBTOOL",
109+
// value: #""$(BAZEL_INTEGRATION_DIR)/libtool""#
110+
// ),
100111
.init(
101112
key: "INDEX_IMPORT",
102113
value: indexImport

tools/swiftc_stub/main.swift

+4-3
Original file line numberDiff line numberDiff line change
@@ -226,16 +226,17 @@ error: Failed to parse DEVELOPER_DIR from '-sdk'. Using /usr/bin/swiftc.
226226
let developerDir = sdkPath[range]
227227

228228
let processedArgs = args.dropFirst().map { arg in
229-
if let range = arg.range(of: "BazelRulesXcodeProj16B40.xctoolchain") {
229+
if let range = arg.range(of: "BazelRulesXcodeProj") {
230230
let substring = arg[..<range.lowerBound]
231+
// Extract the version suffix (e.g. "16B40" from "BazelRulesXcodeProj16B40")
232+
let toolchainSuffix = arg[range.upperBound...].prefix(while: { $0 != "." })
231233
return arg.replacingOccurrences(
232-
of: String(substring) + "BazelRulesXcodeProj16B40.xctoolchain",
234+
of: String(substring) + "BazelRulesXcodeProj" + toolchainSuffix + ".xctoolchain",
233235
with: "\(developerDir)/Toolchains/XcodeDefault.xctoolchain"
234236
)
235237
}
236238
return arg
237239
}
238-
try "\(developerDir)/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc \(processedArgs.joined(separator: " "))".appendLineToURL(fileURL: URL(fileURLWithPath: NSHomeDirectory()).appendingPathComponent("rulesxcodeproj_ld.log"))
239240
try exit(runSubProcess(
240241
executable: """
241242
\(developerDir)/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc

xcodeproj/internal/bazel_integration_files/copy_outputs.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,11 @@ if [[ "$ACTION" != indexbuild ]]; then
2626
cd "${BAZEL_OUTPUTS_PRODUCT%/*}"
2727

2828
# Symlink .o files from BAZEL_PACKAGE_BIN_DIR to OBJECT_FILE_DIR_normal/arm64
29-
find "$PWD" -name '*.o' -exec sh -c '
29+
find "$PWD/${PRODUCT_NAME}_objs" -name '*.o' -exec sh -c '
3030
TARGET_FILE="$OBJECT_FILE_DIR_normal/arm64/$(basename "$1" | sed "s/\.swift//")"
3131
rm -f $TARGET_FILE
3232
cp "$1" $TARGET_FILE
33+
chmod 644 $TARGET_FILE
3334
' _ {} \;
3435

3536
if [[ -f "$BAZEL_OUTPUTS_PRODUCT_BASENAME" ]]; then

xcodeproj/internal/templates/xcodeproj.bazelrc

+4
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ common:rules_xcodeproj_indexbuild --bes_backend= --bes_results_url=
9393

9494
common:rules_xcodeproj_swiftuipreviews --config=rules_xcodeproj
9595

96+
# This is required for Previews to dynamically substitute Swift UI view bodies.
97+
# https://github.com/swiftlang/swift-build/blob/25648e8e5cc5e4f7f91aba666007ff9a00d6bd31/Sources/SwiftBuild/SWBPreviewSupport.swift#L77
98+
common:rules_xcodeproj --features=swift.experimental.OpaqueTypeErasure
99+
96100
# Allow frameworks to find framework dependencies when running a preview
97101
# See `$PROJECT_FILE_PATH/rules_xcodeproj/bazel/copy_outputs.sh` for more info
98102
common:rules_xcodeproj_swiftuipreviews --linkopt="-Wl,-rpath,@loader_path/SwiftUIPreviewsFrameworks"

xcodeproj/internal/xcodeproj_incremental_rule.bzl

+3-1
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,9 @@ Are you using an `alias`? `xcodeproj.focused_targets` and \
778778
DefaultInfo(
779779
executable = installer,
780780
files = depset(
781-
transitive = [inputs.important_generated],
781+
transitive = [inputs.important_generated] + [
782+
ctx.attr._rulesxcodeproj_toolchain.files
783+
],
782784
),
783785
runfiles = ctx.runfiles(files = runfiles),
784786
),

0 commit comments

Comments
 (0)