smithy-rs/build.gradle.kts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

81 lines
2.5 KiB
Plaintext
Raw Normal View History

2020-10-28 23:00:49 +08:00
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
2020-10-28 23:00:49 +08:00
*/
buildscript {
repositories {
mavenCentral()
2020-10-28 23:00:49 +08:00
google()
}
val kotlinVersion: String by project
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
}
}
allprojects {
Allow 'null' variants in unions (#3481) ## Motivation and Context - https://github.com/awslabs/aws-sdk-rust/issues/1095 ## Description Update the JSON parser generator to allow for `null` to be set in unions. Servers can send unions like this: ```json { "AmazonElasticsearchParameters": null, "AmazonOpenSearchParameters": null, "AppFlowParameters": null, "AthenaParameters": null, "AuroraParameters": null, "AuroraPostgreSqlParameters": null, "AwsIotAnalyticsParameters": null, "BigQueryParameters": null, "DatabricksParameters": null, "Db2Parameters": null, "DenodoParameters": null, "DocumentDBParameters": null, "DremioParameters": null, "ExasolParameters": null, "GoogleAnalyticsParameters": null, "JiraParameters": null, "MariaDbParameters": null, "MongoAtlasParameters": null, "MongoDBParameters": null, "MySqlParameters": null, "OracleParameters": null, "PostgreSqlParameters": null, "PrestoParameters": null, "RdsParameters": null, "RedshiftParameters": null, "S3Parameters": { "IsUploaded": false, "ManifestFileLocation": { "Bucket": "deided-bucket.prod.us-east-1", "Key": "sales/manifest.json" }, "RoleArn": null }, "SalesforceParameters": null, "SapHanaParameters": null, "ServiceNowParameters": null, "SnowflakeParameters": null, "SparkParameters": null, "SqlServerParameters": null, "StarburstParameters": null, "TeradataParameters": null, "TrinoParameters": null, "TwitterParameters": null } ``` This caused our parser to fail. ## Testing <!--- Please describe in detail how you tested your changes --> <!--- Include details of your testing environment, and the tests you ran to --> <!--- see how your change affects other areas of the code, etc. --> - [x] New unit test - [x] Dry run against new [smithy protocol test](https://github.com/smithy-lang/smithy/pull/2180) ## Checklist <!--- If a checkbox below is not applicable, then please DELETE it rather than leaving it unchecked --> - [ ] I have updated `CHANGELOG.next.toml` if I made changes to the smithy-rs codegen or runtime crates - [ ] I have updated `CHANGELOG.next.toml` if I made changes to the AWS SDK, generated SDK code, or SDK runtime crates ---- _By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice._
2024-03-16 06:36:42 +08:00
val allowLocalDeps: String by project
2020-10-28 23:00:49 +08:00
repositories {
Allow 'null' variants in unions (#3481) ## Motivation and Context - https://github.com/awslabs/aws-sdk-rust/issues/1095 ## Description Update the JSON parser generator to allow for `null` to be set in unions. Servers can send unions like this: ```json { "AmazonElasticsearchParameters": null, "AmazonOpenSearchParameters": null, "AppFlowParameters": null, "AthenaParameters": null, "AuroraParameters": null, "AuroraPostgreSqlParameters": null, "AwsIotAnalyticsParameters": null, "BigQueryParameters": null, "DatabricksParameters": null, "Db2Parameters": null, "DenodoParameters": null, "DocumentDBParameters": null, "DremioParameters": null, "ExasolParameters": null, "GoogleAnalyticsParameters": null, "JiraParameters": null, "MariaDbParameters": null, "MongoAtlasParameters": null, "MongoDBParameters": null, "MySqlParameters": null, "OracleParameters": null, "PostgreSqlParameters": null, "PrestoParameters": null, "RdsParameters": null, "RedshiftParameters": null, "S3Parameters": { "IsUploaded": false, "ManifestFileLocation": { "Bucket": "deided-bucket.prod.us-east-1", "Key": "sales/manifest.json" }, "RoleArn": null }, "SalesforceParameters": null, "SapHanaParameters": null, "ServiceNowParameters": null, "SnowflakeParameters": null, "SparkParameters": null, "SqlServerParameters": null, "StarburstParameters": null, "TeradataParameters": null, "TrinoParameters": null, "TwitterParameters": null } ``` This caused our parser to fail. ## Testing <!--- Please describe in detail how you tested your changes --> <!--- Include details of your testing environment, and the tests you ran to --> <!--- see how your change affects other areas of the code, etc. --> - [x] New unit test - [x] Dry run against new [smithy protocol test](https://github.com/smithy-lang/smithy/pull/2180) ## Checklist <!--- If a checkbox below is not applicable, then please DELETE it rather than leaving it unchecked --> - [ ] I have updated `CHANGELOG.next.toml` if I made changes to the smithy-rs codegen or runtime crates - [ ] I have updated `CHANGELOG.next.toml` if I made changes to the AWS SDK, generated SDK code, or SDK runtime crates ---- _By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice._
2024-03-16 06:36:42 +08:00
if (allowLocalDeps.toBoolean()) {
mavenLocal()
}
2020-10-28 23:00:49 +08:00
mavenCentral()
google()
}
}
val ktlint by configurations.creating
2020-10-28 23:00:49 +08:00
val ktlintVersion: String by project
dependencies {
ktlint("com.pinterest.ktlint:ktlint-cli:$ktlintVersion") {
attributes {
attribute(Bundling.BUNDLING_ATTRIBUTE, objects.named(Bundling.EXTERNAL))
}
}
2020-10-28 23:00:49 +08:00
}
val lintPaths =
listOf(
"**/*.kt",
// Exclude build output directories
"!**/build/**",
"!**/node_modules/**",
"!**/target/**",
)
2020-10-28 23:00:49 +08:00
tasks.register<JavaExec>("ktlint") {
description = "Check Kotlin code style."
group = LifecycleBasePlugin.VERIFICATION_GROUP
classpath = ktlint
mainClass.set("com.pinterest.ktlint.Main")
args = listOf("--log-level=info", "--relative", "--") + lintPaths
// https://github.com/pinterest/ktlint/issues/1195#issuecomment-1009027802
jvmArgs("--add-opens", "java.base/java.lang=ALL-UNNAMED")
2020-10-28 23:00:49 +08:00
}
tasks.register<JavaExec>("ktlintFormat") {
description = "Auto fix Kotlin code style violations"
group = LifecycleBasePlugin.VERIFICATION_GROUP
classpath = ktlint
mainClass.set("com.pinterest.ktlint.Main")
args = listOf("--log-level=info", "--relative", "--format", "--") + lintPaths
// https://github.com/pinterest/ktlint/issues/1195#issuecomment-1009027802
jvmArgs("--add-opens", "java.base/java.lang=ALL-UNNAMED")
2020-10-28 23:00:49 +08:00
}
tasks.register<JavaExec>("ktlintPreCommit") {
description = "Check Kotlin code style (for the pre-commit hooks)."
group = LifecycleBasePlugin.VERIFICATION_GROUP
classpath = ktlint
mainClass.set("com.pinterest.ktlint.Main")
args = listOf("--log-level=warn", "--color", "--relative", "--format", "--") +
System.getProperty("ktlintPreCommitArgs").let { args ->
check(args.isNotBlank()) { "need to pass in -DktlintPreCommitArgs=<some file paths to check>" }
args.split(" ")
}
// https://github.com/pinterest/ktlint/issues/1195#issuecomment-1009027802
jvmArgs("--add-opens", "java.base/java.lang=ALL-UNNAMED")
}