blob: b8d6fd35db5e9778dee973631a06b473f243b899 [file] [log] [blame]
{namespace buck.install}
/***/
{template .soyweb}
{call buck.page}
{param title: 'Downloading and Installing Buck' /}
{param prettify: true /}
{param content}
{call buck.platformWarning /}
Buck requires that the following tools are already installed:
<ul>
<li>Oracle JDK 7
<li>Ant
<li>Python 2.7
<li>Git
<li>Android SDK
</ul>
Once you have the above tools installed, you can install Buck as follows:
{call buck.installationInstructions /}
If everything worked correctly, you should see something like:
{literal}<pre>
buck build tool
usage:
buck [options]
buck command --help
buck command [command-options]
available commands:
audit lists the inputs for the specified target
build builds the specified target
clean deletes any generated files
install builds and installs an APK
project generates project configuration files for an IDE
targets prints the list of buildable targets
test builds and runs the tests for the specified target
uninstall uninstalls an APK
options:
--help : Shows this screen and exits.
--version (-V) : Show version number.
{/literal}</pre>
Because you will likely be running <code>./bin/buck</code> often, you should
add it to your <code>$PATH</code> so that you can simply
run <code>buck</code> from the command line. One of the easiest ways to do this
is to create a symlink to Buck from a directory that is likely already on
your <code>$PATH</code>, such as <code>/usr/bin/</code>:
<pre>sudo ln -s ${lb}PWD{rb}/bin/buck /usr/bin/buck</pre>
To verify that this worked, run <code>which buck</code> to confirm
that it maps to <code>/usr/bin/buck</code>.
<h2 id="locate-android-sdk">Tell Buck where to find your Android SDK and NDK</h2>
Assuming you are using Buck to build Android code, you need to tell Buck where to find your Android
SDK (and Android NDK, if you are building native code). You have two options:
<h3>Create a local.properties File</h3>
The preferred option is to create a <code>local.properties</code> file in the root of your project.
It should define <code>sdk.dir</code> to identify the path to your Android SDK
and <code>ndk.dir</code> to identify the path to your Android NDK.
Be sure to specify an absolute path.
// This is not actually Python code, but lang-py results in the desired effect.
<pre class="prettyprint lang-py">
sdk.dir=/home/username/android-sdk-linux<br>
{\n}
# This is necessary only if you are building native code<br>
# using build rules such as ndk_library().<br>
ndk.dir=/home/username/android-ndk-r8b
</pre>
<h3>Define environment variables</h3>
If Buck cannot find the necessary paths in a <code>local.properties</code> file, then it will fall
back on environment variables. The location of the Android SDK can be specified by either an
{sp}<code>ANDROID_SDK</code> or <code>ANDROID_HOME</code> environment variable. (If both are
specified, then <code>ANDROID_SDK</code> takes precedence.)
The location of the Android NDK can be specified by an <code>ANDROID_NDK</code> environment
variable.
<pre>
export ANDROID_SDK=/home/username/android-sdk-linux<br>
export ANDROID_HOME=/home/username/android-sdk-linux<br>
export ANDROID_NDK=/home/username/android-ndk-r8b
</pre>
If you choose to go this route, you likely want to add these definitions to your
{sp}<code>~/.bash_profile</code> on OS X or <code>~/.bashrc</code> on Linux.
{/param}
{/call}
{/template}