Kode / khamake

Kha's build tool.
http://kha.tech
15 stars 43 forks source link

A library's addDefine gets ignored #204

Open XANOZOID opened 5 years ago

XANOZOID commented 5 years ago

Basically, I was able to test that my flags were being ignored when they were declared in an added library.

The library khafile.js

let project = new Project('tests');
project.addDefine('hxp_test_message_lib');

resolve(project);

The project khafile.js

let project = new Project('tests');
project.addDefine('hxp_test_message');
project.addLibrary('HaxePunk');
resolve(project);

Theoretical haxe file:

class App 
{

    public static function main() 
    {
        #if (hxp_test_message)
                trace("message from project");
        #end
        #if (hxp_test_message_lib)
                trace("message from lib");
        #end
        System.start({title: "Project", width: 1024, height: 768, framebuffer: {frequency: 60}}, function(window)
        {
            // . . .
        });
    }
}

The output ignores the library's define, but it registers the projects own flag.

XANOZOID commented 5 years ago

Correction, as clarified in the IRC I was using addLibrary incorrectly. addProject is the functionality I'm looking for, but it doesn't fallback to Haxelib projects - which I actually want. So I'll be making a pull-request that takes care of this use-case.