DO NOT MERGE: fix PHP build issue with upb textformat (version2).#23634
DO NOT MERGE: fix PHP build issue with upb textformat (version2).#23634jtattermusch wants to merge 10 commits intogrpc:masterfrom
Conversation
|
Local run of |
| # See https://github.com/grpc/grpc/issues/23307 | ||
|
|
||
| # move all .upbdefs.c files from under src/core/ext/upb-generated to src/core/ext/upbdefs-generated | ||
| UPBDEFS_OUTPUT_DIR=$PWD/src/core/ext/upbdefs-generated |
There was a problem hiding this comment.
If we wind up going with this approach, you will also need to change tools/distrib/check_upb_output.sh to check the upbdefs directory as well.
There was a problem hiding this comment.
I will check the situation with #23122 and come back with an opinion.
|
Several observations and concerns:
|
| # move all .upbdefs.c files from under src/core/ext/upb-generated to src/core/ext/upbdefs-generated | ||
| UPBDEFS_OUTPUT_DIR=$PWD/src/core/ext/upbdefs-generated | ||
| rm -rf $UPBDEFS_OUTPUT_DIR | ||
| cp -r $UPB_OUTPUT_DIR $UPBDEFS_OUTPUT_DIR |
There was a problem hiding this comment.
Is it safe to not have a mkdir -p $UPBDEFS_OUTPUT_DIR prior to this?
There was a problem hiding this comment.
Yes, it works. The cp command takes the entire upb-generated and stores a copy as upbdefs-generated (if the destination directory would exist, the outcome would be different (upb-generated would end up under upbdefs-generated/upb-generated), but we do rm -rf $UPBDEFS_OUTPUT_DIR in the previous step.
Note that it's already the case that when the set of files we're generating changes, we need to make the corresponding changes in the BUILD file and then re-run generate_projects.sh. This PR does not make that any worse, as far as I can tell. |
Ah I see. Thanks for clarifying. I was actually looking more into this and was coming to a similar conclusion - that if someone is adding/changing the list of .protos being generated in So the slightly new cognitive load is that |
|
|
||
| # move all .upbdefs.c files from under src/core/ext/upb-generated to src/core/ext/upbdefs-generated | ||
| UPBDEFS_OUTPUT_DIR=$PWD/src/core/ext/upbdefs-generated | ||
| rm -rf $UPBDEFS_OUTPUT_DIR |
There was a problem hiding this comment.
Earlier in the script, there's an option of invoking this script and providing a custom location for the upb-generated directory name as $1. Just want to point out that there won't be such option for this new upbdefs-generated directory.
There was a problem hiding this comment.
Good point. I didn't want to get into details like that in the first iteration of the PR as it's just a technicality.
We could either:
- stop supporting the
$1argument (which I'd be in favor of if this option it's used very often as these special cases add complexity to the script and I'd like to avoid unnecessary complexity as much as possible). - make sure the $1 still works fine (doable, it's just a technicality).
Thanks for confirming!
That's accurate. If the idea of this PR looks good I can improve the comment to make this clearer. I'd probably also change it to make ".upbdefs.h" files also land in
IMHO the location of .h files is not important at all (of course as long as all the build use the right include paths). .h files are not compilation units (.c files are, .h are just included in them by a preprocessor so their location is completely irrelevant) and the issue we're facing is purely about the resulting object files colliding with each other.
That was explained by Mark. Currently the BUILD file needs to be updated manually (at least before #23122 is in place) so this is really only about knowing that upbdefs.c files will be generated under
I'll check if this trick seems to cause problems in conjunction with planned PR #23122. |
|
@jtattermusch We probably should move this forward. Anything I can help? |
|
superseded by #23835. |
Better version #23628 (if it works).