Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: custombuildtask multiple command calls not allowed in Ninja #420

Open
TesterPointer opened this issue Mar 6, 2019 · 4 comments
Open

Comments

@TesterPointer
Copy link

custombuildtask {
    {
        _input_file,
        _output_file,
        {},
        {                
            "C:/workcopy/extsw/windows_amd64/qt3/bin/moc.exe $(<) ".._defines_params.." -o $(@)",
            "echo Running MOC on",
        },
    },
}

When I try to compile this with a second command (echo) and error occurs.
I tried if there is a MOC error, but if I use 2 echo commands the error output are the same, I dont know if is a Ninja or not....

ninja: error: ASDF.ninja:40: multiple rules generate ../../_input_file.cpp [-w dupbuild=err]

@bkaradzic
Copy link
Owner

See: https://milostosic.github.io/build/

It's set of GENie build scripts, that supports Qt too.

@TesterPointer
Copy link
Author

mmm really interested, I will take a look at this auto project setup, but independently of this autogen with QT support, Does Ninja supports double command in a same file? I checked that VS can but with Ninja I´m not sure.
Thanks for the info, I didnt know the existence of a powerfull magic that uses GENIe

@belegdol
Copy link
Contributor

belegdol commented Aug 2, 2020

mame appears to be affected too (you have to fix some $ escaping errors first):

custombuildtask {
	{ MAME_DIR .. "scripts/font/NotoSans-Bold.bdc", GEN_DIR .. "emu/uismall.fh", { MAME_DIR .. "scripts/build/file2str.py" }, { "@echo Converting NotoSans-Bold.bdc...", PYTHON .. " $(1) $(<) $(@) font_uismall uint8_t" } },
}

custombuildtask {
	{ MAME_DIR .. "src/frontend/mame/ui/uicmd14.png", GEN_DIR .. "emu/ui/uicmd14.fh", { MAME_DIR.. "scripts/build/png2bdc.py",  MAME_DIR .. "scripts/build/file2str.py" }, { "@echo Converting uicmd14.png...", PYTHON .. " $(1) $(<) temp_cmd.bdc", PYTHON .. " $(2) temp_cmd.bdc $(@) font_uicmd14 uint8_t" } },

@ksherlock
Copy link

Per this:

Internally, ninja just ignores all but the last rule.

Per the ninja manual on rules and commands:

Each rule may have only one command declaration. See the next section for more details on quoting and executing multiple commands.

...

On Unixes, commands are arrays of arguments. The Ninja command variable is passed directly to sh -c, which is then responsible for interpreting that string into an argv array. Therefore the quoting rules are those of the shell, and you can use all the normal shell operators, like && to chain multiple commands, or VAR=value cmd to set environment variables.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants
@bkaradzic @ksherlock @belegdol @TesterPointer and others