Use relative paths in links in docs.
This change fixes links among Bazel docs to use relative paths links instead of
absolute path (either full URL or absolute from site root). This way, versioned
documentation will link to other pages within the same versioned directory
rather than to the site root, which will point to the latest version of the
page from HEAD.
Future improvements may include adding a lint tool to check links in
documentation to ensure that the correct convention is followed such that all
links to pages within a version of the docs will point to pages within the same
version.
RELNOTES: None
PiperOrigin-RevId: 160117865
diff --git a/site/docs/tutorial/android-app.md b/site/docs/tutorial/android-app.md
index cdab41e..1c6c722 100644
--- a/site/docs/tutorial/android-app.md
+++ b/site/docs/tutorial/android-app.md
@@ -115,7 +115,7 @@
## Create a BUILD file
-A [`BUILD` file](/docs/build-ref.html#BUILD_files) is a text file that describes
+A [`BUILD` file](../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
@@ -123,7 +123,7 @@
`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
+structure in your workspace. Each [package](../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
@@ -145,13 +145,13 @@
### 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
+most important type is the [build rule](../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/be/android.html#android_library) rule to tell
+[`android_library`](../be/android.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
@@ -176,7 +176,7 @@
### Add an android_binary rule
-The [`android_binary`](/docs/be/android.html#android_binary) rule builds
+The [`android_binary`](../be/android.html#android_binary) rule builds
the Android application package (`.apk` file) for your app.
Add the following to your build file:
@@ -204,10 +204,10 @@
## Run the build
You use the
-[`bazel`](/docs/bazel-user-manual.html) command-line tool to run builds, execute
+[`bazel`](../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
+[installation](../install.md), you probably added this location to your
path.
Before you build the sample app, make sure that your current working directory
@@ -223,12 +223,12 @@
bazel build //android:android
```
-The [`build`](/docs/bazel-user-manual.html#build) subcommand instructs Bazel to
+The [`build`](../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
+line and the name of the target. See [Labels](../build-ref.html#labels) in
*Bazel Concepts and Terminology* page for more information about target labels
and paths.
@@ -271,7 +271,7 @@
You can now deploy the app to a connected Android device or emulator from the
command line using the
-[`bazel mobile-install`](http://bazel.build/docs/bazel-user-manual.html#mobile-install)
+[`bazel mobile-install`](../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
@@ -287,7 +287,7 @@
```
Note that the `mobile-install` subcommand also supports the
-[`--incremental`](http://bazel.build/docs/bazel-user-manual.html#mobile-install)
+[`--incremental`](../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.
diff --git a/site/docs/tutorial/backend-server.md b/site/docs/tutorial/backend-server.md
index 9ebbffa..cfcbc2a 100644
--- a/site/docs/tutorial/backend-server.md
+++ b/site/docs/tutorial/backend-server.md
@@ -19,7 +19,7 @@
* Deploy to Google App Engine
Bazel provides a set of [App Engine build rules](https://github.com/bazelbuild/rules_appengine)
-written using the [Skylark](/docs/skylark/index.html) framework. You'll use
+written using the [Skylark](../skylark/index.html) framework. You'll use
these in the steps below to build the application.
## Review the source files
@@ -50,7 +50,7 @@
## Update the WORKSPACE file
As with the Android app, you must add references to
-[external dependencies](http://bazel.build/docs/external.html) to your `WORKSPACE`
+[external dependencies](../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.
@@ -78,9 +78,9 @@
appengine_repositories()
```
-[`http_archive`](/docs/be/workspace.html#http_archive) downloads the
+[`http_archive`](../be/workspace.html#http_archive) downloads the
AppEngine rules from a GitHub archive. We could also have used
-[`git_repository`](/docs/be/workspace.html#git_repository) to fetch the rules
+[`git_repository`](../be/workspace.html#git_repository) to fetch the rules
directly from the Git repository.
The next two lines use the `appengine_repositories` function defined in
@@ -118,11 +118,11 @@
)
```
-The [`java_binary`](/docs/be/java.html#java_binary) tells Bazel
+The [`java_binary`](../be/java.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/be/java.html#java_library) because we need
+[`java_library`](../be/java.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.
@@ -147,7 +147,7 @@
)
```
-The [`appengine_war`](/docs/be/appengine.html#appengine_war)
+The [`appengine_war`](../be/appengine.html#appengine_war)
rule builds the final App Engine `war` file from the library `.jar` file and web
application metadata files in the `webapp` directory.
diff --git a/site/docs/tutorial/cpp-use-cases.md b/site/docs/tutorial/cpp-use-cases.md
index 1c3af2c..b005009 100644
--- a/site/docs/tutorial/cpp-use-cases.md
+++ b/site/docs/tutorial/cpp-use-cases.md
@@ -16,7 +16,7 @@
## Including multiple files in a target
You can include multiple files in a single target with
-[glob](https://bazel.build/versions/master/docs/be/functions.html#glob).
+[glob](../be/functions.html#glob).
For example:
```python
diff --git a/site/docs/tutorial/cpp.md b/site/docs/tutorial/cpp.md
index e0a5e70..95898e3 100644
--- a/site/docs/tutorial/cpp.md
+++ b/site/docs/tutorial/cpp.md
@@ -27,7 +27,7 @@
## Before you begin
-To prepare for the tutorial, first [Install Bazel](/docs/install.md) if
+To prepare for the tutorial, first [Install Bazel](../install.md) if
you don't have it installed already. Then, retrieve the sample project from
Bazel's GitHub repository:
@@ -369,15 +369,15 @@
Next, read up on the most common [C++ build use cases](cpp-use-cases.md). Then,
check out the following:
-* [External Dependencies](https://bazel.build/versions/master/docs/external.html)
- to learn more about working with local and remote repositories.
+* [External Dependencies](../external.html) to learn more about working with
+ local and remote repositories.
-* The [Build Encyclopedia](/docs/be/overview.html) to learn more about Bazel.
+* The [Build Encyclopedia](../be/overview.html) to learn more about Bazel.
-* The [Java build tutorial](/docs/tutorial/java.md) to get started with
+* The [Java build tutorial](java.md) to get started with
building Java applications with Bazel.
-* The [mobile application tutorial](/docs/tutorial/app.md) to get started with
+* The [mobile application tutorial](app.md) to get started with
building mobile applications for Android and iOS with Bazel.
Happy building!
diff --git a/site/docs/tutorial/environment.md b/site/docs/tutorial/environment.md
index 20a4870..c9f9043 100644
--- a/site/docs/tutorial/environment.md
+++ b/site/docs/tutorial/environment.md
@@ -16,7 +16,7 @@
## Install Bazel
-Follow the [installation instructions](/docs/install.md) to install Bazel and
+Follow the [installation instructions](../install.md) to install Bazel and
its dependencies.
## Install Android Studio
diff --git a/site/docs/tutorial/ios-app.md b/site/docs/tutorial/ios-app.md
index ce17c2b..ff6a5b1 100644
--- a/site/docs/tutorial/ios-app.md
+++ b/site/docs/tutorial/ios-app.md
@@ -65,7 +65,7 @@
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/be/objective-c.html#objc_library) rule to tell Bazel
+[`objc_library`](../be/objective-c.html#objc_library) rule to tell Bazel
how to build a static library from the app source code and Xib files. Then
you'll use the [`ios_application`](https://github.com/bazelbuild/rules_apple)
rule to tell it how to build the application binary and the `.ipa` bundle.
@@ -93,7 +93,7 @@
## Add an ios_application rule
-The [`ios_application`](/docs/be/objective-c.html#ios_application) rule builds
+The [`ios_application`](../be/objective-c.html#ios_application) rule builds
the application binary and creates the `.ipa` bundle file.
Add the following to your `BUILD` file:
diff --git a/site/docs/tutorial/java.md b/site/docs/tutorial/java.md
index 34cb7b5..6059ba1 100644
--- a/site/docs/tutorial/java.md
+++ b/site/docs/tutorial/java.md
@@ -25,7 +25,7 @@
## Before you begin
-To prepare for the tutorial, first [Install Bazel](/docs/install.md) if
+To prepare for the tutorial, first [Install Bazel](../install.md) if
you don't have it installed already. Then, retrieve the sample project from
Bazel's GitHub repository:
@@ -94,7 +94,7 @@
```
In our example, the `ProjectRunner` target instantiates Bazel's built-in
-[`java_binary` rule](/docs/be/java.html#java_binary). The rule tells Bazel to
+[`java_binary` rule](../be/java.html#java_binary). The rule tells Bazel to
build a `.jar` file and a wrapper shell script (both named after the target).
The attributes in the target explicitly state its dependencies and options.
@@ -102,7 +102,7 @@
`ProjectRunner` rule target, `name` is the name of the target, `srcs` specifies
the source files that Bazel uses to build the target, and `main_class` specifies
the class that contains the main method. (You may have noticed that our example
-uses [glob](/docs/be/functions.html#glob) to pass a set of source files to Bazel
+uses [glob](../be/functions.html#glob) to pass a set of source files to Bazel
instead of listing them one by one.)
### Build the project
@@ -338,7 +338,7 @@
of its runtime dependencies. This lets you run the binary outside of your
development environment.
-As you remember, the [java_binary](/docs/be/java.html#java_binary) build rule
+As you remember, the [java_binary](../be/java.html#java_binary) build rule
produces a `.jar` and a wrapper shell script. Take a look at the contents of
`runner.jar` using this command:
@@ -382,15 +382,15 @@
## Further reading
-* [External Dependencies](https://bazel.build/versions/master/docs/external.html)
- to learn more about working with local and remote repositories.
+* [External Dependencies](../external.html) to learn more about working with
+ local and remote repositories.
-* The [Build Encyclopedia](/docs/be/overview.html) to learn more about Bazel.
+* The [Build Encyclopedia](../be/overview.html) to learn more about Bazel.
-* The [C++ build tutorial](/docs/tutorial/cpp.md) to get started with building
+* The [C++ build tutorial](../tutorial/cpp.md) to get started with building
C++ projects with Bazel.
-* The [mobile application tutorial](/docs/tutorial/app.md) to get started with
+* The [mobile application tutorial](../tutorial/app.md) to get started with
building mobile applications for Android and iOS with Bazel.
Happy building!
diff --git a/site/docs/tutorial/workspace.md b/site/docs/tutorial/workspace.md
index eee1b1a..59115c7e 100644
--- a/site/docs/tutorial/workspace.md
+++ b/site/docs/tutorial/workspace.md
@@ -5,7 +5,7 @@
# Tutorial - Set Up a Workspace
-A [workspace](/docs/build-ref.html#workspaces) is a directory that contains the
+A [workspace](../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. The workspace may also contain symbolic links to output
@@ -32,7 +32,7 @@
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
+to [external dependencies](../external.html) required to build the
software.
For now, you'll create an empty `WORKSPACE` file, which simply serves to