Chaining actions does not work as documented

I am using premake 4.3 and suspect that I have found a bug in chaining actions:

 newaction {
           trigger     = "qtmake",
           description = "Do QT stuff",
        valid_kinds = premake.action.get("gmake").valid_kinds,
        valid_languages = premake.action.get("gmake").valid_languages,
        valid_tools = premake.action.get("gmake").valid_tools,
 
           execute = function ()
                os.execute("rm -rf "..GENDIR)
                os.execute("mkdir "..GENDIR)
                os.execute("echo 'Running QT stuff'" )
                os.execute(qtGen("QtProgressBar"))
                os.execute("echo 'Done QT stuff'")
                os.execute("echo 'Calling normal gmake action'")
              -- copy files, etc. here
                premake.action.call("gmake")
           end
        }

I receive the following output:

Building configurations...
Running action 'qtmake'...
Running QT stuff
Done QT stuff
Calling normal gmake action
Generating Makefile...
[string "function io.capture()..."]:30: bad argument #2 to 'format' (string expected, got no value)

If this is indeed a bug, I will file it on the tracker.

With the beta, I get this error message:

[string "function io.capture()..."]:32: bad argument #2 to 'format' (string expected, got no value)

You cannot file it on tracker because given code is not a part of Premake itself. It worked for me somehow in my Qt Creator plugin, however I have not tested it much. I'll try to investigate it.

I should be clear here, the error does not occur when I comment the following line:

premake.action.call("gmake")

I can then build the project with

premake qtmake && premake gmake && make

However, I would like to just specify

premake qtmake

And have *it* call the gmake action when it is done.

You can use prebuildcommands instead

I was originally trying to use prebuild commands, but unfortunately premake scans the list of files *before* it runs the prebuild commands.

This means that using the prebuild method, the generated Qt stuff doesn't get compiled (because it doesn't exist) the first time through (with the "generated files" folder being empty).

The solution for me has been to run my custom action "'qtmake" that just runs the calls to generate moc objects etc *first*, then use gmake with

premake4 qtmake && premake4 gmake && make

Which works fine. However, it would be awesome if I could just call "premake 4qtmake", and have it run the gmake action (which is described in your post)

Wait a bit (if you can), there will be proper solution for Qt 4 + gmake soon.

Thanks : )

For now I will just stick with my chain of commands, but Qt 4 support would be *awesome*.

I've written a draft of Qt support (right now only gmake and no Windows). See here for more details:

http://industriousone.com/topic/support-projects-using-qt-framework

Your mistake was missing 'shortname' field. Chaining works as expected if you add it with arbitrary value.

P.S. When in doubt, use debug.traceback() :)

I've found one more solution: put

_ACTION = "gmake"

right before premake.action.call - it will work without shortname provided + will print "# GNU Make project makefile" instead of "# project makefile" in the beginning of Makefiles. However, you still need all those valid_* fileds.