Skip to content

Commit 4e914cb

Browse files
authored
Merge branch 'main' into automerge/merge-main-2025-06-23_09-03
2 parents 17b53a4 + 972a844 commit 4e914cb

File tree

118 files changed

+3116
-918
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+3116
-918
lines changed

.github/workflows/automerge.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ jobs:
1010
name: Create PR to merge main into release branch
1111
uses: swiftlang/github-workflows/.github/workflows/create_automerge_pr.yml@main
1212
with:
13-
base_branch: release/6.2
13+
head_branch: release/6.2
14+
base_branch: main
1415
permissions:
1516
contents: write
1617
pull-requests: write

.licenseignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55
**/Package.swift
66
.dir-locals.el
77
.editorconfig
8+
.swift-version
89
CODEOWNERS
910
Package.swift

.swift-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
6.1.0

Package.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ let package = Package(
110110
"SWBBuildSystem",
111111
"SWBServiceCore",
112112
"SWBTaskExecution",
113-
.product(name: "SystemPackage", package: "swift-system", condition: .when(platforms: [.linux, .android, .windows])),
113+
.product(name: "SystemPackage", package: "swift-system", condition: .when(platforms: [.linux, .openbsd, .android, .windows, .custom("freebsd")])),
114114
],
115115
exclude: ["CMakeLists.txt"],
116116
swiftSettings: swiftSettings(languageMode: .v5)),
@@ -201,7 +201,7 @@ let package = Package(
201201
"SWBCSupport",
202202
"SWBLibc",
203203
.product(name: "ArgumentParser", package: "swift-argument-parser"),
204-
.product(name: "SystemPackage", package: "swift-system", condition: .when(platforms: [.linux, .android, .windows])),
204+
.product(name: "SystemPackage", package: "swift-system", condition: .when(platforms: [.linux, .openbsd, .android, .windows, .custom("freebsd")])),
205205
],
206206
exclude: ["CMakeLists.txt"],
207207
swiftSettings: swiftSettings(languageMode: .v5)),
@@ -369,7 +369,7 @@ let package = Package(
369369
// Perf tests
370370
.testTarget(
371371
name: "SWBBuildSystemPerfTests",
372-
dependencies: ["SWBBuildSystem", "SWBTestSupport"],
372+
dependencies: ["SWBBuildSystem", "SWBTestSupport", "SwiftBuildTestSupport"],
373373
swiftSettings: swiftSettings(languageMode: .v6)),
374374
.testTarget(
375375
name: "SWBCASPerfTests",
@@ -455,11 +455,11 @@ if useLocalDependencies {
455455
}
456456
} else {
457457
package.dependencies += [
458-
.package(url: "https://github.com/swiftlang/swift-driver.git", branch: "release/6.2"),
458+
.package(url: "https://github.com/swiftlang/swift-driver.git", branch: "main"),
459459
.package(url: "https://github.com/apple/swift-system.git", .upToNextMajor(from: "1.5.0")),
460460
.package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.0.3"),
461461
]
462462
if !useLLBuildFramework {
463-
package.dependencies += [.package(url: "https://github.com/swiftlang/swift-llbuild.git", branch: "release/6.2"),]
463+
package.dependencies += [.package(url: "https://github.com/swiftlang/swift-llbuild.git", branch: "main"),]
464464
}
465465
}

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ When building SwiftPM from sources which include Swift Build integration, passin
1212

1313
### With Xcode
1414

15-
Changes to swift-build can also be tested in Xcode using the `launch-xcode` command plugin provided by the package. Run `swift package --disable-sandbox launch-xcode` from your checkout of swift-build to launch a copy of the currently `xcode-select`ed Xcode.app configured to use your modified copy of the build system service. This workflow is currently supported when using Xcode 16.2.
15+
Changes to swift-build can also be tested in Xcode using the `launch-xcode` command plugin provided by the package. Run `swift package --disable-sandbox launch-xcode` from your checkout of swift-build to launch a copy of the currently `xcode-select`ed Xcode.app configured to use your modified copy of the build system service. This workflow is generally only supported when using the latest available Xcode version.
1616

1717
### With xcodebuild
1818

19-
Changes to swift-build can also be tested in xcodebuild using the `run-xcodebuild` command plugin provided by the package. Run `swift package --disable-sandbox run-xcodebuild` from your checkout of swift-build to run xcodebuild from the currently `xcode-select`ed Xcode.app configured to use your modified copy of the build system service. Arguments followed by `--` will be forwarded to xcodebuild unmodified. This workflow is currently supported when using Xcode 16.2.
19+
Changes to swift-build can also be tested in xcodebuild using the `run-xcodebuild` command plugin provided by the package. Run `swift package --disable-sandbox run-xcodebuild` from your checkout of swift-build to run xcodebuild from the currently `xcode-select`ed Xcode.app configured to use your modified copy of the build system service. Arguments followed by `--` will be forwarded to xcodebuild unmodified. This workflow is generally only supported when using the latest available Xcode version.
2020

2121
### Debugging
2222

Sources/SWBApplePlatform/Specs/DarwinProductTypes.xcspec

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,4 +461,17 @@
461461
);
462462
Platforms = (driverkit);
463463
},
464+
{
465+
_Domain = darwin;
466+
Type = ProductType;
467+
Identifier = com.apple.product-type.tool.swiftpm-test-runner;
468+
Name = "SwiftPM Unit Test Runner";
469+
Description = "SwiftPM Unit Test Runner";
470+
DefaultBuildProperties = {
471+
__SKIP_BUILD = YES;
472+
};
473+
PackageTypes = (
474+
com.apple.package-type.mach-o-executable
475+
);
476+
},
464477
)

