generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 237
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
129 lines (115 loc) · 5.11 KB
/
build.gradle.kts
File metadata and controls
129 lines (115 loc) · 5.11 KB
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
description = "Generates Rust code from Smithy models and runs the protocol tests"
extra["displayName"] = "Smithy :: Rust :: Codegen :: Server :: Test"
extra["moduleName"] = "software.amazon.smithy.rust.kotlin.codegen.server.test"
tasks["jar"].enabled = false
plugins {
java
alias(libs.plugins.smithy.gradle.base)
alias(libs.plugins.smithy.gradle.jar)
}
val properties = PropertyRetriever(rootProject, project)
val pluginName = "rust-server-codegen"
val workingDirUnderBuildDir = "smithyprojections/codegen-server-test/"
dependencies {
implementation(project(":codegen-server"))
implementation(libs.smithy.aws.protocol.tests)
implementation(libs.smithy.protocol.tests)
implementation(libs.smithy.protocol.test.traits)
implementation(libs.smithy.aws.traits)
implementation(libs.smithy.validation.model)
}
smithy {
format.set(false)
}
val allCodegenTests = "../codegen-core/common-test-models".let { commonModels ->
listOf(
CodegenTest(
"crate#Config",
"naming_test_ops",
imports = listOf("$commonModels/naming-obstacle-course-ops.smithy"),
),
CodegenTest(
"casing#ACRONYMInside_Service",
"naming_test_casing",
imports = listOf("$commonModels/naming-obstacle-course-casing.smithy"),
),
CodegenTest(
"naming_obs_structs#NamingObstacleCourseStructs",
"naming_test_structs",
imports = listOf("$commonModels/naming-obstacle-course-structs.smithy"),
),
CodegenTest("com.amazonaws.simple#SimpleService", "simple", imports = listOf("$commonModels/simple.smithy")),
CodegenTest("smithy.protocoltests.rpcv2Cbor#RpcV2Protocol", "rpcv2Cbor"),
CodegenTest(
"smithy.protocoltests.rpcv2Cbor#RpcV2CborService",
"rpcv2Cbor_extras",
imports = listOf("$commonModels/rpcv2Cbor-extras.smithy"),
),
CodegenTest(
"com.amazonaws.constraints#ConstraintsService",
"constraints_without_public_constrained_types",
imports = listOf("$commonModels/constraints.smithy"),
extraConfig = """, "codegen": { "publicConstrainedTypes": false } """,
),
CodegenTest(
"com.amazonaws.constraints#UniqueItemsService",
"unique_items",
imports = listOf("$commonModels/unique-items.smithy"),
),
CodegenTest(
"com.amazonaws.constraints#ConstraintsService",
"constraints",
imports = listOf("$commonModels/constraints.smithy"),
),
CodegenTest("aws.protocoltests.restjson#RestJson", "rest_json"),
CodegenTest(
"aws.protocoltests.restjson#RestJsonExtras",
"rest_json_extras",
imports = listOf("$commonModels/rest-json-extras.smithy"),
),
CodegenTest(
"aws.protocoltests.restjson.validation#RestJsonValidation",
"rest_json_validation",
// `@range` trait is used on floating point shapes, which we deliberately don't want to support.
// See https://github.com/smithy-lang/smithy-rs/issues/1401.
extraConfig = """, "codegen": { "ignoreUnsupportedConstraints": true } """,
),
CodegenTest("aws.protocoltests.json10#JsonRpc10", "json_rpc10"),
CodegenTest("aws.protocoltests.json#JsonProtocol", "json_rpc11"),
CodegenTest(
"aws.protocoltests.misc#MiscService",
"misc",
imports = listOf("$commonModels/misc.smithy"),
),
CodegenTest("com.amazonaws.ebs#Ebs", "ebs", imports = listOf("$commonModels/ebs.json")),
CodegenTest("com.amazonaws.s3#AmazonS3", "s3"),
CodegenTest(
"com.aws.example#PokemonService",
"pokemon-service-server-sdk",
imports = listOf("$commonModels/pokemon.smithy", "$commonModels/pokemon-common.smithy"),
),
CodegenTest(
"com.aws.example#PokemonService",
"pokemon-service-awsjson-server-sdk",
imports = listOf("$commonModels/pokemon-awsjson.smithy", "$commonModels/pokemon-common.smithy"),
),
)
}
project.registerGenerateSmithyBuildTask(rootProject, pluginName, allCodegenTests)
project.registerGenerateCargoWorkspaceTask(rootProject, pluginName, allCodegenTests, workingDirUnderBuildDir)
project.registerGenerateCargoConfigTomlTask(layout.buildDirectory.dir(workingDirUnderBuildDir).get().asFile)
tasks["smithyBuild"].dependsOn("generateSmithyBuild")
tasks["assemble"].finalizedBy("generateCargoWorkspace", "generateCargoConfigToml")
project.registerModifyMtimeTask()
project.registerCargoCommandsTasks(layout.buildDirectory.dir(workingDirUnderBuildDir).get().asFile)
tasks.register<Exec>("cargoTestIntegration") {
dependsOn("assemble")
workingDir(projectDir.resolve("integration-tests"))
commandLine("cargo", "test")
}
tasks["test"].finalizedBy(cargoCommands(properties).map { it.toString }, "cargoTestIntegration")
tasks["clean"].doFirst { delete("smithy-build.json") }