Bazel tutorial files initial commit.
--
MOS_MIGRATED_REVID=102049574
diff --git a/site/docs/tutorial/android-app.md b/site/docs/tutorial/android-app.md
new file mode 100644
index 0000000..252bf6d4
--- /dev/null
+++ b/site/docs/tutorial/android-app.md
@@ -0,0 +1,253 @@
+# Tutorial - Build an Android App
+
+The sample Android app in this tutorial is a very simple application that makes
+an HTTP connection to the [backend server](backend-server.md) and displays the
+resulting response.
+
+Here, you'll do the following:
+
+* Review the source files for the app
+* Update the `WORKSPACE` file
+* Create a `BUILD` file
+* Run the build
+* Find the build outputs
+* Run the app
+
+## Review the source files
+
+Let's take a look at the source files for the app. These are located in
+`$WORKSPACE/android/`.
+
+The key files and directories are:
+
+<table class="table table-condensed table-striped">
+<thead>
+<tr>
+<td>Name</td>
+<td>Location</td>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td>Manifest file</td>
+<td><code>src/main/java/com/google/bazel/example/android/AndroidManifest.xml</code></td>
+</tr>
+<tr>
+<td>Activity source file</td>
+<td><code>src/main/java/com/google/bazel/example/android/activities/MainActivity.java</code></td>
+</tr>
+<tr>
+<td>Resource file directory</td>
+<td><code>src/main/java/com/google/bazel/example/android/res/</code></td>
+</tr>
+</tbody>
+</table>
+
+Note that you're just looking at these files now to become familiar with the
+structure of the app. You don't have to edit any of the source files to complete
+this tutorial.
+
+## Update the WORKSPACE file
+
+Bazel needs to run the Android SDK
+[build tools](https://developer.android.com/tools/revisions/build-tools.html)
+and uses the SDK libraries to build the app. This means that you need to add
+some information to your `WORKSPACE` file so that Bazel knows where to find
+them. Note that this step is not required when you build all types of outputs.
+For example, Bazel automatically detects the location of Java, C++ and
+Objective-C compilers from settings in your environment.
+
+Add the following lines to your `WORKSPACE` file:
+
+```python
+android_sdk_repository(
+ name = "androidsdk",
+ # Replace with path to Android SDK on your system
+ path = "/Users/username/Library/Android/sdk",
+ # Replace with the Android SDK API level
+ api_level = 23,
+ # Replace with the verion in sdk/build-tools/
+ build_tools_version="23.0.0"
+)
+```
+
+## Create a BUILD file
+
+A [`BUILD` file](/docs/build-ref.html#BUILD_files) is a text file that describes
+the relationship between a set of build outputs -- for example, compiled
+software libraries or executables -- and their dependencies. These dependencies
+may be source files in your workspace or other build outputs. `BUILD` files are
+written in the Bazel *build language*.
+
+`BUILD` files are part of concept in Bazel known as the *package hierarchy*.
+The package hierarchy is a logical structure that overlays the directory
+structure in your workspace. Each [package](/docs/build-ref.html#packages) is a
+directory (and its subdirectories) that contains a related set of source files
+and a `BUILD` file. The package also includes any subdirectories, excluding
+those that contain their own `BUILD` file. The *package name* is the name of the
+directory where the `BUILD` file is located.
+
+Note that this package hierarchy is distinct from, but coexists with, the Java
+package hierarchy for your Android app.
+
+For the simple Android app in this tutorial, we'll consider all the source files
+in `$WORKSPACE/android/` to comprise a single Bazel package. A more complex
+project may have many nested packages.
+
+At a command-line prompt, open your new `BUILD` file for editing:
+
+```bash
+$ vi $WORKSPACE/android/BUILD
+```
+
+### Add an android_library rule
+
+A `BUILD` file contains several different types of instructions for Bazel. The
+most important type is the [build rule](/docs/build-ref.html#funcs), which tells
+Bazel how to build an intermediate or final software output from a set of source
+files or other dependencies.
+
+Bazel provides two build rules, `android_library` and `android_binary`, that you
+can use to build an Android app. For this tutorial, you'll first use the
+[`android_library`](/docs/build-encyclopedia.html#android_library) rule to tell
+Bazel how to build an
+[Android library module](http://developer.android.com/tools/projects/index.html#LibraryProjects)
+from the app source code and resource files. Then you'll use the
+`android_binary` rule to tell it how to build the Android application package.
+
+Add the following to your `BUILD` file:
+
+```python
+android_library(
+ name = "activities",
+ srcs = glob(["src/main/java/com/google/bazel/example/android/activities/*.java"]),
+ custom_package = "com.google.bazel.example.android.activities",
+ manifest = "src/main/java/com/google/bazel/example/android/activities/AndroidManifest.xml",
+ resource_files = glob(["src/main/java/com/google/bazel/example/android/activities/res/**"]),
+)
+```
+
+As you can see, the `android_library` build rule contains a set of attributes
+that specify the information that Bazel needs to build a library module from the
+source files. Note also that the name of the rule is `activities`. You'll
+reference the rule using this name as a dependency in the `android_binary` rule.
+
+### Add an android_binary rule
+
+The [`android_binary`](/docs/build-encyclopedia.html#android_binary) rule builds
+the Android application package (`.apk` file) for your app.
+
+Add the following to your build file:
+
+```python
+android_binary(
+ name = "android",
+ custom_package = "com.google.bazel.example.android",
+ manifest = "src/main/java/com/google/bazel/example/android/AndroidManifest.xml",
+ resource_files = glob(["src/main/java/com/google/bazel/example/android/res/**"]),
+ deps = [":activities"],
+)
+```
+
+Here, the `deps` attribute references the output of the `activities` rule you
+added to the `BUILD` file above. This means that, when Bazel builds the output
+of this rule, it checks first to see if the output of the `activities` library
+rule has been built and is up-to-date. If not, it builds it and then uses that
+output to build the application package file.
+
+Now, save and close the file. You can compare your `BUILD` file to the
+[completed example](https://github.com/bazelbuild/examples/blob/master/tutorial/android/BUILD)
+in the `master` branch of the GitHub repo.
+
+## Run the build
+
+You use the
+[`bazel`](/docs/bazel-user-manual.html) command-line tool to run builds, execute
+unit tests and perform other operations in Bazel. This tool is located in the
+`output` subdirectory of the location where you installed Bazel. During
+[installation](/docs/install.md), you probably added this location to your
+path.
+
+Before you build the sample app, make sure that your current working directory
+is inside your Bazel workspace:
+
+```bash
+$ cd $WORKSPACE
+```
+
+Now, enter the following to build the sample app:
+
+```bash
+$ bazel build //android:android
+```
+
+The [`build`](/docs/bazel-user-manual.html#build) subcommand instructs Bazel to
+build the target that follows. The target is specified as the name of a build
+rule inside a `BUILD` file, with along with the package path relative to
+your workspace directory. Note that you can sometimes omit the package path
+or target name, depending on your current working directory at the command
+line and the name of the target. See [Labels](/docs/build-ref.html#labels) in
+*Bazel Concepts and Terminology* page for more information about target labels
+and paths.
+
+Bazel now launches and builds the sample app. During the build process, its
+output will appear similar to the following:
+
+```bash
+INFO: Found 1 target...
+Target //android:android up-to-date:
+ bazel-bin/android/android_deploy.jar
+ bazel-bin/android/android_unsigned.apk
+ bazel-bin/android/android.apk
+INFO: Elapsed time: 7.237s, Critical Path: 5.81s
+```
+
+## Find the build outputs
+
+Bazel stores the outputs of both intermediate and final build operations in
+a set of per-user, per-workspace output directories. These directories are
+symlinked from the following locations:
+
+* `$WORKSPACE/bazel-bin`, which stores binary executables and other runnable
+ build outputs
+* `$WORKSPACE/bazel-genfiles`, which stores intermediary source files that are
+ generated by Bazel rules
+* `$WORKSPACE/bazel-out`, which stores other types of build outputs
+
+Bazel stores the Android `.apk` file generated using the `android_binary` rule
+in the `bazel-bin/android/` directory, where the subdirectory name `android` is
+derived from the name of the Bazel package.
+
+At a command prompt, list the contents of this directory and find the
+`android.apk` file:
+
+```bash
+$ ls $WORKSPACE/bazel-bin/android
+```
+
+## Run the app
+
+You can now deploy the app to a connected Android device or emulator from the
+command line using the
+[`bazel mobile-install`](http://bazel.io/docs/bazel-user-manual.html#mobile-install)
+command. This command uses the Android Debug Bridge (`adb`) to communicate with
+the device. You must set up your device to use `adb` following the instructions
+in
+[Android Debug Bridge](http://developer.android.com/tools/help/adb.html) before
+deployment.
+
+Enter the following:
+
+```bash
+$ bazel mobile-install //android:android
+```
+
+Note that the `mobile-install` subcommand also supports the
+[`--incremental`](http://bazel.io/docs/bazel-user-manual.html#mobile-install)
+flag that can be used to deploy only those parts of the app that have changed
+since the last deployment.
+
+## What's next
+
+Now that you've built a sample app for Android, it's time to do the same for
+the [iOS app](ios-app.md).
diff --git a/site/docs/tutorial/backend-server.md b/site/docs/tutorial/backend-server.md
new file mode 100644
index 0000000..27d9158
--- /dev/null
+++ b/site/docs/tutorial/backend-server.md
@@ -0,0 +1,317 @@
+# Tutorial - Build the Backend Server
+
+The backend server is a simple web application that runs on Google App Engine
+and responds to incoming HTTP requests from the sample Android and iOS apps.
+
+Here, you'll do the following:
+
+* Review the source files for the app
+* Update the `WORKSPACE` file
+* Create the `appengine.BUILD` file
+* Create a `BUILD` file
+* Run the build
+* Find the build outputs
+* Deploy to a local development server
+* Deploy to Google App Engine
+
+Bazel provides a set of
+[App Engine build rules](https://github.com/bazelbuild/bazel/blob/master/tools/build_rules/appengine/README.md)
+written using the [Skylark](/docs/skylark/index.html) framework. You'll use
+these in the steps below to build the application.
+
+## Review the source files
+
+The source files for the backend server are located in `$WORKSPACE/backend/`.
+
+The key files and directories are:
+
+<table class="table table-condensed table-striped">
+<thead>
+<tr>
+<td>Name</td>
+<td>Location</td>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td>Source file directory</td>
+<td><code>src/main/java/com/google/bazel/example/app/</code></td>
+</tr>
+<tr>
+<td>Web application metadata directory</td>
+<td><code>webapp/WEB-INF/</code></td>
+</tr>
+</tbody>
+</table>
+
+## Update the WORKSPACE file
+
+As with the Android app, you must add references to
+[external dependencies](http://bazel.io/docs/external.html) to your `WORKSPACE`
+file. For the backend server, these are references to the App Engine SDK,
+the Java Servlet SDK and other libraries needed to build the App Engine
+applications.
+
+### Add a new\_http\_archive rule
+
+When you built the Android app, you added a reference to the location on your
+filesystem where you downloaded and installed the Android SDK. For the
+backend server, however, you'll give Bazel instructions for downloading the
+required App Engine SDK package from a remote server. This is optional. You
+can also download and install the SDK manually on your filesystem and reference
+it from that location as described in the
+[App Engine rule documentation](https://github.com/google/bazel/blob/master/tools/build_rules/appengine/README.md).
+
+Add the following to your `WORKSPACE` file:
+
+```python
+new_http_archive(
+ name = "appengine-java",
+ url = "http://central.maven.org/maven2/com/google/appengine/appengine-java-sdk/1.9.23/appengine-java-sdk-1.9.23.zip",
+ sha256 = "05e667036e9ef4f999b829fc08f8e5395b33a5a3c30afa9919213088db2b2e89",
+ build_file = "appengine.BUILD",
+)
+```
+
+The [`new_http_archive`](/docs/build-encyclopedia.html#new_http_archive) rule
+instructs Bazel to download a remote archive file, uncompress it and add it to
+the virtual `external` package by combining the archive contents with
+the referenced `BUILD` file, here `appengine.BUILD`. You'll create this file
+below after you finish updating your `WORKSPACE` file.
+
+### Add bind rules
+
+You also need to add some [`bind`](docs/build-encyclopedia.html#bind) rules
+to the file. These provide aliases to targets in the virtual `external` package
+so they can be located either either inside or outside the workspace without
+changing the App Engine build rules.
+
+Add the following to the `WORKSPACE` file:
+
+```python
+bind(
+ name = "appengine/java/sdk",
+ actual = "@appengine-java//:sdk",
+)
+
+bind(
+ name = "appengine/java/api",
+ actual = "@appengine-java//:api",
+)
+
+bind(
+ name = "appengine/java/jars",
+ actual = "@appengine-java//:jars",
+)
+```
+
+### Add maven_jar rules
+
+Finally, you need to add some
+[`maven_jar`](/docs/build-encyclopedia.html#maven_jar) rules to the file. These
+tell Bazel to download `.jar` files from the Maven repository and allow Bazel
+to use them as Java dependencies.
+
+Add the following to the `WORKSPACE` file:
+
+```python
+maven_jar(
+ name = "commons-lang",
+ artifact = "commons-lang:commons-lang:2.6",
+)
+
+maven_jar(
+ name = "javax-servlet-api",
+ artifact = "javax.servlet:servlet-api:2.5",
+)
+
+bind(
+ name = "javax/servlet/api",
+ actual = "//tools/build_rules/appengine:javax.servlet.api",
+)
+```
+
+Now, save and close the file. You can compare your `WORKSPACE` file to the
+[completed example](https://github.com/bazelbuild/examples//blob/master/tutorial/WORKSPACE)
+in the `master` branch of the GitHub repo.
+
+## Create the appengine.BUILD file
+
+When you added the `new_http_archive` to your `WORKSPACE` above, you specified
+the filename `appengine.BUILD` in the `build_file` attribute. The
+`appengine.BUILD` file is a special build file that allows Bazel to use the
+downloaded App Engine SDK libraries as a Bazel package. Here, you'll create
+this file in your top-level workspace directory.
+
+Open your new `appengine.BUILD` file for editing:
+
+```bash
+$ vi $WORKSPACE/appengine.BUILD
+```
+
+Add the following to the file:
+
+```python
+java_import(
+ name = "jars",
+ jars = glob(["**/*.jar"]),
+ visibility = ["//visibility:public"],
+)
+
+java_import(
+ name = "api",
+ jars = ["appengine-java-sdk-1.9.23/lib/impl/appengine-api.jar"],
+ visibility = ["//visibility:public"],
+ neverlink = 1,
+)
+
+filegroup(
+ name = "sdk",
+ srcs = glob(["appengine-java-sdk-1.9.23/**"]),
+ visibility = ["//visibility:public"],
+ path = "appengine-java-sdk-1.9.23",
+)
+```
+
+The [`java_import`](/docs/build-encyclopedia.html#java_import) rules tell
+Bazel how to use the precompiled SDK `.jar` files as libraries. These rules
+define the targets that you referenced in the `bind` rules in the `WORKSPACE`
+file above.
+
+Save and close the file. The
+[completed example](https://github.com/bazelbuild/examples//blob/master/tutorial/appengine.BUILD)
+is in the `master` branch of the GitHub repo.
+
+## Create a BUILD file
+
+Now that you have set up the external dependencies, you can go ahead and create
+the `BUILD` file for the backend server, as you did previously for the sample
+Android and iOS apps.
+
+Open your new `BUILD` file for editing:
+
+```bash
+$ vi $WORKSPACE/backend/BUILD
+```
+
+### Add a java_binary rule
+
+Add the following to your `BUILD` file:
+
+```python
+java_binary(
+ name = "app",
+ srcs = glob(["src/main/java/**/*.java"]),
+ main_class = "does.not.exist",
+ deps = [
+ "//external:javax/servlet/api",
+ ],
+)
+```
+
+The [`java_binary`](/docs/build-encyclopedia.html#java_binary) tells Bazel
+how to build a Java `.jar` library for your application, plus a wrapper shell
+script that launches the application code from the specified main class. Here,
+we're using this rule instead of the
+[`java_library`](/docs/build-encyclopedia.html#java_library) because we need
+the `.jar` file to contain all the dependencies required to build the final
+App Engine `.war` file. For this reason, we specify a bogus class name
+for the `main_class` attribute.
+
+### Add an appengine_war rule
+
+Add the following to your `BUILD` file:
+
+```python
+appengine_war(
+ name = "backend",
+ data = [":webapp"],
+ data_path = "/backend/webapp",
+ jars = [":app_deploy.jar"],
+)
+
+filegroup(
+ name = "webapp",
+ srcs = glob(["webapp/**/*"]),
+)
+```
+
+The [`appengine_war`](https://github.com/google/bazel/blob/master/tools/build_rules/appengine/README.md)
+rule builds the final App Engine `war` file from the library `.jar` file and web
+application metadata files in the `webapp` directory.
+
+Save and close the file. Again, the
+[completed example](https://github.com/google/bazel-examples/blob/master/tutorial/backend/BUILD)
+is in the `master` branch of the GitHub repo.
+
+## Run the build
+
+Make sure that your current working directory is inside your Bazel workspace:
+
+```bash
+$ cd $WORKSPACE
+```
+
+Now, enter the following to build the sample app:
+
+```bash
+$ bazel build //backend:backend
+```
+
+Bazel now launches and builds the sample app. During the build process, its
+output will appear similar to the following:
+
+```bash
+INFO: Found 1 target...
+Target //backend:backend up-to-date:
+ bazel-bin/backend/backend.war
+ bazel-bin/backend/backend.deploy
+ bazel-bin/backend/backend
+INFO: Elapsed time: 56.867s, Critical Path: 2.72s
+```
+
+## Find the build outputs
+
+The `.war` file and other outputs are located in the
+`$WORKSPACE/bazel-bin/backend` directory.
+
+## Deploy to a local development server
+
+The `appengine_war` rule generates an upload script that you can use to deploy
+your backend server on Google App Engine. Here, you'll start a local App Engine
+development server in your environment and deploy your application there.
+
+To deploy the application, enter the following:
+
+```bash
+$ bazel-bin/backend/backend --port=12345
+```
+
+Your application URL will be `http://localhost:12345`
+
+## Deploy to Google App Engine
+
+You can also deploy the application to the live App Engine serving
+environment on Google Cloud Platform. For this scenario, you must first create
+a project in the
+[Google Developers Console](https://console.developers.google.com).
+
+To deploy the application, enter the following:
+
+```bash
+$ $WORKSPACE/bazel-bin/backend/backend.deploy <project-id>
+```
+
+The deployment script prompts you to authorize access to Google Cloud Platform.
+After you have authorized access the first time, you can deploy the application
+using the `bazel` command and the following rule target:
+
+```bash
+$ bazel run //backend:backend.deploy <project-id>
+```
+
+Your application URL will be `http://<project-id>.appspot.com`.
+
+## What's next
+
+Now let's [review](review.md) the tutorial steps.
diff --git a/site/docs/tutorial/environment.md b/site/docs/tutorial/environment.md
new file mode 100644
index 0000000..5cd9972
--- /dev/null
+++ b/site/docs/tutorial/environment.md
@@ -0,0 +1,86 @@
+# Tutorial - Set Up Your Environment
+
+The first step in this tutorial is to set up your environment.
+
+Here, you'll do the following:
+
+* Install Bazel
+* Install Android Studio and the Android SDK
+* Install Xcode (OS X only)
+* Get the sample project from the GitHub repo
+
+## Install Bazel
+
+Follow the [installation instructions](/docs/install.md) to install Bazel and
+its dependencies.
+
+## Install the Android SDK tools
+
+Do the following:
+
+1. Download and install the
+ [Android SDK Tools](https://developer.android.com/sdk/index.html#Other).
+
+2. Run the Android SDK Manager and install the following packages:
+
+ <table class="table table-condensed table-striped">
+ <thead>
+ <tr>
+ <td>Package</td>
+ <td>SDK directory</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>Android SDK Platform Tools</td>
+ <td><code>platform-tools</code></td>
+ </tr>
+ <tr>
+ <td>Android SDK Build Tools</td>
+ <td><code>build-tools</code></td>
+ </tr>
+ <tr>
+ <td>Android SDK Platform</td>
+ <td><code>platform</code></td>
+ </tr>
+ </tbody>
+ </table>
+
+ The SDK Manager is an executable named `android` located in the `tools`
+ directory.
+
+## Install Xcode (OS X only)
+
+If you are following the steps in this tutorial on Mac OS X, download and
+install [Xcode](https://developer.apple.com/xcode/downloads/). The Xcode
+download contains the iOS libraries, Objective-C compiler other tools
+required by Bazel to build the iOS app.
+
+## Get the sample project
+
+You also need to get the sample project for the tutorial from GitHub:
+
+[https://github.com/bazelbuild/examples/](https://github.com/bazelbuild/examples/)
+
+The GitHub repo has two branches: `source-only` and `master`. The `source-only`
+branch contains the source files for the project only. You'll use the files in
+this branch in this tutorial. The `master` branch contains both the source files
+and completed Bazel `WORKSPACE` and `BUILD` files. You can use the files in this
+branch to check your work when you've completed the tutorial steps.
+
+Enter the following at the command line to get the files in the `source-only`
+branch:
+
+```bash
+$ cd $HOME
+$ git clone -b source-only https://github.com/bazelbuild/examples
+```
+
+The `git clone` command creates a directory named `$HOME/examples/`. This
+directory contains several sample projects for Bazel. The project files for this
+tutorial are in `$HOME/examples/tutorial`.
+
+## What's next
+
+Now that you have set up your environment, you can
+[set up a Bazel workspace](workspace.md).
diff --git a/site/docs/tutorial/index.md b/site/docs/tutorial/index.md
new file mode 100644
index 0000000..6d15484
--- /dev/null
+++ b/site/docs/tutorial/index.md
@@ -0,0 +1,40 @@
+# Tutorial - Introduction
+
+You can use Bazel to build a variety of software outputs, including
+Linux and Mac OS X applications written in Java, C++ and Objective-C. You can
+also use Bazel to build software for other platforms or written in other
+languages.
+
+This tutorial shows how to use Bazel to build the following:
+
+* An Android app
+* An iOS app
+* A mobile backend server running on App Engine
+
+In this tutorial, you'll learn how to:
+
+* Set up a Bazel workspace and create a `WORKSPACE` file
+* Create `BUILD` files that contain the instructions used by Bazel to build
+ the software
+* Run builds using the Bazel command line tool
+
+## Requirements
+
+You can follow the steps in this tutorial on either a Linux or Mac OS X system.
+However, you can only build the iOS app if you are running Bazel on OS X. If
+you are using Linux, you can skip the iOS instructions and still complete
+the rest of the tutorial steps.
+
+## Sample project
+
+You don't have to write your own mobile apps and backend server to use this
+tutorial. Instead, you'll use a sample project hosted on GitHub. The sample
+project is hosted at the following location:
+
+[https://github.com/bazelbuild/examples/](https://github.com/bazelbuild/examples/)
+
+You'll grab the sample project files in the next step in this tutorial.
+
+## What's next
+
+Let's start off by [setting up](environment.md) the tutorial environment.
diff --git a/site/docs/tutorial/ios-app.md b/site/docs/tutorial/ios-app.md
new file mode 100644
index 0000000..a128457
--- /dev/null
+++ b/site/docs/tutorial/ios-app.md
@@ -0,0 +1,139 @@
+# Tutorial - Build an iOS App
+
+Like the [Android app](android-app.md) you built in the previous step, the iOS
+app is a simple mobile app that communicates with the
+[backend server](backend-server.md).
+
+Here, you'll do the following:
+
+* Review the source files for the app
+* Create a `BUILD` file
+* Run the build
+* Find the build outputs
+* Run the app
+
+Note that, unlike with the Android app, you don't have to modify your
+`WORKSPACE` file to add iOS-specific external dependencies.
+
+If you're following the steps in this tutorial on Mac OS X, you can go ahead
+and build the sample iOS app as described below. If you are on Linux, skip ahead
+to the [next step](backend-server.md).
+
+## Review the source files
+
+Let's take a look at the source files for the app. These are located in
+`$WORKSPACE/ios-app/UrlGet`. Again, you're just looking at these files now to
+become familiar with the structure of the app. You don't have to edit any of the
+source files to complete this tutorial.
+
+## Create a BUILD file
+
+At a command-line prompt, open your new `BUILD` file for editing:
+
+```bash
+$ vi $WORKSPACE/ios-app/BUILD
+```
+
+## Add an objc_library rule
+
+Bazel provides several build rules, that you can use to build an app for the
+iOS platform. For this tutorial, you'll first use the
+[`objc_library`](/docs/build-encyclopedia.html#objc_library) rule to tell Bazel
+how to build an
+[static library](https://developer.apple.com/library/ios/technotes/iOSStaticLibraries/Introduction.html)
+from the app source code and Xib files. Then you'll use the
+`objc_binary` rule to tell it how to bundle the iOS application. (Note that
+this is a minimal use case of the Objective-C rules in Bazel. For example, you
+have to use the `ios_application` rule to build multi-architecture iOS
+apps.)
+
+Add the following to your `BUILD` file:
+
+```python
+objc_library(
+ name = "UrlGetClasses",
+ srcs = [
+ "UrlGet/AppDelegate.m",
+ "UrlGet/UrlGetViewController.m",
+ ],
+ hdrs = glob(["UrlGet/*.h"]),
+ xibs = ["UrlGet/UrlGetViewController.xib"],
+)
+```
+
+Note the name of the rule, `UrlGetClasses`.
+
+## Add an objc_binary rule
+
+The [`objc_binary`](/docs/build-encyclopedia.html#objc_binary) rule creates the
+bundled `.ipa` archive file for the application and also generates an Xcode
+project file.
+
+Add the following to your `BUILD` file:
+
+```python
+objc_binary(
+ name = "ios-app",
+ srcs = [
+ "UrlGet/main.m",
+ ],
+ deps = [
+ ":UrlGetClasses",
+ ],
+ infoplist = "UrlGet/UrlGet-Info.plist",
+)
+```
+
+Now, save and close the file. You can compare your `BUILD` file to the
+[completed example](https://github.com/bazelbuild/examples/blob/master/tutorial/ios-app/BUILD)
+in the `master` branch of the GitHub repo.
+
+Again, note how the `deps` attribute references the output of the
+`UrlGetClasses` rule you added to the `BUILD` file above.
+
+## Run the build
+
+Make sure that your current working directory is inside your Bazel workspace:
+
+```bash
+$ cd $WORKSPACE
+```
+
+Now, enter the following to build the sample app:
+
+```bash
+$ bazel build //ios-app:ios-app
+```
+
+Bazel now launches and builds the sample app. During the build process, its
+output will appear similar to the following:
+
+```bash
+INFO: Found 1 target...
+Target //ios-app:ios-app up-to-date:
+ bazel-bin/ios-app/ios-app_bin
+ bazel-bin/ios-app/ios-app.ipa
+ bazel-bin/ios-app/ios-app.xcodeproj/project.pbxproj
+INFO: Elapsed time: 3.765s, Critical Path: 3.44s
+```
+
+## Find the build outputs
+
+The `.ipa` file and other outputs are located in the
+`$WORKSPACE/bazel-bin/ios-app` directory.
+
+## Run the app
+
+You can now run the app from Xcode using the iOS Simulator. To run the app,
+open the project directory `$WORKSPACE/bazel-bin/ios-app/ios-app.xcodeproj` in
+Xcode, choose an iOS Simulator as the runtime scheme and then click the **Run**
+button.
+
+**Note:** If you change anything about the project file set in Xcode (for
+example, if you add or remove a file, or add or change a dependency), you must
+rebuild the app using Bazel and then re-open the project.
+
+## What's next
+
+The next step is to build a [backend server](backend-server.md) for the two
+mobile apps you built in this tutorial.
diff --git a/site/docs/tutorial/review.md b/site/docs/tutorial/review.md
new file mode 100644
index 0000000..ed5f5ff
--- /dev/null
+++ b/site/docs/tutorial/review.md
@@ -0,0 +1,24 @@
+# Tutorial - Review
+
+In this tutorial, you used Bazel to build an [Android app](android-app.md),
+an [iOS app](ios-app.md) and a [backend server](backend-server.md) that runs on
+Google App Engine.
+
+To build these software outputs, you:
+
+* Set up a Bazel [workspace](workspace.md) that contained the source code
+ for the components and a `WORKSPACE` that identifies the top level of the
+ workspace directory
+* Created a `BUILD` file for each component
+* Updated the `WORKSPACE` file to contain references to the required
+ external dependencies
+* Ran Bazel to build the software components
+
+The built mobile apps and backend server application files are located in the
+`$WORKSPACE/bazel-bin` directory.
+
+Note that completed `WORKSPACE` and `BUILD` files for this tutorial are located
+in the
+[master branch](https://github.com/bazelbuild/examples/tree/master/tutorial)
+of the GitHub repo. You can compare your work to the completed files for
+additional help or troubleshooting.
diff --git a/site/docs/tutorial/workspace.md b/site/docs/tutorial/workspace.md
new file mode 100644
index 0000000..13e55ab
--- /dev/null
+++ b/site/docs/tutorial/workspace.md
@@ -0,0 +1,48 @@
+# Tutorial - Set Up a Workspace
+
+A [workspace](/docs/build-ref.html#workspaces) is a directory that contains the
+source files for one or more software projects, as well as a `WORKSPACE` file
+and `BUILD` files that contain the instructions that Bazel uses to build
+the software. It also contains symbolic links to output directories in the
+Bazel home directory.
+
+A workspace directory can be located anywhere on your filesystem. In this
+tutorial, your workspace directory is `$HOME/examples/tutorial/`, which
+contains the sample project files you cloned from the GitHub repo in the
+previous step.
+
+Note that Bazel itself doesn't make any requirements about how you organize
+source files in your workspace. The sample source files in this tutorial are
+organized according to common conventions for Android apps, iOS apps and App
+Engine applications.
+
+For your convenience, set the `$WORKSPACE` environment variable now to refer to
+your workspace directory. At the command line, enter:
+
+```bash
+$ export $WORKSPACE=$HOME/examples/tutorial
+```
+
+## Create a WORKSPACE file
+
+Every workspace must have a text file named `WORKSPACE` located in the top-level
+workspace directory. This file may be empty or it may contain references
+to [external dependencies](/docs/external.html) required to build the
+software.
+
+For now, you'll create an empty `WORKSPACE` file, which simply serves to
+identify the workspace directory. In later steps, you'll update the file to add
+external dependency information.
+
+Enter the following at the command line:
+
+```bash
+$ touch $WORKSPACE/WORKSPACE
+```
+
+This creates the empty `WORKSPACE` file.
+
+## What's next
+
+Now that you've set up your workspace, you can
+[build the Android app](android-app.md).