2021-10-06 01:05:00 +08:00
|
|
|
/*
|
|
|
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
2022-05-09 22:50:46 +08:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
2021-10-06 01:05:00 +08:00
|
|
|
*/
|
2022-03-29 02:05:08 +08:00
|
|
|
|
|
|
|
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
|
|
|
|
|
2021-10-06 01:05:00 +08:00
|
|
|
plugins {
|
|
|
|
kotlin("jvm")
|
|
|
|
`maven-publish`
|
|
|
|
}
|
|
|
|
|
|
|
|
description = "Generates Rust server-side code from Smithy models"
|
|
|
|
|
|
|
|
extra["displayName"] = "Smithy :: Rust :: Codegen :: Server"
|
|
|
|
|
|
|
|
extra["moduleName"] = "software.amazon.smithy.rust.codegen.server"
|
|
|
|
|
|
|
|
group = "software.amazon.smithy.rust.codegen.server.smithy"
|
|
|
|
|
|
|
|
version = "0.1.0"
|
|
|
|
|
|
|
|
val smithyVersion: String by project
|
|
|
|
|
|
|
|
dependencies {
|
2022-09-08 00:31:46 +08:00
|
|
|
implementation(project(":codegen-core"))
|
2021-10-06 01:05:00 +08:00
|
|
|
implementation("software.amazon.smithy:smithy-aws-traits:$smithyVersion")
|
|
|
|
implementation("software.amazon.smithy:smithy-protocol-test-traits:$smithyVersion")
|
2023-02-09 06:14:31 +08:00
|
|
|
|
|
|
|
// `smithy.framework#ValidationException` is defined here, which is used in `constraints.smithy`, which is used
|
|
|
|
// in `CustomValidationExceptionWithReasonDecoratorTest`.
|
|
|
|
testImplementation("software.amazon.smithy:smithy-validation-model:$smithyVersion")
|
2021-10-06 01:05:00 +08:00
|
|
|
}
|
|
|
|
|
2023-12-15 04:35:18 +08:00
|
|
|
tasks.compileKotlin { kotlinOptions.jvmTarget = "11" }
|
2021-10-06 01:05:00 +08:00
|
|
|
|
|
|
|
// 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 }
|
|
|
|
}
|
|
|
|
|
|
|
|
val sourcesJar by tasks.creating(Jar::class) {
|
|
|
|
group = "publishing"
|
|
|
|
description = "Assembles Kotlin sources jar"
|
2022-11-12 05:04:30 +08:00
|
|
|
archiveClassifier.set("sources")
|
2021-10-06 01:05:00 +08:00
|
|
|
from(sourceSets.getByName("main").allSource)
|
|
|
|
}
|
|
|
|
|
2022-12-21 01:13:31 +08:00
|
|
|
val isTestingEnabled: String by project
|
|
|
|
if (isTestingEnabled.toBoolean()) {
|
|
|
|
val kotestVersion: String by project
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
testImplementation("org.junit.jupiter:junit-jupiter:5.6.1")
|
|
|
|
testImplementation("io.kotest:kotest-assertions-core-jvm:$kotestVersion")
|
|
|
|
}
|
|
|
|
|
2023-12-15 04:35:18 +08:00
|
|
|
tasks.compileTestKotlin { kotlinOptions.jvmTarget = "11" }
|
2022-12-21 01:13:31 +08:00
|
|
|
|
|
|
|
tasks.test {
|
|
|
|
useJUnitPlatform()
|
|
|
|
testLogging {
|
|
|
|
events("passed", "skipped", "failed")
|
|
|
|
exceptionFormat = TestExceptionFormat.FULL
|
|
|
|
showCauses = true
|
|
|
|
showExceptions = true
|
|
|
|
showStackTraces = true
|
|
|
|
showStandardStreams = true
|
|
|
|
}
|
2021-10-06 01:05:00 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
publishing {
|
|
|
|
publications {
|
|
|
|
create<MavenPublication>("default") {
|
|
|
|
from(components["java"])
|
|
|
|
artifact(sourcesJar)
|
|
|
|
}
|
|
|
|
}
|
2023-12-07 06:05:21 +08:00
|
|
|
repositories { maven { url = uri(layout.buildDirectory.dir("repository")) } }
|
2021-10-06 01:05:00 +08:00
|
|
|
}
|