Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add example workspace #3

Merged
merged 4 commits into from
Jun 23, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 11 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,30 @@ Building Bazel
We currently only support building on Ubuntu, and the binaries only run on
Ubuntu. You will need packages for the protobuf-compiler, and for libarchive:

apt-get install protobuf-compiler libarchive-dev
apt-get install protobuf-compiler libarchive-dev

Then run:
./compile.sh

./compile.sh

We are working on bootstrapping bazel with itself.

Running Bazel
=============

Create a google3 directory. This is your package root where all of your builds
will happen (we're working on removing the google3 naming requirement). Add the
following directory structure:

$ cd google3
$ mkdir -p tools/genrule my_output my_install
$ touch tools/genrule/genrule-setup.sh

Create tools/genrule/BUILD and add the following to it:
Bazel has some workspace setup requirements (which we're working on removing).
All builds need to happen from within a google3 directory (or subdirectory) and
have certain files exist in certain places. To get your workspace set up
correctly, copy example-workspace/google3 to wherever you want to do your
builds.

exports_files([
"genrule-setup.sh",
])

Create your own project with a BUILD file, for example:
Create your own project with a BUILD file within this google3 directory, for
example:

$ cd google3
$ mkdir -p hello
$ echo 'genrule(name = "world", outs = ["hi"], cmd = "touch $(@D)/hi")' > hello/BUILD


Now run Bazel using --output_base and --install_base options, e.g.,

$ bazel --output_base=my_output --install_base=my_install build //hello:world
Expand Down
3 changes: 3 additions & 0 deletions example-workspace/google3/tools/genrule/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
exports_files([
"genrule-setup.sh",
])
Empty file.