|
| 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 | +private import Foundation |
| 14 | +public import SWBUtil |
| 15 | +import SWBMacro |
| 16 | + |
| 17 | +public final class BuildDependencyInfoSpec: CommandLineToolSpec, SpecImplementationType, @unchecked Sendable { |
| 18 | + public static let identifier = "com.apple.tools.build-dependency-info" |
| 19 | + |
| 20 | + public static func construct(registry: SpecRegistry, proxy: SpecProxy) -> Spec { |
| 21 | + return Self.init(registry: registry) |
| 22 | + } |
| 23 | + |
| 24 | + public init(registry: SpecRegistry) { |
| 25 | + let proxy = SpecProxy(identifier: Self.identifier, domain: "", path: Path(""), type: Self.self, classType: nil, basedOn: nil, data: ["ExecDescription": PropertyListItem("Merging build dependency info")], localizedStrings: nil) |
| 26 | + super.init(createSpecParser(for: proxy, registry: registry), nil, isGeneric: false) |
| 27 | + } |
| 28 | + |
| 29 | + required init(_ parser: SpecParser, _ basedOnSpec: Spec?) { |
| 30 | + super.init(parser, basedOnSpec, isGeneric: false) |
| 31 | + } |
| 32 | + |
| 33 | + override public func constructTasks(_ cbc: CommandBuildContext, _ delegate: any TaskGenerationDelegate) async { |
| 34 | + fatalError("unexpected direct invocation") |
| 35 | + } |
| 36 | + |
| 37 | + public func createTasks(_ cbc: CommandBuildContext, _ delegate: any TaskGenerationDelegate, dumpDependencyPaths: [Path]) async { |
| 38 | + delegate.createTask(type: self, ruleInfo: ["BuildDependencyInfo"], commandLine: ["builtin-build-dependency-info"] + dumpDependencyPaths.map { $0.str }, environment: EnvironmentBindings(), workingDirectory: cbc.producer.defaultWorkingDirectory, inputs: dumpDependencyPaths, outputs: [cbc.output], action: delegate.taskActionCreationDelegate.createBuildDependencyInfoTaskAction(), preparesForIndexing: false, enableSandboxing: false) |
| 39 | + } |
| 40 | +} |
0 commit comments