From b462128f3d39d065e0871b98d076ab9fb186e724 Mon Sep 17 00:00:00 2001 From: kchodorow Date: Tue, 18 Apr 2017 21:21:51 +0200 Subject: [PATCH] Add warning to git_repository #2147 PiperOrigin-RevId: 153494286 --- .../rules/workspace/GitRepositoryRule.java | 35 ++++++++++++++++++ .../rules/workspace/NewGitRepositoryRule.java | 36 +++++++++++++++++++ 2 files changed, 71 insertions(+) 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 f1cc2bc58b1458..37aa7b9e4d8de6 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 @@ -74,6 +74,41 @@ public Metadata getMetadata() { /* +

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 = "",
+    urls = ["https://github.com///archive/.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.

+

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/NewGitRepositoryRule.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/workspace/NewGitRepositoryRule.java index 4cda4d71caad62..8659f5d5a90cd9 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 @@ -106,6 +106,42 @@ public Metadata getMetadata() { /* +

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

+

Clones a Git repository, checks out the specified tag, or commit, and makes its targets available for binding.