diff --git a/aws/sdk-codegen/build.gradle.kts b/aws/sdk-codegen/build.gradle.kts index dd5c081b9d76202f47961482d760a6a470ca18ad..bb6f2925a74f95a8388ff7ba1073b18a8d2539a8 100644 --- a/aws/sdk-codegen/build.gradle.kts +++ b/aws/sdk-codegen/build.gradle.kts @@ -19,18 +19,14 @@ group = "software.amazon.software.amazon.smithy.rust.codegen.smithy" version = "0.1.0" val smithyVersion: String by project -val kotestVersion: String by project dependencies { implementation(project(":codegen-core")) implementation(project(":codegen-client")) - runtimeOnly(project(":aws:rust-runtime")) implementation("org.jsoup:jsoup:1.14.3") implementation("software.amazon.smithy:smithy-aws-traits:$smithyVersion") implementation("software.amazon.smithy:smithy-protocol-test-traits:$smithyVersion") implementation("software.amazon.smithy:smithy-rules-engine:$smithyVersion") - testImplementation("org.junit.jupiter:junit-jupiter:5.6.1") - testImplementation("io.kotest:kotest-assertions-core-jvm:$kotestVersion") } val generateAwsRuntimeCrateVersion by tasks.registering { @@ -52,10 +48,6 @@ tasks.compileKotlin { dependsOn(generateAwsRuntimeCrateVersion) } -tasks.compileTestKotlin { - kotlinOptions.jvmTarget = "1.8" -} - // Reusable license copySpec val licenseSpec = copySpec { from("${project.rootDir}/LICENSE") @@ -78,29 +70,44 @@ val sourcesJar by tasks.creating(Jar::class) { from(sourceSets.getByName("main").allSource) } -tasks.test { - useJUnitPlatform() - testLogging { - events("passed", "skipped", "failed") - exceptionFormat = TestExceptionFormat.FULL - showCauses = true - showExceptions = true - showStackTraces = true - showStandardStreams = true +val isTestingEnabled: String by project +if (isTestingEnabled.toBoolean()) { + val kotestVersion: String by project + + dependencies { + runtimeOnly(project(":aws:rust-runtime")) + testImplementation("org.junit.jupiter:junit-jupiter:5.6.1") + testImplementation("io.kotest:kotest-assertions-core-jvm:$kotestVersion") } -} -// Configure jacoco (code coverage) to generate an HTML report -tasks.jacocoTestReport { - reports { - xml.required.set(false) - csv.required.set(false) - html.outputLocation.set(file("$buildDir/reports/jacoco")) + tasks.compileTestKotlin { + kotlinOptions.jvmTarget = "1.8" } -} -// Always run the jacoco test report after testing. -tasks["test"].finalizedBy(tasks["jacocoTestReport"]) + tasks.test { + useJUnitPlatform() + testLogging { + events("passed", "skipped", "failed") + exceptionFormat = TestExceptionFormat.FULL + showCauses = true + showExceptions = true + showStackTraces = true + showStandardStreams = true + } + } + + // Configure jacoco (code coverage) to generate an HTML report + tasks.jacocoTestReport { + reports { + xml.required.set(false) + csv.required.set(false) + html.outputLocation.set(file("$buildDir/reports/jacoco")) + } + } + + // Always run the jacoco test report after testing. + tasks["test"].finalizedBy(tasks["jacocoTestReport"]) +} publishing { publications { diff --git a/build.gradle.kts b/build.gradle.kts index 440e4ca41c4e38819bcf54c26acc2dbe58af42bd..316b1c8d9a3331f686b2c45880202310b6a6d2ec 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -16,7 +16,6 @@ buildscript { plugins { kotlin("jvm") version "1.3.72" apply false - id("org.jetbrains.dokka") version "1.7.10" } allprojects { diff --git a/codegen-client/build.gradle.kts b/codegen-client/build.gradle.kts index 34005100653b0bc384dc464a5911bbfeb6cbc69d..ba6ac6ac1b40fa9067df81284e47af2754af1e09 100644 --- a/codegen-client/build.gradle.kts +++ b/codegen-client/build.gradle.kts @@ -7,7 +7,6 @@ import org.gradle.api.tasks.testing.logging.TestExceptionFormat plugins { kotlin("jvm") - id("org.jetbrains.dokka") jacoco `maven-publish` } @@ -20,7 +19,6 @@ group = "software.amazon.smithy.rust.codegen" version = "0.1.0" val smithyVersion: String by project -val kotestVersion: String by project dependencies { implementation(project(":codegen-core")) @@ -30,13 +28,6 @@ dependencies { implementation("software.amazon.smithy:smithy-protocol-test-traits:$smithyVersion") implementation("software.amazon.smithy:smithy-waiters:$smithyVersion") implementation("software.amazon.smithy:smithy-rules-engine:$smithyVersion") - runtimeOnly(project(":rust-runtime")) - testImplementation("org.junit.jupiter:junit-jupiter:5.6.1") - testImplementation("io.kotest:kotest-assertions-core-jvm:$kotestVersion") -} - -tasks.compileTestKotlin { - kotlinOptions.jvmTarget = "1.8" } tasks.compileKotlin { @@ -65,36 +56,44 @@ val sourcesJar by tasks.creating(Jar::class) { from(sourceSets.getByName("main").allSource) } -tasks.test { - useJUnitPlatform() - testLogging { - events("passed", "skipped", "failed") - exceptionFormat = TestExceptionFormat.FULL - showCauses = true - showExceptions = true - showStackTraces = true - showStandardStreams = true +val isTestingEnabled: String by project +if (isTestingEnabled.toBoolean()) { + val kotestVersion: String by project + + dependencies { + runtimeOnly(project(":rust-runtime")) + testImplementation("org.junit.jupiter:junit-jupiter:5.6.1") + testImplementation("io.kotest:kotest-assertions-core-jvm:$kotestVersion") } -} -tasks.dokkaHtml.configure { - outputDirectory.set(buildDir.resolve("javadoc")) -} + tasks.compileTestKotlin { + kotlinOptions.jvmTarget = "1.8" + } -// Always build documentation -tasks["build"].finalizedBy(tasks["dokkaHtml"]) + tasks.test { + useJUnitPlatform() + testLogging { + events("passed", "skipped", "failed") + exceptionFormat = TestExceptionFormat.FULL + showCauses = true + showExceptions = true + showStackTraces = true + showStandardStreams = true + } + } -// Configure jacoco (code coverage) to generate an HTML report -tasks.jacocoTestReport { - reports { - xml.required.set(false) - csv.required.set(false) - html.outputLocation.set(file("$buildDir/reports/jacoco")) + // Configure jacoco (code coverage) to generate an HTML report + tasks.jacocoTestReport { + reports { + xml.required.set(false) + csv.required.set(false) + html.outputLocation.set(file("$buildDir/reports/jacoco")) + } } -} -// Always run the jacoco test report after testing. -tasks["test"].finalizedBy(tasks["jacocoTestReport"]) + // Always run the jacoco test report after testing. + tasks["test"].finalizedBy(tasks["jacocoTestReport"]) +} publishing { publications { diff --git a/codegen-core/build.gradle.kts b/codegen-core/build.gradle.kts index d705a62faa7e27d8a58925592d3aa0c1242b92c5..393eb4dfa73b4945b9bd405343c0cf010bcef284 100644 --- a/codegen-core/build.gradle.kts +++ b/codegen-core/build.gradle.kts @@ -8,7 +8,6 @@ import java.io.ByteArrayOutputStream plugins { kotlin("jvm") - id("org.jetbrains.dokka") jacoco `maven-publish` } @@ -21,7 +20,6 @@ group = "software.amazon.smithy.rust.codegen" version = "0.1.0" val smithyVersion: String by project -val kotestVersion: String by project dependencies { implementation(kotlin("stdlib-jdk8")) @@ -31,9 +29,6 @@ dependencies { implementation("software.amazon.smithy:smithy-aws-traits:$smithyVersion") implementation("software.amazon.smithy:smithy-protocol-test-traits:$smithyVersion") implementation("software.amazon.smithy:smithy-waiters:$smithyVersion") - runtimeOnly(project(":rust-runtime")) - testImplementation("org.junit.jupiter:junit-jupiter:5.6.1") - testImplementation("io.kotest:kotest-assertions-core-jvm:$kotestVersion") } fun gitCommitHash(): String { @@ -78,10 +73,6 @@ tasks.compileKotlin { dependsOn(generateSmithyRuntimeCrateVersion) } -tasks.compileTestKotlin { - kotlinOptions.jvmTarget = "1.8" -} - // Reusable license copySpec val licenseSpec = copySpec { from("${project.rootDir}/LICENSE") @@ -104,36 +95,44 @@ val sourcesJar by tasks.creating(Jar::class) { from(sourceSets.getByName("main").allSource) } -tasks.test { - useJUnitPlatform() - testLogging { - events("passed", "skipped", "failed") - exceptionFormat = TestExceptionFormat.FULL - showCauses = true - showExceptions = true - showStackTraces = true - showStandardStreams = true +val isTestingEnabled: String by project +if (isTestingEnabled.toBoolean()) { + val kotestVersion: String by project + + dependencies { + runtimeOnly(project(":rust-runtime")) + testImplementation("org.junit.jupiter:junit-jupiter:5.6.1") + testImplementation("io.kotest:kotest-assertions-core-jvm:$kotestVersion") } -} -tasks.dokkaHtml.configure { - outputDirectory.set(buildDir.resolve("javadoc")) -} + tasks.compileTestKotlin { + kotlinOptions.jvmTarget = "1.8" + } -// Always build documentation -tasks["build"].finalizedBy(tasks["dokkaHtml"]) + tasks.test { + useJUnitPlatform() + testLogging { + events("passed", "skipped", "failed") + exceptionFormat = TestExceptionFormat.FULL + showCauses = true + showExceptions = true + showStackTraces = true + showStandardStreams = true + } + } -// Configure jacoco (code coverage) to generate an HTML report -tasks.jacocoTestReport { - reports { - xml.required.set(false) - csv.required.set(false) - html.outputLocation.set(file("$buildDir/reports/jacoco")) + // Configure jacoco (code coverage) to generate an HTML report + tasks.jacocoTestReport { + reports { + xml.required.set(false) + csv.required.set(false) + html.outputLocation.set(file("$buildDir/reports/jacoco")) + } } -} -// Always run the jacoco test report after testing. -tasks["test"].finalizedBy(tasks["jacocoTestReport"]) + // Always run the jacoco test report after testing. + tasks["test"].finalizedBy(tasks["jacocoTestReport"]) +} publishing { publications { diff --git a/codegen-server/build.gradle.kts b/codegen-server/build.gradle.kts index d9cea78519374949c19710fa52b4149497f5c4cc..50aa275492b97ca77b67c2a7e85b57efdfe73244 100644 --- a/codegen-server/build.gradle.kts +++ b/codegen-server/build.gradle.kts @@ -21,19 +21,15 @@ group = "software.amazon.smithy.rust.codegen.server.smithy" version = "0.1.0" val smithyVersion: String by project -val kotestVersion: String by project dependencies { implementation(project(":codegen-core")) implementation(project(":codegen-client")) implementation("software.amazon.smithy:smithy-aws-traits:$smithyVersion") implementation("software.amazon.smithy:smithy-protocol-test-traits:$smithyVersion") - testImplementation("org.junit.jupiter:junit-jupiter:5.6.1") - testImplementation("io.kotest:kotest-assertions-core-jvm:$kotestVersion") } tasks.compileKotlin { kotlinOptions.jvmTarget = "1.8" } -tasks.compileTestKotlin { kotlinOptions.jvmTarget = "1.8" } // Reusable license copySpec val licenseSpec = copySpec { @@ -55,15 +51,27 @@ val sourcesJar by tasks.creating(Jar::class) { from(sourceSets.getByName("main").allSource) } -tasks.test { - useJUnitPlatform() - testLogging { - events("passed", "skipped", "failed") - exceptionFormat = TestExceptionFormat.FULL - showCauses = true - showExceptions = true - showStackTraces = true - showStandardStreams = true +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") + } + + tasks.compileTestKotlin { kotlinOptions.jvmTarget = "1.8" } + + tasks.test { + useJUnitPlatform() + testLogging { + events("passed", "skipped", "failed") + exceptionFormat = TestExceptionFormat.FULL + showCauses = true + showExceptions = true + showStackTraces = true + showStandardStreams = true + } } } diff --git a/codegen-server/python/build.gradle.kts b/codegen-server/python/build.gradle.kts index 40dba2024e65a753cc3ccd0fbbf6565f190a2cc3..5a23bd5d7dc5fbca0bdb44dea19c99a3fd2d6494 100644 --- a/codegen-server/python/build.gradle.kts +++ b/codegen-server/python/build.gradle.kts @@ -21,7 +21,6 @@ group = "software.amazon.smithy.rust.codegen.server.python.smithy" version = "0.1.0" val smithyVersion: String by project -val kotestVersion: String by project dependencies { implementation(project(":codegen-core")) @@ -29,12 +28,9 @@ dependencies { implementation(project(":codegen-server")) implementation("software.amazon.smithy:smithy-aws-traits:$smithyVersion") implementation("software.amazon.smithy:smithy-protocol-test-traits:$smithyVersion") - testImplementation("org.junit.jupiter:junit-jupiter:5.6.1") - testImplementation("io.kotest:kotest-assertions-core-jvm:$kotestVersion") } tasks.compileKotlin { kotlinOptions.jvmTarget = "1.8" } -tasks.compileTestKotlin { kotlinOptions.jvmTarget = "1.8" } // Reusable license copySpec val licenseSpec = copySpec { @@ -56,15 +52,27 @@ val sourcesJar by tasks.creating(Jar::class) { from(sourceSets.getByName("main").allSource) } -tasks.test { - useJUnitPlatform() - testLogging { - events("passed", "skipped", "failed") - exceptionFormat = TestExceptionFormat.FULL - showCauses = true - showExceptions = true - showStackTraces = true - showStandardStreams = true +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") + } + + tasks.compileTestKotlin { kotlinOptions.jvmTarget = "1.8" } + + tasks.test { + useJUnitPlatform() + testLogging { + events("passed", "skipped", "failed") + exceptionFormat = TestExceptionFormat.FULL + showCauses = true + showExceptions = true + showStackTraces = true + showStandardStreams = true + } } } diff --git a/gradle.properties b/gradle.properties index 319485872c08ce47f9c509e7e9e791dbfc7d017b..502ab6a3ba255da8081f5574b5cea0ad50eded40 100644 --- a/gradle.properties +++ b/gradle.properties @@ -23,6 +23,8 @@ kotlinVersion=1.6.21 # testing/utility ktlintVersion=0.46.1 kotestVersion=5.2.3 +# Avoid registering dependencies/plugins/tasks that are only used for testing purposes +isTestingEnabled=true # TODO(https://github.com/awslabs/smithy-rs/issues/1068): Once doc normalization # is completed, warnings can be prohibited in rustdoc.