-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathbuild.gradle.kts
127 lines (109 loc) · 3.92 KB
/
build.gradle.kts
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
import java.io.File
import java.io.FileInputStream
import java.util.Properties
import java.net.URI
import javax.annotation.Nullable
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
plugins {
`java`
`java-library`
id("io.freefair.lombok") version "8.1.0"
}
var props = Properties().apply {
load(FileInputStream(File(rootProject.rootDir, "../../../../project.properties")))
}
group = "software.amazon.cryptography"
version = "1.0-SNAPSHOT"
description = "DynamoDbEncryptionExamples"
var mplVersion = props.getProperty("mplDependencyJavaVersion")
var ddbecVersion = props.getProperty("projectJavaVersion")
java {
toolchain.languageVersion.set(JavaLanguageVersion.of(8))
sourceSets["main"].java {
srcDir("src/main/java")
}
sourceSets["test"].java {
srcDir("src/test/java")
}
}
var caUrl: URI? = null
@Nullable
val caUrlStr: String? = System.getenv("CODEARTIFACT_REPO_URL")
if (!caUrlStr.isNullOrBlank()) {
caUrl = URI.create(caUrlStr)
}
var caPassword: String? = null
@Nullable
val caPasswordString: String? = System.getenv("CODEARTIFACT_TOKEN")
if (!caPasswordString.isNullOrBlank()) {
caPassword = caPasswordString
}
repositories {
mavenLocal()
maven {
name = "DynamoDB Local Release Repository - US West (Oregon) Region"
url = URI.create("https://s3-us-west-2.amazonaws.com/dynamodb-local/release")
}
mavenCentral()
if (caUrl != null && caPassword != null) {
maven {
name = "CodeArtifact"
url = caUrl!!
credentials {
username = "aws"
password = caPassword!!
}
}
}
}
dependencies {
implementation("software.amazon.cryptography:aws-database-encryption-sdk-dynamodb:${ddbecVersion}")
implementation("software.amazon.cryptography:aws-cryptographic-material-providers:${mplVersion}")
implementation(platform("software.amazon.awssdk:bom:2.19.1"))
implementation("software.amazon.awssdk:arns")
implementation("software.amazon.awssdk:auth")
implementation("software.amazon.awssdk:dynamodb")
implementation("software.amazon.awssdk:dynamodb-enhanced")
implementation("software.amazon.awssdk:kms")
implementation("software.amazon.awssdk:sts")
implementation("org.bouncycastle:bcprov-jdk18on:1.72")
// https://mvnrepository.com/artifact/org.testng/testng
testImplementation("org.testng:testng:7.5")
}
tasks.withType<JavaCompile>() {
options.encoding = "UTF-8"
}
tasks.test {
useTestNG()
// This will show System.out.println statements
testLogging.showStandardStreams = true
testLogging {
lifecycle {
events = mutableSetOf(TestLogEvent.FAILED, TestLogEvent.PASSED, TestLogEvent.SKIPPED)
exceptionFormat = TestExceptionFormat.FULL
showExceptions = true
showCauses = true
showStackTraces = true
showStandardStreams = true
}
info.events = lifecycle.events
info.exceptionFormat = lifecycle.exceptionFormat
}
// See https://github.com/gradle/kotlin-dsl/issues/836
addTestListener(object : TestListener {
override fun beforeSuite(suite: TestDescriptor) {}
override fun beforeTest(testDescriptor: TestDescriptor) {}
override fun afterTest(testDescriptor: TestDescriptor, result: TestResult) {}
override fun afterSuite(suite: TestDescriptor, result: TestResult) {
if (suite.parent == null) { // root suite
logger.lifecycle("----")
logger.lifecycle("Test result: ${result.resultType}")
logger.lifecycle("Test summary: ${result.testCount} tests, " +
"${result.successfulTestCount} succeeded, " +
"${result.failedTestCount} failed, " +
"${result.skippedTestCount} skipped")
}
}
})
}