From 22aa4e55e309941e179efd6de3c5940c555222a5 Mon Sep 17 00:00:00 2001
From: Klaus Aehlig Warning: this rule has several limitations. We recommend using
- Many git repository hosts serve tarballs of the repository, so depend on those if possible.
-For GitHub, this takes the form:
-
-http_archive
instead for more robust and secure
-performance.git_repository
has several issues:
-
-
-
-
-http_archive
allows a sha256 to be specified, which ensures that the
-downloaded code is exactly what was expected.
-http_archive
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.
-http_archive
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.
-
-http_archive(
- name = "<name>",
- strip_prefix = "<top-level-name>",
- urls = ["https://github.com/<user>/<repo>/archive/<commit or tag>.tar.gz"],
-)
-
-
-The top-level-name
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:
-
-
-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"],
-)
-
-
-If you are using a private repository, prefer the
-Skylark git
-repository rules, 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.
Deprecated.
+load("@bazel_tools//tools/build_defs/repo:http.bzl", "git_repository")
+for a drop-in replacement.
Clones a Git repository, checks out the specified tag, or commit, and makes its targets available for binding.
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 { /* +Deprecated.
+load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
+for a drop-in replacement.
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 { } /* +
Deprecated.
+load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file")
+for a drop-in replacement.
Downloads a file from a URL and makes it available to be used as a file group.
Deprecated.
+load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_jar")
+for a drop-in replacement.
Downloads a jar from a URL and makes it available to be used as a Java dependency.
Downloaded files must have a .jar extension.
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 { /* -Warning: this rule has several limitations. We recommend using
-new_http_archive
instead for more robust and
-secure performance.
new_git_repository
has several issues:
-
-
new_http_archive
allows a sha256 to be specified, which ensures that
-the downloaded code is exactly what was expected.
-new_http_archive
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.
-new_http_archive
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.
-Many git repository hosts serve tarballs of the repository, so depend on those if possible. -For GitHub, this takes the form: - -
-new_http_archive( - name = "- -If you are using a private repository, prefer the -Skylark git -repository rules, 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. +", - urls = ["https://github.com/<user>/<repo>/archive/<commit or tag>.tar.gz"], - build_file = " ", -) -
Deprecated.
+load("@bazel_tools//tools/build_defs/repo:http.bzl", "new_git_repository")
+for a drop-in replacement.
Clones a Git repository, checks out the specified tag, or commit, and makes its targets available for binding.
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 { /* +Deprecated.
+load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
+for a drop-in replacement.
Downloads a compressed archive file, decompresses it, and creates a Bazel repository by combining the archive with the provided BUILD file.
-- cgit v1.2.3