diff --git a/settings.gradle.kts b/settings.gradle.kts index d70d0e64e54..7a29b53784f 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -41,24 +41,42 @@ include(":aws-runtime:aws-endpoint") include(":aws-runtime:aws-http") include(":services") include(":tests") -include(":tests:benchmarks:service-benchmarks") include(":tests:codegen:event-stream") include(":tests:e2e-test-util") // generated services -fun File.isServiceDir(): Boolean { - if (isDirectory) { - return toPath().resolve("build.gradle.kts").toFile().exists() - } - return false -} +val File.isServiceDir: Boolean + get() = isDirectory && toPath().resolve("build.gradle.kts").toFile().exists() + +val String.isBootstrappedService: Boolean + get() = file("services/$this").isServiceDir file("services").listFiles().forEach { - if (it.isServiceDir()) { + if (it.isServiceDir) { include(":services:${it.name}") } } +// Service benchmarks project +val benchmarkServices = listOf( + // keep this list in sync with tests/benchmarks/service-benchmarks/build.gradle.kts + + "s3", + "sns", + "sts", + "cloudwatch", + "cloudwatchevents", + "dynamodb", + "secretsmanager", + "iam", +) +if (benchmarkServices.all { it.isBootstrappedService }) { + include(":tests:benchmarks:service-benchmarks") +} else { + val missing = benchmarkServices.filterNot { it.isBootstrappedService } + logger.warn("Skipping :tests:benchmarks:service-benchmarks because these service(s) are not bootstrapped: $missing") +} + /** * The following code enables to optionally include aws-sdk-kotlin dependencies in source form for easier * development. By default, if `smithy-kotlin` exists as a directory at the same level as `aws-sdk-kotlin` diff --git a/tests/benchmarks/service-benchmarks/build.gradle.kts b/tests/benchmarks/service-benchmarks/build.gradle.kts index 30167c9f262..97d4c86fd70 100644 --- a/tests/benchmarks/service-benchmarks/build.gradle.kts +++ b/tests/benchmarks/service-benchmarks/build.gradle.kts @@ -17,6 +17,8 @@ application { skipPublishing() val requiredServices = setOf( + // keep this list in sync with /settings.gradle.kts + // Top 6 services called by Kotlin SDK customers as of 7/25/2023, in descending order of call volume, // plus Secrets Manager which replaced Pinpoint after new API throttling limits broke our benchmark. "s3", @@ -31,48 +33,25 @@ val requiredServices = setOf( "iam", // Create roles for STS::AssumeRole ) -val missingServices = requiredServices.filterNot { rootProject.file("services/$it/build.gradle.kts").exists() } - -if (missingServices.isEmpty()) { - val optinAnnotations = listOf("kotlin.RequiresOptIn", "aws.smithy.kotlin.runtime.InternalApi") +val optinAnnotations = listOf("kotlin.RequiresOptIn", "aws.smithy.kotlin.runtime.InternalApi") - kotlin { - sourceSets { - all { - optinAnnotations.forEach { languageSettings.optIn(it) } - } +kotlin { + sourceSets { + all { + optinAnnotations.forEach { languageSettings.optIn(it) } + } - jvmMain { - dependencies { - api(libs.smithy.kotlin.runtime.core) - implementation(project(":aws-runtime:aws-core")) - implementation(libs.kotlinx.atomicfu) - implementation(libs.kotlinx.coroutines.core) + jvmMain { + dependencies { + api(libs.smithy.kotlin.runtime.core) + implementation(project(":aws-runtime:aws-core")) + implementation(libs.kotlinx.atomicfu) + implementation(libs.kotlinx.coroutines.core) - requiredServices.forEach { implementation(project(":services:$it")) } - } + requiredServices.forEach { implementation(project(":services:$it")) } } } } -} else { - logger.warn( - "Skipping build for {} project, missing the following services: {}. To ensure this project builds, run the " + - "{}:bootstrapAll task.", - project.name, - missingServices.joinToString(", "), - project.path, - ) - - tasks.withType { - enabled = false - } -} - -tasks.register("bootstrapAll") { - val bootstrapArg = requiredServices.joinToString(",") { "+$it" } - val bootstrapProj = project(":codegen:sdk") - bootstrapProj.ext.set("aws.services", bootstrapArg) - dependsOn(":codegen:sdk:bootstrap") } tasks.named("run") {