Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rfc30/feature gate for generated crates #2183

Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
9b70288
add CfgUnstable for feature-gate
thomas-k-cameron Jan 8, 2023
5c794cf
add features
thomas-k-cameron Jan 8, 2023
6403cec
add feature-gate
thomas-k-cameron Jan 8, 2023
1f33a5c
strings for feature gate
thomas-k-cameron Jan 8, 2023
2fb7178
Revert "strings for feature gate"
thomas-k-cameron Jan 8, 2023
3513d7d
Merge branch 'main' into rfc30/feature-gate-for-generated-crates
thomas-k-cameron Jan 9, 2023
1717d72
Update codegen-core/src/main/kotlin/software/amazon/smithy/rust/codeg…
thomas-k-cameron Jan 11, 2023
e16ce62
fix dependency thing on cargo
thomas-k-cameron Jan 11, 2023
14d5e1d
add OutputShape to builder
thomas-k-cameron Jan 11, 2023
cc61ede
EnumGenerator
thomas-k-cameron Jan 11, 2023
22ef698
StructureGenerator
thomas-k-cameron Jan 11, 2023
7aaa744
UnionGenerator
thomas-k-cameron Jan 11, 2023
8b12529
todo
thomas-k-cameron Jan 11, 2023
cd602bf
fixed?
thomas-k-cameron Jan 12, 2023
b90a1b2
SerdeDecorator
thomas-k-cameron Jan 12, 2023
1cefde2
codegen stuff
thomas-k-cameron Jan 12, 2023
af24d35
Merge branch 'main' into rfc30/feature-gate-for-generated-crates
thomas-k-cameron Jan 12, 2023
25ed6ff
update
thomas-k-cameron Jan 12, 2023
6a3757e
fix
thomas-k-cameron Jan 12, 2023
a1dd430
Apply suggestions from code review
thomas-k-cameron Jan 24, 2023
8c0843d
- refactoring
thomas-k-cameron Jan 24, 2023
d64ee3a
adds serde-serialize/deserialize
thomas-k-cameron Jan 24, 2023
296ab7b
Merge branch 'unstable-serde-support' into rfc30/feature-gate-for-gen…
thomas-k-cameron Jan 24, 2023
e0811b2
this one causes null pointer exception
thomas-k-cameron Jan 27, 2023
a5c2eb8
interim solution
thomas-k-cameron Jan 30, 2023
8ceb679
new push
thomas-k-cameron Jan 31, 2023
b3fa786
fix
thomas-k-cameron Feb 3, 2023
9f84174
add Sensitive Warning
thomas-k-cameron Feb 3, 2023
a5970c0
add test for CargoTomlGeneratorTest
thomas-k-cameron Feb 3, 2023
4e8a72c
Update codegen-core/src/main/kotlin/software/amazon/smithy/rust/codeg…
thomas-k-cameron Feb 18, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import java.nio.file.Path
sealed class DependencyScope {
object Dev : DependencyScope()
object Compile : DependencyScope()
object CfgUnstable : DependencyScope()
Velfi marked this conversation as resolved.
Show resolved Hide resolved
}

sealed class DependencyLocation
Expand Down Expand Up @@ -245,5 +246,8 @@ data class CargoDependency(
fun smithyQuery(runtimeConfig: RuntimeConfig) = runtimeConfig.smithyRuntimeCrate("smithy-query")
fun smithyTypes(runtimeConfig: RuntimeConfig) = runtimeConfig.smithyRuntimeCrate("smithy-types")
fun smithyXml(runtimeConfig: RuntimeConfig) = runtimeConfig.smithyRuntimeCrate("smithy-xml")

// behind feature-gate
val Serde = CargoDependency("serde", CratesIo("1.0"), features = setOf("derive"), scope = DependencyScope.CfgUnstable)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,10 @@ data class RuntimeType(val path: String, val dependency: RustDependency? = null)
val ConstrainedTrait = RuntimeType("crate::constrained::Constrained", InlineDependency.constrained())
val MaybeConstrained = RuntimeType("crate::constrained::MaybeConstrained", InlineDependency.constrained())

// serde types. They will be behind feature gates
thomas-k-cameron marked this conversation as resolved.
Show resolved Hide resolved
val SerdeSerialize = CargoDependency.Serde.toType().resolve("Serialize")
val SerdeDeserialize = CargoDependency.Serde.toType().resolve("Deserialize")

// smithy runtime types
fun smithyAsync(runtimeConfig: RuntimeConfig) = CargoDependency.smithyAsync(runtimeConfig).toType()
fun smithyChecksums(runtimeConfig: RuntimeConfig) = CargoDependency.smithyChecksums(runtimeConfig).toType()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ class CargoTomlGenerator(
if (features.isNotEmpty()) {
cargoFeatures.add("default" to features.filter { it.default }.map { it.name })
}
// add serde related features
cargoFeatures.add("serialize" to listOf("aws-smithy-types/serialize"))
cargoFeatures.add("deserialize" to listOf("aws-smithy-types/deserialize"))
Velfi marked this conversation as resolved.
Show resolved Hide resolved

val cargoToml = mapOf(
"package" to listOfNotNull(
Expand All @@ -74,6 +77,8 @@ class CargoTomlGenerator(
.associate { it.name to it.toMap() },
"dev-dependencies" to dependencies.filter { it.scope == DependencyScope.Dev }
.associate { it.name to it.toMap() },
"target.'cfg(aws_sdk_unstable)'" to dependencies.filter { it.scope == DependencyScope.CfgUnstable }
.associate { it.name to it.toMap() },
"features" to cargoFeatures.toMap(),
).deepMergeWith(manifestCustomizations)

Expand Down