-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathPackage.swift
78 lines (68 loc) · 2.37 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// swift-tools-version: 5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "SwiftTranslate",
platforms: [
.macOS(.v12)
],
products: [
.plugin(
name: "SwiftTranslate",
targets: ["SwiftTranslate"]
),
.executable(
name: "swift-translate",
targets: ["swift-translate"]
),
.library(
name: "SwiftStringCatalog",
targets: ["SwiftStringCatalog"]
)
],
dependencies: [
.package(url: "https://github.com/apple/swift-argument-parser", .upToNextMajor(from: "1.5.0")),
.package(url: "https://github.com/MacPaw/OpenAI.git", .upToNextMajor(from: "0.3.0")),
.package(url: "https://github.com/onevcat/Rainbow.git", .upToNextMajor(from: "4.0.0")),
],
targets: [
// Main Plugin
.plugin(
name: "SwiftTranslate",
capability: .command(
intent: .custom(
verb: "swift-translate",
description: "Translates project String Catalogs using OpenAI's GPT 3.5 model"
),
permissions: [
.writeToPackageDirectory(reason: "Translates string catalogs in your project"),
.allowNetworkConnections(scope: .all(ports: []), reason: "Needs access to OpenAI servers")
]
),
dependencies: [
.target(name: "swift-translate")
]
),
// Libraries
.executableTarget(
name: "swift-translate",
dependencies: [
.product(name: "ArgumentParser", package: "swift-argument-parser"),
.product(name: "OpenAI", package: "OpenAI"),
.product(name: "Rainbow", package: "Rainbow"),
"SwiftStringCatalog"
],
path: "Sources/SwiftTranslate"
),
.target(
name: "SwiftStringCatalog"
),
// Tests
.testTarget(
name: "SwiftStringCatalogTests",
dependencies: ["SwiftStringCatalog"],
exclude: ["SwiftStringCatalog.xctestplan"],
resources: [.process("Resources")]
)
]
)