Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basics,Commands,PackageLoading,SPMBuildCore: internalize Collections #8244

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,6 @@ let package = Package(
dependencies: [
"Basics",
"PackageGraph",
.product(name: "OrderedCollections", package: "swift-collections"),
],
exclude: ["CMakeLists.txt"],
swiftSettings: [
Expand Down Expand Up @@ -441,7 +440,6 @@ let package = Package(
dependencies: [
"SPMBuildCore",
"PackageGraph",
.product(name: "OrderedCollections", package: "swift-collections"),
],
exclude: ["CMakeLists.txt"],
swiftSettings: [
Expand Down Expand Up @@ -713,7 +711,6 @@ let package = Package(
"PackageSigning",
"SourceControl",
.product(name: "TSCTestSupport", package: "swift-tools-support-core"),
.product(name: "OrderedCollections", package: "swift-collections"),
"Workspace",
],
swiftSettings: [
Expand Down
2 changes: 1 addition & 1 deletion Sources/Basics/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ add_library(Basics
Vendor/Triple+Platforms.swift)
target_link_libraries(Basics PUBLIC
_AsyncFileSystem
SwiftCollections::OrderedCollections
TSCBasic
TSCUtility)
target_link_libraries(Basics PRIVATE
SwiftCollections::DequeModule
SwiftCollections::OrderedCollections
SPMSQLite3
TSCclibc)

Expand Down
2 changes: 1 addition & 1 deletion Sources/Basics/Collections/IdentifiableSet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
//
//===----------------------------------------------------------------------===//

import struct OrderedCollections.OrderedDictionary
private import OrderedCollections

/// Replacement for `Set` elements that can't be `Hashable`, but can be `Identifiable`.
public struct IdentifiableSet<Element: Identifiable>: Collection {
Expand Down
2 changes: 1 addition & 1 deletion Sources/Basics/Graph/GraphAlgorithms.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
//
//===----------------------------------------------------------------------===//

import struct OrderedCollections.OrderedSet
private import OrderedCollections

/// Implements a pre-order depth-first search.
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,12 @@

import Basics
import PackageGraph

@_spi(SwiftPMInternal)
import PackageModel

import OrderedCollections
import SPMBuildCore

private import OrderedCollections

import struct TSCBasic.SortedArray

/// The build description for a product.
Expand Down
5 changes: 3 additions & 2 deletions Sources/Build/BuildPlan/BuildPlan.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ import _Concurrency
import Basics
import Foundation
import LLBuildManifest
import OrderedCollections
import PackageGraph
import PackageLoading
import PackageModel
import SPMBuildCore

private import OrderedCollections

#if USE_IMPL_ONLY_IMPORTS
@_implementationOnly import SwiftDriver
#else
Expand Down Expand Up @@ -665,7 +666,7 @@ public class BuildPlan: SPMBuildCore.BuildPlan {
}

// Build cache
var cflagsCache: OrderedCollections.OrderedSet<String> = []
var cflagsCache: OrderedSet<String> = []
var libsCache: [String] = []
for tuple in ret {
for cFlag in tuple.cFlags {
Expand Down
2 changes: 1 addition & 1 deletion Sources/Build/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ add_library(Build
target_link_libraries(Build PUBLIC
TSCBasic
Basics
SwiftCollections::OrderedCollections
PackageGraph
SPMBuildCore)
target_link_libraries(Build PRIVATE
DriverSupport
LLBuildManifest
SPMLLBuild
SwiftCollections::OrderedCollections
SwiftDriver)
target_link_libraries(Build INTERFACE
llbuildSwift)
Expand Down
2 changes: 1 addition & 1 deletion Sources/Commands/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ add_library(Commands
Utilities/TestingSupport.swift
Utilities/XCTEvents.swift)
target_link_libraries(Commands PUBLIC
SwiftCollections::OrderedCollections
ArgumentParser
Basics
Build
Expand All @@ -69,6 +68,7 @@ target_link_libraries(Commands PUBLIC
XCBuildSupport)
target_link_libraries(Commands PRIVATE
DriverSupport
SwiftCollections::OrderedCollections
$<$<NOT:$<PLATFORM_ID:Darwin>>:FoundationXML>)
# NOTE(compnerd) workaround for CMake not setting up include flags yet
set_target_properties(Commands PROPERTIES
Expand Down
7 changes: 4 additions & 3 deletions Sources/Commands/CommandWorkspaceDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@ import CoreCommands
import Dispatch
import class Foundation.NSLock
import struct Foundation.URL
import OrderedCollections
import PackageGraph
import PackageModel
import SPMBuildCore
import Workspace

private import OrderedCollections

import protocol TSCBasic.OutputByteStream
import struct TSCUtility.Version

Expand All @@ -36,11 +37,11 @@ final class CommandWorkspaceDelegate: WorkspaceDelegate {
}

/// The progress of binary downloads.
private var binaryDownloadProgress = OrderedCollections.OrderedDictionary<String, DownloadProgress>()
private var binaryDownloadProgress = OrderedDictionary<String, DownloadProgress>()
private let binaryDownloadProgressLock = NSLock()

/// The progress of package fetch operations.
private var fetchProgress = OrderedCollections.OrderedDictionary<PackageIdentity, FetchProgress>()
private var fetchProgress = OrderedDictionary<PackageIdentity, FetchProgress>()
private let fetchProgressLock = NSLock()

private let observabilityScope: ObservabilityScope
Expand Down
3 changes: 2 additions & 1 deletion Sources/Commands/Utilities/MermaidPackageSerializer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
//
//===----------------------------------------------------------------------===//

import struct OrderedCollections.OrderedDictionary
private import OrderedCollections

import class PackageModel.Package
import class PackageModel.Product
import class PackageModel.Module
Expand Down
1 change: 1 addition & 0 deletions Sources/PackageLoading/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ target_link_libraries(PackageLoading PUBLIC
target_link_libraries(PackageLoading PUBLIC
$<$<NOT:$<PLATFORM_ID:Darwin>>:Foundation>)
target_link_libraries(PackageLoading PRIVATE
SwiftCollections::OrderedCollections
SourceControl)
# NOTE(compnerd) workaround for CMake not setting up include flags yet
set_target_properties(PackageLoading PROPERTIES
Expand Down
5 changes: 3 additions & 2 deletions Sources/PackageLoading/PackageBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@

import Basics
import Dispatch
import OrderedCollections
import PackageModel

private import OrderedCollections

import func TSCBasic.findCycle
import struct TSCBasic.KeyedPair
import func TSCBasic.topologicalSort
Expand Down Expand Up @@ -1404,7 +1405,7 @@ public final class PackageBuilder {

/// Collects the products defined by a package.
private func constructProducts(_ modules: [Module]) throws -> [Product] {
var products = OrderedCollections.OrderedSet<KeyedPair<Product, String>>()
var products = OrderedSet<KeyedPair<Product, String>>()

/// Helper method to append to products array.
func append(_ product: Product) {
Expand Down
3 changes: 1 addition & 2 deletions Sources/PackageLoading/PkgConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@

import Basics
import Foundation
import OrderedCollections

import class Basics.AsyncProcess
private import OrderedCollections

/// Information on an individual `pkg-config` supported package.
public struct PkgConfig {
Expand Down
1 change: 0 additions & 1 deletion Sources/SPMBuildCore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ target_link_libraries(SPMBuildCore PUBLIC
TSCBasic
TSCUtility
Basics
SwiftCollections::OrderedCollections
PackageGraph)


Expand Down
2 changes: 0 additions & 2 deletions Sources/SPMBuildCore/Plugins/PluginInvocation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ import PackageModel
import PackageLoading
import PackageGraph

import struct OrderedCollections.OrderedDictionary

import protocol TSCBasic.DiagnosticLocation

public enum PluginAction {
Expand Down
1 change: 0 additions & 1 deletion Sources/_InternalTestSupport/misc.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import struct Foundation.URL
#if os(macOS)
import class Foundation.Bundle
#endif
import OrderedCollections

@_spi(DontAdoptOutsideOfSwiftPMExposedForBenchmarksAndTestsOnly)
import PackageGraph
Expand Down
5 changes: 3 additions & 2 deletions Sources/swift-bootstrap/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ import Dispatch
import DriverSupport

import Foundation
import OrderedCollections
import PackageGraph
import PackageLoading
import PackageModel
import SPMBuildCore
import XCBuildSupport

private import OrderedCollections

import struct TSCBasic.KeyedPair
import func TSCBasic.topologicalSort
import var TSCBasic.stdoutStream
Expand Down Expand Up @@ -398,7 +399,7 @@ struct SwiftBootstrapBuildTool: AsyncParsableCommand {
return try ModulesGraph.load(
root: packageGraphRoot,
identityResolver: identityResolver,
externalManifests: loadedManifests.reduce(into: OrderedCollections.OrderedDictionary<PackageIdentity, (manifest: Manifest, fs: FileSystem)>()) { partial, item in
externalManifests: loadedManifests.reduce(into: OrderedDictionary<PackageIdentity, (manifest: Manifest, fs: FileSystem)>()) { partial, item in
partial[item.key] = (manifest: item.value, fs: self.fileSystem)
},
binaryArtifacts: [:],
Expand Down