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
tasks.wrapper {
5
7
gradleVersion = " 7.6"
@@ -26,38 +28,26 @@ java {
26
28
}
27
29
}
28
30
29
- var caUrl: URI ? = null
30
- @Nullable
31
- val caUrlStr: String? = System .getenv(" CODEARTIFACT_URL_JAVA_CONVERSION" )
32
- if (! caUrlStr.isNullOrBlank()) {
33
- caUrl = URI .create(caUrlStr)
34
- }
35
-
36
- var caPassword: String? = null
37
- @Nullable
38
- val caPasswordString: String? = System .getenv(" CODEARTIFACT_AUTH_TOKEN" )
39
- if (! caPasswordString.isNullOrBlank()) {
40
- caPassword = caPasswordString
31
+ tasks.withType<JavaCompile >() {
32
+ options.encoding = " UTF-8"
41
33
}
42
34
43
35
repositories {
36
+ maven {
37
+ name = " DynamoDB Local Release Repository - US West (Oregon) Region"
38
+ url = URI .create(" https://s3-us-west-2.amazonaws.com/dynamodb-local/release" )
39
+ }
44
40
mavenCentral()
45
41
mavenLocal()
46
- if (caUrl != null && caPassword != null ) {
47
- maven {
48
- name = " CodeArtifact"
49
- url = caUrl!!
50
- credentials {
51
- username = " aws"
52
- password = caPassword!!
53
- }
54
- }
55
- }
56
42
}
57
43
44
+ // Configuration to hold SQLLite information.
45
+ // DynamoDB-Local needs to have access to native sqllite4java.
46
+ val dynamodb by configurations.creating
47
+
58
48
dependencies {
59
49
implementation(" org.dafny:DafnyRuntime:4.0.0" )
60
- implementation(" software.amazon.dafny:conversion:1.0-SNAPSHOT " )
50
+ implementation(" software.amazon.smithy. dafny:conversion:0.1 " )
61
51
implementation(" software.amazon.cryptography:StandardLibrary:1.0-SNAPSHOT" )
62
52
implementation(" software.amazon.cryptography:AwsCryptographyPrimitives:1.0-SNAPSHOT" )
63
53
implementation(" software.amazon.cryptography:AwsCryptographicMaterialProviders:1.0-SNAPSHOT" )
@@ -71,7 +61,16 @@ dependencies {
71
61
implementation(" software.amazon.awssdk:dynamodb-enhanced" )
72
62
implementation(" software.amazon.awssdk:core:2.19.1" )
73
63
implementation(" software.amazon.awssdk:kms" )
74
-
64
+ testImplementation(" com.amazonaws:DynamoDBLocal:1.+" )
65
+ // This is where we gather the SQLLite files to copy over
66
+ dynamodb(" com.amazonaws:DynamoDBLocal:1.+" )
67
+ // As of 1.21.0 DynamoDBLocal does not support Apple Silicon
68
+ // This checks the dependencies and adds a native library
69
+ // to support this architecture.
70
+ if (org.apache.tools.ant.taskdefs.condition.Os .isArch(" aarch64" )) {
71
+ testImplementation(" io.github.ganadist.sqlite4java:libsqlite4java-osx-aarch64:1.0.392" )
72
+ dynamodb(" io.github.ganadist.sqlite4java:libsqlite4java-osx-aarch64:1.0.392" )
73
+ }
75
74
}
76
75
77
76
publishing {
@@ -83,17 +82,25 @@ publishing {
83
82
repositories { mavenLocal() }
84
83
}
85
84
86
- tasks.withType<JavaCompile >() {
87
- options.encoding = " UTF-8"
85
+
86
+ tasks.register<Copy >(" copyKeysJSON" ) {
87
+ from(layout.projectDirectory.file(" ../../../submodules/MaterialProviders/TestVectorsAwsCryptographicMaterialProviders/dafny/TestVectorsAwsCryptographicMaterialProviders/test/keys.json" ))
88
+ into(layout.projectDirectory.dir(" dafny/DDBEncryption/test" ))
89
+ }
90
+
91
+ tasks.register<Copy >(" CopyDynamoDb" ) {
92
+ from (dynamodb) {
93
+ include(" *.dll" )
94
+ include(" *.dylib" )
95
+ include(" *.so" )
96
+ }
97
+ into(" build/libs" )
88
98
}
89
99
90
100
tasks.register<JavaExec >(" runTests" ) {
101
+ dependsOn(" CopyDynamoDb" )
91
102
dependsOn(" copyKeysJSON" )
103
+ systemProperty(" java.library.path" , " build/libs" )
92
104
mainClass.set(" TestsFromDafny" )
93
105
classpath = sourceSets[" test" ].runtimeClasspath
94
106
}
95
-
96
- tasks.register<Copy >(" copyKeysJSON" ) {
97
- from(layout.projectDirectory.file(" ../../../submodules/MaterialProviders/TestVectorsAwsCryptographicMaterialProviders/dafny/TestVectorsAwsCryptographicMaterialProviders/test/keys.json" ))
98
- into(layout.projectDirectory.dir(" dafny/DDBEncryption/test" ))
99
- }
0 commit comments