sttz / trimmer

An editor, build and player configuration framework for the Unity game engine.
MIT License
104 stars 8 forks source link

Trimmer returns 0 even if the build failed #4

Closed JesseTG closed 3 years ago

JesseTG commented 4 years ago

I'm using Trimmer as part of my build pipeline. Sometimes when the build fails, Unity returns 0 even when it shouldn't. This is on Ubuntu 2019.3.0f5. I'm not sure when exactly this happens, though. What info can I give you to help narrow this down?

sttz commented 4 years ago

How are you executing the build and do you have a log of such a failing build?

I'm not sure trimmer actually handles exit codes correctly. The Unity manual for -executeMethod states that the method needs to throw an error or call EditorApplication.Exit, which it's not currently doing. Makes me wonder why it's sometimes returning a non-0 exit code.

As a workaround, you could check the log for the messages printed by trimmer on success ("Trimmer: Built x to y") or failure ("Trimmer: Build failed for platform x").

JesseTG commented 4 years ago

I don't actually have logs on-hand, I had to delete them to free up storage space on GitHub Actions. But if that's what you need to do, I'll just make a PR.

JesseTG commented 4 years ago

Before I write much, can you tell me which parts of sttz.Trimmer.Editor.BuildManager.Build()'s behavior are important and definitely should not change? I want to ensure that I don't break anything, even if it means leaving in a wart or two.

If, for instance, I can change the return type of Build() to void (as opposed to string), then it will vastly simplify error-handling. But if I can't, I'll find another way.

sttz commented 3 years ago

Uh, this was a long time ago, sorry for the delay.

In 878941ee I changed the Build method to throw in case of an error when a command line build is detected. This will make Unity exit with code 1 if the build has failed.

Not sure why you'd want Build to return void and how that would simplify error handling?

JesseTG commented 3 years ago

In 878941e I changed the Build method to throw in case of an error when a command line build is detected. This will make Unity exit with code 1 if the build has failed.

Thank you!

Not sure why you'd want Build to return void and how that would simplify error handling?

To be honest, I forgot. Maybe it had to do with partial methods?