Sources/SWBBuildSystem/BuildOperation.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2304,9 +2304,9 @@ internal final class OperationSystemAdaptor: SWBLLBuild.BuildSystemDelegate, Act
23042304
private func inputNounPhraseForBuildKey(_ inputKey: BuildKey) -> String {
23052305
switch inputKey {
23062306
case is BuildKey.Command, is BuildKey.CustomTask:
2307-
return "the producer"
2307+
return "the task producing"
23082308
case is BuildKey.DirectoryContents, is BuildKey.FilteredDirectoryContents, is BuildKey.DirectoryTreeSignature, is BuildKey.Node:
2309-
return "an input"
2309+
return "an input of"
23102310
case is BuildKey.Target, is BuildKey.Stat:
23112311
return "<unexpected build key>"
23122312
default:
@@ -2343,15 +2343,15 @@ internal final class OperationSystemAdaptor: SWBLLBuild.BuildSystemDelegate, Act
23432343
previousFrameID = nil
23442344
case .signatureChanged:
23452345
category = .ruleSignatureChanged
2346-
description = "signature of \(descriptionForBuildKey(rule)) changed"
2346+
description = "arguments, environment, or working directory of \(descriptionForBuildKey(rule)) changed"
23472347
previousFrameID = nil
23482348
case .invalidValue:
23492349
category = .ruleHadInvalidValue
23502350
previousFrameID = nil
23512351
if let command = rule as? BuildKey.Command, let task = lookupTask(TaskIdentifier(rawValue: command.name)), task.alwaysExecuteTask {
2352-
description = "\(descriptionForBuildKey(rule)) is configured to run in every incremental build"
2352+
description = "\(descriptionForBuildKey(rule)) was configured to run in every incremental build"
23532353
} else if rule is BuildKey.Command || rule is BuildKey.CustomTask {
2354-
description = "\(descriptionForBuildKey(rule)) did not have up-to-date outputs"
2354+
description = "outputs of \(descriptionForBuildKey(rule)) were missing or modified"
23552355
} else {
23562356
description = "\(descriptionForBuildKey(rule)) changed"
23572357
}
@@ -2361,7 +2361,7 @@ internal final class OperationSystemAdaptor: SWBLLBuild.BuildSystemDelegate, Act
23612361
if isTriggerNode(rule), let mutatedNodeDescription = descriptionOfInputMutatedByBuildKey(inputRule) {
23622362
description = "\(descriptionForBuildKey(inputRule)) mutated \(mutatedNodeDescription)"
23632363
} else {
2364-
description = "\(inputNounPhraseForBuildKey(inputRule)) of \(descriptionForBuildKey(rule)) \(rebuiltVerbPhraseForBuildKey(inputRule))"
2364+
description = "\(inputNounPhraseForBuildKey(inputRule)) \(descriptionForBuildKey(rule)) \(rebuiltVerbPhraseForBuildKey(inputRule))"
23652365
}
23662366
previousFrameID = previousFrameIdentifier
23672367
} else {
@@ -2370,7 +2370,7 @@ internal final class OperationSystemAdaptor: SWBLLBuild.BuildSystemDelegate, Act
23702370
}
23712371
case .forced:
23722372
category = .ruleForced
2373-
description = "\(descriptionForBuildKey(rule)) was forced to run"
2373+
description = "\(descriptionForBuildKey(rule)) was forced to run to break a cycle in the build graph"
23742374
previousFrameID = nil
23752375
@unknown default:
23762376
category = .none

Sources/SWBBuildSystem/DependencyCycleFormatter.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ struct DependencyCycleFormatter {
379379
message = "Target '\(previousTargetName)' has an explicit dependency on Target '\(targetName)'"
380380
case let .implicitBuildPhaseLinkage(filename, _, buildPhase)?:
381381
message = "Target '\(previousTargetName)' has an implicit dependency on Target '\(targetName)' because '\(previousTargetName)' references the file '\(filename)' in the build phase '\(buildPhase)'"
382-
case let .implicitBuildSettingLinkage(settingName, options)?:
382+
case let .implicitBuildSetting(settingName, options)?:
383383
message = "Target '\(previousTargetName)' has an implicit dependency on Target '\(targetName)' because '\(previousTargetName)' defines the option '\(options.joined(separator: " "))' in the build setting '\(settingName)'"
384384
case let .impliedByTransitiveDependencyViaRemovedTargets(intermediateTargetName: intermediateTargetName):
385385
message = "Target '\(previousTargetName)' has a dependency on Target '\(targetName)' via its transitive dependency through '\(intermediateTargetName)'"
@@ -501,7 +501,7 @@ struct DependencyCycleFormatter {
501501
suffix = " via the “Target Dependencies“ build phase"
502502
case let .implicitBuildPhaseLinkage(filename, _, buildPhase)?:
503503
suffix = " because the scheme has implicit dependencies enabled and the Target '\(lastTargetsName)' references the file '\(filename)' in the build phase '\(buildPhase)'"
504-
case let .implicitBuildSettingLinkage(settingName, options)?:
504+
case let .implicitBuildSetting(settingName, options)?:
505505
suffix = " because the scheme has implicit dependencies enabled and the Target '\(lastTargetsName)' defines the options '\(options.joined(separator: " "))' in the build setting '\(settingName)'"
506506
case let .impliedByTransitiveDependencyViaRemovedTargets(intermediateTargetName: intermediateTargetName):
507507
suffix = " via its transitive dependency through '\(intermediateTargetName)'"

Sources/SWBCSupport/IndexStore.h

Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// This source file is part of the Swift open source project
4+
//
5+
// Copyright (c) 2025 Apple Inc. and the Swift project authors
6+
// Licensed under Apache License v2.0 with Runtime Library Exception
7+
//
8+
// See http://swift.org/LICENSE.txt for license information
9+
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+
//
11+
//===----------------------------------------------------------------------===//
12+
13+
#ifndef INDEXSTORE_H
14+
#define INDEXSTORE_H
15+
16+
#include <stdbool.h>
17+
#include <stddef.h>
18+
#include <stdint.h>
19+
#include <time.h>
20+
21+
typedef void *indexstore_error_t;
22+
23+
typedef struct {
24+
const char *data;
25+
size_t length;
26+
} indexstore_string_ref_t;
27+
28+
typedef void *indexstore_t;
29+
typedef void *indexstore_symbol_t;
30+
31+
typedef enum {
32+
INDEXSTORE_SYMBOL_KIND_UNKNOWN = 0,
33+
INDEXSTORE_SYMBOL_KIND_MODULE = 1,
34+
INDEXSTORE_SYMBOL_KIND_NAMESPACE = 2,
35+
INDEXSTORE_SYMBOL_KIND_NAMESPACEALIAS = 3,
36+
INDEXSTORE_SYMBOL_KIND_MACRO = 4,
37+
INDEXSTORE_SYMBOL_KIND_ENUM = 5,
38+
INDEXSTORE_SYMBOL_KIND_STRUCT = 6,
39+
INDEXSTORE_SYMBOL_KIND_CLASS = 7,
40+
INDEXSTORE_SYMBOL_KIND_PROTOCOL = 8,
41+
INDEXSTORE_SYMBOL_KIND_EXTENSION = 9,
42+
INDEXSTORE_SYMBOL_KIND_UNION = 10,
43+
INDEXSTORE_SYMBOL_KIND_TYPEALIAS = 11,
44+
INDEXSTORE_SYMBOL_KIND_FUNCTION = 12,
45+
INDEXSTORE_SYMBOL_KIND_VARIABLE = 13,
46+
INDEXSTORE_SYMBOL_KIND_FIELD = 14,
47+
INDEXSTORE_SYMBOL_KIND_ENUMCONSTANT = 15,
48+
INDEXSTORE_SYMBOL_KIND_INSTANCEMETHOD = 16,
49+
INDEXSTORE_SYMBOL_KIND_CLASSMETHOD = 17,
50+
INDEXSTORE_SYMBOL_KIND_STATICMETHOD = 18,
51+
INDEXSTORE_SYMBOL_KIND_INSTANCEPROPERTY = 19,
52+
INDEXSTORE_SYMBOL_KIND_CLASSPROPERTY = 20,
53+
INDEXSTORE_SYMBOL_KIND_STATICPROPERTY = 21,
54+
INDEXSTORE_SYMBOL_KIND_CONSTRUCTOR = 22,
55+
INDEXSTORE_SYMBOL_KIND_DESTRUCTOR = 23,
56+
INDEXSTORE_SYMBOL_KIND_CONVERSIONFUNCTION = 24,
57+
INDEXSTORE_SYMBOL_KIND_PARAMETER = 25,
58+
INDEXSTORE_SYMBOL_KIND_USING = 26,
59+
60+
INDEXSTORE_SYMBOL_KIND_COMMENTTAG = 1000,
61+
} indexstore_symbol_kind_t;
62+
63+
typedef enum {
64+
INDEXSTORE_SYMBOL_PROPERTY_GENERIC = 1 << 0,
65+
INDEXSTORE_SYMBOL_PROPERTY_TEMPLATE_PARTIAL_SPECIALIZATION = 1 << 1,
66+
INDEXSTORE_SYMBOL_PROPERTY_TEMPLATE_SPECIALIZATION = 1 << 2,
67+
INDEXSTORE_SYMBOL_PROPERTY_UNITTEST = 1 << 3,
68+
INDEXSTORE_SYMBOL_PROPERTY_IBANNOTATED = 1 << 4,
69+
INDEXSTORE_SYMBOL_PROPERTY_IBOUTLETCOLLECTION = 1 << 5,
70+
INDEXSTORE_SYMBOL_PROPERTY_GKINSPECTABLE = 1 << 6,
71+
INDEXSTORE_SYMBOL_PROPERTY_LOCAL = 1 << 7,
72+
INDEXSTORE_SYMBOL_PROPERTY_PROTOCOL_INTERFACE = 1 << 8,
73+
INDEXSTORE_SYMBOL_PROPERTY_SWIFT_ASYNC = 1 << 16,
74+
} indexstore_symbol_property_t;
75+
76+
typedef enum {
77+
INDEXSTORE_SYMBOL_ROLE_DECLARATION = 1 << 0,
78+
INDEXSTORE_SYMBOL_ROLE_DEFINITION = 1 << 1,
79+
INDEXSTORE_SYMBOL_ROLE_REFERENCE = 1 << 2,
80+
INDEXSTORE_SYMBOL_ROLE_READ = 1 << 3,
81+
INDEXSTORE_SYMBOL_ROLE_WRITE = 1 << 4,
82+
INDEXSTORE_SYMBOL_ROLE_CALL = 1 << 5,
83+
INDEXSTORE_SYMBOL_ROLE_DYNAMIC = 1 << 6,
84+
INDEXSTORE_SYMBOL_ROLE_ADDRESSOF = 1 << 7,
85+
INDEXSTORE_SYMBOL_ROLE_IMPLICIT = 1 << 8,
86+
INDEXSTORE_SYMBOL_ROLE_UNDEFINITION = 1 << 19,
87+
88+
// Relation roles.
89+
INDEXSTORE_SYMBOL_ROLE_REL_CHILDOF = 1 << 9,
90+
INDEXSTORE_SYMBOL_ROLE_REL_BASEOF = 1 << 10,
91+
INDEXSTORE_SYMBOL_ROLE_REL_OVERRIDEOF = 1 << 11,
92+
INDEXSTORE_SYMBOL_ROLE_REL_RECEIVEDBY = 1 << 12,
93+
INDEXSTORE_SYMBOL_ROLE_REL_CALLEDBY = 1 << 13,
94+
INDEXSTORE_SYMBOL_ROLE_REL_EXTENDEDBY = 1 << 14,
95+
INDEXSTORE_SYMBOL_ROLE_REL_ACCESSOROF = 1 << 15,
96+
INDEXSTORE_SYMBOL_ROLE_REL_CONTAINEDBY = 1 << 16,
97+
INDEXSTORE_SYMBOL_ROLE_REL_IBTYPEOF = 1 << 17,
98+
INDEXSTORE_SYMBOL_ROLE_REL_SPECIALIZATIONOF = 1 << 18,
99+
} indexstore_symbol_role_t;
100+
101+
typedef void *indexstore_unit_dependency_t;
102+
103+
typedef enum {
104+
INDEXSTORE_UNIT_DEPENDENCY_UNIT = 1,
105+
INDEXSTORE_UNIT_DEPENDENCY_RECORD = 2,
106+
INDEXSTORE_UNIT_DEPENDENCY_FILE = 3,
107+
} indexstore_unit_dependency_kind_t;
108+
109+
typedef void *indexstore_symbol_relation_t;
110+
typedef void *indexstore_occurrence_t;
111+
typedef void *indexstore_record_reader_t;
112+
typedef void *indexstore_unit_reader_t;
113+
114+
typedef struct {
115+
const char *
116+
(*error_get_description)(indexstore_error_t);
117+
118+
void
119+
(*error_dispose)(indexstore_error_t);
120+
121+
indexstore_t
122+
(*store_create)(const char *store_path, indexstore_error_t *error);
123+
124+
void
125+
(*store_dispose)(indexstore_t);
126+
127+
size_t
128+
(*store_get_unit_name_from_output_path)(indexstore_t store,
129+
const char *output_path,
130+
char *name_buf,
131+
size_t buf_size);
132+
133+
indexstore_symbol_kind_t
134+
(*symbol_get_kind)(indexstore_symbol_t);
135+
136+
uint64_t
137+
(*symbol_get_properties)(indexstore_symbol_t);
138+
139+
indexstore_string_ref_t
140+
(*symbol_get_name)(indexstore_symbol_t);
141+
142+
uint64_t
143+
(*symbol_relation_get_roles)(indexstore_symbol_relation_t);
144+
145+
indexstore_symbol_t
146+
(*symbol_relation_get_symbol)(indexstore_symbol_relation_t);
147+
148+
indexstore_symbol_t
149+
(*occurrence_get_symbol)(indexstore_occurrence_t);
150+
151+
bool
152+
(*occurrence_relations_apply_f)(indexstore_occurrence_t,
153+
void *context,
154+
bool(*applier)(void *context, indexstore_symbol_relation_t symbol_rel));
155+
156+
indexstore_record_reader_t
157+
(*record_reader_create)(indexstore_t store, const char *record_name,
158+
indexstore_error_t *error);
159+
160+
void
161+
(*record_reader_dispose)(indexstore_record_reader_t);
162+
163+
bool
164+
(*record_reader_occurrences_apply_f)(indexstore_record_reader_t,
165+
void *context,
166+
bool(*applier)(void *context, indexstore_occurrence_t occur));
167+
168+
indexstore_unit_reader_t
169+
(*unit_reader_create)(indexstore_t store, const char *unit_name,
170+
indexstore_error_t *error);
171+
172+
void
173+
(*unit_reader_dispose)(indexstore_unit_reader_t);
174+
175+
indexstore_string_ref_t
176+
(*unit_reader_get_module_name)(indexstore_unit_reader_t);
177+
178+
indexstore_unit_dependency_kind_t
179+
(*unit_dependency_get_kind)(indexstore_unit_dependency_t);
180+
181+
indexstore_string_ref_t
182+
(*unit_dependency_get_name)(indexstore_unit_dependency_t);
183+
184+
bool
185+
(*unit_reader_dependencies_apply_f)(indexstore_unit_reader_t,
186+
void *context,
187+
bool(*applier)(void *context, indexstore_unit_dependency_t));
188+
} swiftbuild_indexstore_functions_t;
189+
190+
#endif

Sources/SWBCSupport/SWBCSupport.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
#include "CLibclang.h"
2323
#include "CLibRemarksHelper.h"
24+
#include "IndexStore.h"
2425
#include "PluginAPI.h"
2526
#include "PluginAPI_functions.h"
2627
#include "PluginAPI_types.h"

Sources/SWBCore/Core.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,12 @@ public final class Core: Sendable {
245245
// If the ProductBuildVersion key is missing, we use "UNKNOWN" as the value.
246246
self.xcodeProductBuildVersion = info.productBuildVersion ?? ProductBuildVersion(major: 0, train: "A", build: 0, buildSuffix: "")
247247
self.xcodeProductBuildVersionString = info.productBuildVersion?.description ?? "UNKNOWN"
248+
249+
// Enforce a minimum Xcode version for Open Source testing workflows
250+
let minimumXcodeVersion = Version(16, 2)
251+
if xcodeVersion < minimumXcodeVersion {
252+
throw StubError.error("This build of Swift Build requires a minimum Xcode version of \(minimumXcodeVersion.description) (current version: \(xcodeVersion.zeroTrimmed.description)).")
253+
}
248254
} else {
249255
// Set an arbitrary version for testing purposes.
250256
self.xcodeVersion = Version(99, 99, 99)

Sources/SWBCore/Extensions/FeatureAvailabilityExtension.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,4 @@ public struct FeatureAvailabilityExtensionPoint: ExtensionPoint {
2121
}
2222

2323
public protocol FeatureAvailabilityExtension: Sendable {
24-
var supportsCompilationCaching: Bool { get }
2524
}

0 commit comments

Comments
 (0)