Exemple #1
0
def html(docdir):
    sh = shell('{sphinx_build} -b html -d {build_docdir}/doctrees {docdir} {build_docdir}/html'
               , always=True)
    sh.use(build_docdir=Directory(docdir).to_builddir(), docdir=docdir)
    sh.use(':sphinx/sphinx_build')
    sh.require(('sphinx_build', find))
    return sh
Exemple #2
0
def moc(fs):
    fs = nodes(fs)
    ret = []
    for f in fs:
        tgt = file(f).to_builddir().append_extension('moc.cpp')
        t = shell(cmd='{moc} -o {tgt} {src}', sources=f.to_file(), targets=tgt)
        t.require('moc', spawn=find_moc)
        ret.append(t)
    return group(ret)
Exemple #3
0
def compile_schema():
    directory(ctx.builddir.join('schema')).ensure_exists()
    schema_sources = []
    tasks = []
    for src in directory('src/schema').glob('.*\.capnp'):
        cmd = 'capnp compile --src-prefix=src/schema -oc++:{outp} {src}'
        tgt = file(ctx.builddir.join('schema').join(src.basename)).append_extension('.c++')
        schema_sources.append(tgt)
        capnp = shell(cmd, sources=src, targets=tgt)
        capnp.use(outp=ctx.builddir.join('schema'))
        tasks.append(capnp)
    return tasks, schema_sources
Exemple #4
0
def install(pkg, prefix=None, update=True):
    # TODO: support version
    # TODO: defer update of the package to 'update' task
    # but only if version was not given (otherwise, this does not make much sense)
    if prefix is None:
        prefix = ctx.builddir
    if not isinstance(prefix, str):
        prefix = str(prefix)
    Directory(prefix).mkdir('node_modules')
    cmdline_prefix = _make_prefix(prefix)
    return shell('{npm} --prefix {prefix} install {package}')\
        .use(package=pkg, prefix=cmdline_prefix)\
        .produce(package(pkg, prefix=prefix))\
        .use(':nodejs/find-npm')\
        .require(('npm', find_npm))
Exemple #5
0
def compile_schema():
    tasks = []
    directory(ctx.builddir.join('schema')).ensure_exists()
    schema_sources = []
    for src in directory('src/schema').glob('.*\.capnp'):
        cmd = 'capnp compile --src-prefix=src/schema -oc++:{outp} {src_nobs}'
        tgt = file(ctx.builddir.join('schema').join(src.basename)).append_extension('.c++')
        capnp = shell(cmd, sources=src, targets=tgt)
        capnp.use(outp=ctx.builddir.join('schema'))
        # on windows, capnp compiler does not like backslashes, however
        # wasp formats with backslashes by default
        capnp.use(src_nobs=str(src).replace('\\', '/'))
        tasks.append(capnp)
        moved = tgt.replace_extension('cpp')
        mv = copy(tgt, moved).use(capnp)
        schema_sources.append(moved)
        tasks.append(mv)
    return tasks, schema_sources
Exemple #6
0
def doc():
    ctx.builddir.mkdir('doc')
    yield shell('doxygen doc/capnqml.conf')
    yield sphinx.html('doc/sphinx')
Exemple #7
0
def test():
    yield shell(ctx.builddir.join('main').path)
    yield shell('python bindings/python/_tests/test.py')
Exemple #8
0
def executable(source, target):
    target = ctx.builddir.join(target)
    return shell('{rustc} {src} -o {tgt}', sources=source, targets=target)\
        .use(':rust/rustc').require(('rustc', find_rustc))
Exemple #9
0
def cargo_build(directory):
    if isinstance(directory, str):
        directory = Directory(directory)
    assert isinstance(directory, Directory), 'cargo_build() expects an argument of type str or Directory'
    return shell('{cargo} build', always=True, cwd=directory).use(':rust/cargo').require(('cargo', find_cargo))
Exemple #10
0
def tidy(src, directory, fix=False):
    cmd = 'clang-tidy {fix} -checks=' + CHECKS + ' -header-filter="src/.*"'
    cmd = cmd.format(fix='-fix' if fix else '')
    return shell(cmd + ' {src}',
                    sources=[src, 'compile_commands.json']).use(
                    ':clang/compiledb', dir=directory)
Exemple #11
0
def test():
    yield find_exe("py.test", argprefix="pytest").produce(":pytest")
    yield shell("{pytest} tests").use(":pytest")
Exemple #12
0
def tidy(src, directory):
    return shell('clang-tidy -checks=' + CHECKS + ' -fix -header-filter="src/.*" {src}',
                    sources=[src, 'compile_commands.json']).use(
                    ':clang/compiledb', dir=directory)