-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPackage.swift
More file actions
83 lines (77 loc) · 3.44 KB
/
Copy pathPackage.swift
File metadata and controls
83 lines (77 loc) · 3.44 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
// swift-tools-version:5.9
import PackageDescription
let package = Package(
name: "swift-aws-lambda-sam-dsl",
platforms: [
.macOS(.v12),
],
products: [
// SwiftPM plugin to deploy a SAM Lambda function
.plugin(name: "AWSLambdaDeployer", targets: ["AWSLambdaDeployer"]),
.executable(name: "DeploymentDescriptorGeneratorExecutable",
targets: ["DeploymentDescriptorGeneratorExecutable"]),
// SwiftPM plugin to generate a SAM deployment descriptor
.plugin(name: "AWSLambdaDescriptorGenerator", targets: ["AWSLambdaDescriptorGenerator"]),
// Shared Library to generate a SAM deployment descriptor
.library(name: "AWSLambdaDeploymentDescriptor", type: .dynamic, targets: ["AWSLambdaDeploymentDescriptor"]),
],
dependencies: [
.package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.0.0"),
.package(url: "https://github.com/apple/swift-log.git", .upToNextMajor(from: "1.4.2")),
.package(url: "https://github.com/hummingbird-project/hummingbird-mustache.git", from: "1.0.3"),
],
targets: [
.target(
name: "AWSLambdaDeploymentDescriptor",
path: "Sources/AWSLambdaDeploymentDescriptor"
),
.executableTarget(
name: "DeploymentDescriptorGeneratorExecutable",
dependencies: [
.byName(name: "AWSLambdaDeploymentDescriptorGenerator"),
.product(name: "ArgumentParser", package: "swift-argument-parser"),
.product(name: "Logging", package: "swift-log")
]
),
.target(name: "AWSLambdaDeploymentDescriptorGenerator", dependencies: [
.product(name: "Logging", package: "swift-log"),
.product(name: "ArgumentParser", package: "swift-argument-parser"),
.product(name: "HummingbirdMustache", package: "hummingbird-mustache"),
],
resources: [
.process("Resources/SamTranslatorSchema.json")
]
),
.plugin(
name: "AWSLambdaDeployer",
capability: .command(
intent: .custom(
verb: "deploy",
description: "Deploy the Lambda ZIP created by the archive plugin. Generates SAM-compliant deployment files based on deployment struct passed by the developer and invoke the SAM command."
)
// permissions: [.writeToPackageDirectory(reason: "This plugin generates a SAM template to describe your deployment")]
)
),
.plugin(
name: "AWSLambdaDescriptorGenerator",
capability: .buildTool(),
dependencies: ["DeploymentDescriptorGeneratorExecutable"]
),
.testTarget(
name: "AWSLambdaDeploymentDescriptorTests",
dependencies: [
.byName(name: "AWSLambdaDeploymentDescriptor"),
]
),
.testTarget(
name: "AWSLambdaDeploymentDescriptorGeneratorTests",
dependencies: [
.byName(name: "AWSLambdaDeploymentDescriptorGenerator"),
],
// https://stackoverflow.com/questions/47177036/use-resources-in-unit-tests-with-swift-package-manager
resources: [
.copy("Resources/SimpleJSONSchema.json"),
.copy("Resources/SAMJSONSchema.json")]
),
]
)