File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -80,6 +80,22 @@ def main(argv=sys.argv[1:]):
8080                       package_name     =  package_name 
8181    )
8282
83+     # Modify the generated .pb.h to include visibility file 
84+     for  proto_file  in  proto_files :
85+         msg  =  os .path .splitext (os .path .basename (proto_file ))[0 ]
86+ 
87+         # Just in case if the path contains another <xxx>.proto, e.g.,  
88+         # /home/<xxx>.proto/<path-to-proto-file> 
89+         with  open (f"{ cpp_out_dir } { package_name } { msg }  , "r" ) as  f :
90+             contents  =  f .readlines ()
91+ 
92+         # Insert the visibility file on line 6 
93+         contents .insert (
94+             6 ,
95+             f"#include \" { package_name } \" \n " )
96+         with  open (f"{ cpp_out_dir } { package_name } { msg }  , "w" ) as  f :
97+             f .write ("" .join (contents ))
98+ 
8399    return  rc 
84100
85101
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments