From 22aa4e55e309941e179efd6de3c5940c555222a5 Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Thu, 19 Jul 2018 01:46:54 -0700 Subject: 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 --- .../bazel/rules/workspace/GitRepositoryRule.java | 48 ++-------------------- .../lib/bazel/rules/workspace/HttpArchiveRule.java | 4 ++ .../lib/bazel/rules/workspace/HttpFileRule.java | 4 ++ .../lib/bazel/rules/workspace/HttpJarRule.java | 4 ++ .../rules/workspace/NewGitRepositoryRule.java | 37 ++--------------- .../bazel/rules/workspace/NewHttpArchiveRule.java | 4 ++ 6 files changed, 22 insertions(+), 79 deletions(-) (limited to 'src/main/java/com') 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 { /* -

Warning: this rule has several limitations. We recommend using -http_archive instead for more robust and secure -performance.

- -

git_repository has several issues: - -

- -

Many git repository hosts serve tarballs of the repository, so depend on those if possible. -For GitHub, this takes the form: - -

-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.

Examples

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 { } /* +

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: - -

- -

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 = "",
-    urls = ["https://github.com/<user>/<repo>/archive/<commit or tag>.tar.gz"],
-    build_file = "",
-)
-
- -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", "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