1
1
import java.net.URI
2
2
import javax.annotation.Nullable
3
+ import org.gradle.api.tasks.testing.logging.TestExceptionFormat
4
+ import org.gradle.api.tasks.testing.logging.TestLogEvent
3
5
4
6
plugins {
5
7
`java- library`
@@ -16,9 +18,11 @@ java {
16
18
srcDir(" src/main/java" )
17
19
srcDir(" src/main/dafny-generated" )
18
20
srcDir(" src/main/smithy-generated" )
21
+ srcDir(" src/main/sdkv1" )
19
22
}
20
23
sourceSets[" test" ].java {
21
24
srcDir(" src/test/dafny-generated" )
25
+ srcDir(" src/test/sdkv1" )
22
26
}
23
27
}
24
28
@@ -37,6 +41,10 @@ if (!caPasswordString.isNullOrBlank()) {
37
41
}
38
42
39
43
repositories {
44
+ maven {
45
+ name = " DynamoDB Local Release Repository - US West (Oregon) Region"
46
+ url = URI .create(" https://s3-us-west-2.amazonaws.com/dynamodb-local/release" )
47
+ }
40
48
mavenCentral()
41
49
mavenLocal()
42
50
if (caUrl != null && caPassword != null ) {
@@ -51,6 +59,10 @@ repositories {
51
59
}
52
60
}
53
61
62
+ // Configuration to hold SQLLite information.
63
+ // DynamoDB-Local needs to have access to native sqllite4java.
64
+ val dynamodb by configurations.creating
65
+
54
66
dependencies {
55
67
implementation(" dafny.lang:DafnyRuntime:3.10.0" )
56
68
implementation(" software.amazon.dafny:conversion:1.0-SNAPSHOT" )
@@ -62,6 +74,33 @@ dependencies {
62
74
implementation(" software.amazon.cryptography:ComAmazonawsKms:1.0-SNAPSHOT" )
63
75
implementation(platform(" software.amazon.awssdk:bom:2.19.1" ))
64
76
implementation(" software.amazon.awssdk:dynamodb" )
77
+
78
+ // For the DDB-EC v1
79
+ implementation(" com.amazonaws:aws-java-sdk-dynamodb:1.12.409" )
80
+ // https://mvnrepository.com/artifact/org.testng/testng
81
+ testImplementation(" org.testng:testng:7.5" )
82
+ // https://mvnrepository.com/artifact/com.amazonaws/DynamoDBLocal
83
+ testImplementation(" com.amazonaws:DynamoDBLocal:1.+" )
84
+ // This is where we gather the SQLLite files to copy over
85
+ dynamodb(" com.amazonaws:DynamoDBLocal:1.+" )
86
+ // As of 1.21.0 DynamoDBLocal does not support Apple Silicon
87
+ // This checks the dependencies and adds a native library
88
+ // to support this architecture.
89
+ if (org.apache.tools.ant.taskdefs.condition.Os .isArch(" aarch64" )) {
90
+ testImplementation(" io.github.ganadist.sqlite4java:libsqlite4java-osx-aarch64:1.0.392" )
91
+ dynamodb(" io.github.ganadist.sqlite4java:libsqlite4java-osx-aarch64:1.0.392" )
92
+ }
93
+ // https://mvnrepository.com/artifact/org.hamcrest/hamcrest-all
94
+ testImplementation(" org.hamcrest:hamcrest-all:1.3" )
95
+ // https://mvnrepository.com/artifact/org.bouncycastle/bcprov-jdk15on
96
+ testImplementation(" org.bouncycastle:bcprov-jdk15on:1.70" )
97
+ // https://mvnrepository.com/artifact/org.quicktheories/quicktheories
98
+ testImplementation(" org.quicktheories:quicktheories:0.26" )
99
+ // https://mvnrepository.com/artifact/junit/junit
100
+ testImplementation(" junit:junit:4.13.2" )
101
+ // https://mvnrepository.com/artifact/edu.umd.cs.mtc/multithreadedtc
102
+ testImplementation(" edu.umd.cs.mtc:multithreadedtc:1.01" )
103
+
65
104
}
66
105
67
106
publishing {
@@ -77,9 +116,53 @@ tasks.withType<JavaCompile>() {
77
116
options.encoding = " UTF-8"
78
117
}
79
118
80
- tasks {
81
- register(" runTests" , JavaExec ::class .java) {
82
- mainClass.set(" TestsFromDafny" )
83
- classpath = sourceSets[" test" ].runtimeClasspath
119
+ tasks.register<JavaExec >(" runTests" ) {
120
+ mainClass.set(" TestsFromDafny" )
121
+ classpath = sourceSets[" test" ].runtimeClasspath
122
+ }
123
+
124
+ tasks.test {
125
+ useTestNG()
126
+ dependsOn(" CopyDynamoDb" )
127
+ systemProperty(" java.library.path" , " build/libs" )
128
+
129
+ testLogging {
130
+ lifecycle {
131
+ events = mutableSetOf (TestLogEvent .FAILED , TestLogEvent .PASSED , TestLogEvent .SKIPPED )
132
+ exceptionFormat = TestExceptionFormat .FULL
133
+ showExceptions = true
134
+ showCauses = true
135
+ showStackTraces = true
136
+ showStandardStreams = true
137
+ }
138
+ info.events = lifecycle.events
139
+ info.exceptionFormat = lifecycle.exceptionFormat
140
+ }
141
+
142
+ // See https://github.com/gradle/kotlin-dsl/issues/836
143
+ addTestListener(object : TestListener {
144
+ override fun beforeSuite (suite : TestDescriptor ) {}
145
+ override fun beforeTest (testDescriptor : TestDescriptor ) {}
146
+ override fun afterTest (testDescriptor : TestDescriptor , result : TestResult ) {}
147
+
148
+ override fun afterSuite (suite : TestDescriptor , result : TestResult ) {
149
+ if (suite.parent == null ) { // root suite
150
+ logger.lifecycle(" ----" )
151
+ logger.lifecycle(" Test result: ${result.resultType} " )
152
+ logger.lifecycle(" Test summary: ${result.testCount} tests, " +
153
+ " ${result.successfulTestCount} succeeded, " +
154
+ " ${result.failedTestCount} failed, " +
155
+ " ${result.skippedTestCount} skipped" )
156
+ }
157
+ }
158
+ })
159
+ }
160
+
161
+ tasks.register<Copy >(" CopyDynamoDb" ) {
162
+ from (dynamodb) {
163
+ include(" *.dll" )
164
+ include(" *.dylib" )
165
+ include(" *.so" )
84
166
}
167
+ into(" build/libs" )
85
168
}
0 commit comments