-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
58 lines (48 loc) · 1.62 KB
/
Copy pathbuild.gradle
File metadata and controls
58 lines (48 loc) · 1.62 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
plugins {
id 'java'
}
group 'com.anderb.chatbot'
version '0.1.0'
ext {
functionName = 'chatgpt-bot-function'
bucketName = project.findProperty('bucket')
objectKey = project.findProperty('key') ?: "${functionName}.zip"
}
repositories {
mavenCentral()
}
dependencies {
implementation 'com.amazonaws:aws-lambda-java-core:1.2.1'
implementation 'com.amazonaws:aws-lambda-java-events:3.12.0'
implementation 'com.amazonaws:aws-java-sdk-dynamodb:1.12.765'
implementation 'org.slf4j:slf4j-api:2.0.12'
implementation 'org.slf4j:slf4j-simple:2.0.13'
implementation 'org.telegram:telegrambots:6.9.7.0'
compileOnly 'org.projectlombok:lombok:1.18.34'
annotationProcessor 'org.projectlombok:lombok:1.18.34'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.3'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.2'
}
test {
useJUnitPlatform()
}
tasks.register('buildZip', Zip) {
from compileJava
from processResources
into('lib') {
from configurations.runtimeClasspath
}
archiveFileName = "${functionName}.zip"
}
build.dependsOn buildZip
tasks.register('deploy', Exec) {
dependsOn buildZip
commandLine 'aws', 'lambda', 'update-function-code', '--function-name', functionName, '--zip-file', "fileb://build/distributions/${functionName}.zip"
}
tasks.register('upload', Exec) {
dependsOn build
doFirst {
println "Executing command: aws s3 cp build/distributions/${functionName}.zip s3://${bucketName}/${objectKey}"
}
commandLine 'aws', 's3', 'cp', "build/distributions/${functionName}.zip", "s3://${bucketName}/${objectKey}"
}