-
Notifications
You must be signed in to change notification settings - Fork 592
Adds libgit2 1.9.1 #6502
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
OlekRaymond
wants to merge
1
commit into
bazelbuild:main
Choose a base branch
from
OlekRaymond:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+260
−1
Open
Adds libgit2 1.9.1 #6502
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| module( | ||
| name = "libgit2", | ||
| version = "1.9.1", | ||
| bazel_compatibility = [">=7.2.1"], | ||
| compatibility_level = 1, | ||
| ) | ||
|
|
||
| bazel_dep(name = "bazel_skylib", version = "1.7.1") | ||
| bazel_dep(name = "platforms", version = "0.0.11") | ||
| bazel_dep(name = "rules_cc", version = "0.1.1") | ||
| bazel_dep(name = "zlib", version = "1.3") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| alias( | ||
| name = "libgit2", | ||
| actual = "//src/libgit2:git2", | ||
| visibility = ["//visibility:public"], | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| module( | ||
| name = "libgit2", | ||
| version = "1.9.1", | ||
| bazel_compatibility = [">=7.2.1"], | ||
| compatibility_level = 1, | ||
| ) | ||
|
|
||
| bazel_dep(name = "bazel_skylib", version = "1.7.1") | ||
| bazel_dep(name = "platforms", version = "0.0.11") | ||
| bazel_dep(name = "rules_cc", version = "0.1.1") | ||
| bazel_dep(name = "zlib", version = "1.3") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| load("@rules_cc//cc:cc_library.bzl", "cc_library") | ||
|
|
||
| cc_library( | ||
| name = "llhttp", | ||
| srcs = glob(["*.c"]), | ||
| hdrs = ["llhttp.h"], | ||
| strip_include_prefix = "/deps/llhttp", | ||
| visibility = ["//:__subpackages__"], | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| load("@bazel_skylib//rules:write_file.bzl", "write_file") | ||
| load("@rules_cc//cc:cc_library.bzl", "cc_library") | ||
|
|
||
| _CONFIG_H = """ | ||
| #define HAVE_MEMMOVE | ||
|
|
||
| #define NEWLINE 10 | ||
| #define POSIX_MALLOC_THRESHOLD 10 | ||
| #define LINK_SIZE 2 | ||
| #define PARENS_NEST_LIMIT 250 | ||
| #define MATCH_LIMIT 10000000 | ||
| #define MATCH_LIMIT_RECURSION MATCH_LIMIT | ||
|
|
||
| #define MAX_NAME_SIZE 32 | ||
| #define MAX_NAME_COUNT 10000 | ||
| """ | ||
|
|
||
| write_file( | ||
| name = "pcre_config_h", | ||
| out = "config.h", | ||
| content = [_CONFIG_H], | ||
| newline = "unix", | ||
| ) | ||
|
|
||
| cc_library( | ||
| name = "pcre_config", | ||
| hdrs = [":pcre_config_h"], | ||
| strip_include_prefix = "/deps/pcre", | ||
| ) | ||
|
|
||
| cc_library( | ||
| name = "pcre_hdrs", | ||
| hdrs = ["pcre.h"], | ||
| strip_include_prefix = "/deps/pcre", | ||
| visibility = ["//:__subpackages__"], | ||
| ) | ||
|
|
||
| cc_library( | ||
| name = "pcre", | ||
| srcs = glob(["*.c"]) + [ | ||
| "pcre_internal.h", | ||
| "pcreposix.h", | ||
| "ucp.h", | ||
| ], | ||
| implementation_deps = [":pcre_config"], | ||
| local_defines = ["HAVE_CONFIG_H"], | ||
| visibility = ["//:__subpackages__"], | ||
| deps = [":pcre_hdrs"], | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| load("@rules_cc//cc:cc_library.bzl", "cc_library") | ||
|
|
||
| cc_library( | ||
| name = "xdiff_hdrs", | ||
| hdrs = glob(["*.h"]), | ||
| strip_include_prefix = "/deps/xdiff", | ||
| visibility = ["//:__subpackages__"], | ||
| deps = ["//src/util:util_hdrs"], | ||
| ) | ||
|
|
||
| cc_library( | ||
| name = "xdiff", | ||
| srcs = glob(["*.c"]), | ||
| visibility = ["//:__subpackages__"], | ||
| deps = [":xdiff_hdrs"], | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| load("@rules_cc//cc:cc_library.bzl", "cc_library") | ||
|
|
||
| cc_library( | ||
| name = "git2", | ||
| hdrs = [ | ||
| "git2.h", | ||
| ] + glob([ | ||
| "git2/**/*.h", | ||
| ]), | ||
| strip_include_prefix = "/include", | ||
| visibility = ["//:__subpackages__"], | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| load("@rules_cc//cc:cc_library.bzl", "cc_library") | ||
|
|
||
| cc_library( | ||
| name = "libgit2_hdrs", | ||
| hdrs = glob(["**/*.h"]), | ||
| strip_include_prefix = "/src/libgit2", | ||
| deps = [ | ||
| "//deps/xdiff:xdiff_hdrs", | ||
| "//include:git2", | ||
| "//src/util:util_hdrs", | ||
| ], | ||
| ) | ||
|
|
||
| cc_library( | ||
| name = "git2", | ||
| srcs = glob([ | ||
| "**/*.c", | ||
| "**/*.h", | ||
| ]), | ||
| implementation_deps = [ | ||
| ":libgit2_hdrs", | ||
| "//deps/llhttp", | ||
| "//deps/xdiff", | ||
| "//src/util", | ||
| ], | ||
| conlyopts = select({ | ||
| "@platforms//os:windows": [], | ||
| "//conditions:default": [ | ||
| "-Wno-error", | ||
| ], | ||
| }), | ||
| visibility = ["//:__subpackages__"], | ||
| deps = ["//include:git2"], | ||
| ) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| load("@bazel_skylib//rules:write_file.bzl", "write_file") | ||
| load("@rules_cc//cc:cc_library.bzl", "cc_library") | ||
|
|
||
| _GIT2_FEATURES_H = """ | ||
| #define GIT_REGEX_BUILTIN | ||
| #define GIT_SHA1_COLLISIONDETECT | ||
| #define GIT_SHA256_BUILTIN | ||
| #define GIT_HTTPPARSER_BUILTIN | ||
| #define GIT_THREADS | ||
| """ | ||
|
|
||
| write_file( | ||
| name = "git2_features_h", | ||
| out = "git2_features.h", | ||
| content = [_GIT2_FEATURES_H] + | ||
| select({ | ||
| "@platforms//os:windows": ["#define GIT_IO_WSAPOLL 1"], | ||
| "//conditions:default": ["#define GIT_IO_POLL"], | ||
| }), | ||
| newline = "unix", | ||
| ) | ||
|
|
||
| cc_library( | ||
| name = "git2_features", | ||
| hdrs = [":git2_features_h"], | ||
| strip_include_prefix = "/src/util", | ||
| ) | ||
|
|
||
| cc_library( | ||
| name = "util_hdrs", | ||
| hdrs = glob(["**/*.h"]), | ||
| strip_include_prefix = "/src/util", | ||
| visibility = ["//:__subpackages__"], | ||
| deps = [ | ||
| ":git2_features", | ||
| "//deps/pcre:pcre_hdrs", | ||
| "//include:git2", | ||
| "@zlib", | ||
| ], | ||
| ) | ||
|
|
||
| GIT2_UTIL_WINDOWS_SRCS = glob([ | ||
| "win32/*", | ||
| ]) + ["hash/win32.c"] | ||
|
|
||
| GIT2_UTIL_UNIX_SRCS = glob(["unix/*"]) | ||
|
|
||
| GIT2_UTIL_SRCS = glob( | ||
| include = ["**/*.c"], | ||
| exclude = [ | ||
| "hash/common_crypto.c", | ||
| "hash/openssl.c", | ||
| ] + GIT2_UTIL_WINDOWS_SRCS + GIT2_UTIL_UNIX_SRCS, | ||
| ) | ||
|
|
||
| cc_library( | ||
| name = "util", | ||
| srcs = GIT2_UTIL_SRCS + select({ | ||
| "@platforms//os:windows": GIT2_UTIL_WINDOWS_SRCS, | ||
| "//conditions:default": GIT2_UTIL_UNIX_SRCS, | ||
| }), | ||
| implementation_deps = [ | ||
| "//deps/pcre", | ||
| "//deps/xdiff", | ||
| ], | ||
| linkopts = select({ | ||
| "@platforms//os:windows": [ | ||
| "secur32.lib", | ||
| "ws2_32.lib", | ||
| "advapi32.lib", | ||
| ], | ||
| "//conditions:default": [], | ||
| }), | ||
| visibility = ["//:__subpackages__"], | ||
| deps = [":util_hdrs"], | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| matrix: | ||
| platform: | ||
| - debian10 | ||
| - debian11 | ||
| - ubuntu2004 | ||
| - ubuntu2204 | ||
| - macos | ||
| - macos_arm64 | ||
| - windows | ||
| bazel: | ||
| - 7.x | ||
| - 8.x | ||
| tasks: | ||
| verify_targets: | ||
| name: Verify build targets | ||
| platform: ${{ platform }} | ||
| bazel: ${{ bazel }} | ||
| build_targets: | ||
| - '@libgit2//...' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| { | ||
| "url": "https://github.com/libgit2/libgit2/archive/refs/tags/v1.9.1.tar.gz", | ||
| "integrity": "sha256-FMqzAUsretdZcP9FSOg2FfdNcZr+AKpHm0qInB4T/AA=", | ||
| "strip_prefix": "libgit2-1.9.1", | ||
| "patch_strip": 0, | ||
| "overlay": { | ||
| "BUILD.bazel": "sha256-fdg9xWPYD2n+6KA/6CpD3jduFkZ7tl9rMeh83e+Q+Ak=", | ||
| "MODULE.bazel": "sha256-xKjJdIvY/DT5Zhaz+NPbHPeG4v0iX/VvdiuLRwuMhes=", | ||
| "deps/llhttp/BUILD.bazel": "sha256-XLmlczQX4YDVuIz+pon+dosGRRlO08VAL/Zm4dvmrM8=", | ||
| "deps/pcre/BUILD.bazel": "sha256-LE92UDy/qqpzR/AL3YAJ5vIghMm+h4Mhgw8t4ryqByA=", | ||
| "deps/xdiff/BUILD.bazel": "sha256-kWOJfhwdeEIbw3SQ1mt+DUvidUfhxVO6nREpiZ5LWHM=", | ||
| "include/BUILD.bazel": "sha256-Rpi8QCJUzSiLYz7GoIo4aY7fCpQgYJ5I8mdWZLiQV8Y=", | ||
| "src/libgit2/BUILD.bazel": "sha256-BpsrseiJWPYlaXStaOZE9ku3dF0/Vy6dcpWGGx5CZwI=", | ||
| "src/util/BUILD.bazel": "sha256-Z6xhcmlpSh9aJUBzEISmP42Om3UvvArpZbi2T1EGaMg=" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,7 +14,8 @@ | |
| "versions": [ | ||
| "1.8.1", | ||
| "1.8.1.bcr.1", | ||
| "1.9.0" | ||
| "1.9.0", | ||
| "1.9.1" | ||
| ], | ||
| "yanked_versions": {} | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's this for? Left-over build debugging...?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gcc and clang compile with warnings 1 2 and has some macros intended for user use which also produce warnings (see 1:
GIT_REPOSITORY_INIT_OPTIONS_INIT) so compiling with--copts = ["-Werror"]breaks the build.I based it on this precedence though happy to remove/change.
Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you revert this addition?
The
@platforms//os:*conditions are for changing flags according to the target OS. If you want to set flags for specific compilers, use@bazel_tools//tools/cpp:compilerinstead (see https://github.com/jmillikin/rules_bison/blob/v0.4/bison/rules/bison_repository.bzl#L56-L85 for an example).The example you copied from is probably assuming that Windows builds always use MSVC and that non-Windows always uses either GCC or Clang, which is true for BCR CI but not generally true for actual users. For example lots of folks use Clang on Windows.
Also, looking at the links you posted, the warnings in question do seem to be legitimate -- they're warning about stuff like uninitialized variables.
If you're building your own code with
-Werrorthat's fine, but I wouldn't recommend setting it with--coptsbecause that'll apply it to everycc_libraryin your dependency tree. Many open-source projects have a ... relaxed ... approach to fixing compiler warnings, and there's always the possibility that a newer compiler will emit warnings for older code.