diff options
author | 2018-07-19 01:46:54 -0700 | |
---|---|---|
committer | 2018-07-19 01:48:29 -0700 | |
commit | 22aa4e55e309941e179efd6de3c5940c555222a5 (patch) | |
tree | 5af17d68dcaf3ffe1a1093ec9d0927858cd5498c /src/main/java/com | |
parent | 6c399d642d3451d6cd22009118f64f50ccaefd6a (diff) |
Add deprecation note to native http/git rules
...mentioning that a drop-in replacement can be loaded from @bazel_tools.
Change-Id: I0197d65359664e6fed84dc1fe5d5b6ddad48520e
PiperOrigin-RevId: 205204800
Diffstat (limited to 'src/main/java/com')
6 files changed, 22 insertions, 79 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/workspace/GitRepositoryRule.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/workspace/GitRepositoryRule.java index a2e1c146ee..0150596178 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/rules/workspace/GitRepositoryRule.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/workspace/GitRepositoryRule.java @@ -85,51 +85,9 @@ public class GitRepositoryRule implements RuleDefinition { /*<!-- #BLAZE_RULE (NAME = git_repository, TYPE = OTHER, FAMILY = Workspace)[GENERIC_RULE] --> -<strong><p>Warning: this rule has several limitations. We recommend using -<a href="#http_archive"><code>http_archive</code></a> instead for more robust and secure -performance.</p></strong> - -<p><code>git_repository</code> has several issues: - -<ul> -<li>Security - <code>http_archive</code> allows a sha256 to be specified, which ensures that the -downloaded code is exactly what was expected. -<li>Reliability - <code>http_archive</code> allows the user to specify multiple URLs to attempt -downloads from. Most services have downtime occasionally, so specifying multiple remotes decreases -the chances of being unable to download a dependency. -<li>Speed - <code>http_archive</code> multiplexes downloads to get the fastest possible rate. -You can also generally download a tarball that is a "shallow clone" of the repository, which -decreases the size of the download. -<li>Library issues - This implementation uses an old version of jGit and since this rule is -deprecated, we don't plan to upgrade it. -</ul> - -<p>Many git repository hosts serve tarballs of the repository, so depend on those if possible. -For GitHub, this takes the form: - -<pre> -http_archive( - name = "<name>", - strip_prefix = "<top-level-name>", - urls = ["https://github.com/<user>/<repo>/archive/<commit or tag>.tar.gz"], -) -</pre> - -The <code>top-level-name</code> is often needed because the contents of the archive are nested down -a directory when the tarball is extracted. For example the Apple Build Rules are referred to using: - -<pre> -http_archive( - name = "build_bazel_rules_apple", - strip_prefix = "rules_apple-0.4.0", - urls = ["https://github.com/bazelbuild/rules_apple/archive/0.4.0.tar.gz"], -) -</pre> - -If you are using a private repository, prefer the -<a href="https://github.com/bazelbuild/bazel/blob/master/tools/build_defs/repo/git.bzl">Skylark git -repository rules</a>, which will use your system's git install (instead of jGit). These rules -are built into Bazel and have the same API as the native rules.</p> +<p><strong>Deprecated. +<code>load("@bazel_tools//tools/build_defs/repo:http.bzl", "git_repository")</code> +for a drop-in replacement.</strong></p> <p>Clones a Git repository, checks out the specified tag, or commit, and makes its targets available for binding.</p> diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/workspace/HttpArchiveRule.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/workspace/HttpArchiveRule.java index b953d9fb23..3fc484a249 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/rules/workspace/HttpArchiveRule.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/workspace/HttpArchiveRule.java @@ -104,6 +104,10 @@ public class HttpArchiveRule implements RuleDefinition { /*<!-- #BLAZE_RULE (NAME = http_archive, TYPE = OTHER, FAMILY = Workspace)[GENERIC_RULE] --> +<p><strong>Deprecated. +<code>load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")</code> +for a drop-in replacement.</strong></p> + <p>Downloads a Bazel repository as a compressed archive file, decompresses it, and makes its targets available for binding. The repository should already contain a BUILD file. If it does not, use diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/workspace/HttpFileRule.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/workspace/HttpFileRule.java index 63a4db1478..104d5ef505 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/rules/workspace/HttpFileRule.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/workspace/HttpFileRule.java @@ -79,6 +79,10 @@ public class HttpFileRule implements RuleDefinition { } /*<!-- #BLAZE_RULE (NAME = http_file, TYPE = OTHER, FAMILY = Workspace)[GENERIC_RULE] --> +<p><strong>Deprecated. +<code>load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file")</code> +for a drop-in replacement.</strong></p> + <p>Downloads a file from a URL and makes it available to be used as a file group.</p> <h4 id="http_file_examples">Examples</h4> diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/workspace/HttpJarRule.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/workspace/HttpJarRule.java index b8dab31339..bc18509509 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/rules/workspace/HttpJarRule.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/workspace/HttpJarRule.java @@ -65,6 +65,10 @@ public class HttpJarRule implements RuleDefinition { } /*<!-- #BLAZE_RULE (NAME = http_jar, TYPE = OTHER, FAMILY = Workspace)[GENERIC_RULE] --> +<p><strong>Deprecated. +<code>load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_jar")</code> +for a drop-in replacement.</strong></p> + <p>Downloads a jar from a URL and makes it available to be used as a Java dependency.</p> <p>Downloaded files must have a .jar extension.</p> diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/workspace/NewGitRepositoryRule.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/workspace/NewGitRepositoryRule.java index 26eda95485..c910d2580a 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/rules/workspace/NewGitRepositoryRule.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/workspace/NewGitRepositoryRule.java @@ -117,40 +117,9 @@ public class NewGitRepositoryRule implements RuleDefinition { /*<!-- #BLAZE_RULE (NAME = new_git_repository, TYPE = OTHER, FAMILY = Workspace)[GENERIC_RULE] --> -<em><p>Warning: this rule has several limitations. We recommend using -<a href="#new_http_archive"><code>new_http_archive</code></a> instead for more robust and -secure performance.</p> - -<p><code>new_git_repository</code> has several issues: - -<ul> -<li>Security - <code>new_http_archive</code> allows a sha256 to be specified, which ensures that -the downloaded code is exactly what was expected. -<li>Reliability - <code>new_http_archive</code> allows the user to specify multiple URLs to attempt -downloads from. Most services have downtime occasionally, so specifying multiple remotes decreases -the chances of being unable to download a dependency. -<li>Speed - <code>new_http_archive</code> multiplexes downloads to get the fastest possible rate. -You can also generally download a tarball that is a "shallow clone" of the repository, which -decreases the size of the download. -<li>Library issues - This implementation uses an old version of jGit and since this rule is -deprecated, we don't plan to upgrade it. -</ul> - -<p>Many git repository hosts serve tarballs of the repository, so depend on those if possible. -For GitHub, this takes the form: - -<pre> -new_http_archive( - name = "<name>", - urls = ["https://github.com/<user>/<repo>/archive/<commit or tag>.tar.gz"], - build_file = "<build file>", -) -</pre> - -If you are using a private repository, prefer the -<a href="https://github.com/bazelbuild/bazel/blob/master/tools/build_defs/repo/git.bzl">Skylark git -repository rules</a>, which will use your system's git install (instead of jGit). These rules -are built into Bazel and have the same API as the native rules.</p></em> +<p><strong>Deprecated. +<code>load("@bazel_tools//tools/build_defs/repo:http.bzl", "new_git_repository")</code> +for a drop-in replacement.</strong></p> <p>Clones a Git repository, checks out the specified tag, or commit, and makes its targets available for binding.</p> diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/workspace/NewHttpArchiveRule.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/workspace/NewHttpArchiveRule.java index 10650169b5..cd5c0128f0 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/rules/workspace/NewHttpArchiveRule.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/workspace/NewHttpArchiveRule.java @@ -133,6 +133,10 @@ public class NewHttpArchiveRule implements RuleDefinition { /*<!-- #BLAZE_RULE (NAME = new_http_archive, TYPE = OTHER, FAMILY = Workspace)[GENERIC_RULE] --> +<p><strong>Deprecated. +<code>load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")</code> +for a drop-in replacement.</strong></p> + <p>Downloads a compressed archive file, decompresses it, and creates a Bazel repository by combining the archive with the provided BUILD file.</p> |