| 
					
				 | 
			
			
				@@ -21,10 +21,14 @@ bazel=`pwd`/tools/bazel 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 if [ $# -eq 0 ]; then 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   UPB_OUTPUT_DIR=$PWD/src/core/ext/upb-generated 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  UPBDEFS_OUTPUT_DIR=$PWD/src/core/ext/upbdefs-generated 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   rm -rf $UPB_OUTPUT_DIR 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  rm -rf $UPBDEFS_OUTPUT_DIR 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   mkdir -p $UPB_OUTPUT_DIR 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  UPB_OUTPUT_DIR=$1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  UPB_OUTPUT_DIR=$1/upb-generated 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  UPBDEFS_OUTPUT_DIR=$1/upbdefs-generated 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  mkdir $UPB_OUTPUT_DIR 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 fi 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 $bazel build @com_google_protobuf//:protoc 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -129,5 +133,17 @@ do 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     --plugin=protoc-gen-upb=$UPB_PLUGIN 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 done 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+# In PHP build Makefile, the files with .upb.c suffix collide .upbdefs.c suffix due to a PHP buildsystem bug. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+# Work around this by placing the generated files with ".upbdefs.h" and ".upbdefs.c" suffix under a different directory. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+# See https://github.com/grpc/grpc/issues/23307 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+# move all .upbdefs.h and .upbdefs.c files from under src/core/ext/upb-generated to src/core/ext/upbdefs-generated 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+cp -r $UPB_OUTPUT_DIR $UPBDEFS_OUTPUT_DIR 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+# remove files that don't belong under upb-generated 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 find $UPB_OUTPUT_DIR -name "*.upbdefs.c" -type f -delete 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 find $UPB_OUTPUT_DIR -name "*.upbdefs.h" -type f -delete 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+# remove files that don't belong under upbdefs-generated 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+find $UPBDEFS_OUTPUT_DIR -name "*.upb.h" -type f -delete 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+find $UPBDEFS_OUTPUT_DIR -name "*.upb.c" -type f -delete 
			 |