Skip to content

Commit

Permalink
Merge pull request #1129 from ahoppen/ahoppen/fix-swiftpm-deprecations
Browse files Browse the repository at this point in the history
Fix SwiftPM deprecation warnings
  • Loading branch information
ahoppen committed Mar 13, 2024
2 parents 05f9859 + f06b2aa commit a6628d0
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions Sources/SKSwiftPMWorkspace/SwiftPMWorkspace.swift
Expand Up @@ -84,7 +84,7 @@ public actor SwiftPMWorkspace {
let workspacePath: TSCAbsolutePath
/// The directory containing `Package.swift`.
public var projectRoot: TSCAbsolutePath
var packageGraph: PackageGraph
var modulesGraph: ModulesGraph
let workspace: Workspace
public let buildParameters: BuildParameters
let fileSystem: FileSystem
Expand Down Expand Up @@ -163,7 +163,7 @@ public actor SwiftPMWorkspace {
flags: buildSetup.flags
)

self.packageGraph = try PackageGraph(rootPackages: [], dependencies: [], binaryArtifacts: [:])
self.modulesGraph = try ModulesGraph(rootPackages: [], dependencies: [], binaryArtifacts: [:])
self.reloadPackageStatusCallback = reloadPackageStatusCallback

try await reloadPackage()
Expand Down Expand Up @@ -213,7 +213,7 @@ extension SwiftPMWorkspace {
logger.log(level: diagnostic.severity.asLogLevel, "SwiftPM log: \(diagnostic.description)")
})

let packageGraph = try self.workspace.loadPackageGraph(
let modulesGraph = try self.workspace.loadPackageGraph(
rootInput: PackageGraphRootInput(packages: [AbsolutePath(projectRoot)]),
forceResolvedVersions: true,
availableLibraries: self.buildParameters.toolchain.providedLibraries,
Expand All @@ -223,7 +223,7 @@ extension SwiftPMWorkspace {
let plan = try BuildPlan(
productsBuildParameters: buildParameters,
toolsBuildParameters: buildParameters,
graph: packageGraph,
graph: modulesGraph,
fileSystem: fileSystem,
observabilityScope: observabilitySystem.topScope
)
Expand All @@ -232,10 +232,10 @@ extension SwiftPMWorkspace {
/// Make sure to execute any throwing statements before setting any
/// properties because otherwise we might end up in an inconsistent state
/// with only some properties modified.
self.packageGraph = packageGraph
self.modulesGraph = modulesGraph

self.fileToTarget = [AbsolutePath: SwiftBuildTarget](
packageGraph.allTargets.flatMap { target in
modulesGraph.allTargets.flatMap { target in
return target.sources.paths.compactMap {
guard let buildTarget = buildDescription.getBuildTarget(for: target) else {
return nil
Expand All @@ -250,7 +250,7 @@ extension SwiftPMWorkspace {
)

self.sourceDirToTarget = [AbsolutePath: SwiftBuildTarget](
packageGraph.allTargets.compactMap { (target) -> (AbsolutePath, SwiftBuildTarget)? in
modulesGraph.allTargets.compactMap { (target) -> (AbsolutePath, SwiftBuildTarget)? in
guard let buildTarget = buildDescription.getBuildTarget(for: target) else {
return nil
}
Expand Down Expand Up @@ -351,7 +351,7 @@ extension SwiftPMWorkspace: SKCore.BuildSystem {

return self.workspace.fileAffectsSwiftOrClangBuildSettings(
filePath: path,
packageGraph: self.packageGraph
packageGraph: self.modulesGraph
)
case .changed:
return fileURL.lastPathComponent == "Package.swift"
Expand Down Expand Up @@ -389,7 +389,7 @@ extension SwiftPMWorkspace {
/// Retrieve settings for a package manifest (Package.swift).
private func settings(forPackageManifest path: AbsolutePath) throws -> FileBuildSettings? {
func impl(_ path: AbsolutePath) -> FileBuildSettings? {
for package in packageGraph.packages where path == package.manifest.path {
for package in modulesGraph.packages where path == package.manifest.path {
let compilerArgs = workspace.interpreterFlags(for: package.path) + [path.pathString]
return FileBuildSettings(compilerArguments: compilerArgs)
}
Expand Down

0 comments on commit a6628d0

Please sign in to comment.