-
Notifications
You must be signed in to change notification settings - Fork 16
/
Package.swift
60 lines (52 loc) · 1.75 KB
/
Package.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// swift-tools-version:5.1
//===----------------------------------------------------------*- swift -*-===//
//
// This source file is part of the Swift open source project
//
// Copyright (c) 2019 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
//
//===----------------------------------------------------------------------===//
import PackageDescription
/// Details about an SE package.
struct Export {
var package: String
var requirement: Package.Dependency.Requirement
var name: String {
let parts = package.split(separator: "-")
let SE = parts[1].uppercased()
let name = parts[2...].map { $0.capitalized }.joined()
return "\(SE)_\(name)"
}
var packageDependency: PackageDescription.Package.Dependency {
.package(url: "https://github.com/apple/\(package)", requirement)
}
var targetDependency: Target.Dependency {
.product(name: name, package: package)
}
}
/// The list of SE packages to re-export.
let exports = [
Export(package: "swift-se0270-range-set", requirement: .upToNextMajor(from: "1.0.0")),
Export(package: "swift-se0288-is-power", requirement: .upToNextMajor(from: "2.0.0")),
]
/// The `StandardLibraryPreview` package definition.
let package = Package(
name: "swift-standard-library-preview",
products: [
.library(
name: "StandardLibraryPreview",
targets: ["StandardLibraryPreview"]),
],
dependencies: exports.map { $0.packageDependency },
targets: [
.target(
name: "StandardLibraryPreview",
dependencies: exports.map { $0.targetDependency }),
.testTarget(
name: "ExportTests",
dependencies: ["StandardLibraryPreview"]),
]
)