Skip to content

Commit d08a019

Browse files
authored
Move package collection JSON models to a separate module (#3199)
Motivation: Some publishers may opt to generate package collections on their own, which will require the JSON models. It might not be desirable to pull in all the dependencies that come with PackageCollections module. Modifications: Move PackageCollections/JSONModel into its own PackageCollectionsModel module and make it a product. Result: Package collection JSON models can be used with minimal dependencies.
1 parent 610c282 commit d08a019

File tree

11 files changed

+599
-417
lines changed

11 files changed

+599
-417
lines changed

Package.swift

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ let package = Package(
3939
"SourceControl",
4040
"SPMLLBuild",
4141
"PackageCollections",
42+
"PackageCollectionsModel",
4243
"LLBuildManifest",
4344
"PackageModel",
4445
"PackageLoading",
@@ -55,6 +56,7 @@ let package = Package(
5556
"SPMLLBuild",
5657
"LLBuildManifest",
5758
"PackageCollections",
59+
"PackageCollectionsModel",
5860
"PackageModel",
5961
"PackageLoading",
6062
"PackageGraph",
@@ -69,6 +71,7 @@ let package = Package(
6971
targets: [
7072
"SourceControl",
7173
"PackageCollections",
74+
"PackageCollectionsModel",
7275
"PackageModel",
7376
"PackageLoading",
7477
"PackageGraph",
@@ -87,6 +90,11 @@ let package = Package(
8790
type: .dynamic,
8891
targets: ["PackageDescription"]
8992
),
93+
94+
.library(
95+
name: "PackageCollectionsModel",
96+
targets: ["PackageCollectionsModel"]
97+
),
9098
],
9199
targets: [
92100
// The `PackageDescription` targets define the API which is available to
@@ -139,11 +147,16 @@ let package = Package(
139147
dependencies: ["SwiftToolsSupport-auto", "Basics", "PackageLoading", "PackageModel", "SourceControl"]),
140148

141149
// MARK: Package Collections
150+
151+
.target(
152+
/** Package collections models */
153+
name: "PackageCollectionsModel",
154+
dependencies: []),
142155

143156
.target(
144157
/** Data structures and support for package collections */
145158
name: "PackageCollections",
146-
dependencies: ["SwiftToolsSupport-auto", "Basics", "PackageModel", "SourceControl"]),
159+
dependencies: ["SwiftToolsSupport-auto", "Basics", "PackageModel", "SourceControl", "PackageCollectionsModel"]),
147160

148161
// MARK: Package Manager Functionality
149162

@@ -249,6 +262,9 @@ let package = Package(
249262
.testTarget(
250263
name: "PackageGraphPerformanceTests",
251264
dependencies: ["PackageGraph", "SPMTestSupport"]),
265+
.testTarget(
266+
name: "PackageCollectionsModelTests",
267+
dependencies: ["PackageCollectionsModel"]),
252268
.testTarget(
253269
name: "PackageCollectionsTests",
254270
dependencies: ["SPMTestSupport", "PackageCollections"]),

Sources/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ add_subdirectory(Build)
1111
add_subdirectory(Commands)
1212
add_subdirectory(LLBuildManifest)
1313
add_subdirectory(PackageCollections)
14+
add_subdirectory(PackageCollectionsModel)
1415
add_subdirectory(PackageDescription)
1516
add_subdirectory(PackageGraph)
1617
add_subdirectory(PackageLoading)

Sources/PackageCollections/CMakeLists.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
# This source file is part of the Swift.org open source project
22
#
3-
# Copyright (c) 2020 Apple Inc. and the Swift project authors
3+
# Copyright (c) 2020-2021 Apple Inc. and the Swift project authors
44
# Licensed under Apache License v2.0 with Runtime Library Exception
55
#
66
# See http://swift.org/LICENSE.txt for license information
77
# See http://swift.org/CONTRIBUTORS.txt for Swift project authors
88

99
add_library(PackageCollections
10-
JSONModel/JSONCollection.swift
11-
JSONModel/JSONCollection+v1.swift
1210
Model/Collection.swift
1311
Model/CVE.swift
1412
Model/License.swift

0 commit comments

Comments
 (0)