-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathbuild.gradle
221 lines (178 loc) · 8.17 KB
/
build.gradle
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
plugins {
id 'java'
id 'java-library'
id 'application'
id 'idea'
// Creates fat JAR
id 'com.github.johnrengelman.shadow' version '7.1.2'
// Downloads binary dependencies
id 'de.undercouch.download' version '5.2.1'
}
def gradleDependencyVersion = '7.4'
wrapper {
gradleVersion = gradleDependencyVersion
distributionType = Wrapper.DistributionType.ALL
}
// Use the GGProvisioner main class when the JAR is invoked directly
mainClassName = 'com.awslabs.aws.greengrass.provisioner.AwsGreengrassProvisioner'
distZip.enabled = shadowDistZip.enabled = false
distTar.enabled = shadowDistTar.enabled = false
// Specify all of our dependency versions
def daggerVersion = '2.44'
def configVersion = '1.4.2'
def ztZipVersion = '1.15'
def jcommanderVersion = '1.82'
def slf4jVersion = '2.0.3'
def jcabiVersion = '0.22.0'
def jtarVersion = '2.3'
def gsonVersion = '2.9.1'
def dockerClientVersion = '8.16.0'
def awsSdk2Version = '2.17.291'
def mavenInvokerVersion = '3.2.0'
def commonsTextVersion = '1.10.0'
def commonsLangVersion = '3.12.0'
def commonsIoVersion = '2.11.0'
def junitVersion = '4.13.2'
def systemRulesVersion = '1.19.0'
def mockitoVersion = '4.8.0'
def vavrVersion = '0.10.4'
def httpClientVersion = '4.5.13'
def jodahFailsafeVersion = '2.4.4'
def testContainersVersion = '1.17.5'
def hamcrestVersion = '2.2'
def awsIotCoreWebsocketsVersion = '4.0.1'
def awaitilityVersion = '4.2.0'
def immutablesValueVersion = '2.9.2'
def awsLambdaJavaCoreVersion = '1.2.1'
def resultsIteratorForAwsJavaSdkVersion = '11.0.2'
def nomenEstOmenVersion = '2.1.0'
def jschVersion = '0.1.55'
def jetbrainsAnnotationVersion = '23.0.0'
def buildDirDist = "$buildDir/dist"
def buildDirFoundation = "$buildDir/foundation"
def greengrassVersion = '1.11.0'
task downloadGreengrassBinaries(type: Download) {
// Download the Greengrass binaries into the dist directory so they can be packaged into the JAR
src(
["https://d1onfpft10uf5o.cloudfront.net/greengrass-core/downloads/$greengrassVersion/greengrass-linux-aarch64-${greengrassVersion}.tar.gz",
"https://d1onfpft10uf5o.cloudfront.net/greengrass-core/downloads/$greengrassVersion/greengrass-openwrt-aarch64-${greengrassVersion}.tar.gz",
"https://d1onfpft10uf5o.cloudfront.net/greengrass-core/downloads/$greengrassVersion/greengrass-linux-armv7l-${greengrassVersion}.tar.gz",
"https://d1onfpft10uf5o.cloudfront.net/greengrass-core/downloads/$greengrassVersion/greengrass-openwrt-armv7l-${greengrassVersion}.tar.gz",
"https://d1onfpft10uf5o.cloudfront.net/greengrass-core/downloads/$greengrassVersion/greengrass-linux-armv6l-${greengrassVersion}.tar.gz",
"https://d1onfpft10uf5o.cloudfront.net/greengrass-core/downloads/$greengrassVersion/greengrass-linux-x86-64-${greengrassVersion}.tar.gz"]
)
dest "$buildDirDist"
overwrite false
}
task downloadAll {
dependsOn downloadGreengrassBinaries
}
assemble.dependsOn downloadAll
check.dependsOn downloadAll
group = 'com.awslabs.aws.greengrass.provisioner.AwsGreengrassProvisioner'
version = '1.0-SNAPSHOT'
description = """"""
shadowJar {
// Create a shadow JAR with all of the necessary dependencies
archiveFileName = 'AwsGreengrassProvisioner.jar'
// Include the "dist" files which are the SDKs and Greengrass binaries
into('/dist') {
from fileTree("$buildDirDist")
}
// Include the foundation for the Java functions
into('/foundation') {
from fileTree("$buildDirFoundation")
}
zip64 true
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
repositories {
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
// Required for Gradle tooling API
maven { url "https://repo.gradle.org/gradle/libs-releases-local/" }
// Jitpack for MQTT over WebSockets support
maven { url 'https://jitpack.io' }
}
sourceSets {
integrationTest {
java {
compileClasspath += sourceSets.main.output
runtimeClasspath += sourceSets.main.output
srcDir file('src/integration-test/java')
}
}
}
configurations {
integrationTestImplementation.extendsFrom implementation
integrationTestApi.extendsFrom api
}
task integrationTest(type: Test) {
description = 'Runs the integration tests.'
group = 'verification'
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
outputs.upToDateWhen { false }
mustRunAfter test
}
dependencies {
// Dagger code generation
annotationProcessor "com.google.dagger:dagger-compiler:$daggerVersion"
// Immutables (requires annotation processing for code generation)
annotationProcessor "org.immutables:value:$immutablesValueVersion"
annotationProcessor "org.immutables:gson:$immutablesValueVersion"
implementation "org.immutables:value:$immutablesValueVersion"
implementation "org.immutables:gson:$immutablesValueVersion"
// Dependency injection with Dagger
implementation "com.google.dagger:dagger:$daggerVersion"
implementation "com.typesafe:config:$configVersion"
implementation "org.zeroturnaround:zt-zip:$ztZipVersion"
implementation "com.beust:jcommander:$jcommanderVersion"
implementation "org.slf4j:slf4j-log4j12:$slf4jVersion"
implementation "com.jcabi:jcabi-log:$jcabiVersion"
implementation "org.kamranzafar:jtar:$jtarVersion"
implementation "com.google.code.gson:gson:$gsonVersion"
implementation "com.spotify:docker-client:$dockerClientVersion"
// For Docker-style names
implementation "com.oblac:nomen-est-omen:$nomenEstOmenVersion"
// For scp/ssh support
implementation "com.jcraft:jsch:$jschVersion"
implementation "software.amazon.awssdk:greengrass:$awsSdk2Version"
implementation "software.amazon.awssdk:iam:$awsSdk2Version"
implementation "software.amazon.awssdk:iot:$awsSdk2Version"
implementation "software.amazon.awssdk:lambda:$awsSdk2Version"
implementation "software.amazon.awssdk:cloudformation:$awsSdk2Version"
implementation "software.amazon.awssdk:sts:$awsSdk2Version"
implementation "software.amazon.awssdk:ecr:$awsSdk2Version"
implementation "software.amazon.awssdk:ec2:$awsSdk2Version"
implementation "software.amazon.awssdk:s3:$awsSdk2Version"
implementation "software.amazon.awssdk:cloudwatchlogs:$awsSdk2Version"
implementation "software.amazon.awssdk:secretsmanager:$awsSdk2Version"
implementation "org.apache.maven.shared:maven-invoker:$mavenInvokerVersion"
implementation "org.apache.commons:commons-text:$commonsTextVersion"
implementation "org.apache.commons:commons-lang3:$commonsLangVersion"
implementation "org.gradle:gradle-tooling-api:7.1.1"
implementation "io.vavr:vavr:$vavrVersion"
implementation "commons-io:commons-io:$commonsIoVersion"
implementation "com.github.awslabs:results-iterator-for-aws-java-sdk:$resultsIteratorForAwsJavaSdkVersion"
implementation "org.jetbrains:annotations:$jetbrainsAnnotationVersion"
// Dependency added to fix - https://github.com/aws/aws-sdk-java-v2/issues/652
implementation "org.apache.httpcomponents:httpclient:$httpClientVersion"
// https://mvnrepository.com/artifact/net.jodah/failsafe
implementation "net.jodah:failsafe:$jodahFailsafeVersion"
implementation "org.testcontainers:testcontainers:$testContainersVersion"
implementation "org.awaitility:awaitility:$awaitilityVersion"
// To support AWS Lambda invocations
implementation "com.amazonaws:aws-lambda-java-core:$awsLambdaJavaCoreVersion"
testImplementation "junit:junit:$junitVersion"
testImplementation "com.github.stefanbirkner:system-rules:$systemRulesVersion"
testImplementation "org.hamcrest:hamcrest:$hamcrestVersion"
testImplementation "org.mockito:mockito-core:$mockitoVersion"
integrationTestImplementation "junit:junit:$junitVersion"
integrationTestImplementation "com.github.stefanbirkner:system-rules:$systemRulesVersion"
integrationTestImplementation "org.hamcrest:hamcrest:$hamcrestVersion"
integrationTestImplementation "org.mockito:mockito-core:$mockitoVersion"
integrationTestImplementation "com.github.awslabs:aws-iot-core-websockets:$awsIotCoreWebsocketsVersion"
}