-
Notifications
You must be signed in to change notification settings - Fork 805
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
Checkout idls if folder is empty #4155
Conversation
Pull Request Test Coverage Report for Build 094d7eeb-603b-4726-8873-85026b441aee
💛 - Coveralls |
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.
"definite no" signs:
- this will currently no-op if there's a
checkout-idls-if-empty
file in the folder, which is almost definitely not what you want. it should either be .PHONY or have a real target file. - this needs to be FAR before lint. at the moment the only thing these prerequisites say is that you must have files in there at some point before the linter runs... but that's practically the last thing that happens, and these files are needed for codegen that happens much earlier. there's no way that's correct.
- even if you move it earlier in the dependency list, makefile parsing has already completed, and the list of files-to-generate is already wrong and will not be updated. this is a fairly fundamental limitation on anything like this in makefiles.
this isn't really something you can do "inline" like this, and have anything even approaching correct behavior. it might work in some situations, but definitely not all.
since the files need to exist in order to figure out what files need to be generated: there's almost no way to do this without having it set up before the makefile is run. so there are really only 3 options:
- tell people to set up the submodules before making. either in docs, or in an early check on the makefile, or something. they need to do it, and then run
make [whatever]
, because parsing for a build has to happen after the files exist. - "synchronously" init the folder during parsing, e.g. do that
if ... git submodule update
near the top and execute it all the time. I'll pretty strongly recommend against this though, it's far worse to troubleshoot for users. - have the "set up and build" make target do two steps, e.g. recursively make one thing and then the other:
git submodule update; $(MAKE) bins
. this'll ensure a "clean" parse for themake bins
part, since it's started after the submodule is updated. we could perhaps set this up as amake bootstrap
that we recommend people run once... but they still need to be told to do that and do it. in that case, why not just tell them togit submodule update
.
we could also make a somewhat larger change, to make thrift / protoc codegen prerequisites not depend on specific files at all. then it could be initialized "inline" like this, and the dependency graph will still be correct. I'm not sure off-hand how feasible that is, but it probably isn't too bad. we'd likely be giving up parallelism though.
personally i'd probably vote for a "detect empty idl folder, fail early" blocking step, somewhere early-on before codegen runs. we can say "run git submodule update
and try again" pretty easily there.
Thanks for the comment. Really appreciate it.
@Groxx that works for me. Will do that. |
@Groxx could you point out where we should put the if check and fail early with some message? |
Yep, definitely. Let me try to craft something since I can't do inline comments outside the small context window, apparently. |
This is the list of high-level dependencies, near the top of the makefile, in roughly-reverse order (maybe I should change that. order doesn't really matter in this part.): https://github.com/uber/cadence/blob/70031dedfef4e13679a09ff8628c395b37c3d37b/Makefile#L37-L43 Since this is something that thrift needs to have in place before it runs, thrift needs to depend on it. So add something like this, to mark that there's a dependency:
Now, before thrift runs, submodule must have already completed. (protoc can run in parallel and ignore it, since that's not in the idl folder apparently) Somewhere lower (wherever you feel it makes sense), define the recipe as something like this:
^ When THRIFT_FILES found files (it's a This is effectively the same as your Lastly, Ultimately, that'll print something like this when it fails, and it'll stop the build:
And when it succeeds, it'll make that [1]: probably. Arguably this is something that's meaningful to run on all builds, which would make it a
Unfortunately, since So don't do this. You could do something like this, anywhere in the makefile:
And that would work... but it would also mean you can't run ANYTHING without the submodule, which sucks. E.g. |
And! While typing all that out, I realized there's a simpler option that we should probably do. The instructions above are fairly general "how to add another step", so I'll keep them, but for this we can probably just change this:
since |
a61b8ee
to
bf05388
Compare
@Groxx I tried what you suggested but does't work with me.
I may misunderstood it. I think maybe you can take over to fix it for us. (you can reuse or create other PR, I am totally cool with it) |
@Groxx will come up with a better fix, so I will just close this. |
This is largely a continuation of #4155 , and is related to / helps resolve #4162 . When the IDL submodule doesn't have files in it, builds can fail in a variety of obtuse ways. Currently it fails when running protoc, as there's a symlink from proto/ into idls/, e.g. causing error from #4155 : ``` uber/cadence/matching/v1/service.proto:213:12: "api.v1.TaskListPartitionMetadata" is not defined. proto/public: warning: directory does not exist. uber/cadence/api/v1/history.proto: File not found. ... ``` Since this needs to be fixed *before* running a `make ...`, as its files are used as target prerequisites, it can't be auto-initialized by the makefile. Instead, it now fails the build with a descriptive error, and the user needs to resolve it before trying again. --- While building and testing this I also noticed that the fake protoc/thrift binaries were sometimes surprising me, so I added a warning about them to `make clean`. They *might* be reasonable to automatically clean up as well, but I'm leaving them in place for now, so e.g. a build process doesn't accidentally fake -> clean -> do a full build.
…flow#4172) This is largely a continuation of cadence-workflow#4155 , and is related to / helps resolve cadence-workflow#4162 . When the IDL submodule doesn't have files in it, builds can fail in a variety of obtuse ways. Currently it fails when running protoc, as there's a symlink from proto/ into idls/, e.g. causing error from cadence-workflow#4155 : ``` uber/cadence/matching/v1/service.proto:213:12: "api.v1.TaskListPartitionMetadata" is not defined. proto/public: warning: directory does not exist. uber/cadence/api/v1/history.proto: File not found. ... ``` Since this needs to be fixed *before* running a `make ...`, as its files are used as target prerequisites, it can't be auto-initialized by the makefile. Instead, it now fails the build with a descriptive error, and the user needs to resolve it before trying again. --- While building and testing this I also noticed that the fake protoc/thrift binaries were sometimes surprising me, so I added a warning about them to `make clean`. They *might* be reasonable to automatically clean up as well, but I'm leaving them in place for now, so e.g. a build process doesn't accidentally fake -> clean -> do a full build.
What changed?
Checkout idls if folder is empty
Why?
After this #4152 , the development is broken for people who start development on Cadence.
The errors is:
If you checkout Cadence from beginning you will see it.
This should be safe enough because if your idls is already checked out, this target won't do anything.
How did you test it?
Local test
Potential risks
na
Release notes
na
Documentation Changes
na