deplinenoise / tundra

Tundra is a code build system that tries to be accurate and fast for incremental builds
MIT License
438 stars 75 forks source link

duplicate node guids in 'empty' sample #276

Closed ricka-github closed 8 years ago

ricka-github commented 8 years ago

The following tundra file gives me an error about duplicate node guids. I am unsure why this is happening. This example is pretty non-functional, but I had the same issue with a slightly more realistic scenario. Naturally, it's my new node that is causing the issue somehow.

local nodegen  = require "tundra.nodegen"
local depgraph = require "tundra.depgraph"

_ios_bundle_mt = nodegen.create_eval_subclass { }

function _ios_bundle_mt:create_dag(env, data, deps)
  return depgraph.make_node {
    Env   = env,
    Pass  = data.Pass,
  }
end

nodegen.add_evaluator("iOSBundle", _ios_bundle_mt, {})

Build {
    Configs = {
        {
            Name = "macosx-gcc",
            DefaultOnHost = "macosx",
            Tools = { "gcc" },
        },
    },
    Units = {
        function()
            Default( Program {
                Name = "HelloWorld",
                Sources = { 
                    "hello.c"
                },
            } )

            Default( iOSBundle{} )
        end
    }
}
deplinenoise commented 8 years ago

Your generator makes a bunch of nodes that are identical for each configuration, so the DAG generator doesn't know how to separate them. The generators computes a hash based on the action (command line), input and output files (and maybe something else, I forget). This node has nothing, so they all map to the same thing which confuses the subsequent pass. The hashes are used for a couple of things, including automatic filesystem cleanup of build steps that are not present anymore.

ricka-github commented 8 years ago

I thought that might be the case, which is why I tried removing all but a single configuration.

...

Which means I still have the debug/release/production triplet, so I actually have three configurations. Thanks for the help!