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

Unit Script Template Manual is outdated #269

Open
lundmark opened this issue Nov 11, 2015 · 2 comments
Open

Unit Script Template Manual is outdated #269

lundmark opened this issue Nov 11, 2015 · 2 comments

Comments

@lundmark
Copy link

When trying to use the documentation on Unit Script Template to create my own Unit Type, it seems to fail to use the code provided.

My definition:

module("my_compiler", package.seeall)
local nodegen = require "tundra.nodegen"
local _mt = nodegen.create_eval_subclass {}
local blueprint = {
    Sources = {
        Type = "source_list",
        Help = "List of sources",
        Required = true,
        ExtensionKey = "MY_EXTENSION",
    },
    Name = {
        Type = "string",
        Required = true,
    },
}

function _mt:create_dag(env, data, deps)
    return env:make_node {
        Label = "MyCompiler $(@)",
        Action = "echo", --"$(MYACTION)",
        Inputs = data.Sources,
        Outputs = {},
        Dependencies = deps,
    }
end

nodegen.add_evaluator("MyCompiler", _mt, blueprint)

But when trying to run MyCompiler then I get that when trying to create the dag, it calls the :create_dag-function where the make_node function doesn't exist.

(attempt to call method 'make_node' (a nil value))

It would be really awesome if there would be an example of how to get this working in the examples/directory

@lundmark
Copy link
Author

This should probably look something like this instead:

local depgraph = require 'tundra.depgraph'

function _mt:create_dag(env, data, deps)
    return depgraph.make_node {
        Env = env,
        Pass = data.Pass,
        Label = "MyCompiler $(@)",
        Action = "echo", --"$(MYACTION)",
        Inputs = data.Sources,
        Outputs = {},
        Dependencies = deps,
    }
end

However, the notation of $(@) and $(<) seem undocumented (at least I can't find anything in the tundra-manual.html). When those are and aren't usable would be very good to document.

@lundmark
Copy link
Author

It shouldn't be Inputs / Outputs, it should be InputFiles / OutputFiles.

Is it possible to get ConfigInvariant working on your own Unit Extension somehow?

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

1 participant