-
Notifications
You must be signed in to change notification settings - Fork 50
/
Copy pathbuild.gradle.kts
108 lines (94 loc) · 3.22 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
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
plugins {
alias(libs.plugins.kotlin.jvm)
jacoco
}
val sdkVersion: String by project
description = "Codegen support for AWS SDK for Kotlin"
group = "aws.sdk.kotlin"
version = sdkVersion
dependencies {
implementation(libs.kotlin.stdlib.jdk8)
api(libs.smithy.kotlin.codegen)
api(libs.smithy.aws.kotlin.codegen)
api(libs.smithy.aws.traits)
api(libs.smithy.aws.iam.traits)
api(libs.smithy.aws.cloudformation.traits)
api(libs.smithy.protocol.test.traits)
implementation(libs.smithy.aws.endpoints)
implementation(libs.smithy.smoke.test.traits)
implementation(libs.smithy.kotlin.runtime.core)
testImplementation(libs.junit.jupiter)
testImplementation(libs.junit.jupiter.params)
testImplementation(libs.kotest.assertions.core.jvm)
testImplementation(libs.kotlin.test.junit5)
testImplementation(libs.smithy.kotlin.codegen.testutils)
testImplementation(libs.slf4j.api)
testImplementation(libs.slf4j.simple)
testImplementation(libs.kotlinx.serialization.json)
}
val generateSdkRuntimeVersion by tasks.registering {
// generate the version of the runtime to use as a resource.
// this keeps us from having to manually change version numbers in multiple places
val resourcesDir = layout.buildDirectory.dir("resources/main/aws/sdk/kotlin/codegen").get()
val versionFile = file("$resourcesDir/sdk-version.txt")
val gradlePropertiesFile = rootProject.file("gradle.properties")
inputs.file(gradlePropertiesFile)
outputs.file(versionFile)
sourceSets.main.get().output.dir(resourcesDir)
doLast {
versionFile.writeText("$version")
}
}
tasks.withType<KotlinCompile> {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_17)
}
dependsOn(generateSdkRuntimeVersion)
}
tasks.withType<JavaCompile> {
sourceCompatibility = JavaVersion.VERSION_17.toString()
targetCompatibility = JavaVersion.VERSION_17.toString()
}
// Reusable license copySpec
val licenseSpec = copySpec {
from("${project.rootDir}/LICENSE")
from("${project.rootDir}/NOTICE")
}
// Configure jars to include license related info
tasks.jar {
metaInf.with(licenseSpec)
inputs.property("moduleName", project.name)
manifest {
attributes["Automatic-Module-Name"] = project.name
}
}
tasks.test {
useJUnitPlatform()
testLogging {
events("passed", "skipped", "failed")
showStandardStreams = true
showStackTraces = true
showExceptions = true
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
}
}
// Configure jacoco (code coverage) to generate an HTML report
tasks.jacocoTestReport {
reports {
xml.required.set(false)
csv.required.set(false)
html.outputLocation.set(layout.buildDirectory.dir("reports/jacoco"))
}
}
// Always run the jacoco test report after testing.
tasks["test"].finalizedBy(tasks["jacocoTestReport"])