-
Notifications
You must be signed in to change notification settings - Fork 499
Expand file tree
/
Copy pathPackage.swift
More file actions
96 lines (94 loc) · 3.52 KB
/
Copy pathPackage.swift
File metadata and controls
96 lines (94 loc) · 3.52 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
// swift-tools-version:6.0
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import PackageDescription
// A Swift Package Manager build for the `idb-repl` CLI. This is an ADDITIONAL,
// standalone way to build idb-repl (`swift build --product idb-repl`); it does not
// replace or affect the xcodebuild (`build.sh`) or Buck builds. It is possible
// because idb-repl and its entire dependency closure -- CompanionUtilities,
// CompanionDiscovery and the generated IDBGRPCSwift -- are pure Swift, so none of
// the Objective-C simulator/device frameworks are involved.
//
// The tools-version of 6.0 means every target builds in the Swift 6 language mode
// by default.
let package = Package(
name: "idb",
platforms: [
.macOS(.v12)
],
products: [
.executable(name: "idb-repl", targets: ["idb-repl"])
],
dependencies: [
.package(url: "https://github.com/grpc/grpc-swift.git", from: "1.19.1"),
.package(url: "https://github.com/apple/swift-protobuf.git", from: "1.28.0"),
.package(url: "https://github.com/apple/swift-nio.git", from: "2.50.0"),
.package(url: "https://github.com/apple/swift-nio-ssl.git", from: "2.25.0"),
.package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.3.0"),
],
targets: [
.target(
name: "CompanionUtilities",
path: "CompanionUtilities"
),
.target(
name: "CompanionDiscovery",
path: "CompanionDiscovery"
),
// The gRPC/protobuf types generated from proto/idb.proto (checked in under
// IDBGRPCSwift/). Run `./build.sh generate-proto` to regenerate them.
.target(
name: "IDBGRPCSwift",
dependencies: [
.product(name: "GRPC", package: "grpc-swift"),
.product(name: "SwiftProtobuf", package: "swift-protobuf"),
.product(name: "NIO", package: "swift-nio"),
.product(name: "NIOConcurrencyHelpers", package: "swift-nio"),
],
path: "IDBGRPCSwift",
swiftSettings: [.swiftLanguageMode(.v5)]
),
// The shared REPL Swift compiler (source generation + swiftc), linked by
// idb-repl to compile injected code client-side. Pure Swift + Foundation.
.target(
name: "ReplCompiler",
path: "REPL/Compiler"
),
.executableTarget(
name: "idb-repl",
dependencies: [
"CompanionUtilities",
"CompanionDiscovery",
"IDBGRPCSwift",
"ReplCompiler",
.product(name: "GRPC", package: "grpc-swift"),
.product(name: "NIOCore", package: "swift-nio"),
.product(name: "NIOPosix", package: "swift-nio"),
.product(name: "NIOSSL", package: "swift-nio-ssl"),
.product(name: "ArgumentParser", package: "swift-argument-parser"),
],
path: "REPL/CLI",
// main.swift declares `@main`, so it must be parsed as a library rather
// than as top-level script code (mirrors OTHER_SWIFT_FLAGS in the
// xcodebuild build and -parse-as-library in the Buck build).
swiftSettings: [
.unsafeFlags(["-parse-as-library"])
],
// Generates BuildInfo.swift (kBuildDate / kBuildTime) at build time, the
// SwiftPM equivalent of the xcodebuild preBuildScript and Buck :BuildInfo
// genrule. Keeps the generated file out of the shared REPL/CLI sources.
plugins: [
"GenerateBuildInfo"
]
),
.plugin(
name: "GenerateBuildInfo",
capability: .buildTool(),
path: "Plugins/GenerateBuildInfo"
),
]
)