Example #1
0
def test_target():
    tgt = Target("foo.d")
    assert tgt.jsonify() == {
        "type": "fixed",
        "command": {},
        "outputs": ["foo.d"],
        "dependencies": {"type": "fixed", "targets": []},
        "implicits": {"type": "fixed", "targets": []},
    }

    json = dumps(tgt.jsonify())
    assert loads(json) == tgt.jsonify()
Example #2
0
def test_link_foo():
    mainObj = Target("main.o", "dmd -I$project/src -c $in -of$out", Target("src/main.d"))
    assert mainObj.jsonify() == {
        "type": "fixed",
        "command": {"type": "shell", "cmd": "dmd -I$project/src -c $in -of$out"},
        "outputs": ["main.o"],
        "dependencies": {
            "type": "fixed",
            "targets": [
                {
                    "type": "fixed",
                    "command": {},
                    "outputs": ["src/main.d"],
                    "dependencies": {"type": "fixed", "targets": []},
                    "implicits": {"type": "fixed", "targets": []},
                }
            ],
        },
        "implicits": {"type": "fixed", "targets": []},
    }
Example #3
0
def link(exe_name=None, flags='', dependencies=None, implicits=[]):
    assert exe_name is not None
    assert dependencies is not None
    return Target([exe_name], LinkCommand(flags), dependencies, implicits)