Projeny icon indicating copy to clipboard operation
Projeny copied to clipboard

Feature Request: Intercept/modify vs project generation.

Open Geminior opened this issue 9 years ago • 4 comments

When using Visual Studio Tools for Unity it is possible to intercept the project file generation and modify the generated project file.

This is useful for adding custom MSBuild tasks such as Stylecop checks, static code analysis rules etc.

Geminior avatar May 05 '16 16:05 Geminior

If you're running from python source, you can add python hooks that are triggered at various points while projeny is executing (this is currently undocumented)

For example, if you uncomment the contents of Source/prj/plugins/ExamplePlugin.py then every unity project that is initialized will have a new file generated inside it named MyExampleFile.txt

So I could add another python hook during C# project generation very easily. Question is, when would it make the most sense to trigger? After fully creating the solution? After every c# project?

svermeulen avatar May 05 '16 16:05 svermeulen

We are currently trying it out using the binaries, so I haven't looked at the source yet.

Regarding when to provide the hook, I think it would be best to do so after the solution is fully generated, and then simply have the hook called for each project in the solution and once for the solution file itself. If it is simpler to do it after each project that would work just fine as well.

A possible signature would be string ProjectGenHook(string name, string contents), with the return value being the modified xml contents for the proj or sln file.

Geminior avatar May 05 '16 21:05 Geminior

Yep, that's easy enough to add since there's already a concept of plugins. But it would have to be in python, since both Projeny and Projeny plugins are written in python and are run outside of Unity, so the signature would look more like ProjectGenHook(name, contents)

svermeulen avatar May 06 '16 00:05 svermeulen

Excellent, I'll get the Projeny source and set that up instead then.

Geminior avatar May 06 '16 00:05 Geminior