-
Notifications
You must be signed in to change notification settings - Fork 412
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added unmodified `cargo-bazel` source code * Applied `rules_rust` specific updates to `cargo-bazel` impl * Updated lockfiles * Replaced `crate_universe` examples with `crates_repository` examples * Applied `rules_rust` specific updates to `cargo-bazel` examples * Updated examples lockfiles * Updated `crate_universe` docs to represent `crates_repository` * Regenerate documentation
- Loading branch information
1 parent
acca6f4
commit 59fab4e
Showing
659 changed files
with
118,962 additions
and
7,668 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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,20 @@ | ||
load("//crate_universe:crates.bzl", "crate_deps_target") | ||
|
||
package(default_visibility = ["//visibility:public"]) | ||
|
||
crate_deps_target() | ||
|
||
filegroup( | ||
name = "distro", | ||
srcs = glob([ | ||
"*.bzl", | ||
"*.bazel", | ||
]) + [ | ||
"//crate_universe/3rdparty/crates:srcs", | ||
], | ||
) | ||
|
||
filegroup( | ||
name = "bzl_srcs", | ||
srcs = glob(["*.bzl"]), | ||
) |
This file contains 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,277 @@ | ||
# This BUILD file was written based off of the `build.rs` script for the Rust | ||
# crate `libgit2-sys`. For more details, see the crate's source: | ||
# https://github.com/rust-lang/git2-rs/tree/libgit2-sys-0.13.0/libgit2-sys | ||
|
||
load("@bazel_skylib//lib:selects.bzl", "selects") | ||
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag") | ||
load("@bazel_skylib//rules:write_file.bzl", "write_file") | ||
load("@rules_cc//cc:defs.bzl", "cc_library") | ||
|
||
[ | ||
config_setting( | ||
name = plat, | ||
constraint_values = ["@platforms//os:{}".format(plat)], | ||
) | ||
for plat in [ | ||
"macos", | ||
"ios", | ||
"tvos", | ||
"windows", | ||
] | ||
] | ||
|
||
# env::var("CARGO_FEATURE_SSH").is_ok() | ||
bool_flag( | ||
name = "ssh", | ||
build_setting_default = False, | ||
) | ||
|
||
config_setting( | ||
name = "ssh_setting", | ||
flag_values = {":ssh": "True"}, | ||
) | ||
|
||
# target.contains("apple") | ||
selects.config_setting_group( | ||
name = "apple", | ||
match_any = [ | ||
":macos", | ||
":ios", | ||
":tvos", | ||
], | ||
) | ||
|
||
[ | ||
config_setting( | ||
name = "cpu_" + cpu, | ||
constraint_values = ["@platforms//cpu:{}".format(cpu)], | ||
) | ||
for cpu in [ | ||
"i386", | ||
"x86_32", | ||
] | ||
] | ||
|
||
# env::var("CARGO_CFG_TARGET_POINTER_WIDTH").unwrap() == "32" | ||
selects.config_setting_group( | ||
name = "pointer_width_32", | ||
match_any = [ | ||
"cpu_i386", | ||
"cpu_x86_32", | ||
], | ||
) | ||
|
||
# env::var("CARGO_FEATURE_HTTPS").is_ok() | ||
bool_flag( | ||
name = "https", | ||
build_setting_default = False, | ||
) | ||
|
||
config_setting( | ||
name = "https_setting", | ||
flag_values = {":https": "True"}, | ||
) | ||
|
||
# if https && target.contains("windows") | ||
selects.config_setting_group( | ||
name = "https_windows", | ||
match_all = [ | ||
":https_setting", | ||
":windows", | ||
], | ||
) | ||
|
||
# if https && target.contains("apple") | ||
selects.config_setting_group( | ||
name = "https_apple", | ||
match_all = [ | ||
":https_setting", | ||
":apple", | ||
], | ||
) | ||
|
||
cc_library( | ||
name = "http-parser", | ||
srcs = glob(["deps/http-parser/*.c"]), | ||
hdrs = glob(["deps/http-parser/*.h"]), | ||
copts = select({ | ||
# Required in `opt` builds to solve the following error | ||
# libpcre.a(pcre_compile.o): requires unsupported dynamic reloc 11; recompile with -fPIC | ||
"@platforms//os:linux": ["-fPIC"], | ||
"//conditions:default": [], | ||
}), | ||
includes = ["deps/http-parser"], | ||
linkstatic = True, | ||
) | ||
|
||
cc_library( | ||
name = "pcre", | ||
srcs = glob(["deps/pcre/**/*.c"]), | ||
hdrs = glob(["deps/pcre/**/*.h"]), | ||
copts = select({ | ||
# Required in `opt` builds to solve the following error | ||
# libhttp-parser.a(http_parser.o): requires unsupported dynamic reloc 11; recompile with -fPIC | ||
"@platforms//os:linux": ["-fPIC"], | ||
"//conditions:default": [], | ||
}), | ||
defines = [ | ||
"HAVE_STDINT_H=1", | ||
"HAVE_MEMMOVE=1", | ||
"NO_RECURSE=1", | ||
"NEWLINE=10", | ||
"POSIX_MALLOC_THRESHOLD=10", | ||
"LINK_SIZE=2", | ||
"PARENS_NEST_LIMIT=250", | ||
"MATCH_LIMIT=10000000", | ||
"MATCH_LIMIT_RECURSION=MATCH_LIMIT", | ||
"MAX_NAME_SIZE=32", | ||
"MAX_NAME_COUNT=10000", | ||
], | ||
includes = ["deps/pcre"], | ||
linkstatic = True, | ||
) | ||
|
||
write_file( | ||
name = "configure_features", | ||
out = "include/git2/sys/features.h", | ||
content = [ | ||
"#ifndef INCLUDE_features_h", | ||
"#define INCLUDE_features_h", | ||
"#define GIT_THREADS 1", | ||
"#define GIT_TRACE 1", | ||
] + | ||
# !target.contains("android") | ||
select({ | ||
"@platforms//os:android": [], | ||
"//conditions:default": ["#define GIT_USE_NSEC 1"], | ||
}) + select({ | ||
":apple": ["#define GIT_USE_STAT_MTIMESPEC 1"], | ||
"//conditions:default": ["#define GIT_USE_STAT_MTIM 1"], | ||
}) + select({ | ||
":pointer_width_32": ["#define GIT_ARCH_32 1"], | ||
"//conditions:default": ["#define GIT_ARCH_64 1"], | ||
}) + [ | ||
"#define GIT_SHA1_COLLISIONDETECT 1", | ||
] + select({ | ||
":ssh_setting": ["#define GIT_SSH 1"], | ||
"//conditions:default": [], | ||
}) + select({ | ||
":https_apple": [ | ||
"#define GIT_HTTPS 1", | ||
"#define GIT_SECURE_TRANSPORT 1", | ||
], | ||
":https_setting": [ | ||
"#define GIT_HTTPS 1", | ||
"#define GIT_OPENSSL 1", | ||
], | ||
# target.contains("windows") | ||
":https_windows": [ | ||
"#define GIT_HTTPS 1", | ||
"#define GIT_WINHTTP 1", | ||
], | ||
"//conditions:default": [], | ||
}) + select({ | ||
":apple": ["#define GIT_USE_ICONV 1"], | ||
"//conditions:default": [], | ||
}) + [ | ||
"#endif", | ||
], | ||
) | ||
|
||
cc_library( | ||
name = "git2", | ||
srcs = glob( | ||
include = [ | ||
"src/*.c", | ||
"src/*.h", | ||
"src/xdiff/*.h", | ||
"src/xdiff/*.c", | ||
"src/transports/*.h", | ||
"src/transports/*.c", | ||
"src/streams/*.h", | ||
"src/streams/*.c", | ||
"src/hash/*.h", | ||
"src/hash/*.c", | ||
], | ||
exclude = [ | ||
"src/win32/**", | ||
"src/unix/**", | ||
], | ||
) + select({ | ||
"@platforms//os:windows": glob([ | ||
"src/win32/**/*.h", | ||
"src/win32/**/*.c", | ||
]), | ||
"//conditions:default": glob([ | ||
"src/unix/**/*.h", | ||
"src/unix/**/*.c", | ||
]), | ||
}) + [ | ||
"src/allocators/failalloc.c", | ||
"src/allocators/failalloc.h", | ||
"src/allocators/stdalloc.c", | ||
"src/allocators/stdalloc.h", | ||
"src/allocators/win32_leakcheck.c", | ||
"src/allocators/win32_leakcheck.h", | ||
# Use the CollisionDetection SHA1 implementation. | ||
"src/hash/sha1/collisiondetect.h", | ||
"src/hash/sha1/collisiondetect.c", | ||
"src/hash/sha1/sha1dc/sha1.h", | ||
"src/hash/sha1/sha1dc/sha1.c", | ||
"src/hash/sha1/sha1dc/ubc_check.h", | ||
"src/hash/sha1/sha1dc/ubc_check.c", | ||
], | ||
hdrs = glob(["include/**/*.h"]) + [ | ||
":configure_features", | ||
], | ||
copts = select({ | ||
"@platforms//os:linux": [ | ||
"-fvisibility=hidden", | ||
"-fPIC", | ||
"-Wall", | ||
"-std=gnu90", | ||
# On linux, optimization is required to avoid issues with missing (and unused) symbols: | ||
# `liblibgit2.a(pack.pic.o):pack.c:function packfile_open_locked: error: undefined reference to 'fstat'` | ||
# | ||
# Always enabling optimization helps us avoid this though, it does seem unnecessary and this should | ||
# probably be fixed. | ||
"-O3", | ||
], | ||
"@platforms//os:windows": [], | ||
"//conditions:default": [ | ||
"-fvisibility=hidden", | ||
"-fPIC", | ||
"-Wall", | ||
"-std=gnu90", | ||
], | ||
}), | ||
defines = [ | ||
# Use the CollisionDetection SHA1 implementation. | ||
"SHA1DC_NO_STANDARD_INCLUDES=1", | ||
"SHA1DC_CUSTOM_INCLUDE_SHA1_C=\\\"common.h\\\"", | ||
"SHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C=\\\"common.h\\\"", | ||
# Use the included PCRE regex backend. | ||
"GIT_REGEX_BUILTIN=1", | ||
] + select({ | ||
":windows": ["STRSAFE_NO_DEPRECATE"], | ||
"//conditions:default": [], | ||
}), | ||
includes = [ | ||
"include", | ||
"src", | ||
], | ||
linkstatic = True, | ||
strip_include_prefix = "include", | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
":http-parser", | ||
":pcre", | ||
"@zlib", | ||
], | ||
) | ||
|
||
alias( | ||
name = "libgit2", | ||
actual = ":git2", | ||
visibility = ["//visibility:public"], | ||
) |
Oops, something went wrong.