Git Product home page Git Product logo

anvil-build's Introduction

Anvil - a modern build system

Build Status

NOTE: this project has been deprecated. Bazel is an open source build system that shares roots with the design of anvil, and is a superset of the functionality available here.

Anvil is a build system designed to ease the construction of content pipelines, taking many concepts and the rule file syntax that powers Google's internal build system and making them accessible in a small, open-source Python library. It features a rich and extensible build file format and many built-in rules to get started.

Modern web apps and games have shifted to be more content than code and older build systems (make/scons/etc) are ill-suited for this shift. Most developers now roll their own shell scripts and hack together tools, but as projects scale in both size and complexity they fall apart. Limiting the engineering robustness of many large games is now this lack of solid content pipeline, not language or browser features. Anvil is designed to help fill this gap and let developers build polished, efficient, and cross-browser applications.

Features

  • Parallelizable build process
  • Eventually distributed
  • Rich build files (Python-like)
  • Tiny environment, very few assumptions or dependencies
  • Build files are generally WYSIWYG, with no hidden state or behavior
  • Continuous build server and hosting mode
  • Easy to build live-refresh pages and content
  • Dependency management for rule types
  • Make it simple to checkout and build projects that depend on custom tools or packages
  • Extensible rule definitions
  • Simple Python to add custom data formats or actions

JavaScript Bootstrap

Want to use anvil in a new JavaScript project? This is the easiest way:

wget https://raw.github.com/gist/3814397/anvil-bootstrap.sh
chmod +x anvil-bootstrap.sh
./anvil-bootstrap.sh my-project mp "Your Name"
# this will create my-project/, git init, with 'mp' as the namespace for things
cd my-project/
anvil build :release

Getting Started

# Clone (or add as a submodule) and setup a local install
git clone https://[email protected]/benvanik/anvil-build.git
cd anvil-build/
python setup.py develop

# 'anvil' is the main app, use it to build, test, or serve your content
anvil build project:some_output

Anvil is available via PyPI as 'anvil-build' and can be installed via easy_install or pip, however it's recommeneded that it's used as a submodule instead.

# Install the master git dev branch
pip install anvil-build

Note that bash completion should be enable, but if not use sudo anvil completion --install --bash to install it. You can complete on options, module files, and if you add a : on rules.

Build Files

TODO: detailed overview

The base unit in the build system is a rule. Rules describe some action that is performed on input files and produce output files, and they may reference other rules as inputs. Modules are files that contain many rules, and a project may be made up of many modules. When using the 'anvil' command line tool one specifies a rule or list of rules to build as targets and the build system takes care of building all of the required rules.

The naming syntax for rules is /some/path:rule_name, with the colon splitting module file paths from the rule names contained within. The module files should always be called BUILD, which is a special name that the build system treats as the module for the parent directory. This enables one to omit BUILD when referencing rules, auto-expanding /some/path:rule_name to /some/path/BUILD:rule_name. A shorthand is allowed as :rule_name (omitting the path), enabling easy access to rules defined in the same file or, when dealing with rules from the command line, in the BUILD file in the current working directory.

For example, here's two simple files:

# in /some/path/BUILD:
# All txt files under the current path, plus the outputs of foo:rule2
file_set(name='rule1', srcs=glob('**/*.txt') + ['foo:rule2'])

# in /some/path/foo/BUILD:
file_set(name='rule2', srcs=['some_file.js'])

From the command line when referencing these files:

# if cwd = /some/path, all of these are equivalent:
anvil build :rule1
anvil build /some/path:rule1
anvil build /some/path/BUILD:rule1

TODO: dumping the build graph

Rules

All rules have a few shared parameters, and most use them exclusively to do their work:

  • name: The name of the rule when referenced. Some rules will use this as the base name of their output file.
  • srcs: A list of source files the rule works on. May reference files, globs, or other rules.
  • deps: A list of rules that must execute before the rule does, but the files are not used.

TODO: talk about base rules (file_set, copy_files, concat_files, template_files)

Commands

TODO: talk about built-in commands (build, test, clean, depends, deploy, serve)

Custom Rules

TODO: custom rules/.anvilrc files

anvil-build's People

Contributors

benvanik avatar husafan 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

anvil-build's Issues

Virtual ENV does not have supporting package

I was trying to get Anvil running on my Mac and it failed to run. The issue is when a virtual ENV is created, the new ENV does not have all of the libraries e.g. twisted.internet. I modified my local third_party/anvil-build/setup-local.sh file to have the following line modified:

virtualenv --system-site-packages $DIR/local_virtualenv

With the updated file and newly generated ENV, I was able to get Anvil to start up. Without the update, I got the following error message:

Traceback (most recent call last):
File "/Users/captain/jl/src/tracing-framework/third_party/anvil-build/anvil/manage.py", line 327, in
anvil.manage.main()
File "/Users/captain/jl/src/tracing-framework/third_party/anvil-build/anvil/../anvil/manage.py", line 312, in main
cwd=os.getcwd())
File "/Users/captain/jl/src/tracing-framework/third_party/anvil-build/anvil/../anvil/manage.py", line 191, in run_command
return command.execute(parsed_args, cwd)
File "/Users/captain/jl/src/tracing-framework/third_party/anvil-build/anvil/commands/serve_command.py", line 68, in execute
self._launch_http_server(args.http_port, cwd)
File "/Users/captain/jl/src/tracing-framework/third_party/anvil-build/anvil/commands/serve_command.py", line 85, in _launch_http_server
from twisted.internet import reactor
ImportError: No module named twisted.internet

Support root-relative paths

Would make doing something like '/src/foo' easier than '../../../src/foo' in random places, but would mess up third_party submodules.
Perhaps '/' searches to the highest parent .git-containing folder?

Add simple project management features

anvil setup

  • Install/update dependencies:
    • node_modules via NPM
    • python packages via easyinstall/pip
    • system packages (somehow?)
    • custom scripts?
  • Fetch third_party by git submodule init/update
  • Accept diff of items to run vs. full

anvil pull

  • Stash current setup information
  • git pull
  • Re-run setup with diff

anvil push

  • Run presubmit rules (full build/lint/test/etc)
  • git push

anvil update-submodules

Replaces update-third-party.sh

for each gitsubmodule:
  cd $m
  git checkout master
  git pull origin master
  git merge origin/master
for each gitsubmodule:
  git add $m
run full build/lint/test

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.