@@ -664,51 +664,64 @@ public final class SwiftTool {
664
664
return buildSystem
665
665
}
666
666
667
+ private func _buildParams( toolchain: UserToolchain ) throws -> BuildParameters {
668
+ let targetTriple = toolchain. targetTriple
669
+
670
+ let dataPath = self . scratchDirectory. appending (
671
+ component: targetTriple. platformBuildPathComponent ( buildSystem: options. build. buildSystem)
672
+ )
673
+
674
+ return try BuildParameters (
675
+ dataPath: dataPath,
676
+ configuration: options. build. configuration,
677
+ toolchain: toolchain,
678
+ targetTriple: targetTriple,
679
+ flags: options. build. buildFlags,
680
+ pkgConfigDirectories: options. locations. pkgConfigDirectories,
681
+ architectures: options. build. architectures,
682
+ workers: options. build. jobs ?? UInt32 ( ProcessInfo . processInfo. activeProcessorCount) ,
683
+ shouldLinkStaticSwiftStdlib: options. linker. shouldLinkStaticSwiftStdlib,
684
+ canRenameEntrypointFunctionName: driverSupport. checkSupportedFrontendFlags (
685
+ flags: [ " entry-point-function-name " ] ,
686
+ toolchain: toolchain,
687
+ fileSystem: self . fileSystem
688
+ ) ,
689
+ sanitizers: options. build. enabledSanitizers,
690
+ enableCodeCoverage: false , // set by test commands when appropriate
691
+ indexStoreMode: options. build. indexStoreMode. buildParameter,
692
+ enableParseableModuleInterfaces: options. build. shouldEnableParseableModuleInterfaces,
693
+ useIntegratedSwiftDriver: options. build. useIntegratedSwiftDriver,
694
+ useExplicitModuleBuild: options. build. useExplicitModuleBuild,
695
+ isXcodeBuildSystemEnabled: options. build. buildSystem == . xcode,
696
+ forceTestDiscovery: options. build. enableTestDiscovery, // backwards compatibility, remove with --enable-test-discovery
697
+ testEntryPointPath: options. build. testEntryPointPath,
698
+ explicitTargetDependencyImportCheckingMode: options. build. explicitTargetDependencyImportCheck. modeParameter,
699
+ linkerDeadStrip: options. linker. linkerDeadStrip,
700
+ verboseOutput: self . logLevel <= . info,
701
+ linkTimeOptimizationMode: options. build. linkTimeOptimizationMode? . buildParameter,
702
+ debugInfoFormat: options. build. debugInfoFormat. buildParameter
703
+ )
704
+ }
705
+
706
+ /// Return the build parameters for the host toolchain.
707
+ public func hostBuildParameters( ) throws -> BuildParameters {
708
+ return try _hostBuildParameters. get ( )
709
+ }
710
+
711
+ private lazy var _hostBuildParameters : Result < BuildParameters , Swift . Error > = {
712
+ return Result ( catching: {
713
+ try _buildParams ( toolchain: self . getHostToolchain ( ) )
714
+ } )
715
+ } ( )
716
+
667
717
/// Return the build parameters.
668
718
public func buildParameters( ) throws -> BuildParameters {
669
719
return try _buildParameters. get ( )
670
720
}
671
721
672
722
private lazy var _buildParameters : Result < BuildParameters , Swift . Error > = {
673
723
return Result ( catching: {
674
- let targetToolchain = try self . getTargetToolchain ( )
675
- let targetTriple = targetToolchain. targetTriple
676
-
677
- // Use "apple" as the subdirectory because in theory Xcode build system
678
- // can be used to build for any Apple platform and it has it's own
679
- // conventions for build subpaths based on platforms.
680
- let dataPath = self . scratchDirectory. appending (
681
- component: targetTriple. platformBuildPathComponent ( buildSystem: options. build. buildSystem)
682
- )
683
-
684
- return try BuildParameters (
685
- dataPath: dataPath,
686
- configuration: options. build. configuration,
687
- toolchain: targetToolchain,
688
- targetTriple: targetTriple,
689
- flags: options. build. buildFlags,
690
- pkgConfigDirectories: options. locations. pkgConfigDirectories,
691
- architectures: options. build. architectures,
692
- workers: options. build. jobs ?? UInt32 ( ProcessInfo . processInfo. activeProcessorCount) ,
693
- shouldLinkStaticSwiftStdlib: options. linker. shouldLinkStaticSwiftStdlib,
694
- canRenameEntrypointFunctionName: driverSupport. checkSupportedFrontendFlags (
695
- flags: [ " entry-point-function-name " ] , toolchain: targetToolchain, fileSystem: self . fileSystem
696
- ) ,
697
- sanitizers: options. build. enabledSanitizers,
698
- enableCodeCoverage: false , // set by test commands when appropriate
699
- indexStoreMode: options. build. indexStoreMode. buildParameter,
700
- enableParseableModuleInterfaces: options. build. shouldEnableParseableModuleInterfaces,
701
- useIntegratedSwiftDriver: options. build. useIntegratedSwiftDriver,
702
- useExplicitModuleBuild: options. build. useExplicitModuleBuild,
703
- isXcodeBuildSystemEnabled: options. build. buildSystem == . xcode,
704
- forceTestDiscovery: options. build. enableTestDiscovery, // backwards compatibility, remove with --enable-test-discovery
705
- testEntryPointPath: options. build. testEntryPointPath,
706
- explicitTargetDependencyImportCheckingMode: options. build. explicitTargetDependencyImportCheck. modeParameter,
707
- linkerDeadStrip: options. linker. linkerDeadStrip,
708
- verboseOutput: self . logLevel <= . info,
709
- linkTimeOptimizationMode: options. build. linkTimeOptimizationMode? . buildParameter,
710
- debugInfoFormat: options. build. debugInfoFormat. buildParameter
711
- )
724
+ try _buildParams ( toolchain: self . getTargetToolchain ( ) )
712
725
} )
713
726
} ( )
714
727
0 commit comments