Skip to content

Commit eb946f5

Browse files
committed
Extract BuildConfiguration and BuildEnvironment into separate files
1 parent 8162869 commit eb946f5

File tree

4 files changed

+44
-24
lines changed

4 files changed

+44
-24
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
This source file is part of the Swift.org open source project
3+
4+
Copyright (c) 2014 - 2020 Apple Inc. and the Swift project authors
5+
Licensed under Apache License v2.0 with Runtime Library Exception
6+
7+
See http://swift.org/LICENSE.txt for license information
8+
See http://swift.org/CONTRIBUTORS.txt for Swift project authors
9+
*/
10+
11+
/// The configuration of the build environment.
12+
public enum BuildConfiguration: String, CaseIterable, Codable {
13+
case debug
14+
case release
15+
16+
public var dirname: String {
17+
switch self {
18+
case .debug: return "debug"
19+
case .release: return "release"
20+
}
21+
}
22+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
This source file is part of the Swift.org open source project
3+
4+
Copyright (c) 2014 - 2020 Apple Inc. and the Swift project authors
5+
Licensed under Apache License v2.0 with Runtime Library Exception
6+
7+
See http://swift.org/LICENSE.txt for license information
8+
See http://swift.org/CONTRIBUTORS.txt for Swift project authors
9+
*/
10+
11+
/// A build environment with which to evaluation conditions.
12+
public struct BuildEnvironment: Codable {
13+
public let platform: Platform
14+
public let configuration: BuildConfiguration
15+
16+
public init(platform: Platform, configuration: BuildConfiguration) {
17+
self.platform = platform
18+
self.configuration = configuration
19+
}
20+
}

Sources/PackageModel/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
# See http://swift.org/CONTRIBUTORS.txt for Swift project authors
88

99
add_library(PackageModel
10+
BuildConfiguration.swift
11+
BuildEnvironment.swift
1012
BuildSettings.swift
1113
Diagnostics.swift
1214
Manifest.swift

Sources/PackageModel/Manifest.swift

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -958,30 +958,6 @@ public enum TargetBuildSettingDescription {
958958
}
959959
}
960960

961-
/// The configuration of the build environment.
962-
public enum BuildConfiguration: String, CaseIterable, Codable {
963-
case debug
964-
case release
965-
966-
public var dirname: String {
967-
switch self {
968-
case .debug: return "debug"
969-
case .release: return "release"
970-
}
971-
}
972-
}
973-
974-
/// A build environment with which to evaluation conditions.
975-
public struct BuildEnvironment: Codable {
976-
public let platform: Platform
977-
public let configuration: BuildConfiguration
978-
979-
public init(platform: Platform, configuration: BuildConfiguration) {
980-
self.platform = platform
981-
self.configuration = configuration
982-
}
983-
}
984-
985961
/// A manifest condition.
986962
public protocol PackageConditionProtocol: Codable {
987963
func satisfies(_ environment: BuildEnvironment) -> Bool

0 commit comments

Comments
 (0)