├── .dir-locals.el ├── .editorconfig ├── .gitattributes ├── .github ├── PULL_REQUEST_TEMPLATE.md └── workflows │ ├── automerge.yml │ └── pull_request.yml ├── .gitignore ├── .license_header_template ├── .licenseignore ├── .swift-format ├── .swift-version ├── CMakeLists.txt ├── CODEOWNERS ├── LICENSE.txt ├── Package.swift ├── Plugins ├── cmake-smoke-test │ └── cmake-smoke-test.swift ├── generate-windows-installer-component-groups │ └── generate-windows-installer-component-groups.swift ├── launch-xcode │ └── launch-xcode.swift └── run-xcodebuild │ └── run-xcodebuild.swift ├── README.md ├── Sources ├── CMakeLists.txt ├── SWBAndroidPlatform │ ├── AndroidSDK.swift │ ├── CMakeLists.txt │ ├── Plugin.swift │ └── Specs │ │ └── Android.xcspec ├── SWBAndroidPlatformPlugin │ └── PluginMain.swift ├── SWBApplePlatform │ ├── ActoolInputFileGroupingStrategy.swift │ ├── AppIntentsMetadataCompiler.swift │ ├── AppIntentsMetadataTaskProducer.swift │ ├── AppIntentsSSUTrainingCompiler.swift │ ├── AssetCatalogCompiler.swift │ ├── AssetCatalogCompilerOutputParser.swift │ ├── CMakeLists.txt │ ├── CopyTiffFile.swift │ ├── CoreDataCompiler.swift │ ├── CoreMLCompiler.swift │ ├── DevelopmentAssetsTaskProducer.swift │ ├── DittoTool.swift │ ├── ExtensionPointsCompiler.swift │ ├── IIGCompiler.swift │ ├── ImageScaleFactorsInputFileGroupingStrategy.swift │ ├── InstrumentsPackageBuilderSpec.swift │ ├── IntentsCompiler.swift │ ├── InterfaceBuilderCompiler.swift │ ├── InterfaceBuilderCompilerOutputParser.swift │ ├── InterfaceBuilderShared.swift │ ├── LocalizationInputFileGroupingStrategy.swift │ ├── MacCatalystInfoExtension.swift │ ├── MetalCompiler.swift │ ├── MiGCompiler.swift │ ├── OpenCLCompiler.swift │ ├── Plugin.swift │ ├── RealityAssetsCompilerSpec.swift │ ├── RealityAssetsTaskProducer.swift │ ├── ReferenceObjectCompiler.swift │ ├── ResMergerLinkerSpec.swift │ ├── SceneKitToolSpec.swift │ ├── Specs │ │ ├── AppIntentsMetadata.xcspec │ │ ├── AppIntentsNLTraining.xcspec │ │ ├── AppShortcutStringsMetadata.xcspec │ │ ├── AssetCatalogCompiler.xcspec │ │ ├── CompileSkybox.xcspec │ │ ├── CopyPNGFile.xcspec │ │ ├── CopyTiffFile.xcspec │ │ ├── CoreData.xcspec │ │ ├── CoreML.xcspec │ │ ├── DTrace.xcspec │ │ ├── DarwinPackageTypes.xcspec │ │ ├── DarwinProductTypes.xcspec │ │ ├── DriverKit.xcspec │ │ ├── Embedded-Device.xcspec │ │ ├── Embedded-Shared.xcspec │ │ ├── Embedded-Simulator.xcspec │ │ ├── EmbeddedBinaryValidationUtility.xcspec │ │ ├── GenerateAppPlaygroundAssetCatalog.xcspec │ │ ├── GenerateTextureAtlas.xcspec │ │ ├── IBCompiler.xcspec │ │ ├── IBPostprocessor.xcspec │ │ ├── IBStoryboardCompiler.xcspec │ │ ├── IBStoryboardLinker.xcspec │ │ ├── IBStoryboardPostprocessor.xcspec │ │ ├── Iconutil.xcspec │ │ ├── Iig.xcspec │ │ ├── InfoPlistUtility.xcspec │ │ ├── InstrumentsPackage.xcspec │ │ ├── Intents.xcspec │ │ ├── InterfaceBuilderFileTypes.xcspec │ │ ├── KernelExtension.xcspec │ │ ├── LSRegisterURL.xcspec │ │ ├── Lipo.xcspec │ │ ├── MetalCompiler.xcspec │ │ ├── MetalFileTypes.xcspec │ │ ├── MetalLinker.xcspec │ │ ├── MetalPackageTypes.xcspec │ │ ├── MetalProductTypes.xcspec │ │ ├── MiG.xcspec │ │ ├── OSACompile.xcspec │ │ ├── OpenCL.xcspec │ │ ├── RCFileTypes.xcspec │ │ ├── RealityAssets.xcspec │ │ ├── ReferenceObject.xcspec │ │ ├── ResMerger.xcspec │ │ ├── Rez.xcspec │ │ ├── SceneKitFileTypes.xcspec │ │ ├── SceneKitTools.xcspec │ │ ├── SpriteKitFileTypes.xcspec │ │ ├── TiffUtil.xcspec │ │ ├── WatchKit1ProductTypes.xcspec │ │ ├── XCAppExtensionPoints.xcspec │ │ ├── XCStrings.xcspec │ │ ├── en.lproj │ │ │ ├── CopyTiffFile.strings │ │ │ ├── DTrace.strings │ │ │ ├── Iconutil.strings │ │ │ ├── InstrumentsPackage.strings │ │ │ ├── Interface Builder Storyboard Compiler.strings │ │ │ ├── Interface Builder Storyboard Postprocessor.strings │ │ │ ├── LSRegisterURL.strings │ │ │ ├── MiG.strings │ │ │ ├── OSACompile.strings │ │ │ ├── OpenCL.strings │ │ │ ├── ResMerger.strings │ │ │ ├── Rez.strings │ │ │ ├── TiffUtil.strings │ │ │ ├── com.apple.build-tasks.generate-texture-atlas.strings │ │ │ ├── com.apple.compilers.assetcatalog.strings │ │ │ ├── com.apple.compilers.metal-linker.strings │ │ │ ├── com.apple.compilers.metal.strings │ │ │ ├── com.apple.compilers.model.coredata.strings │ │ │ ├── com.apple.compilers.model.coredatamapping.strings │ │ │ ├── com.apple.compilers.model.mlkit.strings │ │ │ ├── com.apple.compilers.model.persistence.strings │ │ │ ├── com.apple.compilers.referenceobject.strings │ │ │ ├── com.apple.xcode.tools.ibtool.compiler.strings │ │ │ └── com.apple.xcode.tools.ibtool.postprocessor.strings │ │ ├── iOSDevice.xcspec │ │ ├── iOSShared.xcspec │ │ ├── iOSSimulator.xcspec │ │ ├── macOSArchitectures.xcspec │ │ ├── macOSCoreBuildSystem.xcspec │ │ ├── macOSNativeBuildSystem.xcspec │ │ ├── macOSPackageTypes.xcspec │ │ ├── macOSProductTypes.xcspec │ │ ├── tvOSDevice.xcspec │ │ ├── tvOSShared.xcspec │ │ ├── tvOSSimulator.xcspec │ │ ├── watchOSDevice.xcspec │ │ ├── watchOSShared.xcspec │ │ ├── watchOSSimulator.xcspec │ │ ├── xrOSDevice.xcspec │ │ ├── xrOSShared.xcspec │ │ └── xrOSSimulator.xcspec │ ├── StoryboardLinker.swift │ ├── StringCatalogCompilerOutputParser.swift │ ├── StubBinaryTaskProducer.swift │ ├── XCStringsCompiler.swift │ └── XCStringsInputFileGroupingStrategy.swift ├── SWBApplePlatformPlugin │ └── PluginMain.swift ├── SWBBuildService │ ├── BuildDependencyInfo.swift │ ├── BuildOperationMessages.swift │ ├── BuildService.swift │ ├── BuildServiceEntryPoint.swift │ ├── CMakeLists.txt │ ├── ClientExchangeDelegate.swift │ ├── DependencyGraphMessages.swift │ ├── DocumentationInfo.swift │ ├── LocalizationInfo.swift │ ├── Messages.swift │ ├── PlanningOperation.swift │ ├── PreviewInfo.swift │ ├── ProjectDescriptor.swift │ ├── Session.swift │ └── Tools.swift ├── SWBBuildServiceBundle │ ├── CMakeLists.txt │ └── main.swift ├── SWBBuildSystem │ ├── BuildManager.swift │ ├── BuildOperation.swift │ ├── BuildOperationExtension.swift │ ├── BuildSystemCache.swift │ ├── CMakeLists.txt │ ├── CleanOperation.swift │ ├── DependencyCycleFormatter.swift │ └── SandboxViolations.swift ├── SWBCAS │ ├── CASFSNode.swift │ ├── CASProtocol.swift │ ├── CMakeLists.txt │ ├── Errors.swift │ ├── ToolchainCASPlugin.swift │ └── plugin_api_t.swift ├── SWBCLibc │ ├── CMakeLists.txt │ ├── README.md │ ├── include │ │ ├── SWBCLibc.h │ │ └── module.modulemap │ └── libc.c ├── SWBCSupport │ ├── CLibRemarksHelper.c │ ├── CLibRemarksHelper.h │ ├── CLibclang.cpp │ ├── CLibclang.h │ ├── CMakeLists.txt │ ├── CSupportDefines.h │ ├── PluginAPI.h │ ├── PluginAPI_functions.h │ ├── PluginAPI_types.h │ ├── SWBCSupport.h │ ├── empty.swift │ └── module.modulemap ├── SWBCore │ ├── ActivityReporting.swift │ ├── Apple │ │ ├── DeviceFamily.swift │ │ └── InterfaceBuilderShared.swift │ ├── BuildFileFilteringContext.swift │ ├── BuildFileResolution.swift │ ├── BuildParameters.swift │ ├── BuildRequest.swift │ ├── BuildRequestContext.swift │ ├── BuildRuleAction.swift │ ├── BuildRuleCondition.swift │ ├── BuildRuleSet.swift │ ├── CMakeLists.txt │ ├── CapturedBuildInfo.swift │ ├── ClangModuleVerifier │ │ ├── ModuleVerifierFilenameMap.swift │ │ ├── ModuleVerifierFramework.swift │ │ ├── ModuleVerifierHeader.swift │ │ ├── ModuleVerifierLanguage.swift │ │ ├── ModuleVerifierModuleMap.swift │ │ ├── ModuleVerifierModuleMapFileVerifier.swift │ │ └── ModuleVerifierTarget.swift │ ├── ClangModuleVerifierOutputParser.swift │ ├── ClangSerializedDiagnostics.swift │ ├── CommandLineArgument.swift │ ├── ConfiguredTarget.swift │ ├── Core.swift │ ├── CustomTaskTypeDescription.swift │ ├── DependencyInfoEditPayload.swift │ ├── DependencyResolution.swift │ ├── DiagnosticSupport.swift │ ├── EnvironmentBindings.swift │ ├── ExecutableTask.swift │ ├── Extensions │ │ ├── DeveloperDirectoryExtension.swift │ │ ├── DiagnosticToolingExtension.swift │ │ ├── EnvironmentExtension.swift │ │ ├── FeatureAvailabilityExtension.swift │ │ ├── InputFileGroupingStrategyExtension.swift │ │ ├── PlatformInfoExtension.swift │ │ ├── SDKRegistryExtension.swift │ │ ├── SDKVariantInfoExtension.swift │ │ ├── SettingsBuilderExtension.swift │ │ ├── SpecificationsExtension.swift │ │ └── ToolchainRegistryExtension.swift │ ├── FileSystemSignatureBasedCache.swift │ ├── FileToBuild.swift │ ├── LibSwiftDriver │ │ ├── LibSwiftDriver.swift │ │ └── PlannedBuild.swift │ ├── LibclangVendored │ │ ├── ArrayExtensions.swift │ │ ├── CStringArray.swift │ │ └── Libclang.swift │ ├── LinkageDependencyResolver.swift │ ├── MacCatalystInfo.swift │ ├── MacroConfigFileLoader.swift │ ├── MacroEvaluationExtensions.swift │ ├── MacroExpressionSourceExtensions.swift │ ├── OnDemandResources.swift │ ├── OptimizationRemarks.swift │ ├── PlannedNode.swift │ ├── PlannedTask.swift │ ├── PlannedTaskAction.swift │ ├── PlatformEnvironment.swift │ ├── PlatformFiltering.swift │ ├── PlatformRegistry.swift │ ├── Process.swift │ ├── ProcessExecutionCache.swift │ ├── ProductTypeIdentifier.swift │ ├── ProjectModel │ │ ├── BuildConfiguration.swift │ │ ├── BuildFile.swift │ │ ├── BuildPhase.swift │ │ ├── BuildRule.swift │ │ ├── DependencyInfoFormat.swift │ │ ├── FilePathResolver.swift │ │ ├── FileTextEncoding.swift │ │ ├── ImpartedBuildProperties.swift │ │ ├── PIFLoader.swift │ │ ├── PlatformFilter.swift │ │ ├── Project.swift │ │ ├── ProjectModelItem.swift │ │ ├── Reference.swift │ │ ├── ReferenceLookupContext.swift │ │ ├── Target.swift │ │ ├── Workspace.swift │ │ └── WorkspaceHeaderIndex.swift │ ├── ProvisionalTask.swift │ ├── Provisioning.swift │ ├── ProvisioningTaskInputs.swift │ ├── SDKRegistry.swift │ ├── SWBFeatureFlag.swift │ ├── Settings │ │ ├── BuildRuleFile.swift │ │ ├── BuiltinMacros.swift │ │ ├── CASOptions.swift │ │ ├── RecursiveSearchPathResolver.swift │ │ ├── Settings.swift │ │ └── StackedSearchPaths.swift │ ├── ShellScript.swift │ ├── SigningSupport.swift │ ├── SpecImplementations │ │ ├── CommandLineToolSpec.swift │ │ ├── CompilerSpec.swift │ │ ├── FileTypes.swift │ │ ├── LinkerSpec.swift │ │ ├── ProductTypes.swift │ │ ├── PropertyDomainSpec.swift │ │ ├── RegisterSpecs.swift │ │ ├── SpecParser.swift │ │ ├── SpecRegistry.swift │ │ ├── Specs.swift │ │ └── Tools │ │ │ ├── AppShortcutStringsMetadataCompiler.swift │ │ │ ├── CCompiler.swift │ │ │ ├── ClangModuleVerifierInputGenerator.swift │ │ │ ├── ClangStatCache.swift │ │ │ ├── CodeSign.swift │ │ │ ├── ConcatenateTool.swift │ │ │ ├── ConstructStubExecutorFileListTool.swift │ │ │ ├── CopyTool.swift │ │ │ ├── CreateAssetPackManifestTool.swift │ │ │ ├── CreateBuildDirectory.swift │ │ │ ├── DocumentationCompiler.swift │ │ │ ├── DsymutilTool.swift │ │ │ ├── GCCCompatibleCompilerSupport.swift │ │ │ ├── Gate.swift │ │ │ ├── GenerateAppPlaygroundAssetCatalog.swift │ │ │ ├── InfoPlistTool.swift │ │ │ ├── LaunchServicesRegisterTool.swift │ │ │ ├── LinkerTools.swift │ │ │ ├── Lipo.swift │ │ │ ├── MergeInfoPlist.swift │ │ │ ├── MkdirTool.swift │ │ │ ├── ModulesVerifierTool.swift │ │ │ ├── PLUtilTool.swift │ │ │ ├── PrelinkedObjectLink.swift │ │ │ ├── ProcessSDKImports.swift │ │ │ ├── ProcessXCFrameworkLibrary.swift │ │ │ ├── ProductPackaging.swift │ │ │ ├── RegisterExecutionPolicyException.swift │ │ │ ├── SetAttributes.swift │ │ │ ├── ShellScriptTool.swift │ │ │ ├── SignatureCollection.swift │ │ │ ├── StripTool.swift │ │ │ ├── SwiftABICheckerTool.swift │ │ │ ├── SwiftABIGenerationTool.swift │ │ │ ├── SwiftCompiler.swift │ │ │ ├── SwiftHeaderTool.swift │ │ │ ├── SwiftStdLibTool.swift │ │ │ ├── SwiftSymbolExtractor.swift │ │ │ ├── SymlinkTool.swift │ │ │ ├── TAPISymbolExtractor.swift │ │ │ ├── TAPITools.swift │ │ │ ├── TiffUtilTool.swift │ │ │ ├── TouchTool.swift │ │ │ ├── UnifdefTool.swift │ │ │ ├── ValidateDevelopmentAssets.swift │ │ │ ├── ValidateEmbeddedBinaryTool.swift │ │ │ ├── ValidateProductTool.swift │ │ │ └── WriteFile.swift │ ├── Specs │ │ ├── CoreBuildSystem.xcspec │ │ ├── ExternalBuildSystem.xcspec │ │ ├── NativeBuildSystem.xcspec │ │ └── en.lproj │ │ │ └── CoreBuildSystem.strings │ ├── SwiftSDK.swift │ ├── TargetDependencyResolver.swift │ ├── TargetPlatformDiagnostics.swift │ ├── TaskGeneration.swift │ ├── TaskResult.swift │ ├── ToolInfo │ │ └── ClangToolInfo.swift │ ├── ToolchainRegistry.swift │ ├── Tuning.swift │ ├── WorkspaceContext.swift │ ├── WorkspaceSettingsCache.swift │ └── XCFramework.swift ├── SWBGenericUnixPlatform │ ├── CMakeLists.txt │ ├── Plugin.swift │ └── Specs │ │ ├── Unix.xcspec │ │ ├── UnixCompile.xcspec │ │ ├── UnixLd.xcspec │ │ └── UnixLibtool.xcspec ├── SWBGenericUnixPlatformPlugin │ └── PluginMain.swift ├── SWBLLBuild │ ├── CMakeLists.txt │ └── LowLevelBuildSystem.swift ├── SWBLibc │ ├── CMakeLists.txt │ └── libc.swift ├── SWBMacro │ ├── CMakeLists.txt │ ├── MacroCondition.swift │ ├── MacroConditionExpression.swift │ ├── MacroConditionParameter.swift │ ├── MacroConditionSet.swift │ ├── MacroConfigFileDiagnostic.swift │ ├── MacroConfigFileParser.swift │ ├── MacroDeclaration.swift │ ├── MacroEvaluationProgram.swift │ ├── MacroEvaluationScope.swift │ ├── MacroExpression.swift │ ├── MacroExpressionDiagnostic.swift │ ├── MacroExpressionParsing.swift │ ├── MacroNamespace.swift │ ├── MacroType.swift │ └── MacroValueAssignmentTable.swift ├── SWBProjectModel │ ├── CMakeLists.txt │ ├── IDE │ │ ├── IDEPIFGUID.swift │ │ ├── IDEPIFGenerating.swift │ │ ├── IDEPIFObject.swift │ │ ├── IDEPIFObjectInfo.swift │ │ ├── IDEPIFSerializer.swift │ │ └── IDESwiftPackageExtensions.swift │ └── PIFGenerationModel.swift ├── SWBProtocol │ ├── AsyncSequence.swift │ ├── BuildAction.swift │ ├── BuildOperationMessages.swift │ ├── BuildSettingsInfoMessageTypes.swift │ ├── CMakeLists.txt │ ├── ClientExchangeMessages.swift │ ├── DependencyClosureMessages.swift │ ├── DependencyGraphMessages.swift │ ├── DocumentationMessages.swift │ ├── IndexingMessages.swift │ ├── LocalizationMessages.swift │ ├── MacroEvaluationMessages.swift │ ├── Message.swift │ ├── MessageSupport.swift │ ├── PIFKeyConstants.swift │ ├── PlanningOperationMessages.swift │ ├── PreviewMessages.swift │ ├── ProjectDescriptorMessages.swift │ ├── ProjectDescriptorTypes.swift │ └── ProjectModel │ │ ├── BuildConfiguration.swift │ │ ├── BuildFile.swift │ │ ├── BuildPhase.swift │ │ ├── BuildRule.swift │ │ ├── CustomTask.swift │ │ ├── DependencyInfo.swift │ │ ├── ImpartedBuildProperties.swift │ │ ├── MacroExpressionSource.swift │ │ ├── PIFObject.swift │ │ ├── PlatformFilter.swift │ │ ├── Project.swift │ │ ├── ProvisioningSourceData.swift │ │ ├── Reference.swift │ │ ├── SourceTree.swift │ │ ├── Target.swift │ │ ├── TargetDependency.swift │ │ └── Workspace.swift ├── SWBQNXPlatform │ ├── CMakeLists.txt │ ├── Plugin.swift │ ├── QNXSDP.swift │ └── Specs │ │ ├── QNX.xcspec │ │ ├── QNXCompile.xcspec │ │ ├── QNXLd.xcspec │ │ └── QNXLibtool.xcspec ├── SWBQNXPlatformPlugin │ └── PluginMain.swift ├── SWBServiceCore │ ├── CMakeLists.txt │ ├── Request.swift │ ├── Service.swift │ ├── ServiceEntryPoint.swift │ ├── ServiceExtensionPoint.swift │ └── ServiceHostConnection.swift ├── SWBTaskConstruction │ ├── BuildDirectoryContext.swift │ ├── CMakeLists.txt │ ├── DiagnosticSupport.swift │ ├── ProductPlanning │ │ ├── BuildPlan.swift │ │ ├── BuildPlanDumping.swift │ │ ├── ProductPlan.swift │ │ └── ProductPlanner.swift │ ├── StaleFileRemovalContext.swift │ ├── TaskPlanningDelegate.swift │ ├── TaskProducerSandboxing.swift │ ├── TaskProducers │ │ ├── BuildPhaseTaskProducers │ │ │ ├── AppleScriptTaskProducer.swift │ │ │ ├── BuildRuleTaskProducer.swift │ │ │ ├── CopyFilesTaskProducer.swift │ │ │ ├── FilesBasedBuildPhaseTaskProducer.swift │ │ │ ├── HeadersTaskProducer.swift │ │ │ ├── ResourcesTaskProducer.swift │ │ │ ├── RezTaskProducer.swift │ │ │ ├── ShellBasedTaskProducer.swift │ │ │ ├── ShellScriptTaskProducer.swift │ │ │ ├── SourcesTaskProducer.swift │ │ │ └── SwiftPackageCopyFilesTaskProducer.swift │ │ ├── OtherTaskProducers │ │ │ ├── CopySwiftPackageResourcesTaskProducer.swift │ │ │ ├── CustomTaskProducer.swift │ │ │ ├── DevelopmentAssetsTaskProducer.swift │ │ │ ├── DocumentationTaskProducer.swift │ │ │ ├── ExternalTargetTaskProducer.swift │ │ │ ├── GenerateAppPlaygroundAssetCatalogTaskProducer.swift │ │ │ ├── GeneratedFilesTaskProducer.swift │ │ │ ├── HeadermapTaskProducer.swift │ │ │ ├── InfoPlistTaskProducer.swift │ │ │ ├── ModuleMapTaskProducer.swift │ │ │ ├── ModuleVerifierTaskProducer.swift │ │ │ ├── ProductPostprocessingTaskProducer.swift │ │ │ ├── ProductStructureTaskProducer.swift │ │ │ ├── SDKStatCacheTaskProducer.swift │ │ │ ├── SanitizerTaskProducer.swift │ │ │ ├── SwiftFrameworkABICheckerTaskProducer.swift │ │ │ ├── SwiftStandardLibrariesTaskProducer.swift │ │ │ ├── TAPISymbolExtractorTaskProducer.swift │ │ │ ├── TargetOrderTaskProducer.swift │ │ │ └── XCTestProductTypeTaskProducer.swift │ │ ├── StandardTaskProducer.swift │ │ ├── TaskProducer.swift │ │ ├── TaskProducerExtensionPoint.swift │ │ └── WorkspaceTaskProducers │ │ │ ├── CreateBuildDirectoryTaskProducer.swift │ │ │ ├── HeadermapVFSTaskProducer.swift │ │ │ ├── IndexBuildVFSDirectoryRemapTaskProducer.swift │ │ │ ├── PCHModuleMapTaskProducer.swift │ │ │ └── XCFrameworkTaskProducer.swift │ └── XCFrameworkContext.swift ├── SWBTaskExecution │ ├── BuildDescription.swift │ ├── BuildDescriptionManager.swift │ ├── BuildDescriptionSignature.swift │ ├── BuiltinTaskActionsExtension.swift │ ├── CMakeLists.txt │ ├── DynamicTaskSpecs │ │ ├── ClangCachingKeyQueryDynamicTaskSpec.swift │ │ ├── ClangCachingMaterializeKeyDynamicTaskSpec.swift │ │ ├── ClangCachingOutputMaterializerDynamicTaskSpec.swift │ │ ├── ClangCachingTaskCacheKey.swift │ │ ├── ClangModuleDependencyGraph.swift │ │ ├── CompilationCachingDataPruner.swift │ │ ├── CompilationCachingUploader.swift │ │ ├── DynamicTaskOperationContext.swift │ │ ├── DynamicTaskSpecRegistry.swift │ │ ├── PrecompileClangModuleDynamicTaskSpec.swift │ │ ├── SwiftCachingDynamicTaskSpec.swift │ │ ├── SwiftCachingTaskKeys.swift │ │ ├── SwiftDriverJobDynamicTaskSpec.swift │ │ └── SwiftDriverPlanningDynamicTaskSpec.swift │ ├── ProjectPlanner.swift │ ├── Task.swift │ ├── TaskActionExtensionPoint.swift │ ├── TaskActions │ │ ├── AuxiliaryFileTaskAction.swift │ │ ├── ClangCachingKeyQueryTaskAction.swift │ │ ├── ClangCachingMaterializeKeyTaskAction.swift │ │ ├── ClangCachingOutputMaterializerTaskAction.swift │ │ ├── ClangCompileTaskAction.swift │ │ ├── ClangModuleVerifierInputGeneratorTaskAction.swift │ │ ├── ClangScanTaskAction.swift │ │ ├── CodeSignTaskAction.swift │ │ ├── ConcatenateTaskAction.swift │ │ ├── ConstructStubExecutorInputFileListTaskAction.swift │ │ ├── CopyPlistTaskAction.swift │ │ ├── CopyStringsFileTaskAction.swift │ │ ├── CopyTiffTaskAction.swift │ │ ├── CreateBuildDirectoryTaskAction.swift │ │ ├── DeferredExecutionTaskAction.swift │ │ ├── EmbedSwiftStdLibTaskAction.swift │ │ ├── FileCopyTaskAction.swift │ │ ├── GenericCachingTaskAction.swift │ │ ├── InfoPlistProcessorTaskAction.swift │ │ ├── LSRegisterURLTaskAction.swift │ │ ├── LinkAssetCatalogTaskAction.swift │ │ ├── MergeInfoPlistTaskAction.swift │ │ ├── ODRAssetPackManifestTaskAction.swift │ │ ├── PrecompileClangModuleTaskAction.swift │ │ ├── ProcessProductEntitlementsTaskAction.swift │ │ ├── ProcessProductProvisioningProfileTaskAction.swift │ │ ├── ProcessSDKImportsTaskAction.swift │ │ ├── ProcessXCFrameworkTaskAction.swift │ │ ├── RegisterExecutionPolicyExceptionTaskAction.swift │ │ ├── SignatureCollectionTaskAction.swift │ │ ├── SwiftCachingKeyQueryTaskAction.swift │ │ ├── SwiftCachingMaterializeKeyTaskAction.swift │ │ ├── SwiftCachingOutputMaterializerTaskAction.swift │ │ ├── SwiftCompilationTaskAction.swift │ │ ├── SwiftDriverCompilationRequirementTaskAction.swift │ │ ├── SwiftDriverJobSchedulingTaskAction.swift │ │ ├── SwiftDriverJobTaskAction.swift │ │ ├── SwiftDriverTaskAction.swift │ │ ├── SwiftHeaderToolTaskAction.swift │ │ ├── TaskAction.swift │ │ ├── ValidateDevelopmentAssetsTaskAction.swift │ │ └── ValidateProductTaskAction.swift │ ├── TaskResult.swift │ └── TaskStore.swift ├── SWBTestSupport │ ├── AssertMatch.swift │ ├── BuildDescriptionBasedTests.swift │ ├── BuildOperationTester.swift │ ├── CapturingTaskGenerationDelegate.swift │ ├── CommandLineToolSpecDiscoveredInfo.swift │ ├── CoreBasedTests+SDKHelpers.swift │ ├── CoreBasedTests.swift │ ├── CoreTestSupport.swift │ ├── Deferrable.swift │ ├── DeviceFamilyBuildOperationTester.swift │ ├── DiagnosticsCheckingResult.swift │ ├── DiagnosticsEngine.swift │ ├── DummyCommandProducer.swift │ ├── EnvironmentKey.swift │ ├── FSUtilities.swift │ ├── IndexingInfoResults.swift │ ├── KnownIssueTestSupport.swift │ ├── LibraryGeneration.swift │ ├── MachO.swift │ ├── Misc.swift │ ├── PerfTestSupport.swift │ ├── PlatformFilter.swift │ ├── Projects │ │ └── AppClips.swift │ ├── RandomTestWorkspaces.swift │ ├── RunDestinationTestSupport.swift │ ├── SettingsBasedTests.swift │ ├── SettingsRunDestinationTestSupport.swift │ ├── SkippedTestSupport.swift │ ├── SpecTestSupport.swift │ ├── SwiftTestingExtensions.swift │ ├── TargetBuildGraphTestSupport.swift │ ├── TaskConstructionTester.swift │ ├── TaskExecutionTestSupport.swift │ ├── TaskPlanningTestSupport.swift │ ├── TasksCheckingResult.swift │ ├── TestWorkspaces.swift │ ├── Timeout.swift │ ├── UserDefaultTestTrait.swift │ ├── XCFrameworkTestSupport.swift │ └── Xcode.swift ├── SWBUniversalPlatform │ ├── CMakeLists.txt │ ├── CopyPlistFile.swift │ ├── CopyStringsFile.swift │ ├── CppTool.swift │ ├── DiffTool.swift │ ├── LexCompiler.swift │ ├── Plugin.swift │ ├── Specs │ │ ├── BuiltInBuildRules.xcbuildrules │ │ ├── BuiltInCompilers.xcspec │ │ ├── BuiltInFileTypes.xcspec │ │ ├── Clang.xcspec │ │ ├── ClangModuleVerifierInputGenerator.xcspec │ │ ├── ClangStatCache.xcspec │ │ ├── ClangSymbolExtractor.xcspec │ │ ├── ClangVerifier.xcspec │ │ ├── CodeSign.xcspec │ │ ├── CopyPlistFile.xcspec │ │ ├── CopyStringsFile.xcspec │ │ ├── Cpp.xcspec │ │ ├── DefaultCompiler.xcspec │ │ ├── Documentation.xcspec │ │ ├── Ld.xcspec │ │ ├── Lex.xcspec │ │ ├── Libtool.xcspec │ │ ├── PBXCp.xcspec │ │ ├── PackageTypes.xcspec │ │ ├── ProductTypeValidationTool.xcspec │ │ ├── ProductTypes.xcspec │ │ ├── StandardFileTypes.xcspec │ │ ├── StripSymbols.xcspec │ │ ├── Swift.xcspec │ │ ├── SwiftBuildSettings.xcspec │ │ ├── TAPI.xcspec │ │ ├── TestEntryPointGenerator.xcspec │ │ ├── Unifdef.xcspec │ │ ├── Yacc.xcspec │ │ ├── en.lproj │ │ │ ├── Apple Clang.strings │ │ │ ├── CopyPlistFile.strings │ │ │ ├── CopyStringsFile.strings │ │ │ ├── Cpp.strings │ │ │ ├── Default Compiler.strings │ │ │ ├── Ld.strings │ │ │ ├── Lex.strings │ │ │ ├── Libtool.strings │ │ │ ├── PBXCp.strings │ │ │ ├── ProductTypeValidationTool.strings │ │ │ ├── StripSymbols.strings │ │ │ ├── Swift Compiler.strings │ │ │ ├── SwiftBuildSettings.strings │ │ │ ├── Yacc.strings │ │ │ └── com.apple.build-tools.modules-verifier.strings │ │ └── swift-stdlib-tool.xcspec │ ├── TestEntryPointGenerationTaskAction.swift │ ├── TestEntryPointGenerationTool.swift │ ├── TestEntryPointTaskProducer.swift │ └── YaccCompiler.swift ├── SWBUniversalPlatformPlugin │ └── PluginMain.swift ├── SWBUtil │ ├── Architecture.swift │ ├── ArgumentSplitting.swift │ ├── Array.swift │ ├── AsyncCache.swift │ ├── AsyncFlatteningSequence.swift │ ├── AsyncIteratorProtocol.swift │ ├── AsyncLock.swift │ ├── AsyncOperationQueue.swift │ ├── AsyncSingleValueCache.swift │ ├── AsyncStreamController.swift │ ├── ByteCount.swift │ ├── ByteString.swift │ ├── CMakeLists.txt │ ├── CSV.swift │ ├── Cache.swift │ ├── Collection.swift │ ├── CountedSet.swift │ ├── Debugger.swift │ ├── DependencyInfo.swift │ ├── DiagnosticsEngine.swift │ ├── Dictionary.swift │ ├── Diff.swift │ ├── Dispatch+Async.swift │ ├── Duration.swift │ ├── ElapsedTimer.swift │ ├── EmptyState.swift │ ├── Environment.swift │ ├── EnvironmentHelpers.swift │ ├── EnvironmentKey.swift │ ├── Error.swift │ ├── FSProxy.swift │ ├── FileHandle+Async.swift │ ├── FilesSignature.swift │ ├── GraphAlgorithms.swift │ ├── HashContext.swift │ ├── Headermap.swift │ ├── HeavyCache.swift │ ├── IO.swift │ ├── Int.swift │ ├── InterningArena.swift │ ├── JSONEncoder.swift │ ├── KeyValueStorage.swift │ ├── LazyCache.swift │ ├── Library.swift │ ├── LineReader.swift │ ├── Lock.swift │ ├── MachO.swift │ ├── Math.swift │ ├── Misc+Async.swift │ ├── Misc.swift │ ├── MsgPack.swift │ ├── MsgPackSerialization.swift │ ├── NamedTemporaryDirectory.swift │ ├── OSLog.swift │ ├── Optional.swift │ ├── OrderedDictionary.swift │ ├── OrderedSet.swift │ ├── OutputByteStream.swift │ ├── POSIX.swift │ ├── Pair.swift │ ├── Path.swift │ ├── PathWindows.swift │ ├── PbxCp.swift │ ├── PluginManager.swift │ ├── PluginManagerCommon.swift │ ├── Process+Async.swift │ ├── Process.swift │ ├── ProcessInfo.swift │ ├── Promise.swift │ ├── PropertyList.swift │ ├── Queue.swift │ ├── RateLimiter.swift │ ├── Ref.swift │ ├── RegEx.swift │ ├── Registry.swift │ ├── ResponseFiles.swift │ ├── Result.swift │ ├── SWBDispatch.swift │ ├── ScopedKeepAliveCache.swift │ ├── Serialization.swift │ ├── Signatures.swift │ ├── Static.swift │ ├── Statistics.swift │ ├── String.swift │ ├── TAPIFileList.swift │ ├── URL.swift │ ├── UniqueSerialization.swift │ ├── UnsafeSendableDelayedInitializationWrapper.swift │ ├── UserDefaults.swift │ ├── VFS.swift │ ├── Version.swift │ ├── WaitCondition.swift │ ├── WeakRef.swift │ ├── Win32.swift │ ├── Win32Error.swift │ ├── XCBuildDataArchive.swift │ ├── Xcode.swift │ └── fnmatch.swift ├── SWBWebAssemblyPlatform │ ├── CMakeLists.txt │ ├── Plugin.swift │ └── Specs │ │ ├── WasmCompile.xcspec │ │ ├── WasmLd.xcspec │ │ ├── WasmLibtool.xcspec │ │ └── WebAssembly.xcspec ├── SWBWebAssemblyPlatformPlugin │ └── PluginMain.swift ├── SWBWindowsPlatform │ ├── CMakeLists.txt │ ├── KnownFolders.swift │ ├── Plugin.swift │ ├── Specs │ │ ├── Windows.xcspec │ │ ├── WindowsCompile.xcspec │ │ ├── WindowsLd.xcspec │ │ └── WindowsLibtool.xcspec │ └── VSInstallation.swift ├── SWBWindowsPlatformPlugin │ └── PluginMain.swift ├── SwiftBuild │ ├── CMakeLists.txt │ ├── CompatibilityShims.swift │ ├── ConsoleCommands │ │ ├── SWBServiceConsoleBuildCommand.swift │ │ ├── SWBServiceConsoleBuildCommandProtocol.swift │ │ ├── SWBServiceConsoleCreateXCFrameworkCommand.swift │ │ ├── SWBServiceConsoleGeneralCommands.swift │ │ ├── SWBServiceConsoleSessionCommands.swift │ │ └── SWBServiceConsoleXcodeCommands.swift │ ├── ProjectModel │ │ ├── BuildConfig.swift │ │ ├── BuildFile.swift │ │ ├── BuildPhases.swift │ │ ├── BuildRule.swift │ │ ├── BuildSettings.swift │ │ ├── CustomTask.swift │ │ ├── ImpartedBuildProperties.swift │ │ ├── PlatformFilter.swift │ │ ├── Project.swift │ │ ├── ProjectModel.swift │ │ ├── References.swift │ │ ├── SandboxingOverride.swift │ │ ├── TargetDependency.swift │ │ └── Targets.swift │ ├── SWBBuildAction.swift │ ├── SWBBuildOperation.swift │ ├── SWBBuildOperationBacktraceFrame.swift │ ├── SWBBuildParameters.swift │ ├── SWBBuildRequest.swift │ ├── SWBBuildService.swift │ ├── SWBBuildServiceConnection.swift │ ├── SWBBuildServiceConsole.swift │ ├── SWBBuildServiceSession.swift │ ├── SWBChannel.swift │ ├── SWBClientExchangeSupport.swift │ ├── SWBDocumentationSupport.swift │ ├── SWBIndexingSupport.swift │ ├── SWBLocalizationSupport.swift │ ├── SWBMacroEvaluation.swift │ ├── SWBPreviewSupport.swift │ ├── SWBProductPlannerSupport.swift │ ├── SWBPropertyList.swift │ ├── SWBProvisioningTaskInputs.swift │ ├── SWBSystemInfo.swift │ ├── SWBTargetGUID.swift │ ├── SWBTerminal.swift │ ├── SWBUserInfo.swift │ ├── SWBWorkspaceInfo.swift │ ├── SWBuildMessage+Protocol.swift │ ├── SwiftBuild.swift │ ├── SwiftBuildVersion.swift │ └── TerminalAttributes.swift ├── SwiftBuildTestSupport │ ├── CoreQualificationTester.swift │ ├── EmptyBuildOperationDelegate.swift │ ├── TaskBacktraces.swift │ ├── TestBuildOperationDelegate.swift │ ├── TestUtilities.swift │ └── ThroughputTests.swift └── swbuild │ ├── CMakeLists.txt │ └── SWBuildMain.swift ├── SwiftBuild.docc ├── Architecture │ ├── build-system-architecture.md │ ├── dynamic-tasks.md │ ├── indexing-support.md │ └── swift-driver.md ├── Core │ ├── macro-evaluation.md │ ├── project-interchange-format.md │ ├── target-specialization.md │ └── xcspecs.md ├── Development │ ├── build-debugging.md │ ├── test-development-project-tests.md │ └── test-development.md ├── Info.plist ├── Resources │ ├── dynamic-tasks-execution-flow.png │ ├── dynamic-tasks-setup.png │ ├── swift-driver-legacy.png │ ├── swift-driver-new1.png │ └── swift-driver-new2.png ├── TaskConstruction │ ├── discovered-dependencies.md │ ├── mergeable-libraries.md │ └── mutable-outputs.md └── swift-build.md ├── Tests ├── SWBAndroidPlatformTests │ └── SWBAndroidPlatformTests.swift ├── SWBApplePlatformTests │ ├── AppleCommandLineSpecTests.swift │ ├── AppleCommandLineToolSpecDiscoveredInfoTests.swift │ └── AppleInputFileGroupingStrategyTests.swift ├── SWBBuildServiceTests │ ├── BuildDependencyInfoTests.swift │ └── BuildServiceTests.swift ├── SWBBuildSystemPerfTests │ ├── ClangExplicitModulesPerfTests.swift │ ├── DependencyValidatorPerfTests.swift │ ├── ModulesVerifierPerfTests.swift │ └── SwiftDriverPerfTests.swift ├── SWBBuildSystemTests │ ├── AppIntentsNLTrainingTests.swift │ ├── AppShortcutsStringsValidationTests.swift │ ├── AppleScriptTests.swift │ ├── BuildBacktraceTests.swift │ ├── BuildCommandTests.swift │ ├── BuildDescriptionConstructionTests.swift │ ├── BuildOperationDescriptionTests.swift │ ├── BuildOperationTests.swift │ ├── BuildTaskBehaviorTests.swift │ ├── CircularDependencyTests.swift │ ├── ClangBuildOperationTests.swift │ ├── ClangCompilationCachingTests.swift │ ├── ClangExplicitModulesTests.swift │ ├── ClangModuleVerifierTests.swift │ ├── ClangStatCacheTests.swift │ ├── CleanOperationTests.swift │ ├── CodeGenerationToolTests.swift │ ├── CustomTaskBuildOperationTests.swift │ ├── DependencyCycleDiagnosticsTests.swift │ ├── DependencyValidationTests.swift │ ├── DevelopmentAssetsDiagnosticTests.swift │ ├── DeviceFamilyBuildOperationTests.swift │ ├── DiscoveredDependenciesBuildOperationTests.swift │ ├── DriverKitBuildOperationTests.swift │ ├── DsymGenerationBuildOperationTests.swift │ ├── EmbeddedBinaryValidationTests.swift │ ├── EntitlementsBuildOperationTests.swift │ ├── ExportLocBuildOperationTests.swift │ ├── GenericTaskCachingTests.swift │ ├── HeadermapModuleCompatibilityTests.swift │ ├── HostBuildToolBuildOperationTests.swift │ ├── IndexBuildOperationTests.swift │ ├── InfoPlistBuildOperationTests.swift │ ├── InstallAPIBuildOperationTests.swift │ ├── InstrumentsPackageBuildOperationTests.swift │ ├── LinkerTests.swift │ ├── MergeableLibrariesBuildOperationTests.swift │ ├── OnDemandResourcesTests.swift │ ├── PackageBuildOperationTests.swift │ ├── PrefixHeaderAsModuleTests.swift │ ├── PreviewsBuildOperationTests.swift │ ├── RebuildTests.swift │ ├── SDKImportsBuildOperationTests.swift │ ├── SceneKitBuildOperationTests.swift │ ├── ShellScriptSandboxingTests.swift │ ├── SpriteKitBuildOperationTests.swift │ ├── StaleFileRemovalTests.swift │ ├── SwiftBuildOperationTests.swift │ ├── SwiftBuildTraceTests.swift │ ├── SwiftCompilationCachingTests.swift │ ├── SwiftDriverTests.swift │ ├── TestData │ │ ├── WordTagger.mlmodel │ │ └── WordTagger.mlpackage │ │ │ ├── Data │ │ │ └── com.apple.CoreML │ │ │ │ ├── FeatureDescriptions.json │ │ │ │ ├── Metadata.json │ │ │ │ └── WordTagger.mlmodel │ │ │ └── Manifest.json │ ├── TrackedDomainOperationTests.swift │ ├── UnifdefTests.swift │ ├── UnitTestBuildOperationTests.swift │ ├── WatchBuildOperationTests.swift │ ├── WatchKitTests.swift │ ├── WorkspaceDiagnosticsTests.swift │ └── XCFrameworkBuildOperationTests.swift ├── SWBCASPerfTests │ └── CASFSNodePerfTests.swift ├── SWBCASTests │ ├── CASFSNodeTests.swift │ └── ToolchainCASPluginTests.swift ├── SWBCorePerfTests │ ├── BuildParameterPerfTests.swift │ ├── CommandLineSpecPerfTests.swift │ ├── CorePerfTests.swift │ ├── FilePathResolverPerfTests.swift │ ├── MacroConfigFileParsingPerfTests.swift │ ├── MacroEvaluationPerfTests.swift │ ├── MacroExpressionParsingPerfTests.swift │ ├── SerializationPerfTests.swift │ └── SettingsPerfTests.swift ├── SWBCoreTests │ ├── BuildCommandTests.swift │ ├── BuildParametersTests.swift │ ├── BuildRuleTests.swift │ ├── CapturedBuildInfoTests.swift │ ├── ClangSerializedDiagnosticsTests.swift │ ├── CommandLineSpecTests.swift │ ├── CommandLineToolSpecDiscoveredInfoTests.swift │ ├── CoreTests.swift │ ├── DependencyScopingTests.swift │ ├── DocumentationCompilerSpecTests.swift │ ├── DocumentationDiagnosticsOutputParserTests.swift │ ├── FilePathResolverTests.swift │ ├── FileTextEncodingTests.swift │ ├── FileToBuildTests.swift │ ├── FlagPatternTests.swift │ ├── IncrementalPIFLoadingTests.swift │ ├── IndexSelectConfiguredTargetTests.swift │ ├── IndexTargetDependencyResolverTests.swift │ ├── InputFileGroupingStrategyTests.swift │ ├── MacroEvaluationExtensionsTests.swift │ ├── ModuleVerifierFilenameMapTests.swift │ ├── ModuleVerifierFrameworkTests.swift │ ├── ModuleVerifierHeaderTests.swift │ ├── ModuleVerifierModuleMapTests.swift │ ├── ModuleVerifierTargetTests.swift │ ├── MultiPlatformDependencyResolverTests.swift │ ├── OptimizationRemarksTests.swift │ ├── PIFInlineLoadingTests.swift │ ├── PIFLoadingTests.swift │ ├── PlatformRegistryTests.swift │ ├── ProductTypesTests.swift │ ├── ProvisioningTests.swift │ ├── RecursiveSearchPathResolverTests.swift │ ├── SDKRegistryTests.swift │ ├── SerializationTests.swift │ ├── SettingsTests.swift │ ├── ShellScriptEnvironmentTests.swift │ ├── SpecLoadingTests.swift │ ├── SpecParserTests.swift │ ├── SpecRegistryTests.swift │ ├── SwiftCompilerTests.swift │ ├── TargetDependencyResolverTests.swift │ ├── ToolchainRegistryTests.swift │ ├── WorkspaceDiffTests.swift │ ├── WorkspaceHeaderIndexTests.swift │ └── XCFrameworkTests.swift ├── SWBGenericUnixPlatformTests │ └── SWBLinuxPlatformTests.swift ├── SWBLLBuildTests │ └── LLBuildTests.swift ├── SWBMacroTests │ ├── MacroBasicTests.swift │ ├── MacroConditionExpressionTests.swift │ ├── MacroEvaluationTests.swift │ ├── MacroNamespaceTests.swift │ └── MacroParsingTests.swift ├── SWBProjectModelTests │ └── PIFSerializationTests.swift ├── SWBProtocolTests │ ├── MessageSerializationTests.swift │ └── ProjectModelTests.swift ├── SWBQNXPlatformTests │ └── SWBQNXPlatformTests.swift ├── SWBServiceCoreTests │ └── ServiceCoreTests.swift ├── SWBTaskConstructionPerfTests │ └── TaskConstructionPerfTests.swift ├── SWBTaskConstructionTests │ ├── AppClipTaskConstructionTests.swift │ ├── AppExtensionTaskConstructionTests.swift │ ├── AppIntentsMetadataTaskConstructionTests.swift │ ├── AssetCatalogTaskConstructionTests.swift │ ├── BuildActionTaskConstructionTests.swift │ ├── BuildPhaseFusionTests.swift │ ├── BuildRuleTaskConstructionTests.swift │ ├── BuildToolTaskConstructionTests.swift │ ├── ClangModulesTaskConstructionTests.swift │ ├── ClangResponseFileTaskConstructionTests.swift │ ├── ClangStatCacheTaskConstructionTests.swift │ ├── ClangStaticAnalyzerTests.swift │ ├── ClangTests.swift │ ├── CodeCoverageTaskConstructionTests.swift │ ├── CodeSignTaskConstructionTests.swift │ ├── CompilationCachingTaskConstructionTests.swift │ ├── CustomTaskConstructionTests.swift │ ├── DebugInformationTests.swift │ ├── DependencyScopingTaskConstructionTests.swift │ ├── DocumentationTaskConstructionTests.swift │ ├── DriverKitTaskConstructionTests.swift │ ├── EagerCompilationTests.swift │ ├── EagerLinkingTests.swift │ ├── ExportLocTaskConstructionTests.swift │ ├── GenerateAppPlaygroundAssetCatalogTaskConstructionTests.swift │ ├── HeadermapTaskConstructionTests.swift │ ├── HostBuildToolTaskConstructionTests.swift │ ├── InAppPurchaseContentTaskConstructionTests.swift │ ├── IndexBuildTaskConstructionTests.swift │ ├── InfoPlistTaskConstructionTests.swift │ ├── InstallAPITaskConstructionTests.swift │ ├── InstallLocTaskConstructionTests.swift │ ├── InstallTaskConstructionTests.swift │ ├── IntermediateStubTaskConstructionTests.swift │ ├── KernelExtensionTaskConstructionTests.swift │ ├── LibtoolTaskConstructionTests.swift │ ├── MergeableLibraryTests.swift │ ├── ModuleMapTaskConstructionTests.swift │ ├── ModuleVerifierTaskConstructionTests.swift │ ├── MultiPlatformTaskConstructionTests.swift │ ├── ObjectiveCSymbolExtractorTests.swift │ ├── OnDemandResourcesTaskConstructionTests.swift │ ├── PackageProductConstructionTests.swift │ ├── PlannedNodeTests.swift │ ├── PlatformFilteringTaskConstructionTests.swift │ ├── PlatformTaskConstructionTests.swift │ ├── PostprocessingTaskConstructionTests.swift │ ├── PrelinkedObjectFileTests.swift │ ├── PreviewsTaskConstructionTests.swift │ ├── ReadOnlySettingsTaskConstructionTests.swift │ ├── RealityAssetsTaskConstructionTests.swift │ ├── ResourceTaskConstructionTests.swift │ ├── ShellScriptTaskConstructionTests.swift │ ├── SignatureCollectionTaskConstructionTests.swift │ ├── SwiftABICheckerTaskConstructionTests.swift │ ├── SwiftModuleOnlyTaskConstructionTests.swift │ ├── SwiftTaskConstructionTests.swift │ ├── TaskConstructionTests.swift │ ├── TaskOrderingTests.swift │ ├── TrackedDomainTaskConstructionTests.swift │ ├── UnitTestTaskConstructionTests.swift │ ├── UnsupportedBehaviorTaskConstructionTests.swift │ ├── WatchTaskConstructionTests.swift │ ├── XCFrameworkTaskConstructionTests.swift │ └── XCStringsTaskConstructionTests.swift ├── SWBTaskExecutionTests │ ├── AuxiliaryFileTaskTests.swift │ ├── BuildDescriptionTests.swift │ ├── ClangModuleVerifierTaskTests.swift │ ├── ConcatenateTaskTests.swift │ ├── CopyPlistTaskTests.swift │ ├── CopyStringsFileTaskTests.swift │ ├── CopyTiffTaskTests.swift │ ├── CreateBuildDirectoryTaskActionTests.swift │ ├── FileCopyTaskTests.swift │ ├── InProcessTaskTestSupport.swift │ ├── InfoPlistProcessorTaskTests.swift │ ├── LSRegisterURLTaskTests.swift │ ├── PBXCpTests.swift │ ├── ProcessProductEntitlementsTaskActionTests.swift │ ├── ProcessProductPackagingTaskTests.swift │ ├── ProcessXCFrameworkLibraryTaskActionTests.swift │ ├── RegisterExecutionPolicyExceptionTaskActionTests.swift │ ├── SignatureCollectionActionTests.swift │ ├── StaleFileRemovalTests.swift │ ├── TaskTestSupport.swift │ ├── TestData │ │ ├── FileCopyTask │ │ │ ├── LoneFile.txt │ │ │ └── SimpleDir │ │ │ │ ├── FileOne.txt │ │ │ │ └── More │ │ │ │ └── FileTwo.txt │ │ ├── minimal-plist-with-uid.plist │ │ └── product-validation-ipad-multitasking-splitview.plist │ └── TestValidateProductTaskAction.swift ├── SWBTestSupportTests │ └── TestSupportTests.swift ├── SWBUniversalPlatformTests │ └── SWBUniversalPlatformTests.swift ├── SWBUtilPerfTests │ ├── ArgumentSplittingPerfTests.swift │ ├── ByteStringPerfTests.swift │ ├── DependencyInfoPerfTests.swift │ ├── GraphAlgorithmsPerfTests.swift │ ├── MsgPackSerializationPerfTests.swift │ ├── OrderedSetPerfTests.swift │ ├── OutputByteStreamPerfTests.swift │ ├── PathPerfTests.swift │ ├── QueuePerfTests.swift │ ├── StringPerfTests.swift │ └── UtilPerfTests.swift ├── SWBUtilTests │ ├── ArchitectureTests.swift │ ├── ArgumentSplittingTests.swift │ ├── ArrayTests.swift │ ├── ByteStringTests.swift │ ├── CSVTests.swift │ ├── CacheTests.swift │ ├── CountedSetTests.swift │ ├── DependencyInfoTests.swift │ ├── DiagnosticsTests.swift │ ├── DictionaryTests.swift │ ├── ElapsedTimerTests.swift │ ├── EnvironmentKeyTests.swift │ ├── EnvironmentTests.swift │ ├── FSProxyTests.swift │ ├── FileHandleTests.swift │ ├── FnmatchTests.swift │ ├── GraphAlgorithmsTests.swift │ ├── HashContextTests.swift │ ├── HeadermapTests.swift │ ├── HeavyCacheTests.swift │ ├── IntTests.swift │ ├── LazyCacheTests.swift │ ├── LineReaderTests.swift │ ├── MachOTests.swift │ ├── MathTests.swift │ ├── MiscTests.swift │ ├── MsgPackSerializationTests.swift │ ├── OrderedSetTests.swift │ ├── OutputByteStreamTests.swift │ ├── PathTests.swift │ ├── PathWindowsTests.swift │ ├── ProcessTests.swift │ ├── PropertyListTests.swift │ ├── QueueTests.swift │ ├── RateLimiterTests.swift │ ├── RegExTests.swift │ ├── RegistryTests.swift │ ├── ResponseFileTests.swift │ ├── ScopedKeepAliveCacheTests.swift │ ├── SignaturesTests.swift │ ├── StaticTests.swift │ ├── StatisticsTests.swift │ ├── StringTests.swift │ ├── TAPIFileListTests.swift │ ├── UserDefaultsTests.swift │ ├── VFSTests.swift │ ├── VersionTests.swift │ ├── WaitConditionTests.swift │ └── XCBuildDataArchiveTests.swift ├── SWBWebAssemblyPlatformTests │ └── SWBWebAssemblyPlatformTests.swift ├── SWBWindowsPlatformTests │ ├── SWBWindowsPlatformTests.swift │ └── WindowsTestSupport.swift ├── SwiftBuildPerfTests │ ├── BuildOperationPerfTests.swift │ ├── BuildServicePerfTests.swift │ └── XCFrameworkPerfTests.swift └── SwiftBuildTests │ ├── AppClipsTests.swift │ ├── ArenaIndexingInfoTests.swift │ ├── BuildLogTests.swift │ ├── BuildOperationTests.swift │ ├── BuildValidationUtilities.swift │ ├── ConsoleCommands │ ├── BuildCommandTests.swift │ ├── CLIConnection.swift │ ├── CreateXCFrameworkCommandTests.swift │ ├── GeneralCommandsTests.swift │ ├── ServiceConsoleTests.swift │ ├── SessionCommandsTests.swift │ └── XcodeCommandsTests.swift │ ├── DeferredExecutionTests.swift │ ├── DependencyRequestTests.swift │ ├── DocumentationInfoTests.swift │ ├── DocumentationTests.swift │ ├── DriverKitTests.swift │ ├── GeneratePreviewInfoTests.swift │ ├── IndexingInfoTests.swift │ ├── LocalizationInfoTests.swift │ ├── MacCatalystTests.swift │ ├── MacroEvaluationTests.swift │ ├── PIFTests.swift │ ├── ProductPlannerTests.swift │ ├── ProjectModel │ ├── BuildConfigTests.swift │ ├── BuildFileTests.swift │ ├── BuildPhasesTests.swift │ ├── BuildRuleTests.swift │ ├── BuildSettingsTests.swift │ ├── CustomTaskTests.swift │ ├── ImpartedBuildPropertiesTests.swift │ ├── PlatformFilterTests.swift │ ├── ProjectTests.swift │ ├── ReferencesTests.swift │ ├── SandboxingOverrideTests.swift │ ├── TargetDependencyTests.swift │ └── TargetsTests.swift │ ├── ProvisioningTaskInputsTests.swift │ ├── ServiceTests.swift │ ├── TestData │ ├── CommandLineTool │ │ ├── CommandLineTool.xcodeproj │ │ │ ├── project.pbxproj │ │ │ └── project.xcworkspace │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ └── xcshareddata │ │ │ │ └── IDEWorkspaceChecks.plist │ │ ├── CommandLineTool.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ └── IDEWorkspaceChecks.plist │ │ └── CommandLineTool │ │ │ └── main.c │ ├── CommandLineToolPackage │ │ ├── .gitignore │ │ ├── .swiftpm │ │ │ └── xcode │ │ │ │ └── package.xcworkspace │ │ │ │ └── xcshareddata │ │ │ │ └── IDEWorkspaceChecks.plist │ │ ├── Package.swift │ │ └── Sources │ │ │ └── CommandLineToolPackage │ │ │ └── main.swift │ └── WordTagger.mlmodel │ ├── ValidationTests.swift │ └── WatchTests.swift ├── Utilities ├── SwiftBuild+Deps.xcworkspace │ └── contents.xcworkspacedata ├── SwiftPM+SwiftBuild.xcworkspace │ └── contents.xcworkspacedata └── swift-ci-perf-tests.sh └── cmake └── modules ├── CMakeLists.txt └── SwiftBuildConfig.cmake.in /.dir-locals.el: -------------------------------------------------------------------------------- 1 | ;;; Directory Local Variables 2 | ;;; For more information see (info "(emacs) Directory Variables") 3 | 4 | 5 | ((nil 6 | (eval . 7 | ;; Auto-load the xcbuild project settings. 8 | (unless (featurep 'xcbuild-project-settings) 9 | (message "loading 'xcbuild-project-settings") 10 | ;; Make sure the project's own utils directory is in the load path, 11 | ;; but don't override any one the user might have set up. 12 | (add-to-list 13 | 'load-path 14 | (concat 15 | (let ((dlff (dir-locals-find-file default-directory))) 16 | (if (listp dlff) (car dlff) (file-name-directory dlff))) 17 | "utils/emacs") 18 | :append) 19 | (require 'xcbuild-project-settings))))) 20 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | indent_size = 4 7 | indent_style = space 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | xcode_trim_whitespace_on_empty_lines = true 11 | 12 | [*.{yml,yaml}] 13 | indent_size = 2 14 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | _[Put a one line description of your change into the PR title, please be specific]_ 2 | 3 | _[Explain the context, and why you're making that change. What is the problem you're trying to solve.]_ 4 | 5 | _[Tests can be run by commenting `@swift-ci test` on the pull request, for more information see [this](https://github.com/swiftlang/swift-build/blob/main/README.md)]_ 6 | -------------------------------------------------------------------------------- /.github/workflows/automerge.yml: -------------------------------------------------------------------------------- 1 | name: Create PR to merge main into release branch 2 | # In the first period after branching the release branch, we typically want to include many changes from `main` in the release branch. This workflow automatically creates a PR every Monday to merge main into the release branch. 3 | # Later in the release cycle we should stop this practice to avoid landing risky changes by disabling this workflow. To do so, disable the workflow as described in https://docs.github.com/en/actions/managing-workflow-runs-and-deployments/managing-workflow-runs/disabling-and-enabling-a-workflow 4 | on: 5 | schedule: 6 | - cron: '0 9 * * MON' 7 | workflow_dispatch: 8 | jobs: 9 | create_merge_pr: 10 | name: Create PR to merge main into release branch 11 | uses: swiftlang/github-workflows/.github/workflows/create_automerge_pr.yml@main 12 | with: 13 | head_branch: release/6.2 14 | base_branch: main 15 | permissions: 16 | contents: write 17 | pull-requests: write 18 | if: (github.event_name == 'schedule' && github.repository == 'swiftlang/swift-build') || (github.event_name != 'schedule') # Ensure that we don't run this on a schedule in a fork 19 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore OS X cruft. 2 | .DS_Store 3 | /default.profraw 4 | 5 | # Ignore editor temporary files. 6 | *~ 7 | .#* 8 | \#* 9 | *.pyc 10 | 11 | # Ignore Xcode user data. 12 | xcuserdata 13 | 14 | # Ignore VSCode user data. 15 | .vscode/* 16 | 17 | # Commonly used name for build products, at the top level. 18 | /build 19 | /.build 20 | /Packages 21 | 22 | # Ignore indexing build dir. 23 | /.index-build 24 | 25 | # Ignore bootstrap build dir. 26 | /.xbuild 27 | /.DD 28 | /.previous-builds 29 | /.full-build 30 | /.swiftpm 31 | Package.resolved 32 | 33 | # Ignore docc preview build dir 34 | */.docc-build/ 35 | -------------------------------------------------------------------------------- /.license_header_template: -------------------------------------------------------------------------------- 1 | @@===----------------------------------------------------------------------===@@ 2 | @@ 3 | @@ This source file is part of the Swift open source project 4 | @@ 5 | @@ Copyright (c) YEARS 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 | -------------------------------------------------------------------------------- /.licenseignore: -------------------------------------------------------------------------------- 1 | **/*.mlmodel 2 | **/*.pbxproj 3 | **/*.png 4 | **/*.xcworkspacedata 5 | **/Package.swift 6 | .dir-locals.el 7 | .editorconfig 8 | .swift-version 9 | CODEOWNERS 10 | Package.swift 11 | -------------------------------------------------------------------------------- /.swift-format: -------------------------------------------------------------------------------- 1 | { 2 | "version": 1, 3 | "lineLength": 10000, 4 | "indentation": { 5 | "spaces": 4 6 | }, 7 | "rules": { 8 | }, 9 | "tabWidth": 4 10 | } 11 | -------------------------------------------------------------------------------- /.swift-version: -------------------------------------------------------------------------------- 1 | 6.1.0 2 | -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @aciidgh @jakepetroules @mirza-garibovic @mhrawdon @neonichu @owenv 2 | *XCStrings* @matthewseaman @kulpreetchilana @jakepetroules @mirza-garibovic @mhrawdon @neonichu @owenv 3 | *StringCatalog* @matthewseaman @kulpreetchilana @jakepetroules @mirza-garibovic @mhrawdon @neonichu @owenv 4 | *Preview* @jonathanpenn @jakepetroules @mirza-garibovic @mhrawdon @neonichu @owenv 5 | -------------------------------------------------------------------------------- /Sources/SWBAndroidPlatform/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #[[ 2 | This source file is part of the Swift open source project 3 | 4 | Copyright (c) 2014 - 2025 Apple Inc. and the Swift project authors 5 | Licensed under Apache License v2.0 with Runtime Library Exception 6 | 7 | See http://swift.org/LICENSE.txt for license information 8 | See http://swift.org/CONTRIBUTORS.txt for Swift project authors 9 | ]] 10 | 11 | add_library(SWBAndroidPlatform 12 | AndroidSDK.swift 13 | Plugin.swift) 14 | SwiftBuild_Bundle(MODULE SWBAndroidPlatform FILES 15 | Specs/Android.xcspec) 16 | target_link_libraries(SWBAndroidPlatform PUBLIC 17 | SWBCore 18 | SWBMacro 19 | SWBUtil) 20 | 21 | set_target_properties(SWBAndroidPlatform PROPERTIES 22 | INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY}) 23 | 24 | set_property(GLOBAL APPEND PROPERTY SWIFTBUILD_EXPORTS SWBAndroidPlatform) 25 | 26 | install(TARGETS SWBAndroidPlatform 27 | ARCHIVE DESTINATION "${SwiftBuild_INSTALL_LIBDIR}") 28 | -------------------------------------------------------------------------------- /Sources/SWBAndroidPlatform/Specs/Android.xcspec: -------------------------------------------------------------------------------- 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 | ( 14 | { 15 | Domain = android; 16 | Type = Architecture; 17 | Identifier = Standard; 18 | Name = "Standard Architectures"; 19 | Description = "Standard architectures"; 20 | ArchitectureSetting = "ARCHS_STANDARD"; 21 | RealArchitectures = ( 22 | "$(VALID_ARCHS)" 23 | ); 24 | SortNumber = 0; 25 | }, 26 | ) 27 | -------------------------------------------------------------------------------- /Sources/SWBAndroidPlatformPlugin/PluginMain.swift: -------------------------------------------------------------------------------- 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 | import SWBUtil 14 | import SWBCore 15 | import SWBAndroidPlatform 16 | 17 | @_cdecl("initializePlugin") 18 | @PluginExtensionSystemActor public func main(_ ptr: UnsafeRawPointer) { 19 | initializePlugin(Unmanaged.fromOpaque(ptr).takeUnretainedValue()) 20 | } 21 | -------------------------------------------------------------------------------- /Sources/SWBApplePlatform/CopyTiffFile.swift: -------------------------------------------------------------------------------- 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 | import SWBCore 14 | 15 | final class CopyTiffFileSpec: GenericCommandLineToolSpec, SpecIdentifierType, @unchecked Sendable { 16 | static let identifier = "com.apple.build-tasks.copy-tiff-file" 17 | 18 | override func createTaskAction(_ cbc: CommandBuildContext, _ delegate: any TaskGenerationDelegate) -> (any PlannedTaskAction)? { 19 | delegate.taskActionCreationDelegate.createCopyTiffTaskAction() 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Sources/SWBApplePlatform/DevelopmentAssetsTaskProducer.swift: -------------------------------------------------------------------------------- 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 | import SWBCore 14 | import SWBUtil 15 | import SWBTaskConstruction 16 | import SWBMacro 17 | 18 | final class DevelopmentAssetsTaskProducer: StandardTaskProducer, TaskProducer { 19 | func generateTasks() async -> [any PlannedTask] { 20 | let scope = context.settings.globalScope 21 | guard scope.evaluate(BuiltinMacros.VALIDATE_DEVELOPMENT_ASSET_PATHS) != .no && !scope.evaluate(BuiltinMacros.DEVELOPMENT_ASSET_PATHS).isEmpty else { 22 | return [] 23 | } 24 | 25 | var tasks: [any PlannedTask] = [] 26 | await appendGeneratedTasks(&tasks) { delegate in 27 | await context.developmentAssetsSpec?.constructTasks(CommandBuildContext(producer: context, scope: scope, inputs: []), delegate) 28 | } 29 | return tasks 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Sources/SWBApplePlatform/DittoTool.swift: -------------------------------------------------------------------------------- 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 | import SWBCore 14 | 15 | final class DittoToolSpec : CommandLineToolSpec, SpecIdentifierType, @unchecked Sendable { 16 | static let identifier = "com.apple.tools.ditto" 17 | 18 | required convenience init(_ parser: SpecParser, _ basedOnSpec: Spec?) { 19 | self.init(parser, basedOnSpec, isGeneric: false) 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Sources/SWBApplePlatform/ExtensionPointsCompiler.swift: -------------------------------------------------------------------------------- 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 | import SWBCore 14 | import SWBProtocol 15 | 16 | final class CopyXCAppExtensionPointsFileSpec: GenericCommandLineToolSpec, SpecIdentifierType, @unchecked Sendable { 17 | static let identifier = "com.apple.compilers.process-xcappextensionpoints" 18 | 19 | override func createTaskAction(_ cbc: CommandBuildContext, _ delegate: any TaskGenerationDelegate) -> (any PlannedTaskAction)? { 20 | delegate.taskActionCreationDelegate.createCopyPlistTaskAction() 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Sources/SWBApplePlatform/LocalizationInputFileGroupingStrategy.swift: -------------------------------------------------------------------------------- 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 | public import SWBCore 14 | 15 | /// A grouping strategy that groups all files with the same region variant (including a group for unlocalized files). 16 | @_spi(Testing) public final class LocalizationInputFileGroupingStrategy: InputFileGroupingStrategy { 17 | /// Name of the tool to which the grouping strategy belongs (used as a part of the returned group identifier). 18 | let toolName: String 19 | 20 | @_spi(Testing) public init(toolName: String) { 21 | self.toolName = toolName 22 | } 23 | 24 | public func determineGroupIdentifier(groupable: any InputFileGroupable) -> String? { 25 | return "tool:\(toolName) region:\(groupable.regionVariantName ?? "")" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Sources/SWBApplePlatform/MacCatalystInfoExtension.swift: -------------------------------------------------------------------------------- 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 | import SWBCore 14 | 15 | struct MacCatalystInfoExtension: SDKVariantInfoExtension { 16 | var supportsMacCatalystMacroNames: Set { 17 | ["SUPPORTS_MACCATALYST"] 18 | } 19 | 20 | var disallowedMacCatalystMacroNames: Set { 21 | ["DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER"] 22 | } 23 | 24 | var macCatalystDeriveBundleIDMacroNames: Set { 25 | ["DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER"] 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Sources/SWBApplePlatform/Specs/Embedded-Device.xcspec: -------------------------------------------------------------------------------- 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 | ( 14 | { 15 | _Domain = embedded; 16 | Type = BuildSettings; 17 | Identifier = com.apple.build-settings.embedded-device; 18 | Name = "Embedded (Device) Additional Core Build Settings"; 19 | Properties = ( 20 | { 21 | Name = "EMBEDDED_PROFILE_NAME"; 22 | Type = String; 23 | DefaultValue = "embedded.mobileprovision"; 24 | }, 25 | ); 26 | }, 27 | ) 28 | -------------------------------------------------------------------------------- /Sources/SWBApplePlatform/Specs/Embedded-Shared.xcspec: -------------------------------------------------------------------------------- 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 | ( 14 | 15 | { 16 | _Domain = embedded-shared; 17 | Type = BuildSystem; 18 | Identifier = com.apple.build-system.core; 19 | BasedOn = "com.apple.buildsettings.standard"; 20 | IsGlobalDomainInUI = Yes; 21 | Properties = ( 22 | ); 23 | }, 24 | 25 | { 26 | _Domain = embedded-shared; 27 | Type = BuildSystem; 28 | Identifier = com.apple.build-system.native; 29 | BasedOn = "default:com.apple.build-system.native"; 30 | Properties = ( 31 | ); 32 | }, 33 | ) 34 | -------------------------------------------------------------------------------- /Sources/SWBApplePlatform/Specs/Iconutil.xcspec: -------------------------------------------------------------------------------- 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 | ( 14 | { Identifier = com.apple.compilers.iconutil; 15 | Type = Compiler; 16 | Name = "Iconutil"; 17 | Description = "Icon conversion utility"; 18 | Version = "Default"; 19 | Vendor = "Apple"; 20 | CommandLine = "iconutil [options] --convert icns --output [output] [input]"; 21 | RuleName = "ConvertIconsetFile [output] [input]"; 22 | ExecDescription = "Convert iconset $(InputFileName)"; 23 | ProgressDescription = "Converting $(CommandProgressByType) iconsets"; 24 | InputFileTypes = ( 25 | folder.iconset 26 | ); 27 | Outputs = ( 28 | "$(ProductResourcesDir)/$(InputFileBase).icns", 29 | ); 30 | SynthesizeBuildRule = Yes; 31 | CommandOutputParser = ( 32 | ("^([^:]+)():debug: (.*)$", emit-notice), 33 | ("^([^:]+)():warning: (.*)$", emit-warning), 34 | ("^([^:]+)():error: (.*)$", emit-error), 35 | ); 36 | } 37 | ) 38 | -------------------------------------------------------------------------------- /Sources/SWBApplePlatform/Specs/LSRegisterURL.xcspec: -------------------------------------------------------------------------------- 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 | ( 14 | { Identifier = com.apple.build-tasks.ls-register-url; 15 | Type = Compiler; 16 | Name = "LSRegisterURL"; 17 | Description = "Registers the file at a URL with LaunchServices"; 18 | CommandLine = "/System/Library/Frameworks/CoreServices.framework/Versions/Current/Frameworks/LaunchServices.framework/Versions/Current/Support/lsregister -f -R -trusted [options] [input]"; 19 | RuleName = "RegisterWithLaunchServices $(InputFile)"; 20 | ExecDescription = "Register $(InputFileName)"; 21 | ProgressDescription = "Registering $(InputFile) with LaunchServices"; 22 | SynthesizeBuildRule = Yes; 23 | CommandOutputParser = XCGenericCommandOutputParser; 24 | Outputs = ( 25 | "$(OutputPath)", 26 | ); 27 | Options = ( 28 | // None yet 29 | ); 30 | } 31 | ) 32 | -------------------------------------------------------------------------------- /Sources/SWBApplePlatform/Specs/MetalFileTypes.xcspec: -------------------------------------------------------------------------------- 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 | ( 14 | { 15 | Type = FileType; 16 | Identifier = "sourcecode.metal"; 17 | BasedOn = sourcecode; 18 | Name = "Metal shader source files"; 19 | Extensions = ( 20 | metal, 21 | ); 22 | ComputerLanguage = metal; 23 | Language = "xcode.lang.metal"; 24 | AppliesToBuildRules = YES; 25 | UTI = "com.apple.metal"; 26 | }, 27 | { 28 | AppliesToBuildRules = YES; 29 | Type = FileType; 30 | Identifier = "compiled.air"; 31 | BasedOn = compiled; 32 | Extensions = ( 33 | air, 34 | ); 35 | Name = "Metal AIR files"; 36 | UTI = "com.apple.air"; 37 | }, 38 | { 39 | Type = FileType; 40 | Identifier = "archive.metal-library"; 41 | BasedOn = archive; 42 | Name = "Metal library files"; 43 | Extensions = ( 44 | metallib, 45 | ); 46 | "FallbackAutoroutingBuildPhase" = Resources; 47 | UTI = "com.apple.metal-library"; 48 | }, 49 | ) 50 | -------------------------------------------------------------------------------- /Sources/SWBApplePlatform/Specs/RCFileTypes.xcspec: -------------------------------------------------------------------------------- 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 | ( 14 | { 15 | Name = "Skybox Document"; 16 | Type = FileType; 17 | Identifier = "file.skybox"; 18 | BasedOn = file; 19 | Extensions = ( 20 | skybox, 21 | ); 22 | AppliesToBuildRules = YES; 23 | UTI = "com.apple.skybox"; 24 | }, 25 | ) 26 | -------------------------------------------------------------------------------- /Sources/SWBApplePlatform/Specs/SpriteKitFileTypes.xcspec: -------------------------------------------------------------------------------- 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 | ( 14 | { 15 | Name = "SpriteKit Texture Atlas"; 16 | Type = FileType; 17 | Identifier = folder.skatlas; 18 | BasedOn = wrapper; 19 | Extensions = (atlas); 20 | IsTransparent = NO; 21 | UTI = "com.apple.spritekit-atlas"; 22 | }, 23 | { 24 | Name = "SpriteKit Serialized Data"; 25 | Type = FileType; 26 | Identifier = file.sks; 27 | BasedOn = file; 28 | Extensions = (sks); 29 | IsTransparent = NO; 30 | UTI = "com.apple.spritekit.serialized"; 31 | }, 32 | ) 33 | -------------------------------------------------------------------------------- /Sources/SWBApplePlatform/Specs/en.lproj/CopyTiffFile.strings: -------------------------------------------------------------------------------- 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 | "Name" = "Copy TIFF image"; 14 | "Description" = "Copies a TIFF image resource file to the product, while optionally compressing the image data."; 15 | 16 | "[COMPRESS_TIFF_FILES_WHILE_COPYING]-name" = "Compress TIFF Images"; 17 | "[COMPRESS_TIFF_FILES_WHILE_COPYING]-description" = "Determines whether or not to compress the image data of TIFF files while copying them into the product."; 18 | -------------------------------------------------------------------------------- /Sources/SWBApplePlatform/Specs/en.lproj/DTrace.strings: -------------------------------------------------------------------------------- 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 | 14 | // Localized strings for basic info 15 | "Name" = "dtrace"; 16 | "Description" = "DTrace Compiler"; 17 | "Vendor" = "Apple"; 18 | 19 | // Build Options Category 20 | // 21 | "[BuildOptions]-category" = "Build Options"; 22 | 23 | "[DTRACE_OTHER_FLAGS]-name" = "Other DTrace Flags"; 24 | "[DTRACE_OTHER_FLAGS]-description" = "Space-separated list of additional flags to pass to the `dtrace` compiler. Be sure to backslash-escape any arguments that contain spaces or special characters, such as path names that may contain spaces. Use this setting if Xcode does not already provide UI for a particular `dtrace` flag."; 25 | -------------------------------------------------------------------------------- /Sources/SWBApplePlatform/Specs/en.lproj/Iconutil.strings: -------------------------------------------------------------------------------- 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 | "Name" = "Iconutil"; 14 | "Description" = "Icon conversion utility"; 15 | -------------------------------------------------------------------------------- /Sources/SWBApplePlatform/Specs/en.lproj/InstrumentsPackage.strings: -------------------------------------------------------------------------------- 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 | 14 | // Localized strings for basic info 15 | "Name" = "Instruments Package Definition"; 16 | "Description" = "Instruments Package Definition"; 17 | "Version" = "Default"; 18 | "Vendor" = "Apple"; 19 | -------------------------------------------------------------------------------- /Sources/SWBApplePlatform/Specs/en.lproj/Interface Builder Storyboard Postprocessor.strings: -------------------------------------------------------------------------------- 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 | // Localized strings for basic info 14 | "Name" = "Interface Builder Storyboard Postprocessor"; 15 | "Description" = "Interface Builder Storyboard Postprocessor"; 16 | "Version" = "Default"; 17 | "Vendor" = "Apple"; 18 | 19 | "[IBSC_POSTPROCESSOR_OPTIONS]-category" = "Options"; 20 | 21 | "[IBSC_STRIP_NIBS]-name" = "Strip Storyboardc Files"; 22 | "[IBSC_STRIP_NIBS]-description" = "Strips an editable Interface Builder storyboardc file to reduce its size for deployment. The resulting storyboardc is more compact but no longer editable by Interface Builder. When this option is disabled, the resulting storyboardc file remains editable by Interface Builder."; 23 | -------------------------------------------------------------------------------- /Sources/SWBApplePlatform/Specs/en.lproj/LSRegisterURL.strings: -------------------------------------------------------------------------------- 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 | "Name" = "Register with LaunchServices"; 14 | "Description" = "Registers a file with LaunchServices."; 15 | -------------------------------------------------------------------------------- /Sources/SWBApplePlatform/Specs/en.lproj/MiG.strings: -------------------------------------------------------------------------------- 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 | 14 | // Localized strings for basic info 15 | "Name" = "MiG"; 16 | "Description" = "Mach Interface Stub Generator"; 17 | "Version" = "Default"; 18 | "Vendor" = "Apple"; 19 | 20 | // Localized strings for output-parse-info 21 | "OutputParseInfo-ProgressStatusFormat" = "Generating Mach Interface Stub %@"; // arg 1 is name of rule's input file 22 | "OutputParseInfo-MessageStatusFormat" = "Generate Mach Interface Stub %@"; // arg 1 is name of rule's input file, arg 2 is name of file containing message (@"" if unknown) 23 | 24 | "[BuildOptions]-category" = "Build Options"; 25 | 26 | "[OTHER_MIGFLAGS]-name" = "Other MiG Flags"; 27 | "[OTHER_MIGFLAGS]-description" = "Space-separated list of additional flags to pass to `mig`. Be sure to backslash-escape any arguments that contain spaces or special characters, such as path names that may contain spaces. Use this setting if Xcode does not already provide UI for a `mig` flag."; 28 | -------------------------------------------------------------------------------- /Sources/SWBApplePlatform/Specs/en.lproj/ResMerger.strings: -------------------------------------------------------------------------------- 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 | "Name" = "ResMerger"; 14 | "Description" = "Create a Carbon resource file using Apple's Carbon Resource Merger."; 15 | -------------------------------------------------------------------------------- /Sources/SWBApplePlatform/Specs/en.lproj/TiffUtil.strings: -------------------------------------------------------------------------------- 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 | "Name" = "TiffUtil"; 14 | "Description" = "Create a HiDPI-compliant multiple-resolution TIFF image file from separate single-resolution image files."; 15 | -------------------------------------------------------------------------------- /Sources/SWBApplePlatform/Specs/en.lproj/com.apple.build-tasks.generate-texture-atlas.strings: -------------------------------------------------------------------------------- 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 | "Name" = "SpriteKit Texture Atlas Generator"; 14 | "Description" = "Generates a SpriteKit texture atlas and manifest file, from a folder of loose texture files."; 15 | 16 | "[SPRITEKIT_TEXTUREATLAS_OPTION]-category" = "SpriteKit Deployment Options"; 17 | 18 | "[SPRITEKIT_TEXTURE_ATLAS_FORMAT]-name" = "Output Texture Atlas Format"; 19 | "[SPRITEKIT_TEXTURE_ATLAS_FORMAT]-description" = "The enumeration flag is to control the output format of the image file inside .atlasc in the application bundle."; 20 | 21 | "[SPRITEKIT_TEXTURE_ATLAS_SIZE]-name" = "Maximum Output Texture Dimension"; 22 | "[SPRITEKIT_TEXTURE_ATLAS_SIZE]-description" = "The enumeration flag is to control the maximum output dimension of the image file inside .atlasc in the application bundle."; 23 | 24 | "[SPRITEKIT_TEXTURE_ATLAS_WARNINGS]-name" = "Log Warnings"; 25 | "[SPRITEKIT_TEXTURE_ATLAS_WARNINGS]-description" = "The enumeration flag is to control warning logging when generate texture atlas."; 26 | -------------------------------------------------------------------------------- /Sources/SWBApplePlatform/Specs/en.lproj/com.apple.compilers.assetcatalog.strings: -------------------------------------------------------------------------------- 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 | "Name" = "Asset Catalog Compiler"; 14 | "Description" = "Compiles Asset Catalogs into CAR files."; 15 | 16 | "[ASSETCATALOG_COMPILER_OPTIONS]-category" = "Options"; 17 | 18 | "[ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME]-name" = "Asset Catalog Launch Image Set Name"; 19 | "[ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME]-description" = "Name of an asset catalog launch image set whose contents will be merged into the `Info.plist`."; 20 | 21 | "[ASSETCATALOG_NOTICES]-name" = "Show Notices"; 22 | "[ASSETCATALOG_NOTICES]-description" = "Show notices encountered during the compilation of asset catalogs."; 23 | 24 | "[ASSETCATALOG_WARNINGS]-name" = "Show Warnings"; 25 | "[ASSETCATALOG_WARNINGS]-description" = "Show warnings encountered during the compilation of asset catalogs."; 26 | 27 | "[ASSETCATALOG_OTHER_FLAGS]-name" = "Asset Catalog Other Flags"; 28 | "[ASSETCATALOG_OTHER_FLAGS]-description" = "Pass additional flags through to the asset catalog compiler."; 29 | -------------------------------------------------------------------------------- /Sources/SWBApplePlatform/Specs/en.lproj/com.apple.compilers.metal-linker.strings: -------------------------------------------------------------------------------- 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 | "Name" = "Metal Linker"; 14 | "Description" = "Metal Linker"; 15 | "Version" = "Default"; 16 | "Vendor" = "Apple"; 17 | 18 | "[BuildOptions]-category" = "Build Options"; 19 | 20 | "[MTLLINKER_FLAGS]-name" = "Other Metal Linker Flags"; 21 | "[MTLLINKER_FLAGS]-description" = "Space-separated list of metal linker flags"; 22 | -------------------------------------------------------------------------------- /Sources/SWBApplePlatform/Specs/en.lproj/com.apple.compilers.model.coredatamapping.strings: -------------------------------------------------------------------------------- 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 | "Name" = "Core Data Mapping Model Compiler - MAPC"; 14 | "Description" = "MAPC: Core Data Mapping Model Compiler"; 15 | "Version" = "Default"; 16 | "Vendor" = "Apple Computer"; 17 | 18 | "[MAPC_NO_WARNINGS]-name" = "Suppress all mapc warnings"; 19 | "[MAPC_NO_WARNINGS]-description" = "Compile `.xcmappingmodel` files into `.cdm` without reporting warnings."; 20 | 21 | -------------------------------------------------------------------------------- /Sources/SWBApplePlatform/Specs/en.lproj/com.apple.compilers.model.mlkit.strings: -------------------------------------------------------------------------------- 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 | "Name" = "Machine Learning Model Compiler"; 14 | "Description" = "coremlc: Machine Learning Model Compiler"; 15 | "Version" = "Default"; 16 | "Vendor" = "Apple Computer"; 17 | 18 | // TODO: actually make these work 19 | "[COREML_NO_WARNINGS]-name" = "Suppress all coremlc warnings"; 20 | "[COREML_NO_WARNINGS]-description" = "Suppress machine learning model compiler warnings from output during the compilation of .mlmodel files"; 21 | -------------------------------------------------------------------------------- /Sources/SWBApplePlatform/Specs/en.lproj/com.apple.compilers.referenceobject.strings: -------------------------------------------------------------------------------- 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 | "Name" = "Reference Object Compiler"; 14 | "Description" = "referenceobjectc: Reference Object Compiler"; 15 | "Version" = "Default"; 16 | "Vendor" = "Apple Computer"; 17 | -------------------------------------------------------------------------------- /Sources/SWBApplePlatform/Specs/en.lproj/com.apple.xcode.tools.ibtool.postprocessor.strings: -------------------------------------------------------------------------------- 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 | "Name" = "Interface Builder NIB Postprocessor"; 14 | "Description" = "Strips design-time content from Interface Builder NIB files to reduce deployment size."; 15 | 16 | "[IBC_POSTPROCESSOR_OPTIONS]-category" = "Options"; 17 | 18 | "[IBC_STRIP_NIBS]-name" = "Strip NIB Files"; 19 | "[IBC_STRIP_NIBS]-description" = "Strips an Interface Builder NIB to reduce its size for deployment. The resulting NIB is more compact but no longer editable by Interface Builder. When this option is disabled, the resulting NIB file remains editable by Interface Builder."; 20 | -------------------------------------------------------------------------------- /Sources/SWBApplePlatform/Specs/iOSShared.xcspec: -------------------------------------------------------------------------------- 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 | ( 14 | ) 15 | -------------------------------------------------------------------------------- /Sources/SWBApplePlatform/Specs/macOSNativeBuildSystem.xcspec: -------------------------------------------------------------------------------- 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 | ( 14 | { 15 | _Domain = macosx; 16 | Type = BuildSystem; 17 | Identifier = com.apple.build-system.native; 18 | BasedOn = "default:com.apple.build-system.native"; 19 | Name = "Native Build System"; 20 | Properties = ( 21 | 22 | { Name = COMBINE_HIDPI_IMAGES; 23 | Type = bool; 24 | DefaultValue = NO; 25 | Category = "Deployment"; 26 | Description = "Combines image files at different resolutions into one multi-page TIFF file that is HiDPI compliant for macOS 10.7 and later. Only image files in the same directory and with the same base name and extension are combined. The file names must conform to the naming convention used in HiDPI."; 27 | }, 28 | { Name = PRODUCT_DEFINITION_PLIST; 29 | Type = String; 30 | DefaultValue = ""; 31 | Category = "Deployment"; 32 | Description = "Path to a file specifying additional requirements for a product archive."; 33 | }, 34 | ); 35 | } 36 | ) 37 | -------------------------------------------------------------------------------- /Sources/SWBApplePlatform/Specs/xrOSShared.xcspec: -------------------------------------------------------------------------------- 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 | ( 14 | { 15 | _Domain = xros-shared; 16 | Type = Compiler; 17 | Identifier = "com.apple.compilers.assetcatalog"; 18 | BasedOn = "default:com.apple.compilers.assetcatalog"; 19 | Options = ( 20 | { 21 | Name = "ASSETCATALOG_COMPILER_FLATTENED_APP_ICON_PATH"; 22 | Type = String; 23 | CommandLineFlag = "--flattened-app-icon-path"; 24 | }, 25 | ); 26 | }, 27 | ) 28 | -------------------------------------------------------------------------------- /Sources/SWBApplePlatformPlugin/PluginMain.swift: -------------------------------------------------------------------------------- 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 | import SWBUtil 14 | import SWBCore 15 | import SWBApplePlatform 16 | 17 | @_cdecl("initializePlugin") 18 | @PluginExtensionSystemActor public func main(_ ptr: UnsafeRawPointer) { 19 | initializePlugin(Unmanaged.fromOpaque(ptr).takeUnretainedValue()) 20 | } 21 | -------------------------------------------------------------------------------- /Sources/SWBBuildService/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #[[ 2 | This source file is part of the Swift open source project 3 | 4 | Copyright (c) 2014 - 2025 Apple Inc. and the Swift project authors 5 | Licensed under Apache License v2.0 with Runtime Library Exception 6 | 7 | See http://swift.org/LICENSE.txt for license information 8 | See http://swift.org/CONTRIBUTORS.txt for Swift project authors 9 | ]] 10 | 11 | add_library(SWBBuildService 12 | BuildDependencyInfo.swift 13 | BuildOperationMessages.swift 14 | BuildService.swift 15 | BuildServiceEntryPoint.swift 16 | ClientExchangeDelegate.swift 17 | DependencyGraphMessages.swift 18 | DocumentationInfo.swift 19 | LocalizationInfo.swift 20 | Messages.swift 21 | PlanningOperation.swift 22 | PreviewInfo.swift 23 | ProjectDescriptor.swift 24 | Session.swift 25 | Tools.swift) 26 | set_target_properties(SWBBuildService PROPERTIES 27 | Swift_LANGUAGE_VERSION 5) 28 | target_link_libraries(SWBBuildService PUBLIC 29 | SWBBuildSystem 30 | SWBServiceCore 31 | SWBTaskExecution 32 | SWBAndroidPlatform 33 | SWBApplePlatform 34 | SWBGenericUnixPlatform 35 | SWBQNXPlatform 36 | SWBUniversalPlatform 37 | SWBWebAssemblyPlatform 38 | SWBWindowsPlatform 39 | $<$>:SwiftSystem::SystemPackage>) 40 | 41 | set_target_properties(SWBBuildService PROPERTIES 42 | INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY}) 43 | 44 | set_property(GLOBAL APPEND PROPERTY SWIFTBUILD_EXPORTS SWBBuildService) 45 | 46 | install(TARGETS SWBBuildService 47 | ARCHIVE DESTINATION "${SwiftBuild_INSTALL_LIBDIR}") 48 | -------------------------------------------------------------------------------- /Sources/SWBBuildService/ProjectDescriptor.swift: -------------------------------------------------------------------------------- 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 | import SWBBuildSystem 14 | 15 | protocol ProjectDescriptorDelegate { 16 | var clientDelegate: any ClientDelegate { get } 17 | } 18 | -------------------------------------------------------------------------------- /Sources/SWBBuildServiceBundle/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #[[ 2 | This source file is part of the Swift open source project 3 | 4 | Copyright (c) 2014 - 2025 Apple Inc. and the Swift project authors 5 | Licensed under Apache License v2.0 with Runtime Library Exception 6 | 7 | See http://swift.org/LICENSE.txt for license information 8 | See http://swift.org/CONTRIBUTORS.txt for Swift project authors 9 | ]] 10 | 11 | add_executable(SWBBuildServiceBundle 12 | main.swift) 13 | set_target_properties(SWBBuildServiceBundle PROPERTIES 14 | Swift_LANGUAGE_VERSION 6) 15 | target_link_libraries(SWBBuildServiceBundle PRIVATE 16 | SWBBuildService 17 | SWBBuildSystem 18 | SWBServiceCore 19 | SWBUtil 20 | SWBCore) 21 | 22 | install(TARGETS SWBBuildServiceBundle) 23 | 24 | set_property(GLOBAL APPEND PROPERTY SWIFTBUILD_EXPORTS SWBBuildServiceBundle) 25 | -------------------------------------------------------------------------------- /Sources/SWBBuildServiceBundle/main.swift: -------------------------------------------------------------------------------- 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 | import SWBBuildService 14 | 15 | await BuildService.main() 16 | -------------------------------------------------------------------------------- /Sources/SWBBuildSystem/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #[[ 2 | This source file is part of the Swift open source project 3 | 4 | Copyright (c) 2014 - 2025 Apple Inc. and the Swift project authors 5 | Licensed under Apache License v2.0 with Runtime Library Exception 6 | 7 | See http://swift.org/LICENSE.txt for license information 8 | See http://swift.org/CONTRIBUTORS.txt for Swift project authors 9 | ]] 10 | 11 | add_library(SWBBuildSystem 12 | BuildManager.swift 13 | BuildOperation.swift 14 | BuildOperationExtension.swift 15 | BuildSystemCache.swift 16 | CleanOperation.swift 17 | DependencyCycleFormatter.swift 18 | SandboxViolations.swift) 19 | set_target_properties(SWBBuildSystem PROPERTIES 20 | Swift_LANGUAGE_VERSION 5) 21 | target_link_libraries(SWBBuildSystem PUBLIC 22 | SWBCore 23 | SWBTaskConstruction 24 | SWBTaskExecution) 25 | 26 | set_target_properties(SWBBuildSystem PROPERTIES 27 | INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY}) 28 | 29 | set_property(GLOBAL APPEND PROPERTY SWIFTBUILD_EXPORTS SWBBuildSystem) 30 | 31 | install(TARGETS SWBBuildSystem 32 | ARCHIVE DESTINATION "${SwiftBuild_INSTALL_LIBDIR}") 33 | -------------------------------------------------------------------------------- /Sources/SWBCAS/CASProtocol.swift: -------------------------------------------------------------------------------- 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 | public import SWBUtil 14 | 15 | public protocol CASProtocol: Sendable { 16 | associatedtype Object: CASObjectProtocol 17 | typealias DataID = Object.DataID 18 | 19 | func store(object: Object) async throws -> DataID 20 | func load(id: DataID) async throws -> Object? 21 | } 22 | 23 | public protocol ActionCacheProtocol: Sendable { 24 | associatedtype DataID: Equatable, Sendable 25 | 26 | func cache(objectID: DataID, forKeyID key: DataID) async throws 27 | func lookupCachedObject(for keyID: DataID) async throws -> DataID? 28 | } 29 | 30 | public protocol CASObjectProtocol: Equatable, Sendable { 31 | associatedtype DataID: Equatable, Sendable 32 | 33 | var data: ByteString { get } 34 | var refs: [DataID] { get } 35 | 36 | init(data: ByteString, refs: [DataID]) 37 | } 38 | -------------------------------------------------------------------------------- /Sources/SWBCAS/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #[[ 2 | This source file is part of the Swift open source project 3 | 4 | Copyright (c) 2014 - 2025 Apple Inc. and the Swift project authors 5 | Licensed under Apache License v2.0 with Runtime Library Exception 6 | 7 | See http://swift.org/LICENSE.txt for license information 8 | See http://swift.org/CONTRIBUTORS.txt for Swift project authors 9 | ]] 10 | 11 | add_library(SWBCAS 12 | CASFSNode.swift 13 | CASProtocol.swift 14 | Errors.swift 15 | plugin_api_t.swift 16 | ToolchainCASPlugin.swift) 17 | set_target_properties(SWBCAS PROPERTIES 18 | Swift_LANGUAGE_VERSION 6) 19 | target_link_libraries(SWBCAS PUBLIC 20 | SWBUtil 21 | SWBCSupport) 22 | 23 | set_target_properties(SWBCAS PROPERTIES 24 | INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY}) 25 | 26 | set_property(GLOBAL APPEND PROPERTY SWIFTBUILD_EXPORTS SWBCAS) 27 | 28 | install(TARGETS SWBCAS 29 | ARCHIVE DESTINATION "${SwiftBuild_INSTALL_LIBDIR}") 30 | -------------------------------------------------------------------------------- /Sources/SWBCLibc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #[[ 2 | This source file is part of the Swift open source project 3 | 4 | Copyright (c) 2014 - 2025 Apple Inc. and the Swift project authors 5 | Licensed under Apache License v2.0 with Runtime Library Exception 6 | 7 | See http://swift.org/LICENSE.txt for license information 8 | See http://swift.org/CONTRIBUTORS.txt for Swift project authors 9 | ]] 10 | 11 | add_library(SWBCLibc 12 | libc.c) 13 | target_include_directories(SWBCLibc INTERFACE 14 | include) 15 | 16 | target_include_directories(SWBCLibc PUBLIC 17 | ${CMAKE_CURRENT_BINARY_DIR}) 18 | 19 | set_property(GLOBAL APPEND PROPERTY SWIFTBUILD_EXPORTS SWBCLibc) 20 | 21 | install(TARGETS SWBCLibc 22 | ARCHIVE DESTINATION "${SwiftBuild_INSTALL_LIBDIR}") 23 | -------------------------------------------------------------------------------- /Sources/SWBCLibc/README.md: -------------------------------------------------------------------------------- 1 | This target is used to pull in some additional C headers underneath SWBLibc since SwiftPM can't build C and Swift sources in the same target. 2 | -------------------------------------------------------------------------------- /Sources/SWBCLibc/include/SWBCLibc.h: -------------------------------------------------------------------------------- 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 | #if defined(__linux__) && !defined(__ANDROID__) 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | typedef struct { 21 | const char *dli_fname; 22 | void *dli_fbase; 23 | const char *dli_sname; 24 | void *dli_saddr; 25 | } Dl_info; 26 | 27 | int dladdr(void *addr, Dl_info *info); 28 | #endif 29 | -------------------------------------------------------------------------------- /Sources/SWBCLibc/include/module.modulemap: -------------------------------------------------------------------------------- 1 | module SWBCLibc { 2 | header "SWBCLibc.h" 3 | export * 4 | } 5 | -------------------------------------------------------------------------------- /Sources/SWBCLibc/libc.c: -------------------------------------------------------------------------------- 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 | int swb_clibc_anchor(void); 14 | 15 | // Stub method to avoid no debug symbol warning from compiler, 16 | // and avoid a TAPI mismatch from compiler optimizations 17 | // potentially removing profiling symbols. 18 | int swb_clibc_anchor(void) { 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /Sources/SWBCSupport/CLibRemarksHelper.c: -------------------------------------------------------------------------------- 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 | #include "CLibRemarksHelper.h" 14 | 15 | #include 16 | #include 17 | 18 | #if __has_include() && !defined(SKIP_LLVM_REMARKS) 19 | #define HAVE_REMARKS 20 | #endif 21 | 22 | // This is hacky: we can't include llvm-c/Remarks.h because the symbols are not weak_import there, so the compiler can remove the check and return 1. 23 | // Note that the other symbols (which are actually used in OptimizationRemarks.swift) are not weak_import, but the library is weak linked, so it won't require them. 24 | // And another (possible) issue with this approach is the fact that we're weak linking libRemarks to SWBCSupport.framework and SWBCore.framework, but the code in SWBCore is not checking the weak_imports itself (it's Swift, so it can't), but instead calling into SWBCSupport (here) to do that. 25 | #ifdef HAVE_REMARKS 26 | extern uint32_t LLVMRemarkVersion(void) __attribute__((weak_import)); 27 | #endif 28 | 29 | bool isLibRemarksAvailable(void) { 30 | #ifdef HAVE_REMARKS 31 | return &LLVMRemarkVersion != NULL; 32 | #else 33 | return false; 34 | #endif 35 | } 36 | -------------------------------------------------------------------------------- /Sources/SWBCSupport/CLibRemarksHelper.h: -------------------------------------------------------------------------------- 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 CLibRemarksHelper_h 14 | #define CLibRemarksHelper_h 15 | 16 | #include 17 | 18 | #include "CSupportDefines.h" 19 | 20 | // Swift has no way of checking if a weak_import symbol is available. 21 | // This function checks if LLVMRemarkVersion from libRemarks.dylib is available, which should be enough to assert the whole library is available as well. 22 | CSUPPORT_EXPORT bool isLibRemarksAvailable(void); 23 | 24 | #endif /* CLibRemarksHelper_h */ 25 | -------------------------------------------------------------------------------- /Sources/SWBCSupport/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #[[ 2 | This source file is part of the Swift open source project 3 | 4 | Copyright (c) 2014 - 2025 Apple Inc. and the Swift project authors 5 | Licensed under Apache License v2.0 with Runtime Library Exception 6 | 7 | See http://swift.org/LICENSE.txt for license information 8 | See http://swift.org/CONTRIBUTORS.txt for Swift project authors 9 | ]] 10 | 11 | add_library(SWBCSupport 12 | CLibclang.cpp 13 | CLibRemarksHelper.c 14 | empty.swift) 15 | # Use swiftc as the linker so we pick up search paths for the blocks runtime, 16 | # and enable C++ interop so it delegates to clang++. 17 | set_target_properties(SWBCSupport PROPERTIES 18 | LINKER_LANGUAGE Swift) 19 | set_target_properties(SWBCSupport PROPERTIES 20 | Swift_MODULE_NAME __SWBCSupport_Empty) 21 | target_link_options(SWBCSupport PRIVATE 22 | -cxx-interoperability-mode=default) 23 | target_compile_definitions(SWBCSupport PRIVATE 24 | $<$:_CRT_SECURE_NO_WARNINGS> 25 | $<$:_CRT_NONSTDC_NO_WARNINGS>) 26 | target_compile_options(SWBCSupport PRIVATE 27 | "$<$:SHELL:-fblocks>") 28 | target_include_directories(SWBCSupport PUBLIC 29 | ${CMAKE_CURRENT_SOURCE_DIR}) 30 | # TODO(compnerd) wire this up with `find_package` 31 | target_link_libraries(SWBCSupport PRIVATE 32 | $<$>:BlocksRuntime>) 33 | 34 | set_property(GLOBAL APPEND PROPERTY SWIFTBUILD_EXPORTS SWBCSupport) 35 | 36 | install(TARGETS SWBCSupport 37 | ARCHIVE DESTINATION "${SwiftBuild_INSTALL_LIBDIR}") 38 | -------------------------------------------------------------------------------- /Sources/SWBCSupport/CSupportDefines.h: -------------------------------------------------------------------------------- 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 | #ifdef _WIN32 14 | #define CSUPPORT_EXPORT __declspec(dllexport) 15 | #else 16 | #define CSUPPORT_EXPORT 17 | #endif 18 | -------------------------------------------------------------------------------- /Sources/SWBCSupport/SWBCSupport.h: -------------------------------------------------------------------------------- 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 | // This framework defines functionality for Swift Build which is not presently written in Swift for some reason. 14 | 15 | #ifndef SWBCSUPPORT_H 16 | #define SWBCSUPPORT_H 17 | 18 | #if __has_include() 19 | #include 20 | #endif 21 | 22 | #include "CLibclang.h" 23 | #include "CLibRemarksHelper.h" 24 | #include "PluginAPI.h" 25 | #include "PluginAPI_functions.h" 26 | #include "PluginAPI_types.h" 27 | 28 | #endif // SWBCSUPPORT_H 29 | -------------------------------------------------------------------------------- /Sources/SWBCSupport/empty.swift: -------------------------------------------------------------------------------- 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 | // This file is intentionally left blank. When built with CMake, 14 | // SWBCSupport sets the link language to Swift w/ C++ interop 15 | // to find libblocksruntime, and requires at least one Swift 16 | // source file to avoid downstream issues. 17 | -------------------------------------------------------------------------------- /Sources/SWBCSupport/module.modulemap: -------------------------------------------------------------------------------- 1 | module SWBCSupport { 2 | header "SWBCSupport.h" 3 | export * 4 | } 5 | -------------------------------------------------------------------------------- /Sources/SWBCore/Extensions/DeveloperDirectoryExtension.swift: -------------------------------------------------------------------------------- 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 | public import SWBUtil 14 | 15 | public struct DeveloperDirectoryExtensionPoint: ExtensionPoint { 16 | public typealias ExtensionProtocol = DeveloperDirectoryExtension 17 | 18 | public static let name = "DeveloperDirectoryExtensionPoint" 19 | 20 | public init() {} 21 | } 22 | 23 | public protocol DeveloperDirectoryExtension: Sendable { 24 | func fallbackDeveloperDirectory(hostOperatingSystem: OperatingSystem) async throws -> Core.DeveloperPath? 25 | } 26 | -------------------------------------------------------------------------------- /Sources/SWBCore/Extensions/DiagnosticToolingExtension.swift: -------------------------------------------------------------------------------- 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 | public import SWBUtil 14 | 15 | /// An extension point for tooling used to diagnose build system issues.. 16 | public struct DiagnosticToolingExtensionPoint: ExtensionPoint { 17 | public typealias ExtensionProtocol = DiagnosticToolingExtension 18 | 19 | public static let name = "DiagnosticToolingExtensionPoint" 20 | 21 | public init() {} 22 | } 23 | 24 | public protocol DiagnosticToolingExtension: Sendable { 25 | func initialize() 26 | } 27 | -------------------------------------------------------------------------------- /Sources/SWBCore/Extensions/FeatureAvailabilityExtension.swift: -------------------------------------------------------------------------------- 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 | public import SWBUtil 14 | 15 | public struct FeatureAvailabilityExtensionPoint: ExtensionPoint { 16 | public typealias ExtensionProtocol = FeatureAvailabilityExtension 17 | 18 | public static let name = "FeatureAvailabilityExtension" 19 | 20 | public init() {} 21 | } 22 | 23 | public protocol FeatureAvailabilityExtension: Sendable { 24 | var supportsCompilationCaching: Bool { get } 25 | } 26 | -------------------------------------------------------------------------------- /Sources/SWBCore/Extensions/InputFileGroupingStrategyExtension.swift: -------------------------------------------------------------------------------- 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 | public import SWBUtil 14 | 15 | public struct InputFileGroupingStrategyExtensionPoint: ExtensionPoint, Sendable { 16 | public typealias ExtensionProtocol = InputFileGroupingStrategyExtension 17 | 18 | public static let name = "InputFileGroupingStrategyExtensionPoint" 19 | 20 | public init() {} 21 | } 22 | 23 | public protocol InputFileGroupingStrategyExtension: Sendable { 24 | func groupingStrategies() -> [String: any InputFileGroupingStrategyFactory] 25 | func fileTypesCompilingToSwiftSources() -> [String] 26 | } 27 | -------------------------------------------------------------------------------- /Sources/SWBCore/Extensions/SDKVariantInfoExtension.swift: -------------------------------------------------------------------------------- 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 | public import SWBUtil 14 | 15 | /// An extension point for services. 16 | public struct SDKVariantInfoExtensionPoint: ExtensionPoint { 17 | public typealias ExtensionProtocol = SDKVariantInfoExtension 18 | 19 | public static let name = "SDKVariantInfoExtensionPoint" 20 | 21 | public init() {} 22 | } 23 | 24 | // FIXME: Generalize this to be less specific to Mac Catalyst 25 | public protocol SDKVariantInfoExtension: Sendable { 26 | var supportsMacCatalystMacroNames: Set { get } 27 | var disallowedMacCatalystMacroNames: Set { get } 28 | var macCatalystDeriveBundleIDMacroNames: Set { get } 29 | } 30 | -------------------------------------------------------------------------------- /Sources/SWBCore/Extensions/ToolchainRegistryExtension.swift: -------------------------------------------------------------------------------- 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 | public import SWBUtil 14 | private import SWBMacro 15 | 16 | public struct ToolchainRegistryExtensionPoint: ExtensionPoint, Sendable { 17 | public typealias ExtensionProtocol = ToolchainRegistryExtension 18 | 19 | public static let name = "ToolchainRegistryExtensionPoint" 20 | 21 | public init() {} 22 | } 23 | 24 | public protocol ToolchainRegistryExtension: Sendable { 25 | func additionalToolchains(context: any ToolchainRegistryExtensionAdditionalToolchainsContext) async throws -> [Toolchain] 26 | } 27 | 28 | extension ToolchainRegistryExtension { 29 | public func additionalToolchains(context: any ToolchainRegistryExtensionAdditionalToolchainsContext) async throws -> [Toolchain] { 30 | [] 31 | } 32 | } 33 | 34 | public protocol ToolchainRegistryExtensionAdditionalToolchainsContext: Sendable { 35 | var hostOperatingSystem: OperatingSystem { get } 36 | var toolchainRegistry: ToolchainRegistry { get } 37 | var fs: any FSProxy { get } 38 | } 39 | -------------------------------------------------------------------------------- /Sources/SWBCore/LibclangVendored/ArrayExtensions.swift: -------------------------------------------------------------------------------- 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 | public extension Array where Element == String { 14 | /// Converts a C string array into a Swift array of Strings. 15 | static func fromCStringArray(_ cStringArray: UnsafePointer?>) -> [String] { 16 | // TODO: Perhaps this can be upstreamed to TSC? 17 | return sequence(state: cStringArray) { ptr in 18 | defer { ptr += 1 } 19 | return ptr.pointee 20 | }.map { String.init(cString: $0 as UnsafePointer) } 21 | } 22 | } 23 | 24 | extension UnsafeMutablePointer?> { 25 | func toLazyStringSequence() -> some Sequence { 26 | return sequence(state: self) { ptr in 27 | defer { ptr += 1 } 28 | return ptr.pointee.map { String(cString: $0) } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Sources/SWBCore/LibclangVendored/CStringArray.swift: -------------------------------------------------------------------------------- 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 | import Foundation 14 | 15 | /// `CStringArray` represents a C null-terminated array of pointers to C strings. 16 | /// 17 | /// The lifetime of the C strings will correspond to the lifetime of the `CStringArray` 18 | /// instance so be careful about copying the buffer as it may contain dangling pointers. 19 | public final class CStringArray { 20 | /// The null-terminated array of C string pointers. 21 | public let cArray: [UnsafeMutablePointer?] 22 | 23 | /// Creates an instance from an array of strings. 24 | public init(_ array: [String]) { 25 | cArray = array.map({ $0.withCString({ strdup($0) }) }) + [nil] 26 | } 27 | 28 | deinit { 29 | for case let element? in cArray { 30 | free(element) 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Sources/SWBCore/MacCatalystInfo.swift: -------------------------------------------------------------------------------- 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 | /// Utility to avoid duplicating implementation details about macCatalyst. 14 | public struct MacCatalystInfo { 15 | /// Effective platform name to use for the `SWBLocalizationInfo` API. 16 | public static let localizationEffectivePlatformName = "maccatalyst" 17 | 18 | /// Bundle identifier prefix for targets which request a derived bundle identifier. Includes the ending period. 19 | public static let bundleIdPrefix = "maccatalyst." 20 | 21 | /// `BUILT_PRODUCTS_DIR` suffix for public SDK builds. 22 | public static let publicSDKBuiltProductsDirSuffix = "-maccatalyst" 23 | 24 | /// Name of the SDK variant used for the `SDK_VARIANT` build setting. 25 | public static let sdkVariantName = "iosmac" 26 | 27 | private init() { } 28 | } 29 | -------------------------------------------------------------------------------- /Sources/SWBCore/PlatformEnvironment.swift: -------------------------------------------------------------------------------- 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 | import SWBUtil 14 | import Foundation 15 | 16 | extension UserInfo { 17 | public func addingPlatformDefaults(from env: [String: String]) async throws -> Self { 18 | var userInfo = self 19 | for (key, value) in env { 20 | userInfo.buildSystemEnvironment.setValueIfNeeded(value, forKey: key) 21 | userInfo.processEnvironment.setValueIfNeeded(value, forKey: key) 22 | } 23 | return userInfo 24 | } 25 | } 26 | 27 | fileprivate extension Dictionary where Key == String, Value == String { 28 | mutating func setValueIfNeeded(_ value: String, forKey key: String) { 29 | if !contains(key) { 30 | self[key] = value 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Sources/SWBCore/Process.swift: -------------------------------------------------------------------------------- 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 | import SWBLibc 14 | public import enum SWBUtil.Processes 15 | 16 | extension Processes.ExitStatus { 17 | /// Represents a canceled task as an interrupt signal. 18 | /// Matches llbuild's LaneBasedExecutionEngine when canceling outstanding tasks. 19 | public static var buildSystemCanceledTask: Self { 20 | .uncaughtSignal(SIGINT) 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Sources/SWBCore/ProjectModel/DependencyInfoFormat.swift: -------------------------------------------------------------------------------- 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 | public import SWBProtocol 14 | public import SWBMacro 15 | 16 | public enum DependencyInfoFormat: Sendable { 17 | /// A Darwin linker style dependency info file. 18 | case dependencyInfo(MacroStringExpression) 19 | 20 | /// A '.d'-style Makefile. 21 | case makefile(MacroStringExpression) 22 | 23 | /// A list of multiple '.d'-style Makefiles. 24 | case makefiles([MacroStringExpression]) 25 | } 26 | 27 | 28 | extension DependencyInfoFormat { 29 | public static func fromPIF(_ dependencyInfo: SWBProtocol.DependencyInfo?, pifLoader: PIFLoader) -> DependencyInfoFormat? { 30 | guard let dependencyInfo else { 31 | return nil 32 | } 33 | 34 | switch dependencyInfo { 35 | case .dependencyInfo(let path): 36 | return .dependencyInfo(pifLoader.userNamespace.parseString(path)) 37 | case .makefile(let path): 38 | return .makefile(pifLoader.userNamespace.parseString(path)) 39 | case .makefiles(let paths): 40 | return .makefiles(paths.map{ pifLoader.userNamespace.parseString($0) }) 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Sources/SWBCore/ProjectModel/ReferenceLookupContext.swift: -------------------------------------------------------------------------------- 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 | public protocol ReferenceLookupContext { 14 | func lookupReference(for guid: String) -> Reference? 15 | } 16 | -------------------------------------------------------------------------------- /Sources/SWBCore/SpecImplementations/Tools/Gate.swift: -------------------------------------------------------------------------------- 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 | // This is a stub spec type, used for gate tasks. 14 | // 15 | // FIXME: We shouldn't need this, but there are some hard coded assumptions about being able to serialize task types currently. 16 | public final class GateSpec: CommandLineToolSpec, SpecImplementationType, @unchecked Sendable { 17 | public static let identifier = "com.apple.build-tools.gate" 18 | 19 | public class func construct(registry: SpecRegistry, proxy: SpecProxy) -> Spec { 20 | return GateSpec(registry, proxy, ruleInfoTemplate: [], commandLineTemplate: []) 21 | } 22 | 23 | override public func constructTasks(_ cbc: CommandBuildContext, _ delegate: any TaskGenerationDelegate) async { 24 | fatalError("unexpected call") 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Sources/SWBCore/SpecImplementations/Tools/GenerateAppPlaygroundAssetCatalog.swift: -------------------------------------------------------------------------------- 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 | import SWBUtil 14 | 15 | public final class GenerateAppPlaygroundAssetCatalog: GenericCommandLineToolSpec, SpecIdentifierType, @unchecked Sendable { 16 | public static let identifier: String = "com.apple.tools.generate-app-playground-asset-catalog" 17 | 18 | public override func createTaskAction(_ cbc: CommandBuildContext, _ delegate: any TaskGenerationDelegate) -> (any PlannedTaskAction)? { 19 | return delegate.taskActionCreationDelegate.createDeferredExecutionTaskActionIfRequested(userPreferences: delegate.userPreferences) 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Sources/SWBCore/SpecImplementations/Tools/LaunchServicesRegisterTool.swift: -------------------------------------------------------------------------------- 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 | final class LaunchServicesRegisterToolSpec : GenericCommandLineToolSpec, SpecIdentifierType, @unchecked Sendable { 14 | static let identifier = "com.apple.build-tasks.ls-register-url" 15 | 16 | override func createTaskAction(_ cbc: CommandBuildContext, _ delegate: any TaskGenerationDelegate) -> (any PlannedTaskAction)? { 17 | delegate.taskActionCreationDelegate.createLSRegisterURLTaskAction() 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Sources/SWBCore/SpecImplementations/Tools/MkdirTool.swift: -------------------------------------------------------------------------------- 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 | import SWBUtil 14 | 15 | public final class MkdirToolSpec : CommandLineToolSpec, SpecIdentifierType, @unchecked Sendable { 16 | public static let identifier = "com.apple.tools.mkdir" 17 | 18 | override public func constructTasks(_ cbc: CommandBuildContext, _ delegate: any TaskGenerationDelegate) async { 19 | let output = cbc.output 20 | // We must create a virtual output usable for mutable node ordering. 21 | let outputs: [any PlannedNode] = [delegate.createNode(output), delegate.createVirtualNode("MkDir \(output.str)")] 22 | delegate.createTask( 23 | type: self, ruleInfo: ["MkDir", output.str], 24 | commandLine: ["/bin/mkdir", "-p", output.str], 25 | environment: EnvironmentBindings(), 26 | workingDirectory: cbc.producer.defaultWorkingDirectory, 27 | inputs: [], outputs: outputs, action: nil, 28 | execDescription: resolveExecutionDescription(cbc, delegate), 29 | preparesForIndexing: cbc.preparesForIndexing, 30 | enableSandboxing: enableSandboxing 31 | ) 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Sources/SWBCore/SpecImplementations/Tools/PLUtilTool.swift: -------------------------------------------------------------------------------- 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 | final class PLUtilToolSpec : CommandLineToolSpec, SpecIdentifierType, @unchecked Sendable { 14 | static let identifier = "com.apple.tools.plutil" 15 | } 16 | -------------------------------------------------------------------------------- /Sources/SWBCore/SpecImplementations/Tools/ValidateProductTool.swift: -------------------------------------------------------------------------------- 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 | public final class ValidateProductToolSpec: GenericCommandLineToolSpec, SpecIdentifierType, @unchecked Sendable { 14 | public static let identifier = "com.apple.build-tools.platform.validate" 15 | 16 | public override func createTaskAction(_ cbc: CommandBuildContext, _ delegate: any TaskGenerationDelegate) -> (any PlannedTaskAction)? { 17 | delegate.taskActionCreationDelegate.createValidateProductTaskAction() 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Sources/SWBCore/Specs/ExternalBuildSystem.xcspec: -------------------------------------------------------------------------------- 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 | ( 14 | { 15 | Type = BuildSystem; 16 | Identifier = com.apple.build-system.external; 17 | BasedOn = com.apple.build-system.core; 18 | Name = "External Build System"; 19 | Options = ( 20 | ); 21 | } 22 | ) 23 | -------------------------------------------------------------------------------- /Sources/SWBCore/TargetPlatformDiagnostics.swift: -------------------------------------------------------------------------------- 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 | public import SWBUtil 14 | 15 | extension Diagnostic { 16 | public static func unavailableTargetTypeDiagnosticString(targetTypeDescription: String, platformInfoLookup: any PlatformInfoLookup, buildPlatforms: Set) -> String { 17 | return "\(targetTypeDescription)s are not available when building for \(buildPlatforms.displayName(infoLookup: platformInfoLookup))." 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Sources/SWBCore/Tuning.swift: -------------------------------------------------------------------------------- 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 | /// A namespace for "tuning" parameters (magic constants). 14 | public struct Tuning { 15 | /// The TTL for the in-memory incremental PIF object cache. 16 | public static let pifCacheTTL = Duration.seconds(60) 17 | 18 | /// The TTL for each WorkspaceContext's Settings cache. 19 | public static let workspaceSettingsCacheTTL = Duration.seconds(60) 20 | } 21 | -------------------------------------------------------------------------------- /Sources/SWBGenericUnixPlatform/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #[[ 2 | This source file is part of the Swift open source project 3 | 4 | Copyright (c) 2014 - 2025 Apple Inc. and the Swift project authors 5 | Licensed under Apache License v2.0 with Runtime Library Exception 6 | 7 | See http://swift.org/LICENSE.txt for license information 8 | See http://swift.org/CONTRIBUTORS.txt for Swift project authors 9 | ]] 10 | 11 | add_library(SWBGenericUnixPlatform 12 | Plugin.swift) 13 | SwiftBuild_Bundle(MODULE SWBGenericUnixPlatform FILES 14 | Specs/Unix.xcspec 15 | Specs/UnixCompile.xcspec 16 | Specs/UnixLd.xcspec 17 | Specs/UnixLibtool.xcspec) 18 | target_link_libraries(SWBGenericUnixPlatform PUBLIC 19 | SWBCore 20 | SWBUtil) 21 | 22 | set_target_properties(SWBGenericUnixPlatform PROPERTIES 23 | INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY}) 24 | 25 | set_property(GLOBAL APPEND PROPERTY SWIFTBUILD_EXPORTS SWBGenericUnixPlatform) 26 | 27 | install(TARGETS SWBGenericUnixPlatform 28 | ARCHIVE DESTINATION "${SwiftBuild_INSTALL_LIBDIR}") 29 | -------------------------------------------------------------------------------- /Sources/SWBGenericUnixPlatformPlugin/PluginMain.swift: -------------------------------------------------------------------------------- 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 | import SWBUtil 14 | import SWBCore 15 | import SWBGenericUnixPlatform 16 | 17 | @_cdecl("initializePlugin") 18 | @PluginExtensionSystemActor public func main(_ ptr: UnsafeRawPointer) { 19 | initializePlugin(Unmanaged.fromOpaque(ptr).takeUnretainedValue()) 20 | } 21 | -------------------------------------------------------------------------------- /Sources/SWBLLBuild/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #[[ 2 | This source file is part of the Swift open source project 3 | 4 | Copyright (c) 2014 - 2025 Apple Inc. and the Swift project authors 5 | Licensed under Apache License v2.0 with Runtime Library Exception 6 | 7 | See http://swift.org/LICENSE.txt for license information 8 | See http://swift.org/CONTRIBUTORS.txt for Swift project authors 9 | ]] 10 | 11 | add_library(SWBLLBuild 12 | LowLevelBuildSystem.swift) 13 | set_target_properties(SWBLLBuild PROPERTIES 14 | Swift_LANGUAGE_VERSION 6) 15 | target_link_libraries(SWBLLBuild PUBLIC 16 | SWBUtil 17 | $<$>:llbuildSwift>) 18 | 19 | set_target_properties(SWBLLBuild PROPERTIES 20 | INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY}) 21 | 22 | set_property(GLOBAL APPEND PROPERTY SWIFTBUILD_EXPORTS SWBLLBuild) 23 | 24 | install(TARGETS SWBLLBuild 25 | ARCHIVE DESTINATION "${SwiftBuild_INSTALL_LIBDIR}") 26 | -------------------------------------------------------------------------------- /Sources/SWBLibc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #[[ 2 | This source file is part of the Swift open source project 3 | 4 | Copyright (c) 2014 - 2025 Apple Inc. and the Swift project authors 5 | Licensed under Apache License v2.0 with Runtime Library Exception 6 | 7 | See http://swift.org/LICENSE.txt for license information 8 | See http://swift.org/CONTRIBUTORS.txt for Swift project authors 9 | ]] 10 | 11 | add_library(SWBLibc 12 | libc.swift) 13 | set_target_properties(SWBLibc PROPERTIES 14 | Swift_LANGUAGE_VERSION 6) 15 | target_link_libraries(SWBLibc PUBLIC 16 | SWBCLibc) 17 | 18 | # FIXME: why is this needed? We should be wiring up the Swift_MODULE_DIRECTORY 19 | # without this explicit configuration. 20 | target_include_directories(SWBLibc PUBLIC 21 | ${CMAKE_CURRENT_BINARY_DIR}) 22 | 23 | set_target_properties(SWBLibc PROPERTIES 24 | INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY}) 25 | 26 | set_property(GLOBAL APPEND PROPERTY SWIFTBUILD_EXPORTS SWBLibc) 27 | 28 | install(TARGETS SWBLibc 29 | ARCHIVE DESTINATION "${SwiftBuild_INSTALL_LIBDIR}") 30 | -------------------------------------------------------------------------------- /Sources/SWBLibc/libc.swift: -------------------------------------------------------------------------------- 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 | #if canImport(Darwin) 14 | @_exported import Darwin.C 15 | #elseif os(Windows) 16 | @_exported import ucrt 17 | @_exported import CRT 18 | @_exported import WinSDK 19 | #elseif canImport(Glibc) 20 | @_exported import Glibc 21 | #elseif canImport(Musl) 22 | @_exported import Musl 23 | #elseif canImport(Android) 24 | @_exported import Android 25 | #else 26 | #error("Missing libc or equivalent") 27 | #endif 28 | @_exported import SWBCLibc 29 | 30 | // Stub method to avoid no debug symbol warning from compiler, 31 | // and avoid a TAPI mismatch from compiler optimizations 32 | // potentially removing profiling symbols. 33 | public func swb_libc_anchor() -> Never { 34 | preconditionFailure() 35 | } 36 | -------------------------------------------------------------------------------- /Sources/SWBMacro/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #[[ 2 | This source file is part of the Swift open source project 3 | 4 | Copyright (c) 2014 - 2025 Apple Inc. and the Swift project authors 5 | Licensed under Apache License v2.0 with Runtime Library Exception 6 | 7 | See http://swift.org/LICENSE.txt for license information 8 | See http://swift.org/CONTRIBUTORS.txt for Swift project authors 9 | ]] 10 | 11 | add_library(SWBMacro 12 | MacroCondition.swift 13 | MacroConditionExpression.swift 14 | MacroConditionParameter.swift 15 | MacroConditionSet.swift 16 | MacroConfigFileDiagnostic.swift 17 | MacroConfigFileParser.swift 18 | MacroDeclaration.swift 19 | MacroEvaluationProgram.swift 20 | MacroEvaluationScope.swift 21 | MacroExpression.swift 22 | MacroExpressionDiagnostic.swift 23 | MacroExpressionParsing.swift 24 | MacroNamespace.swift 25 | MacroType.swift 26 | MacroValueAssignmentTable.swift) 27 | set_target_properties(SWBMacro PROPERTIES 28 | Swift_LANGUAGE_VERSION 6) 29 | target_link_libraries(SWBMacro PUBLIC 30 | SWBUtil 31 | SwiftDriver 32 | TSCBasic) 33 | 34 | set_target_properties(SWBMacro PROPERTIES 35 | INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY}) 36 | 37 | set_property(GLOBAL APPEND PROPERTY SWIFTBUILD_EXPORTS SWBMacro) 38 | 39 | install(TARGETS SWBMacro 40 | ARCHIVE DESTINATION "${SwiftBuild_INSTALL_LIBDIR}") 41 | -------------------------------------------------------------------------------- /Sources/SWBMacro/MacroType.swift: -------------------------------------------------------------------------------- 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 | /// Represents a type of macro value. There are currently four types: booleans, strings, string lists, and user-defined. Booleans are parsed as strings, but interpreted as boolean after evaluation (in a manner similar to NSString's `-boolValue` method). Values of user-defined macros are interpreted as booleans, strings, or string lists depending on context. 14 | public enum MacroType: Sendable { 15 | case boolean 16 | case string 17 | case stringList 18 | case userDefined 19 | case path 20 | case pathList 21 | 22 | func matchesExpressionType(_ expression: MacroExpression) -> Bool { 23 | switch self { 24 | case .boolean, .string, .path: 25 | return expression is MacroStringExpression 26 | case .stringList, .userDefined, .pathList: 27 | return expression is MacroStringListExpression 28 | } 29 | } 30 | } 31 | 32 | public protocol EnumerationMacroType: Sendable { 33 | init?(rawValue: String) 34 | var rawValue: String { get } 35 | static var defaultValue: Self { get } 36 | } 37 | -------------------------------------------------------------------------------- /Sources/SWBProjectModel/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #[[ 2 | This source file is part of the Swift open source project 3 | 4 | Copyright (c) 2014 - 2025 Apple Inc. and the Swift project authors 5 | Licensed under Apache License v2.0 with Runtime Library Exception 6 | 7 | See http://swift.org/LICENSE.txt for license information 8 | See http://swift.org/CONTRIBUTORS.txt for Swift project authors 9 | ]] 10 | 11 | add_library(SWBProjectModel 12 | IDE/IDEPIFGenerating.swift 13 | IDE/IDEPIFGUID.swift 14 | IDE/IDEPIFObject.swift 15 | IDE/IDEPIFObjectInfo.swift 16 | IDE/IDEPIFSerializer.swift 17 | IDE/IDESwiftPackageExtensions.swift 18 | PIFGenerationModel.swift) 19 | set_target_properties(SWBProjectModel PROPERTIES 20 | Swift_LANGUAGE_VERSION 6) 21 | target_link_libraries(SWBProjectModel PUBLIC 22 | SWBProtocol) 23 | 24 | set_target_properties(SWBProjectModel PROPERTIES 25 | INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY}) 26 | 27 | set_property(GLOBAL APPEND PROPERTY SWIFTBUILD_EXPORTS SWBProjectModel) 28 | 29 | install(TARGETS SWBProjectModel 30 | ARCHIVE DESTINATION "${SwiftBuild_INSTALL_LIBDIR}") 31 | -------------------------------------------------------------------------------- /Sources/SWBProjectModel/IDE/IDEPIFGenerating.swift: -------------------------------------------------------------------------------- 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 | import Foundation 14 | 15 | /// Protocol description any type which can be represented in the PIF. 16 | public protocol IDEPIFGenerating { 17 | 18 | /// The PIF global ID for the receiver, which will be unique within the top-level object of the PIF. 19 | var PIFGUID: IDEPIFGUID? { get } 20 | 21 | /// Returns the PIF representation - dictionary, string, integer, boolean - for the receiver, or nil if the receiver does not have a meaningful PIF representation. If nil is returned, that effectively means the receiver will be skipped in PIF generation. 22 | func pifRepresentation(serializer: any IDEPIFSerializer) -> Any? 23 | 24 | } 25 | -------------------------------------------------------------------------------- /Sources/SWBProjectModel/IDE/IDEPIFObject.swift: -------------------------------------------------------------------------------- 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 | import Foundation 14 | 15 | 16 | /// Protocol describing top-level PIF objects. 17 | public protocol IDEPIFObject : IDEPIFGenerating { 18 | /// The name of the PIF object type (workspace, project, or target). 19 | static var pifObjectTypeName: String { get } 20 | /// Returns the list of subobjects. 21 | var pifSubobjects: [any IDEPIFObject] { get } 22 | /// Returns the PIF object info for the object. 23 | func pifInfo(for serializer: T) -> IDEPIFObjectInfo 24 | } 25 | -------------------------------------------------------------------------------- /Sources/SWBProjectModel/IDE/IDEPIFSerializer.swift: -------------------------------------------------------------------------------- 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 | import Foundation 14 | 15 | /// The PIF serializer interface. 16 | public protocol IDEPIFSerializer { 17 | /// Get the signature for the given PIF object. 18 | func objectSignature(_ object: any IDEPIFObject) -> String 19 | } 20 | -------------------------------------------------------------------------------- /Sources/SWBProtocol/ProjectModel/ImpartedBuildProperties.swift: -------------------------------------------------------------------------------- 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 | public import SWBUtil 14 | 15 | public struct ImpartedBuildProperties: Sendable { 16 | public let buildSettings: [BuildConfiguration.MacroBindingSource] 17 | 18 | public init(buildSettings: [BuildConfiguration.MacroBindingSource]) { 19 | self.buildSettings = buildSettings 20 | } 21 | } 22 | 23 | // MARK: SerializableCodable 24 | 25 | extension ImpartedBuildProperties: PendingSerializableCodable { 26 | public func legacySerialize(to serializer: T) { 27 | serializer.serializeAggregate(1) { 28 | serializer.serialize(buildSettings) 29 | } 30 | } 31 | 32 | public init(fromLegacy deserializer: any Deserializer) throws { 33 | try deserializer.beginAggregate(1) 34 | self.buildSettings = try deserializer.deserialize() 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Sources/SWBQNXPlatform/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #[[ 2 | This source file is part of the Swift open source project 3 | 4 | Copyright (c) 2014 - 2025 Apple Inc. and the Swift project authors 5 | Licensed under Apache License v2.0 with Runtime Library Exception 6 | 7 | See http://swift.org/LICENSE.txt for license information 8 | See http://swift.org/CONTRIBUTORS.txt for Swift project authors 9 | ]] 10 | 11 | add_library(SWBQNXPlatform 12 | Plugin.swift 13 | QNXSDP.swift) 14 | SwiftBuild_Bundle(MODULE SWBQNXPlatform FILES 15 | Specs/QNX.xcspec 16 | Specs/QNXCompile.xcspec 17 | Specs/QNXLd.xcspec 18 | Specs/QNXLibtool.xcspec) 19 | target_link_libraries(SWBQNXPlatform PUBLIC 20 | SWBCore 21 | SWBMacro 22 | SWBUtil) 23 | 24 | set_target_properties(SWBQNXPlatform PROPERTIES 25 | INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY}) 26 | 27 | set_property(GLOBAL APPEND PROPERTY SWIFTBUILD_EXPORTS SWBQNXPlatform) 28 | 29 | install(TARGETS SWBQNXPlatform 30 | ARCHIVE DESTINATION "${SwiftBuild_INSTALL_LIBDIR}") 31 | -------------------------------------------------------------------------------- /Sources/SWBQNXPlatformPlugin/PluginMain.swift: -------------------------------------------------------------------------------- 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 | import SWBUtil 14 | import SWBCore 15 | import SWBQNXPlatform 16 | 17 | @_cdecl("initializePlugin") 18 | @PluginExtensionSystemActor public func main(_ ptr: UnsafeRawPointer) { 19 | initializePlugin(Unmanaged.fromOpaque(ptr).takeUnretainedValue()) 20 | } 21 | -------------------------------------------------------------------------------- /Sources/SWBServiceCore/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #[[ 2 | This source file is part of the Swift open source project 3 | 4 | Copyright (c) 2014 - 2025 Apple Inc. and the Swift project authors 5 | Licensed under Apache License v2.0 with Runtime Library Exception 6 | 7 | See http://swift.org/LICENSE.txt for license information 8 | See http://swift.org/CONTRIBUTORS.txt for Swift project authors 9 | ]] 10 | 11 | add_library(SWBServiceCore 12 | Request.swift 13 | Service.swift 14 | ServiceEntryPoint.swift 15 | ServiceExtensionPoint.swift 16 | ServiceHostConnection.swift) 17 | set_target_properties(SWBServiceCore PROPERTIES 18 | Swift_LANGUAGE_VERSION 6) 19 | target_link_libraries(SWBServiceCore PUBLIC 20 | SWBProtocol) 21 | 22 | set_target_properties(SWBServiceCore PROPERTIES 23 | INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY}) 24 | 25 | set_property(GLOBAL APPEND PROPERTY SWIFTBUILD_EXPORTS SWBServiceCore) 26 | 27 | install(TARGETS SWBServiceCore 28 | ARCHIVE DESTINATION "${SwiftBuild_INSTALL_LIBDIR}") 29 | -------------------------------------------------------------------------------- /Sources/SWBServiceCore/ServiceExtensionPoint.swift: -------------------------------------------------------------------------------- 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 | public import SWBUtil 14 | 15 | /// An extension point for services. 16 | public struct ServiceExtensionPoint: ExtensionPoint { 17 | public typealias ExtensionProtocol = ServiceExtension 18 | 19 | public static let name = "ServiceExtensionPoint" 20 | 21 | public init() {} 22 | } 23 | 24 | public protocol ServiceExtension: Sendable { 25 | /// Called by services upon initialization. 26 | /// 27 | /// Clients are expected to use this as a place to register additional handlers on the service. 28 | func register(_ service: Service) 29 | } 30 | -------------------------------------------------------------------------------- /Sources/SWBTaskConstruction/TaskProducers/OtherTaskProducers/DevelopmentAssetsTaskProducer.swift: -------------------------------------------------------------------------------- 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 | import SWBCore 14 | import SWBUtil 15 | import SWBMacro 16 | 17 | final class DevelopmentAssetsTaskProducer: StandardTaskProducer, TaskProducer { 18 | func generateTasks() async -> [any PlannedTask] { 19 | let scope = context.settings.globalScope 20 | guard scope.evaluate(BuiltinMacros.VALIDATE_DEVELOPMENT_ASSET_PATHS) != .no && !scope.evaluate(BuiltinMacros.DEVELOPMENT_ASSET_PATHS).isEmpty else { 21 | return [] 22 | } 23 | 24 | var tasks: [any PlannedTask] = [] 25 | await appendGeneratedTasks(&tasks) { delegate in 26 | await context.developmentAssetsSpec?.constructTasks(CommandBuildContext(producer: context, scope: scope, inputs: []), delegate) 27 | } 28 | return tasks 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Sources/SWBTaskConstruction/TaskProducers/OtherTaskProducers/ExternalTargetTaskProducer.swift: -------------------------------------------------------------------------------- 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 | import SWBCore 14 | import SWBUtil 15 | 16 | final class ExternalTargetTaskProducer: StandardTaskProducer, TaskProducer { 17 | override var defaultTaskOrderingOptions: TaskOrderingOptions { 18 | // An external target task must block its dependencies. 19 | return [.compilationRequirement, .compilation] 20 | } 21 | 22 | func generateTasks() async -> [any PlannedTask] { 23 | let target = context.configuredTarget!.target as! ExternalTarget 24 | var tasks = [any PlannedTask]() 25 | await appendGeneratedTasks(&tasks) { delegate in 26 | await ShellScriptTaskProducer.constructTasksForExternalTarget(target, context, cbc: CommandBuildContext(producer: context, scope: context.settings.globalScope, inputs: []), delegate: delegate) 27 | } 28 | return tasks 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Sources/SWBTaskExecution/TaskResult.swift: -------------------------------------------------------------------------------- 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 | package import SWBCore 14 | import SWBUtil 15 | package import SWBLLBuild 16 | 17 | extension TaskResult { 18 | package init(_ result: CommandExtendedResult) { 19 | guard let exitStatus = Processes.ExitStatus(rawValue: result.exitStatus) else { 20 | self = .failedSetup 21 | return 22 | } 23 | 24 | self = .exit(exitStatus: exitStatus, metrics: result.metrics.map { .init($0, wcDuration: nil) }) 25 | } 26 | } 27 | 28 | extension SWBCore.CommandMetrics { 29 | init(_ metrics: SWBLLBuild.CommandMetrics, wcDuration: ElapsedTimerInterval?) { 30 | self.init(utime: metrics.utime, stime: metrics.stime, maxRSS: metrics.maxRSS, wcDuration: wcDuration) 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Sources/SWBTestSupport/Deferrable.swift: -------------------------------------------------------------------------------- 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 | package actor Deferrable { 14 | private var workItems: [() async -> Void] = [] 15 | 16 | fileprivate init() {} 17 | 18 | package func addBlock(_ work: @Sendable @escaping () async -> Void) { 19 | workItems.append(work) 20 | } 21 | 22 | fileprivate func runBlocks() async { 23 | for workItem in workItems.reversed() { 24 | await workItem() 25 | } 26 | } 27 | } 28 | 29 | package func withAsyncDeferrable(_ work: (Deferrable) async throws -> T) async throws -> T { 30 | let deferrable = Deferrable() 31 | let result: Result 32 | do { 33 | result = try await .success(work(deferrable)) 34 | } catch { 35 | result = .failure(error) 36 | } 37 | await deferrable.runBlocks() 38 | return try result.get() 39 | } 40 | -------------------------------------------------------------------------------- /Sources/SWBTestSupport/EnvironmentKey.swift: -------------------------------------------------------------------------------- 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 | public import SWBUtil 14 | 15 | extension EnvironmentKey { 16 | public static let externalToolchainsDir = Self("EXTERNAL_TOOLCHAINS_DIR") 17 | } 18 | -------------------------------------------------------------------------------- /Sources/SWBTestSupport/SwiftTestingExtensions.swift: -------------------------------------------------------------------------------- 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 | package import Testing 14 | 15 | // Helper functions to work around https://github.com/swiftlang/swift-testing/issues/162 Value not shown in error message when an expectation condition has effects (try/await) 16 | 17 | package func expectEqual(_ lhs: T, _ rhs: T, sourceLocation: SourceLocation = #_sourceLocation) { 18 | #expect(lhs == rhs, sourceLocation: sourceLocation) 19 | } 20 | -------------------------------------------------------------------------------- /Sources/SWBUniversalPlatform/CopyPlistFile.swift: -------------------------------------------------------------------------------- 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 | import SWBMacro 14 | import SWBCore 15 | import SWBUtil 16 | 17 | final class CopyPlistFileSpec: GenericCommandLineToolSpec, SpecIdentifierType, @unchecked Sendable { 18 | static let identifier = "com.apple.build-tasks.copy-plist-file" 19 | 20 | override func createTaskAction(_ cbc: CommandBuildContext, _ delegate: any TaskGenerationDelegate) -> (any PlannedTaskAction)? { 21 | delegate.taskActionCreationDelegate.createCopyPlistTaskAction() 22 | } 23 | 24 | override func lookup(_ macro: MacroDeclaration, _ cbc: CommandBuildContext, _ delegate: any DiagnosticProducingDelegate, _ lookup: ((MacroDeclaration) -> MacroExpression?)? = nil) -> MacroExpression? { 25 | // FIXME: [Swift Build] Improve definition of task output paths w/ specs and the CommandBuildContext 26 | if cbc.outputs.count == 1 && macro == BuiltinMacros.ProductResourcesDir { 27 | return cbc.scope.table.namespace.parseLiteralString(cbc.output.dirname.str) 28 | } 29 | return super.lookup(macro, cbc, delegate, lookup) 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Sources/SWBUniversalPlatform/CppTool.swift: -------------------------------------------------------------------------------- 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 | import SWBCore 14 | 15 | final class CppToolSpec : GenericCommandLineToolSpec, SpecIdentifierType, @unchecked Sendable { 16 | static let identifier = "com.apple.compilers.cpp" 17 | } 18 | -------------------------------------------------------------------------------- /Sources/SWBUniversalPlatform/Specs/ClangModuleVerifierInputGenerator.xcspec: -------------------------------------------------------------------------------- 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 | ( 14 | { 15 | Identifier = "com.apple.build-tools.module-verifier-input-generator"; 16 | Type = Tool; 17 | Name = "Apple Clang Module Verifier Input Generator"; 18 | ExecDescription = "Generate Module Verifier Input for $(FULL_PRODUCT_NAME)"; 19 | RuleName = "GenerateVerifyModuleInput $(BUILT_PRODUCTS_DIR)/$(FULL_PRODUCT_NAME)"; 20 | CommandLine = "builtin-GenerateVerifyModuleInput $(BUILT_PRODUCTS_DIR)/$(FULL_PRODUCT_NAME) [special-args]"; 21 | IsArchitectureNeutral = YES; 22 | } 23 | ) 24 | -------------------------------------------------------------------------------- /Sources/SWBUniversalPlatform/Specs/ClangStatCache.xcspec: -------------------------------------------------------------------------------- 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 | ( 14 | { 15 | Type = Compiler; 16 | Identifier = "com.apple.compilers.clang-stat-cache"; 17 | Name = "Apple Clang Stat Cache Builder"; 18 | Description = "Build a stat cache for a directory which can be consumed by Clang"; 19 | CommandLine = "clang-stat-cache $(SDKROOT) [options] -o $(OutputPath)"; 20 | RuleName = "ClangStatCache $(CLANG_STAT_CACHE_EXEC) $(SDKROOT) $(OutputPath)"; 21 | ExecDescription = "Build stat cache for $(SDKROOT)"; 22 | Outputs = ("$(OutputPath)"); 23 | IsArchitectureNeutral = YES; 24 | Options = ( 25 | { 26 | Name = SDK_STAT_CACHE_VERBOSE_LOGGING; 27 | Type = Boolean; 28 | DefaultValue = NO; 29 | CommandLineFlag = "-v"; 30 | } 31 | ); 32 | } 33 | ) 34 | -------------------------------------------------------------------------------- /Sources/SWBUniversalPlatform/Specs/DefaultCompiler.xcspec: -------------------------------------------------------------------------------- 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 | ( 14 | { Type = Compiler; 15 | Identifier = com.apple.compilers.gcc; 16 | Name = "Default Compiler"; 17 | Description = "Default Compiler"; 18 | Version = "Default"; 19 | Vendor = "Apple"; 20 | InputFileTypes = (sourcecode.c.c, sourcecode.c.objc, sourcecode.cpp.cpp, sourcecode.cpp.objcpp, sourcecode.asm); 21 | CommandOutputParser = XCGccCommandOutputParser; 22 | OptionConditionFlavors = ( 23 | arch, 24 | sdk, 25 | ); 26 | SupportsHeadermaps = Yes; 27 | DashIFlagAcceptsHeadermaps = No; 28 | SupportsIsysroot = NO; 29 | ExecDescription = "Compile $(InputFileName)"; 30 | ProgressDescription = "Compiling $(CommandProgressByType) source files"; 31 | ExecDescriptionForPrecompile = "Precompile $(InputFileName)"; 32 | ProgressDescriptionForPrecompile = "Precompiling $(CommandProgressByType) prefix headers"; 33 | } 34 | ) 35 | -------------------------------------------------------------------------------- /Sources/SWBUniversalPlatform/Specs/SwiftBuildSettings.xcspec: -------------------------------------------------------------------------------- 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 | ( 14 | { 15 | Type = BuildSettings; 16 | Identifier = com.apple.build-settings.swift; 17 | Name = "SwiftBuildSettings"; 18 | IsGlobalDomainInUI = YES; 19 | 20 | Options = ( 21 | { Name = ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES; 22 | Type = Boolean; 23 | DefaultValue = "$(EMBEDDED_CONTENT_CONTAINS_SWIFT)"; 24 | Category = "Build Options"; 25 | }, 26 | { Name = EMBEDDED_CONTENT_CONTAINS_SWIFT; 27 | Type = Boolean; 28 | DefaultValue = NO; 29 | // Deprecated - not exposed in UI 30 | }, 31 | ); 32 | } 33 | ) 34 | -------------------------------------------------------------------------------- /Sources/SWBUniversalPlatform/Specs/TestEntryPointGenerator.xcspec: -------------------------------------------------------------------------------- 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 | ( 14 | { Identifier = "org.swift.test-entry-point-generator"; 15 | Type = Compiler; 16 | Name = "Generate Test Entry Point"; 17 | Description = "Generates the entry point for a test target."; 18 | CommandLine = "builtin-generateTestEntryPoint [options] --output $(OutputPath)"; 19 | RuleName = "GenerateTestEntryPoint $(OutputPath)"; 20 | ExecDescription = "Generate entry point for $(PRODUCT_NAME)"; 21 | Outputs = ( 22 | "$(OutputPath)" 23 | ); 24 | Options = ( 25 | ); 26 | } 27 | ) 28 | -------------------------------------------------------------------------------- /Sources/SWBUniversalPlatform/Specs/Unifdef.xcspec: -------------------------------------------------------------------------------- 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 | ( 14 | { Identifier = public.build-task.unifdef; 15 | Type = Tool; 16 | Name = "Unifdef"; 17 | ExecPath = "unifdef"; 18 | Description = "Copies files while optionally removing specified preprocessor conditionals."; 19 | InputFileTypes = ( 20 | sourcecode.c.h, 21 | sourcecode.cpp.h, 22 | sourcecode.module-map, 23 | ); 24 | ExecDescription = "Copy $(InputFileName) while removing preprocessor conditionals"; 25 | ProgressDescription = "Copying $(CommandProgressByType) files"; 26 | CommandOutputParser = ( 27 | ("()()(^[^:]+: [^:]+: No such file or directory)", emit-error), 28 | ("()()(^[^:]+: [^:]+: Permission denied)", emit-error), 29 | ("()()(^[^:]+: [^:]+: Is a directory)", emit-error), 30 | ); 31 | Options = ( 32 | ); 33 | } 34 | ) 35 | -------------------------------------------------------------------------------- /Sources/SWBUniversalPlatform/Specs/en.lproj/CopyPlistFile.strings: -------------------------------------------------------------------------------- 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 | "Name" = "Copy Plist File"; 14 | "Description" = "Copies a .plist file resource to the product"; 15 | 16 | "[VALIDATE_PLIST_FILES_WHILE_COPYING]-name" = "Validate .plist files"; 17 | "[VALIDATE_PLIST_FILES_WHILE_COPYING]-description" = "Determines whether or not to check the syntactic validity of .plist files before copying them into the product."; 18 | 19 | -------------------------------------------------------------------------------- /Sources/SWBUniversalPlatform/Specs/en.lproj/CopyStringsFile.strings: -------------------------------------------------------------------------------- 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 | "Name" = "Copy .strings file"; 14 | "Description" = "Copies a .strings file resource to the product, while checking its validity and converting the contents to UTF-16 encoding."; 15 | 16 | "[VALIDATE_STRINGS_FILES_WHILE_COPYING]-name" = "Validate .strings Files"; 17 | "[VALIDATE_STRINGS_FILES_WHILE_COPYING]-description" = "Determines whether or not to check the validity of .strings files before copying them into the product."; 18 | -------------------------------------------------------------------------------- /Sources/SWBUniversalPlatform/Specs/en.lproj/Default Compiler.strings: -------------------------------------------------------------------------------- 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 | // Localized strings for basic info 14 | "Name" = "Default Compiler"; 15 | "Description" = "Default Compiler"; 16 | "Version" = "Default"; 17 | "Vendor" = "Apple"; 18 | 19 | // Localized strings for output-parse-info 20 | "OutputParseInfo-ProgressStatusFormat" = "Compiling %@"; // arg 1 is name of rule's input file 21 | "OutputParseInfo-MessageStatusFormat" = "Compile %@"; // arg 1 is name of rule's input file, arg 2 is name of file containing message (@"" if unknown) 22 | -------------------------------------------------------------------------------- /Sources/SWBUniversalPlatform/Specs/en.lproj/Ld.strings: -------------------------------------------------------------------------------- 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 | "Name" = "Apple Mach-O Linker (ld)"; 14 | "Description" = "Link executable using Apple Mach-O Linker (ld)."; 15 | -------------------------------------------------------------------------------- /Sources/SWBUniversalPlatform/Specs/en.lproj/Libtool.strings: -------------------------------------------------------------------------------- 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 | "Name" = "Apple Mach-O Librarian (libtool)"; 14 | "Description" = "Create static library using Apple Mach-O Librarian (libtool)."; 15 | -------------------------------------------------------------------------------- /Sources/SWBUniversalPlatform/Specs/en.lproj/PBXCp.strings: -------------------------------------------------------------------------------- 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 | "Name" = "PBXCp"; 14 | "Description" = "PBXCp"; 15 | -------------------------------------------------------------------------------- /Sources/SWBUniversalPlatform/Specs/en.lproj/ProductTypeValidationTool.strings: -------------------------------------------------------------------------------- 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 | "Name" = "Product Type Validation"; 14 | "Description" = "Validates a target's product in the context of type and platform."; 15 | -------------------------------------------------------------------------------- /Sources/SWBUniversalPlatform/Specs/en.lproj/StripSymbols.strings: -------------------------------------------------------------------------------- 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 | "Name" = "Strip Mach-O Symbols"; 14 | "Description" = "Removes or modifies the symbol table of a Mach-O binary."; 15 | -------------------------------------------------------------------------------- /Sources/SWBUniversalPlatform/Specs/en.lproj/SwiftBuildSettings.strings: -------------------------------------------------------------------------------- 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 | "Name" = "Standard Build Settings - Swift"; 14 | "Description" = "General"; 15 | 16 | "[ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES]-name" = "Always Embed Swift Standard Libraries"; 17 | "[ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES]-description" = "Always embed the Swift standard libraries in the target's products, even if the target does not contain any Swift code. For example, this should be enabled if the target is embedding other products which contain Swift, or if it is a test target which does not contain Swift but which is testing a product which does. This setting only applies to wrapped products, not to standalone binary products."; 18 | -------------------------------------------------------------------------------- /Sources/SWBUniversalPlatform/TestEntryPointGenerationTool.swift: -------------------------------------------------------------------------------- 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 | import SWBUtil 14 | import SWBMacro 15 | import SWBCore 16 | 17 | final class TestEntryPointGenerationToolSpec: GenericCommandLineToolSpec, SpecIdentifierType, @unchecked Sendable { 18 | static let identifier = "org.swift.test-entry-point-generator" 19 | 20 | override func createTaskAction(_ cbc: CommandBuildContext, _ delegate: any TaskGenerationDelegate) -> (any PlannedTaskAction)? { 21 | TestEntryPointGenerationTaskAction() 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Sources/SWBUniversalPlatformPlugin/PluginMain.swift: -------------------------------------------------------------------------------- 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 | import SWBUtil 14 | import SWBCore 15 | import SWBUniversalPlatform 16 | 17 | @_cdecl("initializePlugin") 18 | @PluginExtensionSystemActor public func main(_ ptr: UnsafeRawPointer) { 19 | initializePlugin(Unmanaged.fromOpaque(ptr).takeUnretainedValue()) 20 | } 21 | -------------------------------------------------------------------------------- /Sources/SWBUtil/AsyncSingleValueCache.swift: -------------------------------------------------------------------------------- 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 | public struct AsyncSingleValueCache: ~Copyable, Sendable { 14 | private let value = AsyncLockedValue(nil) 15 | 16 | public init() { } 17 | 18 | public func value(body: sending () async throws(E) -> sending Value) async throws(E) -> sending Value { 19 | try await value.withLock { value throws(E) in 20 | if let value { 21 | return value 22 | } else { 23 | let newValue = try await body() 24 | value = newValue 25 | return newValue 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Sources/SWBUtil/CSV.swift: -------------------------------------------------------------------------------- 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 | // https://www.ietf.org/rfc/rfc4180.txt - compliant CSV formatting 14 | public struct CSVBuilder: Sendable { 15 | public private(set) var output: String 16 | 17 | public init() { 18 | output = "" 19 | } 20 | 21 | public mutating func writeRow(_ cols: [String]) { 22 | output.append(cols.map { $0.csvEscaped() }.joined(separator: ",")) 23 | output.append("\r\n") 24 | } 25 | } 26 | 27 | extension String { 28 | public func csvEscaped() -> String { 29 | var result = "" 30 | var needsQuoting = false 31 | for character in self { 32 | if character.isWhitespace || character == "," { 33 | needsQuoting = true 34 | } 35 | if character == "\"" { 36 | needsQuoting = true 37 | result += "\"\(character)" 38 | } else { 39 | result.append(character) 40 | } 41 | } 42 | return needsQuoting ? "\"\(result)\"" : result 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Sources/SWBUtil/Duration.swift: -------------------------------------------------------------------------------- 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 | public import struct Foundation.TimeInterval 14 | 15 | extension Duration { 16 | /// The value of the time interval in nanoseconds (ns). 17 | public var nanoseconds: Int64 { 18 | (components.seconds * Int64(1e+9)) + (components.attoseconds / Int64(1e+9)) 19 | } 20 | 21 | /// The value of the time interval in microseconds (μs). 22 | public var microseconds: Int64 { 23 | (components.seconds * Int64(1e+6)) + (components.attoseconds / Int64(1e+12)) 24 | } 25 | 26 | /// The value of the time interval in fractional seconds (s). 27 | public var seconds: TimeInterval { 28 | Double(components.seconds) + (Double(components.attoseconds) / 1e+18) 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Sources/SWBUtil/EmptyState.swift: -------------------------------------------------------------------------------- 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 | /// Represents a type whose instances can be "empty". 14 | public protocol EmptyState { 15 | var isEmpty: Bool { get } 16 | } 17 | 18 | extension EmptyState { 19 | /// Returns `nil` if this instance is considered empty, otherwise returns `self`. 20 | /// 21 | /// This is used to aid in constructing expressions of form `x.isEmpty ? x : y` where `x` is a complex expression, by allowing it to be instead written as `x.nilIfEmpty ?? y`. 22 | public var nilIfEmpty: Self? { 23 | return isEmpty ? nil : self 24 | } 25 | } 26 | 27 | // Add more types here as needed 28 | extension Array: EmptyState { } 29 | extension Path: EmptyState { } 30 | extension String: EmptyState { } 31 | extension Substring: EmptyState { } 32 | extension Set: EmptyState { } 33 | -------------------------------------------------------------------------------- /Sources/SWBUtil/IO.swift: -------------------------------------------------------------------------------- 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 | import Foundation 14 | 15 | #if canImport(System) 16 | public import System 17 | #else 18 | public import SystemPackage 19 | #endif 20 | 21 | public struct IOPipe: Sendable { 22 | public let readEnd: FileDescriptor 23 | public let writeEnd: FileDescriptor 24 | 25 | public init() throws { 26 | let (readEnd, writeEnd) = try FileDescriptor.pipe() 27 | self.readEnd = readEnd 28 | self.writeEnd = writeEnd 29 | } 30 | } 31 | 32 | extension FileDescriptor { 33 | public func setBinaryMode() throws { 34 | #if os(Windows) 35 | if _setmode(rawValue, _O_BINARY) == -1 { 36 | throw Errno(rawValue: errno) 37 | } 38 | #endif 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Sources/SWBUtil/Optional.swift: -------------------------------------------------------------------------------- 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 | extension Optional { 14 | /// Convenience wrapper for `a ?? b` expressions where the right-hand side is `async`, since this is not yet implemented in the compiler/stdlib. 15 | public func or(_ rhs: @autoclosure () async throws -> Wrapped) async rethrows -> Wrapped { 16 | if let lhs = self { 17 | return lhs 18 | } 19 | return try await rhs() 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Sources/SWBUtil/Pair.swift: -------------------------------------------------------------------------------- 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 | 14 | /// Utility wrapper for pairs of values. 15 | public struct Pair { 16 | private let values: (First, Second) 17 | 18 | public var first: First { 19 | return values.0 20 | } 21 | 22 | public var second: Second { 23 | return values.1 24 | } 25 | 26 | public init(_ first: First, _ second: Second) { 27 | values = (first, second) 28 | } 29 | } 30 | 31 | // Make Pair hashable if the values are also hashable. 32 | extension Pair: Hashable, Equatable where First: Hashable, Second: Hashable { 33 | public func hash(into hasher: inout Hasher) { 34 | hasher.combine(values.0) 35 | hasher.combine(values.1) 36 | } 37 | 38 | public static func == (lhs: Pair, rhs: Pair) -> Bool { 39 | lhs.values == rhs.values 40 | } 41 | } 42 | 43 | extension Pair: Sendable where First: Sendable, Second: Sendable {} 44 | -------------------------------------------------------------------------------- /Sources/SWBUtil/PluginManagerCommon.swift: -------------------------------------------------------------------------------- 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 | public protocol CommonPlugin: Sendable { 14 | var identifier: String { get } 15 | var path: Path { get } 16 | } 17 | -------------------------------------------------------------------------------- /Sources/SWBUtil/Ref.swift: -------------------------------------------------------------------------------- 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 | /// Generic reference-semantics wrapper for class types. 14 | /// 15 | /// This wrapper avoids additional heap allocation, but does involve a runtime type cast on the accessor. 16 | // 17 | // FIXME: Reevaluate the presence of this wrapper in the face of Swift now auto-boxing any type into AnyObject. 18 | public struct Ref: Hashable { 19 | fileprivate let _instance: AnyObject 20 | 21 | public init(_ instance: T) { 22 | self._instance = instance as AnyObject 23 | } 24 | 25 | public func hash(into hasher: inout Hasher) { 26 | hasher.combine(ObjectIdentifier(_instance)) 27 | } 28 | 29 | public static func == (lhs: Ref, rhs: Ref) -> Bool { 30 | return lhs._instance === rhs._instance 31 | } 32 | 33 | /// The instance stored inside the wrapper. 34 | public var instance: T { 35 | return _instance as! T 36 | } 37 | } 38 | 39 | extension Ref: @unchecked Sendable where T: Sendable {} 40 | -------------------------------------------------------------------------------- /Sources/SWBUtil/UnsafeSendableDelayedInitializationWrapper.swift: -------------------------------------------------------------------------------- 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 | /// An Unsafe wrapper for values that are initialized exactly once 14 | public final class UnsafeDelayedInitializationSendableWrapper: @unchecked Sendable { 15 | private var _value: T? 16 | 17 | public init() { 18 | self._value = nil 19 | } 20 | 21 | public func initialize(to initializedValue: T) { 22 | precondition(_value == nil, "value is already initialized") 23 | _value = initializedValue 24 | } 25 | 26 | public var value: T { 27 | guard let _value else { 28 | preconditionFailure("value was accessed before it was initialized") 29 | } 30 | return _value 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Sources/SWBUtil/WeakRef.swift: -------------------------------------------------------------------------------- 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 | import Foundation 14 | 15 | public struct WeakRef { 16 | private weak var _instance: AnyObject? 17 | public var instance: T? { _instance as! T? } 18 | 19 | public init(_ instance: T) { 20 | self._instance = instance as AnyObject 21 | } 22 | } 23 | 24 | extension WeakRef: @unchecked Sendable where T: Sendable {} 25 | -------------------------------------------------------------------------------- /Sources/SWBUtil/Win32Error.swift: -------------------------------------------------------------------------------- 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 | #if os(Windows) 14 | public import WinSDK 15 | import Foundation 16 | 17 | public struct Win32Error: Error, CustomStringConvertible { 18 | public let error: DWORD 19 | 20 | public init(_ error: DWORD) { 21 | self.error = error 22 | } 23 | 24 | public var description: String { 25 | let flags: DWORD = DWORD(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS) 26 | var buffer: UnsafeMutablePointer? 27 | let length: DWORD = withUnsafeMutablePointer(to: &buffer) { 28 | $0.withMemoryRebound(to: WCHAR.self, capacity: 2) { 29 | FormatMessageW(flags, nil, error, 0, $0, 0, nil) 30 | } 31 | } 32 | guard let buffer, length > 0 else { 33 | return "Win32 Error Code \(error)" 34 | } 35 | defer { LocalFree(buffer) } 36 | return String(decodingCString: buffer, as: UTF16.self).trimmingCharacters(in: .whitespacesAndNewlines) 37 | } 38 | } 39 | #endif 40 | -------------------------------------------------------------------------------- /Sources/SWBWebAssemblyPlatform/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #[[ 2 | This source file is part of the Swift open source project 3 | 4 | Copyright (c) 2014 - 2025 Apple Inc. and the Swift project authors 5 | Licensed under Apache License v2.0 with Runtime Library Exception 6 | 7 | See http://swift.org/LICENSE.txt for license information 8 | See http://swift.org/CONTRIBUTORS.txt for Swift project authors 9 | ]] 10 | 11 | add_library(SWBWebAssemblyPlatform 12 | Plugin.swift) 13 | SwiftBuild_Bundle(MODULE SWBWebAssemblyPlatform FILES 14 | Specs/WasmCompile.xcspec 15 | Specs/WasmLd.xcspec 16 | Specs/WasmLibtool.xcspec 17 | Specs/WebAssembly.xcspec) 18 | target_link_libraries(SWBWebAssemblyPlatform PUBLIC 19 | SWBCore 20 | SWBMacro 21 | SWBUtil) 22 | set_target_properties(SWBWebAssemblyPlatform PROPERTIES 23 | INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY}) 24 | 25 | set_property(GLOBAL APPEND PROPERTY SWIFTBUILD_EXPORTS SWBWebAssemblyPlatform) 26 | 27 | install(TARGETS SWBWebAssemblyPlatform 28 | ARCHIVE DESTINATION "${SwiftBuild_INSTALL_LIBDIR}") 29 | -------------------------------------------------------------------------------- /Sources/SWBWebAssemblyPlatform/Specs/WasmLibtool.xcspec: -------------------------------------------------------------------------------- 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 | ( 14 | { 15 | Domain = webassembly; 16 | Identifier = com.apple.pbx.linkers.libtool; 17 | Type = Linker; 18 | BasedOn = "generic-unix:com.apple.pbx.linkers.libtool"; 19 | }, 20 | ) 21 | -------------------------------------------------------------------------------- /Sources/SWBWebAssemblyPlatform/Specs/WebAssembly.xcspec: -------------------------------------------------------------------------------- 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 | ( 14 | { 15 | Domain = webassembly; 16 | Type = Architecture; 17 | Identifier = Standard; 18 | Name = "Standard Architectures"; 19 | Description = "Standard architectures"; 20 | ArchitectureSetting = "ARCHS_STANDARD"; 21 | RealArchitectures = ( 22 | "$(VALID_ARCHS)" 23 | ); 24 | SortNumber = 0; 25 | }, 26 | ) 27 | -------------------------------------------------------------------------------- /Sources/SWBWebAssemblyPlatformPlugin/PluginMain.swift: -------------------------------------------------------------------------------- 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 | import SWBUtil 14 | import SWBCore 15 | import SWBWebAssemblyPlatform 16 | 17 | @_cdecl("initializePlugin") 18 | @PluginExtensionSystemActor public func main(_ ptr: UnsafeRawPointer) { 19 | initializePlugin(Unmanaged.fromOpaque(ptr).takeUnretainedValue()) 20 | } 21 | -------------------------------------------------------------------------------- /Sources/SWBWindowsPlatform/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #[[ 2 | This source file is part of the Swift open source project 3 | 4 | Copyright (c) 2014 - 2025 Apple Inc. and the Swift project authors 5 | Licensed under Apache License v2.0 with Runtime Library Exception 6 | 7 | See http://swift.org/LICENSE.txt for license information 8 | See http://swift.org/CONTRIBUTORS.txt for Swift project authors 9 | ]] 10 | 11 | add_library(SWBWindowsPlatform 12 | KnownFolders.swift 13 | Plugin.swift 14 | VSInstallation.swift) 15 | SwiftBuild_Bundle(MODULE SWBWindowsPlatform FILES 16 | Specs/Windows.xcspec 17 | Specs/WindowsCompile.xcspec 18 | Specs/WindowsLd.xcspec 19 | Specs/WindowsLibtool.xcspec) 20 | target_link_libraries(SWBWindowsPlatform PUBLIC 21 | SWBCore 22 | SWBMacro 23 | SWBUtil) 24 | 25 | set_target_properties(SWBWindowsPlatform PROPERTIES 26 | INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY}) 27 | 28 | set_property(GLOBAL APPEND PROPERTY SWIFTBUILD_EXPORTS SWBWindowsPlatform) 29 | 30 | install(TARGETS SWBWindowsPlatform 31 | ARCHIVE DESTINATION "${SwiftBuild_INSTALL_LIBDIR}") 32 | -------------------------------------------------------------------------------- /Sources/SWBWindowsPlatformPlugin/PluginMain.swift: -------------------------------------------------------------------------------- 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 | import SWBUtil 14 | import SWBCore 15 | import SWBWindowsPlatform 16 | 17 | @_cdecl("initializePlugin") 18 | @PluginExtensionSystemActor public func main(_ ptr: UnsafeRawPointer) { 19 | initializePlugin(Unmanaged.fromOpaque(ptr).takeUnretainedValue()) 20 | } 21 | -------------------------------------------------------------------------------- /Sources/SwiftBuild/ProjectModel/ImpartedBuildProperties.swift: -------------------------------------------------------------------------------- 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 | import Foundation 14 | import SWBProtocol 15 | 16 | extension ProjectModel { 17 | public struct ImpartedBuildProperties: Sendable, Hashable { 18 | public let settings: BuildSettings 19 | 20 | public init(settings: BuildSettings) { 21 | self.settings = settings 22 | } 23 | } 24 | } 25 | 26 | extension ProjectModel.ImpartedBuildProperties: Codable { 27 | public init(from decoder: any Decoder) throws { 28 | let container = try decoder.container(keyedBy: CodingKeys.self) 29 | self.settings = try container.decode(ProjectModel.BuildSettings.self, forKey: .buildSettings) 30 | } 31 | 32 | public func encode(to encoder: any Encoder) throws { 33 | var container = encoder.container(keyedBy: CodingKeys.self) 34 | try container.encode(settings, forKey: .buildSettings) 35 | } 36 | 37 | enum CodingKeys: String, CodingKey { 38 | case buildSettings 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Sources/SwiftBuild/ProjectModel/SandboxingOverride.swift: -------------------------------------------------------------------------------- 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 | import Foundation 14 | import SWBProtocol 15 | 16 | extension ProjectModel { 17 | public enum SandboxingOverride: String, Sendable, Codable { 18 | case forceDisabled 19 | case forceEnabled 20 | case basedOnBuildSetting 21 | 22 | public init(from decoder: any Decoder) throws { 23 | let container = try decoder.singleValueContainer() 24 | self = try .init(rawValue: container.decode(String.self))! 25 | } 26 | 27 | public func encode(to encoder: any Encoder) throws { 28 | var container = encoder.singleValueContainer() 29 | try container.encode(rawValue) 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Sources/SwiftBuild/SWBChannel.swift: -------------------------------------------------------------------------------- 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 | import SWBProtocol 14 | 15 | /// Represents an open communication channel. 16 | /// 17 | /// The event stream is infinite (consumer finished) by design. 18 | final class SWBChannel { 19 | let service: SWBBuildService 20 | let stream: AsyncStream<(any Message)?> 21 | private let channel: UInt64 22 | 23 | init(service: SWBBuildService) { 24 | self.service = service 25 | let (stream, continuation) = AsyncStream<(any Message)?>.makeStream() 26 | self.stream = stream 27 | self.channel = service.openChannel(handler: { 28 | if case .terminated = continuation.yield($0) { 29 | continuation.finish() 30 | } 31 | }) 32 | } 33 | 34 | func send(_ makeMessage: (UInt64) -> any SessionChannelMessage) async -> any Message { 35 | await send(makeMessage(channel)) 36 | } 37 | 38 | func send(_ message: any SessionChannelMessage) async -> any Message { 39 | await service.send(message) 40 | } 41 | 42 | deinit { 43 | service.closeChannel(channel) 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Sources/SwiftBuild/SWBSystemInfo.swift: -------------------------------------------------------------------------------- 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 | public import Foundation 14 | 15 | import SWBUtil 16 | 17 | public struct SWBSystemInfo: Sendable { 18 | public static func `default`() throws -> Self { 19 | let processInfo = ProcessInfo.processInfo 20 | return Self( 21 | operatingSystemVersion: processInfo.operatingSystemVersion, 22 | productBuildVersion: try processInfo.productBuildVersion().description, 23 | nativeArchitecture: Architecture.host.stringValue ?? "undefined_arch") 24 | } 25 | 26 | public let operatingSystemVersion: OperatingSystemVersion 27 | public let productBuildVersion: String 28 | public let nativeArchitecture: String 29 | 30 | public init(operatingSystemVersion: OperatingSystemVersion, productBuildVersion: String, nativeArchitecture: String) { 31 | self.operatingSystemVersion = operatingSystemVersion 32 | self.productBuildVersion = productBuildVersion 33 | self.nativeArchitecture = nativeArchitecture 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Sources/SwiftBuild/SWBTargetGUID.swift: -------------------------------------------------------------------------------- 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 | public struct SWBTargetGUID: RawRepresentable, Hashable, Sendable { 14 | public var rawValue: String 15 | 16 | public init(rawValue: String) { 17 | self.rawValue = rawValue 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Sources/SwiftBuild/SWBWorkspaceInfo.swift: -------------------------------------------------------------------------------- 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 | import Foundation 14 | 15 | import SWBProtocol 16 | 17 | public struct SWBWorkspaceInfo: Sendable { 18 | public let targetInfos: [SWBTargetInfo] 19 | } 20 | 21 | public struct SWBTargetInfo: Sendable { 22 | public let guid: String 23 | public let targetName: String 24 | public let projectName: String 25 | } 26 | 27 | extension SWBWorkspaceInfo { 28 | init(_ workspaceInfo: WorkspaceInfoResponse.WorkspaceInfo) { 29 | self = .init(targetInfos: workspaceInfo.targetInfos.map { .init(guid: $0.guid, targetName: $0.targetName, projectName: $0.projectName) }) 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Sources/SwiftBuild/SwiftBuild.swift: -------------------------------------------------------------------------------- 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 | @_exported import SWBProjectModel 14 | -------------------------------------------------------------------------------- /Sources/SwiftBuild/SwiftBuildVersion.swift: -------------------------------------------------------------------------------- 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 | import SWBUtil 14 | 15 | import Foundation 16 | 17 | public func SwiftBuildGetVersion() throws -> String { 18 | final class C { } 19 | return try ((Bundle(for: C.self).infoDictionary?["CFBundleVersion"] as? String).map { try Version($0) } ?? Version()).description 20 | } 21 | -------------------------------------------------------------------------------- /Sources/SwiftBuildTestSupport/EmptyBuildOperationDelegate.swift: -------------------------------------------------------------------------------- 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 | import Foundation 14 | package import SwiftBuild 15 | 16 | /// An testing implementation of `SWBPlanningOperationDelegate` whose methods are all no-ops. 17 | /// 18 | /// This is intended for unit tests which are not interested in handling any delegate methods or only want to handle a subset of delegate methods. 19 | package final class EmptyBuildOperationDelegate: SWBPlanningOperationDelegate, SWBDocumentationDelegate, SWBLocalizationDelegate, SWBIndexingDelegate, SWBPreviewDelegate { 20 | package init() { 21 | } 22 | 23 | package func provisioningTaskInputs(targetGUID: String, provisioningSourceData: SwiftBuild.SWBProvisioningTaskInputsSourceData) async -> SwiftBuild.SWBProvisioningTaskInputs { 24 | SWBProvisioningTaskInputs() 25 | } 26 | 27 | package func executeExternalTool(commandLine: [String], workingDirectory: String?, environment: [String : String]) async throws -> SwiftBuild.SWBExternalToolResult { 28 | .deferred 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Sources/SwiftBuildTestSupport/ThroughputTests.swift: -------------------------------------------------------------------------------- 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 | package import SwiftBuild 14 | package import Foundation 15 | import SWBUtil 16 | 17 | extension SWBBuildService { 18 | /// Send a throughput test by sending the given data. 19 | package func sendThroughputTest(_ bytes: D) async throws -> Bool { 20 | // Allocate a buffer. 21 | var message = Array("TPUT".utf8).withUnsafeBytes { SWBDispatchData(bytes: $0) } 22 | assert(message.count == 4) 23 | Array(bytes).withUnsafeBytes { message.append($0) } 24 | try await setConfig(key: "TPUT", value: "TEST") 25 | return true 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Sources/swbuild/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #[[ 2 | This source file is part of the Swift open source project 3 | 4 | Copyright (c) 2014 - 2025 Apple Inc. and the Swift project authors 5 | Licensed under Apache License v2.0 with Runtime Library Exception 6 | 7 | See http://swift.org/LICENSE.txt for license information 8 | See http://swift.org/CONTRIBUTORS.txt for Swift project authors 9 | ]] 10 | 11 | add_executable(swbuild 12 | SWBuildMain.swift) 13 | set_target_properties(swbuild PROPERTIES 14 | Swift_LANGUAGE_VERSION 6) 15 | target_compile_options(swbuild PRIVATE 16 | -parse-as-library) 17 | target_link_libraries(swbuild PRIVATE 18 | SwiftBuild) 19 | 20 | install(TARGETS swbuild) 21 | -------------------------------------------------------------------------------- /Sources/swbuild/SWBuildMain.swift: -------------------------------------------------------------------------------- 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 | import SwiftBuild 14 | 15 | @main 16 | struct SWBuildMain { 17 | static func main() async { 18 | await SwiftBuild.main() 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /SwiftBuild.docc/Development/test-development.md: -------------------------------------------------------------------------------- 1 | # Test Development 2 | 3 | This document contains various advice related to unit and integration test development in Swift Build. 4 | 5 | ## Working With PIF Files from Xcode 6 | 7 | Sometimes it is useful to have a [PIF](doc:project-interchange-format) to test Swift Build independently of Xcode. To get one, you can run: 8 | 9 | xcrun xcodebuild -dumpPIF path/to/output.pif -project path/to/project.xcodeproj 10 | 11 | ## Saving Temporary Directories 12 | 13 | Many of our tests create temporary directories on the file system and automatically destroy them when complete. If you would like to not have these destroyed (so you can inspect them), you can run with `SAVE_TEMPS=1` set in the environment. 14 | 15 | ## Writing Project Tests 16 | 17 | Project tests are a kind of integration test used to test build system functionality, and one of the most important classes of test in Swift Build. 18 | 19 | 20 | -------------------------------------------------------------------------------- /SwiftBuild.docc/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleShortVersionString 6 | 1.0 7 | CFBundleVersion 8 | 1.0 9 | CFBundleDisplayName 10 | Swift Build 11 | CFBundleName 12 | Swift Build 13 | CFBundleSignature 14 | ???? 15 | CFBundlePackageType 16 | DOCS 17 | CFBundleIdentifier 18 | org.swift.documentation.swift-build 19 | 20 | 21 | -------------------------------------------------------------------------------- /SwiftBuild.docc/Resources/dynamic-tasks-execution-flow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swiftlang/swift-build/b1337725e2807dd9ccb069a73058be1db5485455/SwiftBuild.docc/Resources/dynamic-tasks-execution-flow.png -------------------------------------------------------------------------------- /SwiftBuild.docc/Resources/dynamic-tasks-setup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swiftlang/swift-build/b1337725e2807dd9ccb069a73058be1db5485455/SwiftBuild.docc/Resources/dynamic-tasks-setup.png -------------------------------------------------------------------------------- /SwiftBuild.docc/Resources/swift-driver-legacy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swiftlang/swift-build/b1337725e2807dd9ccb069a73058be1db5485455/SwiftBuild.docc/Resources/swift-driver-legacy.png -------------------------------------------------------------------------------- /SwiftBuild.docc/Resources/swift-driver-new1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swiftlang/swift-build/b1337725e2807dd9ccb069a73058be1db5485455/SwiftBuild.docc/Resources/swift-driver-new1.png -------------------------------------------------------------------------------- /SwiftBuild.docc/Resources/swift-driver-new2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swiftlang/swift-build/b1337725e2807dd9ccb069a73058be1db5485455/SwiftBuild.docc/Resources/swift-driver-new2.png -------------------------------------------------------------------------------- /SwiftBuild.docc/swift-build.md: -------------------------------------------------------------------------------- 1 | # Swift Build 2 | 3 | @Metadata { 4 | @TechnologyRoot 5 | } 6 | 7 | Swift Build is a high-level build system based on [llbuild](https://github.com/swiftlang/swift-llbuild) with great support for building Swift. It is used by Xcode to build Xcode projects and Swift packages. It can also be used as the Swift Package Manager build system in preview form when passing `--build-system swiftbuild`. 8 | 9 | ## Overview 10 | 11 | Swift Build is structured in layers of framework targets, which is described in . 12 | 13 | ## Topics 14 | 15 | ### Architecture 16 | 17 | - 18 | - 19 | - 20 | - 21 | 22 | ### Development 23 | 24 | This section contains notes on developing Swift Build. 25 | 26 | - 27 | - 28 | - 29 | 30 | ### Core 31 | 32 | This section describes selected subsystems of the core infrastructure of Swift Build. 33 | 34 | - 35 | - 36 | - 37 | - 38 | 39 | ### Task Construction 40 | 41 | - 42 | - 43 | - 44 | -------------------------------------------------------------------------------- /Tests/SWBBuildSystemTests/TestData/WordTagger.mlmodel: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swiftlang/swift-build/b1337725e2807dd9ccb069a73058be1db5485455/Tests/SWBBuildSystemTests/TestData/WordTagger.mlmodel -------------------------------------------------------------------------------- /Tests/SWBBuildSystemTests/TestData/WordTagger.mlpackage/Data/com.apple.CoreML/FeatureDescriptions.json: -------------------------------------------------------------------------------- 1 | { 2 | "Outputs" : { 3 | "tokens" : { 4 | "MLFeatureShortDescription" : "Tokens" 5 | }, 6 | "lengths" : { 7 | "MLFeatureShortDescription" : "Token lengths" 8 | }, 9 | "locations" : { 10 | "MLFeatureShortDescription" : "Token locations" 11 | }, 12 | "labels" : { 13 | "MLFeatureShortDescription" : "Token tags" 14 | } 15 | }, 16 | "Inputs" : { 17 | "text" : { 18 | "MLFeatureShortDescription" : "Input text" 19 | } 20 | }, 21 | "TrainingInputs" : { 22 | 23 | } 24 | } -------------------------------------------------------------------------------- /Tests/SWBBuildSystemTests/TestData/WordTagger.mlpackage/Data/com.apple.CoreML/Metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "MLModelCreatorDefinedKey" : { 3 | "com.apple.createml.version" : "10.15.4", 4 | "com.apple.createml.app.tag" : "5", 5 | "com.apple.createml.app.version" : "1.0" 6 | }, 7 | "MLModelVersionStringKey" : "1.0" 8 | } -------------------------------------------------------------------------------- /Tests/SWBBuildSystemTests/TestData/WordTagger.mlpackage/Data/com.apple.CoreML/WordTagger.mlmodel: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swiftlang/swift-build/b1337725e2807dd9ccb069a73058be1db5485455/Tests/SWBBuildSystemTests/TestData/WordTagger.mlpackage/Data/com.apple.CoreML/WordTagger.mlmodel -------------------------------------------------------------------------------- /Tests/SWBBuildSystemTests/TestData/WordTagger.mlpackage/Manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "fileFormatVersion": "1.0.0", 3 | "itemInfoEntries": { 4 | "899547C8-0510-4097-9373-EEA59CE8E91F": { 5 | "author": "com.apple.CoreML", 6 | "description": "CoreML Model Specification", 7 | "name": "WordTagger.mlmodel", 8 | "path": "com.apple.CoreML/WordTagger.mlmodel" 9 | }, 10 | "93AA0E8F-F1B7-4B52-85EB-2721594438FA": { 11 | "author": "com.apple.CoreML", 12 | "description": "External Metadata Overlay", 13 | "name": "Metadata.json", 14 | "path": "com.apple.CoreML/Metadata.json" 15 | }, 16 | "A15D8A41-EC6E-4D1D-B933-FE38DD4168F0": { 17 | "author": "com.apple.CoreML", 18 | "description": "External FeatureDescription Overlay", 19 | "name": "FeatureDescriptions.json", 20 | "path": "com.apple.CoreML/FeatureDescriptions.json" 21 | } 22 | }, 23 | "rootModelIdentifier": "899547C8-0510-4097-9373-EEA59CE8E91F" 24 | } 25 | -------------------------------------------------------------------------------- /Tests/SWBCorePerfTests/CorePerfTests.swift: -------------------------------------------------------------------------------- 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 | import Testing 14 | import SWBUtil 15 | import SWBCore 16 | import SWBTestSupport 17 | 18 | @Suite(.performance) 19 | fileprivate struct CorePerfTests: PerfTests { 20 | @Test 21 | func specRegistrationPerf() async throws { 22 | try await measure { 23 | try await Core.perfTestSpecRegistration() 24 | } 25 | } 26 | 27 | @Test 28 | func completeSpecLoadingPerf() async throws { 29 | try await measure { 30 | try await Core.perfTestSpecLoading() 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Tests/SWBGenericUnixPlatformTests/SWBLinuxPlatformTests.swift: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /Tests/SWBServiceCoreTests/ServiceCoreTests.swift: -------------------------------------------------------------------------------- 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 | import Testing 14 | 15 | @Suite fileprivate struct ServiceCoreTests { 16 | @Test func basics() { 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Tests/SWBTaskConstructionTests/PlannedNodeTests.swift: -------------------------------------------------------------------------------- 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 | import SWBTaskConstruction 14 | import SWBCore 15 | import SWBTestSupport 16 | import SWBUtil 17 | import Testing 18 | 19 | @Suite 20 | fileprivate struct PlannedNodeTests { 21 | @Test(.requireSDKs(.macOS)) 22 | func basics() async throws { 23 | #expect(MakePlannedPathNode(Path("/tmp")).name == "tmp") 24 | #expect(MakePlannedPathNode(Path("/tmp")).path == Path("/tmp")) 25 | 26 | // Check reference==value equality 27 | #expect(MakePlannedPathNode(Path("/tmp")) 28 | === MakePlannedPathNode(Path("/tmp"))) 29 | 30 | // Check expected normalization 31 | #expect(MakePlannedPathNode(Path("/tmp/a/")) 32 | === MakePlannedPathNode(Path("/tmp/a"))) 33 | #expect(MakePlannedPathNode(Path("/tmp/a/../b")) 34 | === MakePlannedPathNode(Path("/tmp/b"))) 35 | #expect(MakePlannedPathNode(Path("/tmp/a/.")) 36 | === MakePlannedPathNode(Path("/tmp/a"))) 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Tests/SWBTaskExecutionTests/TestData/FileCopyTask/LoneFile.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swiftlang/swift-build/b1337725e2807dd9ccb069a73058be1db5485455/Tests/SWBTaskExecutionTests/TestData/FileCopyTask/LoneFile.txt -------------------------------------------------------------------------------- /Tests/SWBTaskExecutionTests/TestData/FileCopyTask/SimpleDir/FileOne.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swiftlang/swift-build/b1337725e2807dd9ccb069a73058be1db5485455/Tests/SWBTaskExecutionTests/TestData/FileCopyTask/SimpleDir/FileOne.txt -------------------------------------------------------------------------------- /Tests/SWBTaskExecutionTests/TestData/FileCopyTask/SimpleDir/More/FileTwo.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swiftlang/swift-build/b1337725e2807dd9ccb069a73058be1db5485455/Tests/SWBTaskExecutionTests/TestData/FileCopyTask/SimpleDir/More/FileTwo.txt -------------------------------------------------------------------------------- /Tests/SWBTaskExecutionTests/TestData/minimal-plist-with-uid.plist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swiftlang/swift-build/b1337725e2807dd9ccb069a73058be1db5485455/Tests/SWBTaskExecutionTests/TestData/minimal-plist-with-uid.plist -------------------------------------------------------------------------------- /Tests/SWBUniversalPlatformTests/SWBUniversalPlatformTests.swift: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /Tests/SWBUtilPerfTests/ByteStringPerfTests.swift: -------------------------------------------------------------------------------- 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 | import Testing 14 | import SWBTestSupport 15 | import SWBUtil 16 | 17 | @Suite(.performance) 18 | fileprivate struct ByteStringPerfTests: PerfTests { 19 | @Test 20 | func initialization() async { 21 | let listOfStrings: [String] = (0..<10).map { "This is the number: \($0)!\n" } 22 | let expectedTotalCount = listOfStrings.map({ $0.utf8.count }).reduce(0, { $0 + $1 }) 23 | await measure { 24 | var count = 0 25 | let N = 10000 26 | for _ in 0..() 31 | 32 | for i in 0 ..< N { 33 | q.append(i) 34 | q.append(i) 35 | if q.popFirst() != i / 2 { fatalError() } 36 | } 37 | for i in 0 ..< N { 38 | if q.popFirst() != halfN + i / 2 { fatalError() } 39 | } 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Tests/SWBUtilTests/ArchitectureTests.swift: -------------------------------------------------------------------------------- 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 | import Foundation 14 | import Testing 15 | import SWBUtil 16 | import SWBTestSupport 17 | 18 | @Suite fileprivate struct ArchitectureTests { 19 | @Test func hostArchitecture() async throws { 20 | #if canImport(Darwin) 21 | #if arch(arm64) 22 | #expect(Architecture.host.stringValue == "arm64") 23 | #expect(Architecture.host.as32bit.stringValue == "arm") 24 | #expect(Architecture.host.as64bit.stringValue == "arm64") 25 | #endif 26 | 27 | #if arch(x86_64) 28 | #expect(Architecture.host.stringValue == "x86_64") 29 | #expect(Architecture.host.as32bit.stringValue == "i386") 30 | #expect(Architecture.host.as64bit.stringValue == "x86_64") 31 | #endif 32 | #else 33 | #expect(Architecture.host.stringValue == nil) 34 | 35 | #if arch(arm64) 36 | #expect(Architecture.hostStringValue == "aarch64") 37 | #endif 38 | 39 | #if arch(x86_64) 40 | #expect(Architecture.hostStringValue == "x86_64") 41 | #endif 42 | #endif 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Tests/SWBUtilTests/CSVTests.swift: -------------------------------------------------------------------------------- 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 | import Foundation 14 | import Testing 15 | import SWBUtil 16 | 17 | @Suite fileprivate struct CSVTests { 18 | @Test 19 | func CSVEscaping() { 20 | #expect("test".csvEscaped() == "test") 21 | #expect("has whitespace".csvEscaped() == "\"has whitespace\"") 22 | #expect("has\nnewline".csvEscaped() == "\"has\nnewline\"") 23 | #expect("has,comma".csvEscaped() == "\"has,comma\"") 24 | #expect("has\"quote".csvEscaped() == "\"has\"\"quote\"") 25 | } 26 | 27 | @Test 28 | func CSVStream() { 29 | var builder = CSVBuilder() 30 | builder.writeRow(["col1", "col2", "col3"]) 31 | builder.writeRow(["v1", "v2", "v3"]) 32 | builder.writeRow(["has whitespace", "has,comma", "has\"quote"]) 33 | #expect(builder.output == """ 34 | col1,col2,col3\r 35 | v1,v2,v3\r 36 | "has whitespace","has,comma","has""quote"\r 37 | 38 | """) 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Tests/SWBUtilTests/ElapsedTimerTests.swift: -------------------------------------------------------------------------------- 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 | import Foundation 14 | import SWBUtil 15 | import Testing 16 | 17 | @Suite fileprivate struct ElapsedTimerTests { 18 | @Test 19 | func time() async throws { 20 | do { 21 | let delta = try await ElapsedTimer.measure { 22 | try await Task.sleep(for: .microseconds(1000)) 23 | return () 24 | } 25 | #expect(delta.seconds > 1.0 / 1000.0) 26 | } 27 | 28 | do { 29 | let (delta, result) = try await ElapsedTimer.measure { () -> Int in 30 | try await Task.sleep(for: .microseconds(1000)) 31 | return 22 32 | } 33 | #expect(delta.seconds > 1.0 / 1000.0) 34 | #expect(result == 22) 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Tests/SWBUtilTests/StaticTests.swift: -------------------------------------------------------------------------------- 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 | import Foundation 14 | import Testing 15 | public import SWBUtil 16 | 17 | extension Int: StaticStorable { 18 | public static var staticStorageTable = Dictionary() 19 | } 20 | 21 | @Suite fileprivate struct StaticTests { 22 | @Test 23 | func basic() { 24 | let numConstructCalls = LockedValue(0) 25 | 26 | func foo() -> Int { 27 | return Static { 28 | numConstructCalls.withLock { $0 += 1 } 29 | return 3 30 | } 31 | } 32 | 33 | #expect(numConstructCalls.withLock { $0 } == 0) 34 | #expect(foo() == 3) 35 | #expect(numConstructCalls.withLock { $0 } == 1) 36 | #expect(foo() == 3) 37 | #expect(numConstructCalls.withLock { $0 } == 1) 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Tests/SWBUtilTests/StatisticsTests.swift: -------------------------------------------------------------------------------- 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 | import Foundation 14 | import Testing 15 | import SWBUtil 16 | 17 | @Suite fileprivate struct StatisticsTests { 18 | /// Statistic instances are designed to be statically initialized on demand from arbitrary threads 19 | @Test 20 | func threadSafety() async { 21 | let statGroup = StatisticsGroup("Test") 22 | 23 | let count = 100 24 | await withTaskGroup(of: Void.self) { group in 25 | for i in 0.. Bool { 26 | try await pluginManager.extensions(of: EnvironmentExtensionPoint.self).compactMap({ $0 as? WindowsEnvironmentExtension }).first?.plugin.cachedVSInstallations().first?.packages.contains(where: { $0.id == name }) == true 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Tests/SwiftBuildTests/ProjectModel/BuildConfigTests.swift: -------------------------------------------------------------------------------- 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 | import Foundation 14 | import SwiftBuild 15 | import Testing 16 | 17 | @Suite 18 | fileprivate struct BuildConfigTests { 19 | @Test func basicEncoding() throws { 20 | let obj = ProjectModel.BuildConfig.example 21 | try testCodable(obj) 22 | } 23 | } 24 | 25 | extension ProjectModel.BuildConfig { 26 | static var example: Self { 27 | return ProjectModel.BuildConfig( 28 | id: "buildconfig-id", 29 | name: "BuildConfigName", 30 | settings: .example, 31 | impartedBuildSettings: .example 32 | ) 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Tests/SwiftBuildTests/ProjectModel/BuildFileTests.swift: -------------------------------------------------------------------------------- 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 | import Foundation 14 | import SwiftBuild 15 | import Testing 16 | 17 | @Suite 18 | fileprivate struct BuildFileTests { 19 | @Test func basicEncoding() throws { 20 | let obj = ProjectModel.BuildFile(id: "foo", ref: .targetProduct(id: "bar")) 21 | try testCodable(obj) 22 | } 23 | } 24 | 25 | extension ProjectModel.BuildFile { 26 | static var example: Self { 27 | return .init(id: "buildFileId", ref: .reference(id: "referenceId")) 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Tests/SwiftBuildTests/ProjectModel/ImpartedBuildPropertiesTests.swift: -------------------------------------------------------------------------------- 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 | import Foundation 14 | import SwiftBuild 15 | import Testing 16 | 17 | @Suite 18 | fileprivate struct ImpartedBuildPropertiesTests { 19 | @Test func basicEncoding() throws { 20 | let obj = ProjectModel.ImpartedBuildProperties(settings: ProjectModel.BuildSettings.example) 21 | try testCodable(obj) 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Tests/SwiftBuildTests/ProjectModel/PlatformFilterTests.swift: -------------------------------------------------------------------------------- 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 | import Foundation 14 | import SwiftBuild 15 | import Testing 16 | 17 | @Suite 18 | fileprivate struct PlatformFilterTests { 19 | @Test func basicEncoding() throws { 20 | let obj = ProjectModel.PlatformFilter.example 21 | try testCodable(obj) 22 | } 23 | } 24 | extension ProjectModel.PlatformFilter { 25 | static var example: Self { 26 | return ProjectModel.PlatformFilter(platform: "platform", environment: "env") 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Tests/SwiftBuildTests/ProjectModel/ReferencesTests.swift: -------------------------------------------------------------------------------- 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 | import Foundation 14 | import SwiftBuild 15 | import Testing 16 | 17 | @Suite 18 | fileprivate struct ReferencesTests { 19 | @Test func fileEncoding() throws { 20 | let obj = ProjectModel.Reference.file(.example) 21 | try testCodable(obj) 22 | } 23 | 24 | @Test func groupEncoding() throws { 25 | let obj = ProjectModel.Reference.group(.example) 26 | try testCodable(obj) 27 | } 28 | 29 | } 30 | 31 | extension ProjectModel.FileReference { 32 | static var example: Self { 33 | return .init( 34 | id: "foo", 35 | path: "bar", 36 | pathBase: .projectDir, 37 | name: "name", 38 | fileType: "fileType" 39 | ) 40 | } 41 | } 42 | 43 | extension ProjectModel.Group { 44 | static var example: Self { 45 | return .init( 46 | id: "foo", 47 | path: "bar", 48 | pathBase: .absolute, 49 | name: "group", 50 | subitems: [ 51 | .file(.example) 52 | ]) 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Tests/SwiftBuildTests/ProjectModel/SandboxingOverrideTests.swift: -------------------------------------------------------------------------------- 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 | import Foundation 14 | import SwiftBuild 15 | import Testing 16 | 17 | @Suite 18 | fileprivate struct SandboxingOverrideTests { 19 | @Test func basicEncoding() throws { 20 | try testCodable(ProjectModel.SandboxingOverride.forceDisabled) 21 | try testCodable(ProjectModel.SandboxingOverride.forceEnabled) 22 | try testCodable(ProjectModel.SandboxingOverride.basedOnBuildSetting) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Tests/SwiftBuildTests/ProjectModel/TargetDependencyTests.swift: -------------------------------------------------------------------------------- 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 | import Foundation 14 | import SwiftBuild 15 | import Testing 16 | 17 | @Suite 18 | fileprivate struct TargetDependencyTests { 19 | @Test func basicEncoding() throws { 20 | try testCodable(ProjectModel.TargetDependency.example) 21 | } 22 | } 23 | 24 | 25 | extension ProjectModel.TargetDependency { 26 | static var example: Self { 27 | return ProjectModel.TargetDependency( 28 | targetId: "foo", 29 | platformFilters: [.example] 30 | ) 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Tests/SwiftBuildTests/TestData/CommandLineTool/CommandLineTool.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Tests/SwiftBuildTests/TestData/CommandLineTool/CommandLineTool.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Tests/SwiftBuildTests/TestData/CommandLineTool/CommandLineTool.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Tests/SwiftBuildTests/TestData/CommandLineTool/CommandLineTool.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Tests/SwiftBuildTests/TestData/CommandLineTool/CommandLineTool/main.c: -------------------------------------------------------------------------------- 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 | int main() { 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /Tests/SwiftBuildTests/TestData/CommandLineToolPackage/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | xcuserdata/ 6 | DerivedData/ 7 | .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata 8 | -------------------------------------------------------------------------------- /Tests/SwiftBuildTests/TestData/CommandLineToolPackage/.swiftpm/xcode/package.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Tests/SwiftBuildTests/TestData/CommandLineToolPackage/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:5.3 2 | import PackageDescription 3 | 4 | let package = Package( 5 | name: "CommandLineToolPackage", 6 | products: [ 7 | .executable( 8 | name: "CommandLineToolPackage", 9 | targets: ["CommandLineToolPackage"]), 10 | ], 11 | targets: [ 12 | .target( 13 | name: "CommandLineToolPackage", 14 | dependencies: []), 15 | ] 16 | ) 17 | -------------------------------------------------------------------------------- /Tests/SwiftBuildTests/TestData/CommandLineToolPackage/Sources/CommandLineToolPackage/main.swift: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /Tests/SwiftBuildTests/TestData/WordTagger.mlmodel: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swiftlang/swift-build/b1337725e2807dd9ccb069a73058be1db5485455/Tests/SwiftBuildTests/TestData/WordTagger.mlmodel -------------------------------------------------------------------------------- /Utilities/SwiftBuild+Deps.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Utilities/SwiftPM+SwiftBuild.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Utilities/swift-ci-perf-tests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##===----------------------------------------------------------------------===## 3 | ## 4 | ## This source file is part of the Swift open source project 5 | ## 6 | ## Copyright (c) 2025 Apple Inc. and the Swift project authors 7 | ## Licensed under Apache License v2.0 with Runtime Library Exception 8 | ## 9 | ## See http://swift.org/LICENSE.txt for license information 10 | ## See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors 11 | ## 12 | ##===----------------------------------------------------------------------===## 13 | 14 | set -euo pipefail 15 | 16 | __dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 17 | cd "${__dir}"/.. 18 | 19 | swift test -c release --filter Perf 20 | -------------------------------------------------------------------------------- /cmake/modules/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SWIFTBUILD_EXPORTS_FILE ${CMAKE_CURRENT_BINARY_DIR}/SwiftBuildExports.cmake) 2 | 3 | configure_file(SwiftBuildConfig.cmake.in 4 | ${CMAKE_CURRENT_BINARY_DIR}/SwiftBuildConfig.cmake) 5 | 6 | get_property(SWIFTBUILD_EXPORTS GLOBAL PROPERTY SWIFTBUILD_EXPORTS) 7 | export(TARGETS ${SWIFTBUILD_EXPORTS} 8 | NAMESPACE SwiftBuild:: 9 | FILE ${SWIFTBUILD_EXPORTS_FILE}) 10 | -------------------------------------------------------------------------------- /cmake/modules/SwiftBuildConfig.cmake.in: -------------------------------------------------------------------------------- 1 | ##===----------------------------------------------------------------------===## 2 | ## 3 | ## This source file is part of the Swift open source project 4 | ## 5 | ## Copyright (c) YEARS 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 | if(NOT TARGET SwiftBuild::SwiftBuild) 13 | include(@SWIFTBUILD_EXPORTS_FILE@) 14 | endif() 15 | --------------------------------------------------------------------------------