-
Notifications
You must be signed in to change notification settings - Fork 49
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
chore: add scaffolding task #1202
Conversation
ec25475
to
60ee9fa
Compare
A new generated diff is ready to view.
|
A new generated diff is ready to view.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the term "scaffold" is not clear enough on its own. May I suggest "scaffold-new-packages", "update-package-manifest", etc., as terms which are more clear for a task name or a task class name.
@@ -37,3 +37,16 @@ internal fun sdkIdToArtifactName(sdkId: String): String = sdkId.replace(" ", "") | |||
* catapult! See AwsSdkCatapultWorkspaceTools:lib/source/merge/smithy-model-handler.ts | |||
*/ | |||
fun sdkIdToModelFilename(sdkId: String): String = sdkId.trim().replace("""[\s]+""".toRegex(), "-").lowercase() | |||
|
|||
// FIX - replace with case utils from smithy-kotlin once we verify we can change the implementation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: FIX
→ FIXME
check(modelFile.isPresent || modelDir.isPresent) { "one of `model` or `model-dir` is required" } | ||
check(!(modelFile.isPresent && modelDir.isPresent)) { "only one of `model` or `model-dir` can be set" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style: Could combine:
check(modelFile.isPresent != modelDir.isPresent) { "Exactly one of `model` or `model-dir` must be set" }
val modelContents = """ | ||
${"$"}version: "2.0" | ||
${"$"}version: "2" | ||
namespace gradle.test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: Why did this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've slept and hacked since then and I don't recall. I want to say something about the model discovery and validation triggering something here and so I just fixed it to make smithy happy again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
services still model this as 2.0
, so if it breaks in this test, would it also break once we try to use it for a real service?
probably not, because the CI which bootstraps services passes, still weird.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In Smithy IDL, both of these statements are valid but seem to mean the exact same thing—tooling must support an IDL version of anywhere from 2.0 (inclusive) to 3.0 (exclusive). I'd be curious what broke and if there's maybe a bug somewhere else.
val expected = AwsService( | ||
"gradle.test#TestService", | ||
"aws.sdk.kotlin.services.testgradle", | ||
"aws.sdk.kotlin.services.testgradle2", | ||
"1.2.3", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: Is this rename significant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's proving that the namespace is taken from the package manifest given vs the inferred namespace from sdkId
.
@Serializable | ||
data class PackageMetadata( | ||
public val sdkId: String, | ||
public val namespace: String, | ||
public val artifactName: String, | ||
public val brazilName: String, | ||
) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: Add KDocs. In particular, it's not clear that artifactName
means "Maven artifact name (i.e., the 'A' in 'GAV')" solely by looking at the code.
As the task name? It is qualified by the project Task names are (err should be) camel cased though so it would be one of:
I chose |
I'd vote for |
val modelContents = """ | ||
${"$"}version: "2.0" | ||
${"$"}version: "2" | ||
namespace gradle.test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
services still model this as 2.0
, so if it breaks in this test, would it also break once we try to use it for a real service?
probably not, because the CI which bootstraps services passes, still weird.
codegen/sdk/build.gradle.kts
Outdated
@@ -185,6 +192,11 @@ tasks.register("bootstrap") { | |||
finalizedBy(stageSdks) | |||
} | |||
|
|||
tasks.register<Scaffold>("scaffold") { | |||
group = "codegen" | |||
description = "Add a new service to packages.json manifest" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: it can add or update multiple services
A new generated diff is ready to view.
|
Quality Gate passedThe SonarCloud Quality Gate passed, but some issues were introduced. 10 New issues |
A new generated diff is ready to view.
|
Issue #
fixes #1189
Description of changes
scaffold
task for service client codegen to generate package metadata once which will be re-used across future build/publish. This allows us to change the logic behind inference over time without breaking existing packages while also serving as a hedge against accidentally breaking existing packages/artifacts.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.