11import java.net.URI
22import javax.annotation.Nullable
3+ import org.gradle.api.tasks.testing.logging.TestExceptionFormat
4+ import org.gradle.api.tasks.testing.logging.TestLogEvent
35
46tasks.wrapper {
57 gradleVersion = " 7.6"
@@ -26,38 +28,26 @@ java {
2628 }
2729}
2830
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"
4133}
4234
4335repositories {
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+ }
4440 mavenCentral()
4541 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- }
5642}
5743
44+ // Configuration to hold SQLLite information.
45+ // DynamoDB-Local needs to have access to native sqllite4java.
46+ val dynamodb by configurations.creating
47+
5848dependencies {
5949 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 " )
6151 implementation(" software.amazon.cryptography:StandardLibrary:1.0-SNAPSHOT" )
6252 implementation(" software.amazon.cryptography:AwsCryptographyPrimitives:1.0-SNAPSHOT" )
6353 implementation(" software.amazon.cryptography:AwsCryptographicMaterialProviders:1.0-SNAPSHOT" )
@@ -71,7 +61,16 @@ dependencies {
7161 implementation(" software.amazon.awssdk:dynamodb-enhanced" )
7262 implementation(" software.amazon.awssdk:core:2.19.1" )
7363 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+ }
7574}
7675
7776publishing {
@@ -83,17 +82,25 @@ publishing {
8382 repositories { mavenLocal() }
8483}
8584
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" )
8898}
8999
90100tasks.register<JavaExec >(" runTests" ) {
101+ dependsOn(" CopyDynamoDb" )
91102 dependsOn(" copyKeysJSON" )
103+ systemProperty(" java.library.path" , " build/libs" )
92104 mainClass.set(" TestsFromDafny" )
93105 classpath = sourceSets[" test" ].runtimeClasspath
94106}
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