-
Notifications
You must be signed in to change notification settings - Fork 245
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
feat(rosetta): support "strict" assemblies #2253
Conversation
A "strict" assembly carries a special metadata entry (`jsii.rosetta.strict = true`) that instructs `jsii-rosetta` to always handle that as if `--compile` and `--fail` were provided. This allows opting specific modules from a mono-repository into "enforced compiling" operation while retaining the ability to run `jsii-rosetta` only once from the root of the repository.
Can't seem to follow what you're saying here. Can you re-state simply? Do you mean the samples will always be compiled as part of |
I've attempted rephrasing (actually added more text). |
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.
Small changes, but overall okay.
I'd like to implore you to see if this can be arranged differently from pushing down the strict
parameter all the way into the bowels of the code (can't remember offhand what a better place would be to make the cut though).
If not, then I suppose this needs to be it...
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.
Couple of questions that aren't clear from the code -
If the sample uses a package/code that is not declared as a dependency of this package (either because it's a downstream dependency or a utility package that a customer can choose to use), how does the --strict
option check this?
Concretely this means one can validate
examples from a single package are valid by simply running jsii-rosetta
(strict mode will imply --compile --fail), while a continuous integration
pipeline can continue to use jsii-rosetta on a whole mono-repo in a single
command (which is typically a lot faster).
If I'm interepreting this correctly, the workflow you're suggesting will be that developers can choose to run jsii-rosetta
on the individual package (in a monorepo) during dev time but it won't be run as part of CI. Instead, the CI system will run it in a single command for the whole monorepo. Did I get that correctly?
Will the single command also interpret the jsii.rosetta.strict
and fail for packages that have this flag set and don't compile?
const snippet = typeScriptSnippetFromSource( | ||
example, | ||
'example', | ||
enforcesStrictMode(this.assembly), |
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.
Why have you chosen for the DocGenerator classes to now depend on the jsii assembly? Is this intentional?
Can be avoided if the enforceStrictAssembly
is called at the layer above. This will also avoid code duplication across the different language targets.
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.
jsii-pacmak
right now uses a single Rosetta instance for all packages it generates (there could be multiple from --recurse
). Some may be strict, some may be "loose", and I don't want a single strict package to cause failures in "loose" packages...
Creating multiple instances of Rosetta means creating multiple TypeScript contexts, which I decided against.
Not certain I understand the question well, but here's some answers nevertheless:
|
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
@Mergifyio refresh |
Command
|
Thank you for contributing! ❤️ I will now look into making sure the PR is up-to-date, then proceed to try and merge it! |
Merging (with squash)... |
A "strict" assembly carries a special metadata entry
(
jsii.rosetta.strict = true
) that instructsjsii-rosetta
to alwayshandle that as if
--compile
and--fail
were provided. This allowsopting specific modules from a mono-repository into "enforced compiling"
operation while retaining the ability to run
jsii-rosetta
only oncefrom the root of the repository. Concretely this means one can validate
examples from a single package are valid by simply running
jsii-rosetta
(strict mode will imply
--compile --fail
), while a continuous integrationpipeline can continue to use
jsii-rosetta
on a whole mono-repo in a singlecommand (which is typically a lot faster).
Also added a
--strict
option tojsii-rosetta
in order to haveconsistent semantics here. And added a sub-command of
jsii-rosetta
to actually set the metadata entry correctly for the user.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.