-
Notifications
You must be signed in to change notification settings - Fork 86
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
Support optional merge function during copy #21
Conversation
The path should be the same relative path, right? |
Yes, it should be the same relative path. Although I'm not entirely clear how to get the "common" relative path. |
I think you can use the Another option would be to compute all of the common parts between the src and dst ( |
I decided to pass the (canonical) destination path as-is to the merge function, since it is the actual file being operated on. By default it's already a relative path anyway. |
Change-Id: If3d727c9b76058532ebd5b91d313731f9157238e
@dazuma I made a few changes and I think everything still works, can you confirm? |
@theacodes Yes, my synth using the new feature still works. Thanks for the fixes. Sometime can you point me to how to run the linter/typechecker/whatever tools you're using? I totally missed a bunch of those type issues. |
|
👋 Sorry for getting to this late. @dazuma can you make sure this is documented in the README? |
Feature request for synthtool. During file copy, allows the result to be a "merge" of the contents of the source and the existing destination file. The merge function itself is provided as an optional argument to
transforms.move
.One use case supported by this feature the ruby gemspec. This file specifies, among other things, the gem version, and the library dependencies. The former is updated during the release process (i.e. GAPIC does not know what version the gem currently is, so it cannot generate that part of the file correctly). The latter should be controlled by GAPIC (e.g. only GAPIC knows what version of google-gax its generated code depends on). Thus, the final gemspec output by synth must include the current version from the existing gemspec, and the dependency information from the freshly gapic-generated gemspec.
Open question: currently the merge function takes two arguments: the contents of the source (i.e. from-gapic) file, and the contents of the existing destination file. This is sufficient for my current use case, in which I am issuing a transforms.copy for a single file. However, maybe the merge function should also be passed the file path, so it has more information if it is invoked during a directory copy that includes multiple files? (And if so, should it be passed the source file path or the destination file path, or both?)