laotao / protobuf

Automatically exported from code.google.com/p/protobuf
Other
0 stars 0 forks source link

Add support for using batch files to wrap plugins on Windows #399

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Windows has this annoying requirement that plugins be .exe's, which discourages 
the use of scripting. As a work around, I propose that should the plugin's 
executable name end with ".cmd" or ".bat", that cmd.exe /c be invoked. This 
would allow a simple .cmd or .bat file to do the work that Unix's #! usually 
provides a script. There are definitely more sophisticated ways to solve this 
problem, but this seems simple and predictable.

Usage is something like:

protoc --plugin=protoc-gen-foo=protoc-gen-foo.cmd --foo_out=. my.proto

With protoc-gen-foo.cmd looking like:
@C:\Path\To\Interpreter.exe protoc-gen-foo

The patch only requires changes to google::protobuf::compiler::subprocess. I've 
attached a patch describing the change.

Original issue reported on code.google.com by cbsm...@gmail.com on 21 Jul 2012 at 2:50

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by xiaof...@google.com on 1 Feb 2013 at 6:39

GoogleCodeExporter commented 9 years ago
Can this patch get merged? This is so useful.

Original comment by yi.codep...@gmail.com on 14 Dec 2013 at 10:39

GoogleCodeExporter commented 9 years ago
This would also make the dart-protoc-plugin useable on windows...

https://github.com/dart-lang/dart-protoc-plugin

Original comment by olli.s...@gmail.com on 18 Dec 2014 at 6:46