Giter Site home page Giter Site logo

cook's Introduction

โ„๏ธ Development is paused for now but may be resumed in the future.

โšก This software is currently in alpha and not ready for production use.

โค๏ธ Contributions to this project are very welcome!

Overview

Cook is an extensible, dynamic, parallel and cross-platform build system. It is based on the concept that writing build definitions should be as powerful and easy as possible, which is why everything in Python. While many other systems may be slightly faster in benchmarks, we believe that, at least for most projects, these differences do not outweigh the advantages you get by using a more powerful system.

Example

Using the built-in rules is straightforward. You just import the corresponding module and call the supplied rule. This is all you need to get a working build going. The following example will automatically work on any supported platform.

from cook import cpp

cpp.executable(
    sources=['main.cpp'],
    destination='main'
)

Executing this script will build an executable using the correct platform-specific details. For example, the output is either named main or main.exe depending on the operating system.

$ ls
BUILD.py  main.cpp  main.h
$ cook
[  0%] Compile main.cpp
[ 50%] Link build/main
[100%] Done.
$ ls build/
main

You can also easily create your own rules. Upon calling, they are executed until the required information is passed back to the system using yield core.publish(...). Everything after that is executed shortly after if the system decides it is necessary to do so.

from cook import core

@core.rule
def replace(source, destination, mapping):
    source = core.resolve(source)
    destination = core.build(destination)

    yield core.publish(
        inputs=[source],
        message='Generating {}'.format(destination),
        outputs=[destination],
        check=mapping
    )

    with open(source) as file:
        content = file.read()
    for key, value in mapping.items():
        content = content.replace(key, value)
    with open(destination, 'w') as file:
        file.write(content)

Please look at the documentation if you want to know more.

cook's People

Contributors

jachris avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

cook's Issues

Handle unknown output filenames

Some rules (e.g. Java) might output different filenames which are difficult to know before executing the rule. Currently all outputs must be known before execution โ€“ other build tools solve this by zipping all produced files to a well-defined path.

Path handling

A rule must currently core.resolve() any files relative to the build script and core.build() any files relative to the build directory. The paths are returned relative to the current working directory.

This can lead to some unexpected resulsts since a path returned by build can be resolved to create a totally nonsensical path. This could be improved to reduce the likelihood of errors.

Determine default environment to run commands within

Currently, core.call() uses an empty environment when not specifying anything else. This is a bad default behaviour because many applications rely on some enviroment variables like TMP. We should determine some useful defaults which will not impact reproducability.

Integrate other build systems

It should be possible to let the system run other build systems. This could be useful to build subprojects not using Cook or for projects that want to change build systems.

Generic rule for arbitrary commands

Sometimes there is the need for just running a program with known outputs and inputs. There should be a user-friendly rule that provides such a functionality, maybe including inputs / outputs path substitution.

Cook name duplicates established work of art

There has been another "cook" build system that was first made available in the early 2000's by a notable software author, Peter Miller. Your system seems to share no relationship with it and that may be confusing for some users.

http://ibiblio.org/pub/Linux/devel/make/cook-2.25.tut.pdf
https://en.wikipedia.org/wiki/Peter_Miller_(software_engineer)
https://lists.auug.org.au/pipermail/cook-users/

I would recommend choosing another name, or including prominent footnotes indicating that there is no relationship in respect to that prior author's work.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.