Skip to content

Commit b579b6c

Browse files
authored
Support index-import on all Xcode 16.x versions (#3162)
Similar to: bazelbuild/rules_swift#1504 Part of #3160 This PR updates the index-import dependency to include both version 5.8 and 6.1 as the hash algorithm changed in Swift 6.1. To make this change backwards compatible we switch to the 5.8 version on Xcode 16.2 and under. Signed-off-by: Luis Padron <heyluispadron@gmail.com>
1 parent 601661d commit b579b6c

29 files changed

Lines changed: 145 additions & 30 deletions

MODULE.bazel

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ bazel_dep(name = "bazel_features", version = "1.3.0")
1010
bazel_dep(name = "bazel_skylib", version = "1.3.0")
1111
bazel_dep(
1212
name = "rules_swift",
13-
version = "1.18.0",
13+
version = "2.8.0",
1414
max_compatibility_level = 2,
1515
repo_name = "build_bazel_rules_swift",
1616
)
@@ -28,6 +28,7 @@ non_module_deps = use_extension("//xcodeproj:extensions.bzl", "non_module_deps")
2828
use_repo(
2929
non_module_deps,
3030
"rules_xcodeproj_index_import",
31+
"rules_xcodeproj_legacy_index_import",
3132
)
3233

3334
# Non-release dependencies
@@ -55,12 +56,6 @@ bazel_dep(
5556
repo_name = "io_bazel_stardoc",
5657
)
5758

58-
# Use newer versions of deps in development
59-
single_version_override(
60-
module_name = "rules_swift",
61-
version = "2.3.0",
62-
)
63-
6459
# Some of our deps are forcing a new stardoc on us, so pinning for now
6560
single_version_override(
6661
module_name = "stardoc",

examples/integration/test/fixtures/bwb.xcodeproj/project.pbxproj

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/integration/test/fixtures/bwb_project_spec.json

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/rules_ios/MODULE.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ bazel_dep(
2020
)
2121
bazel_dep(
2222
name = "rules_ios",
23-
version = "5.5.1",
23+
version = "5.6.0",
2424
repo_name = "build_bazel_rules_ios",
2525
)
2626

examples/rules_ios/WORKSPACE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
22

33
http_archive(
44
name = "build_bazel_rules_ios",
5-
sha256 = "c417b69639a737eb44e2af13309f1b00950d6d0c48f67c64ee36d3ea750f687e",
6-
url = "https://github.com/bazel-ios/rules_ios/releases/download/4.6.0/rules_ios.4.6.0.tar.gz",
5+
sha256 = "e0dbd18f1d7a48a4b98e97dbdc45dfc7f0b1cf902afe86c442614db17f560611",
6+
url = "https://github.com/bazel-ios/rules_ios/releases/download/5.6.0/rules_ios.5.6.0.tar.gz",
77
)
88

99
load(

examples/rules_ios/test/fixtures/bwb.xcodeproj/project.pbxproj

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/rules_ios/test/fixtures/bwb_project_spec.json

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/internal/pbxproj_partials/write_pbxproj_prefix_tests.bzl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ def _write_pbxproj_prefix_test_impl(ctx):
5555
),
5656
index_import = ctx.attr.index_import,
5757
install_path = "a/project.xcodeproj",
58+
legacy_index_import = ctx.attr.legacy_index_import,
5859
minimum_xcode_version = ctx.attr.minimum_xcode_version,
5960
platforms = ctx.attr.platforms,
6061
post_build_script = ctx.attr.post_build_script,
@@ -145,6 +146,7 @@ write_pbxproj_prefix_test = unittest.make(
145146
"execution_root_file": attr.string(mandatory = True),
146147
"import_index_build_indexstores": attr.bool(mandatory = True),
147148
"index_import": attr.string(mandatory = True),
149+
"legacy_index_import": attr.string(mandatory = True),
148150
"minimum_xcode_version": attr.string(mandatory = True),
149151
"platforms": attr.string_list(mandatory = True),
150152
"post_build_script": attr.string(),
@@ -181,6 +183,7 @@ def write_pbxproj_prefix_test_suite(name):
181183
execution_root_file,
182184
import_index_build_indexstores,
183185
index_import,
186+
legacy_index_import,
184187
minimum_xcode_version,
185188
platforms,
186189
post_build_script = None,
@@ -205,6 +208,7 @@ def write_pbxproj_prefix_test_suite(name):
205208
execution_root_file = execution_root_file,
206209
import_index_build_indexstores = import_index_build_indexstores,
207210
index_import = index_import,
211+
legacy_index_import = legacy_index_import,
208212
minimum_xcode_version = minimum_xcode_version,
209213
platforms = platforms,
210214
post_build_script = post_build_script,
@@ -234,6 +238,7 @@ def write_pbxproj_prefix_test_suite(name):
234238
execution_root_file = "an/execution/root/file",
235239
import_index_build_indexstores = True,
236240
index_import = "some/path/to/index_import",
241+
legacy_index_import = "some/path/to/legacy/index_import",
237242
minimum_xcode_version = "14.2.1",
238243
platforms = [
239244
"MACOS",
@@ -262,6 +267,8 @@ def write_pbxproj_prefix_test_suite(name):
262267
"an/execution/root/file",
263268
# targetIdsFile
264269
"a/path/to/target_ids_list",
270+
# legacyIndexImport
271+
"some/path/to/legacy/index_import",
265272
# indexImport
266273
"some/path/to/index_import",
267274
# resolvedRepositoriesFile
@@ -297,6 +304,7 @@ def write_pbxproj_prefix_test_suite(name):
297304
execution_root_file = "an/execution/root/file",
298305
import_index_build_indexstores = False,
299306
index_import = "some/path/to/index_import",
307+
legacy_index_import = "some/path/to/legacy/index_import",
300308
platforms = [
301309
"MACOS",
302310
"IOS_DEVICE",
@@ -328,6 +336,8 @@ def write_pbxproj_prefix_test_suite(name):
328336
"an/execution/root/file",
329337
# targetIdsFile
330338
"a/path/to/target_ids_list",
339+
# legacyIndexImport
340+
"some/path/to/legacy/index_import",
331341
# indexImport
332342
"some/path/to/index_import",
333343
# resolvedRepositoriesFile

tools/BUILD

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@ _XCSCHEMES = [
175175
"bazel-output-base/rules_xcodeproj.noindex/build_output_base/execroot/_main/bazel-out/darwin_arm64-dbg/bin/external/_main~internal~rules_xcodeproj_generated/generator/tools/xcodeproj/xcodeproj_execution_root_file",
176176
# targetIdsFile
177177
"bazel-out/darwin_arm64-dbg/bin/external/_main~internal~rules_xcodeproj_generated/generator/tools/xcodeproj/xcodeproj_target_ids",
178+
# legacyIndexImport
179+
"bazel-out/darwin_arm64-opt-exec-2B5CBBC6/bin/external/_main~non_module_deps~rules_xcodeproj_legacy_index_import/index-import",
178180
# indexImport
179181
"bazel-out/darwin_arm64-opt-exec-2B5CBBC6/bin/external/_main~non_module_deps~rules_xcodeproj_index_import/index-import",
180182
# resolvedRepositoriesFile

tools/generators/legacy/src/DTO/Project.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ struct Project: Equatable {
3939
var customXcodeSchemes: [XcodeScheme] = []
4040
let targetIdsFile: String
4141
let targetNameMode: TargetNameMode
42+
let legacyIndexImport: String
4243
let indexImport: String
4344
let preBuildScript: String?
4445
let postBuildScript: String?
@@ -61,7 +62,8 @@ extension Project: Decodable {
6162
case schemeAutogenerationMode = "s"
6263
case targetIdsFile = "T"
6364
case targetNameMode = "N"
64-
case indexImport = "i"
65+
case legacyIndexImport = "i"
66+
case indexImport = "j"
6567
case preBuildScript = "p"
6668
case postBuildScript = "P"
6769
}
@@ -107,6 +109,8 @@ extension Project: Decodable {
107109
TargetNameMode.self,
108110
forKey: .targetNameMode
109111
) ?? .auto
112+
legacyIndexImport = try container
113+
.decode(String.self, forKey: .legacyIndexImport)
110114
indexImport = try container
111115
.decode(String.self, forKey: .indexImport)
112116
preBuildScript = try container

0 commit comments

Comments
 (0)