|
| 1 | +// swift-tools-version:5.5 |
| 2 | +//===----------------------------------------------------------------------===// |
| 3 | +// |
| 4 | +// This source file is part of the Swift Collections open source project |
| 5 | +// |
| 6 | +// Copyright (c) 2021-2022 Apple Inc. and the Swift project authors |
| 7 | +// Licensed under Apache License v2.0 with Runtime Library Exception |
| 8 | +// |
| 9 | +// See https://swift.org/LICENSE.txt for license information |
| 10 | +// |
| 11 | +//===----------------------------------------------------------------------===// |
| 12 | + |
| 13 | +import PackageDescription |
| 14 | + |
| 15 | +// This package recognizes the conditional compilation flags listed below. |
| 16 | +// To use enable them, uncomment the corresponding lines or define them |
| 17 | +// from the package manager command line: |
| 18 | +// |
| 19 | +// swift build -Xswiftc -DCOLLECTIONS_INTERNAL_CHECKS |
| 20 | +var settings: [SwiftSetting] = [ |
| 21 | + |
| 22 | + // Enables internal consistency checks at the end of initializers and |
| 23 | + // mutating operations. This can have very significant overhead, so enabling |
| 24 | + // this setting invalidates all documented performance guarantees. |
| 25 | + // |
| 26 | + // This is mostly useful while debugging an issue with the implementation of |
| 27 | + // the hash table itself. This setting should never be enabled in production |
| 28 | + // code. |
| 29 | +// .define("COLLECTIONS_INTERNAL_CHECKS"), |
| 30 | + |
| 31 | + // Hashing collections provided by this package usually seed their hash |
| 32 | + // function with the address of the memory location of their storage, |
| 33 | + // to prevent some common hash table merge/copy operations from regressing to |
| 34 | + // quadratic behavior. This setting turns off this mechanism, seeding |
| 35 | + // the hash function with the table's size instead. |
| 36 | + // |
| 37 | + // When used in conjunction with the SWIFT_DETERMINISTIC_HASHING environment |
| 38 | + // variable, this enables reproducible hashing behavior. |
| 39 | + // |
| 40 | + // This is mostly useful while debugging an issue with the implementation of |
| 41 | + // the hash table itself. This setting should never be enabled in production |
| 42 | + // code. |
| 43 | +// .define("COLLECTIONS_DETERMINISTIC_HASHING"), |
| 44 | +] |
| 45 | + |
| 46 | +let package = Package( |
| 47 | + name: "swift-collections", |
| 48 | + products: [ |
| 49 | + .library(name: "Collections", targets: ["Collections"]), |
| 50 | + .library(name: "DequeModule", targets: ["DequeModule"]), |
| 51 | + .library(name: "OrderedCollections", targets: ["OrderedCollections"]), |
| 52 | + ], |
| 53 | + targets: [ |
| 54 | + .target( |
| 55 | + name: "Collections", |
| 56 | + dependencies: [ |
| 57 | + "DequeModule", |
| 58 | + "OrderedCollections", |
| 59 | + ], |
| 60 | + path: "Sources/Collections", |
| 61 | + exclude: ["CMakeLists.txt"], |
| 62 | + swiftSettings: settings), |
| 63 | + |
| 64 | + // Testing support module |
| 65 | + .target( |
| 66 | + name: "_CollectionsTestSupport", |
| 67 | + dependencies: [], |
| 68 | + swiftSettings: settings, |
| 69 | + linkerSettings: [ |
| 70 | + .linkedFramework( |
| 71 | + "XCTest", |
| 72 | + .when(platforms: [.macOS, .iOS, .watchOS, .tvOS])), |
| 73 | + ] |
| 74 | + ), |
| 75 | + .testTarget( |
| 76 | + name: "CollectionsTestSupportTests", |
| 77 | + dependencies: ["_CollectionsTestSupport"], |
| 78 | + swiftSettings: settings), |
| 79 | + |
| 80 | + // Deque<Element> |
| 81 | + .target( |
| 82 | + name: "DequeModule", |
| 83 | + exclude: ["CMakeLists.txt"], |
| 84 | + swiftSettings: settings), |
| 85 | + .testTarget( |
| 86 | + name: "DequeTests", |
| 87 | + dependencies: ["DequeModule", "_CollectionsTestSupport"], |
| 88 | + swiftSettings: settings), |
| 89 | + |
| 90 | + // OrderedSet<Element>, OrderedDictionary<Key, Value> |
| 91 | + .target( |
| 92 | + name: "OrderedCollections", |
| 93 | + exclude: ["CMakeLists.txt"], |
| 94 | + swiftSettings: settings), |
| 95 | + .testTarget( |
| 96 | + name: "OrderedCollectionsTests", |
| 97 | + dependencies: ["OrderedCollections", "_CollectionsTestSupport"], |
| 98 | + swiftSettings: settings), |
| 99 | + ] |
| 100 | +) |
0 commit comments