commit | 5dcdbf9a9bfd547275944f8ebb57b44af29f3a42 | [log] [tgz] |
---|---|---|
author | Francois-Rene Rideau <tunes@google.com> | Thu Feb 19 18:36:17 2015 +0000 |
committer | Han-Wen Nienhuys <hanwen@google.com> | Thu Feb 19 18:36:17 2015 +0000 |
tree | 6bf8f27401774214d00884df3a4a7e497f6cd58e | |
parent | 3671ff634e85e5c3307f37e7c86d88bdf7bf911b [diff] |
Introduce first class function signatures; make the parser use them. This is the first meaty cl in a series to refactor the Skylark function call protocol. 1- We introduce a first-class notion of FunctionSignature, that supports positional and named-only arguments, mandatory and optional, default values, type-checking, *stararg and **kwarg; 2- To keep things clean, we distinguish two different kinds of Argument's: Argument.Passed that appears in function calls, and Parameter, that appears in function definitions. 3- We refactor the Parser so it uses this infrastructure, and make minimal changes to MixedModeFunction so that it works with it (but don't actually implement *starparam and **kwparam yet). 4- As we modify FuncallExpression, we ensure that the args and kwargs arguments it passes to the underlying function are immutable, as a prerequisite to upcoming implementation of *starparam and **kwparam as being provided directly from a skylark list or dict. Further changes under review will take advantage of this FunctionSignature to redo all our function call protocol, to be used uniformly for both UserDefinedFunction's and builtin function. The result will be a simpler inheritance model, with better type-checking, builtin functions that are both simpler and better documented, and many redundant competing functionality-limited codepaths being merged and replaced by something better. NB: The changes to MixedModeFunction, SkylarkFunction and MethodLibrary are temporary hacks to be done away with in an upcoming CL. The rest is the actual changes. -- MOS_MIGRATED_REVID=86704072
Bazel is very much a work in progress. We'd love if you tried it out, but there are many rough edges. Please feel free to give us feedback!
{Fast, Correct} - Choose two
Bazel is an build tool that builds code quickly and reliably. It executes as few build steps as possible by tracking dependencies and outputs, controls the build environment to keep builds hermetic, and uses its knowledge of dependencies to parallelize builds.
This README file contains instructions for building and running Bazel.
Supported platforms:
Java:
Clone the Bazel repo from GitHub:
$ cd $HOME $ git clone https://github.com/google/bazel/
To build Bazel on Ubuntu:
Install required package:
$ sudo apt-get install libarchive-dev
Build Bazel:
$ cd bazel $ ./compile.sh
Using Bazel on Mac OS X requires:
To build Bazel on Mac OS X:
Install required packages:
$ port install protobuf-cpp libarchive
or
$ brew install protobuf libarchive
Build Bazel:
$ cd bazel $ ./compile.sh
The Bazel executable is located at <bazel_home>/output/bazel
.
You must run Bazel from within a workspace directory. Bazel provides a default workspace directory with sample BUILD
files and source code in <bazel_home>/base_workspace
. The default workspace contains files and directories that must be present in order for Bazel to work. If you want to build from source outside the default workspace directory, copy the entire base_workspace
directory to the new location before adding your BUILD
and source files.
Build a sample Java application:
$ cp -R $HOME/bazel/base_workspace $HOME/my_workspace $ cd $HOME/my_workspace $ $HOME/bazel/output/bazel build //examples/java:hello-world
Note: on OS X, you must specify --cpu=darwin to build Java programs (e.g., bazel build --cpu=darwin //examples/java:hello-world).
The build output is located in $HOME/my_workspace/bazel-bin/examples/java/
.
Run the sample application:
$ $HOME/my_workspace/bazel-bin/examples/java/hello-world