scons icon indicating copy to clipboard operation
scons copied to clipboard

WIP: Fix ninja warnings/exceptions

Open mwichmann opened this issue 2 years ago • 5 comments

Try to normalize errors/warnings. One warning which was just a bare class instantition (thus, a no-op) now warns; two failures which used to raise SConsWarning now raise ImportError since that's what they are (has no visible effect to the user); another now raises UserError, as it is raised for an error in SConscripts.

There are no API or documentation impacts of this change, just consistency.

Fixes #4036

Contributor Checklist:

  • [ ] I have created a new test or updated the unit tests to cover the new/changed functionality.
  • [X] I have updated CHANGES.txt (and read the README.rst)
  • [ ] I have updated the appropriate documentation

mwichmann avatar Oct 06 '23 16:10 mwichmann

Ah. This fails tests, because there are places where the warning (that wasn't previously raised) is triggered, and since it didn't happen before, the tests are not written to expect it and now show unexpected output. Will need to update the tests (or drop the change).

	test/ninja/generated_sources_alias.py
	test/ninja/ninja_command_line.py

mwichmann avatar Oct 06 '23 16:10 mwichmann

That's more interesting than I expected - looks like this is an internal action - it comes from the Textfile builder, and the comments in SCons/Tool/ninja/NinjaState.py make me think a different action name was expected. Here's one of the new warnings:

> scons: warning: Found unhandled function action '_action',  generating SCons command to build
> Note: this is less efficient than using Ninja. You can write your own ninja build generator for this function using NinjaRegisterFunctionHandler
> File "/home/mats/github/scons/scripts/scons.py", line 97, in <module>

mwichmann avatar Oct 06 '23 16:10 mwichmann

Flagging this WIP/draft until some questions are answered.

mwichmann avatar Oct 06 '23 16:10 mwichmann

@mwichmann Is this still viable, or should it be closed?

bdbaddog avatar May 19 '24 01:05 bdbaddog

@mwichmann Is this still viable, or should it be closed?

Well, the state hasn't changed: ninja (mildly) misuses some stuff, and "fixing" it causes some tests to go awry, making the change a little bigger than I was up for at the time, with possibly no real benefit. I can possibly be talking into dropping it, since I've never gone back to do the "further investigation".

mwichmann avatar May 19 '24 17:05 mwichmann

I'll revisit this someday, no need to have it hanging around here for now.

mwichmann avatar Jun 29 '24 16:06 mwichmann