mirror of
https://github.com/nestriness/cdc-file-transfer.git
synced 2026-01-30 08:55:36 +02:00
Instead of calling netstat locally to find out available ports in a tight range, call bind() with port zero to find an available ephemeral port. This is faster and much simpler, and will eventually help getting rid of PortManager. Also fixes issues with running SSH commands on Windows when the remote shell is Powershell (aka Backslash Bingo).
218 lines
5.1 KiB
Python
218 lines
5.1 KiB
Python
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
|
|
|
|
package(default_visibility = [
|
|
"//:__subpackages__",
|
|
])
|
|
|
|
cc_binary(
|
|
name = "cdc_rsync",
|
|
srcs = ["main.cc"],
|
|
deps = [
|
|
":cdc_rsync_client",
|
|
":params",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "client_file_info",
|
|
hdrs = ["client_file_info.h"],
|
|
)
|
|
|
|
cc_library(
|
|
name = "file_finder_and_sender",
|
|
srcs = ["file_finder_and_sender.cc"],
|
|
hdrs = ["file_finder_and_sender.h"],
|
|
target_compatible_with = ["@platforms//os:windows"],
|
|
deps = [
|
|
":client_file_info",
|
|
"//cdc_rsync/base:message_pump",
|
|
"//cdc_rsync/protos:messages_cc_proto",
|
|
"//common:log",
|
|
"//common:path",
|
|
"//common:path_filter",
|
|
"//common:platform",
|
|
"//common:util",
|
|
],
|
|
)
|
|
|
|
cc_test(
|
|
name = "file_finder_and_sender_test",
|
|
srcs = ["file_finder_and_sender_test.cc"],
|
|
data = ["testdata/root.txt"] + glob(["testdata/file_finder_and_sender/**"]),
|
|
deps = [
|
|
":file_finder_and_sender",
|
|
"//cdc_rsync/protos:messages_cc_proto",
|
|
"//common:fake_socket",
|
|
"//common:status_test_macros",
|
|
"//common:test_main",
|
|
"@com_google_googletest//:gtest",
|
|
"@com_google_protobuf//:protobuf_lite",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "cdc_rsync_client",
|
|
srcs = ["cdc_rsync_client.cc"],
|
|
hdrs = ["cdc_rsync_client.h"],
|
|
target_compatible_with = ["@platforms//os:windows"],
|
|
deps = [
|
|
":file_finder_and_sender",
|
|
":parallel_file_opener",
|
|
":progress_tracker",
|
|
":server_arch",
|
|
":zstd_stream",
|
|
"//cdc_rsync/base:cdc_interface",
|
|
"//cdc_rsync/base:message_pump",
|
|
"//cdc_rsync/base:server_exit_code",
|
|
"//cdc_rsync/protos:messages_cc_proto",
|
|
"//common:client_socket",
|
|
"//common:gamelet_component",
|
|
"//common:log",
|
|
"//common:path",
|
|
"//common:path_filter",
|
|
"//common:platform",
|
|
"//common:process",
|
|
"//common:remote_util",
|
|
"//common:server_socket",
|
|
"//common:socket",
|
|
"//common:status",
|
|
"//common:status_macros",
|
|
"//common:threadpool",
|
|
"//common:util",
|
|
"@com_google_absl//absl/status",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "parallel_file_opener",
|
|
srcs = ["parallel_file_opener.cc"],
|
|
hdrs = ["parallel_file_opener.h"],
|
|
data = ["testdata/root.txt"] + glob(["testdata/parallel_file_opener/**"]),
|
|
deps = [
|
|
":client_file_info",
|
|
"//common:path",
|
|
"//common:platform",
|
|
"//common:threadpool",
|
|
],
|
|
)
|
|
|
|
cc_test(
|
|
name = "parallel_file_opener_test",
|
|
srcs = ["parallel_file_opener_test.cc"],
|
|
deps = [
|
|
":parallel_file_opener",
|
|
"//common:test_main",
|
|
"@com_google_googletest//:gtest",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "params",
|
|
srcs = ["params.cc"],
|
|
hdrs = ["params.h"],
|
|
deps = [
|
|
":cdc_rsync_client",
|
|
"//common:build_version",
|
|
"//common:port_range_parser",
|
|
"@com_github_zstd//:zstd",
|
|
"@com_google_absl//absl/status",
|
|
],
|
|
)
|
|
|
|
cc_test(
|
|
name = "params_test",
|
|
srcs = ["params_test.cc"],
|
|
data = ["testdata/root.txt"] + glob(["testdata/params/**"]),
|
|
deps = [
|
|
":params",
|
|
"//common:test_main",
|
|
"@com_google_googletest//:gtest",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "progress_tracker",
|
|
srcs = ["progress_tracker.cc"],
|
|
hdrs = ["progress_tracker.h"],
|
|
deps = [
|
|
":file_finder_and_sender",
|
|
"//cdc_rsync/base:cdc_interface",
|
|
"//common:stopwatch",
|
|
"@com_github_jsoncpp//:jsoncpp",
|
|
"@com_google_absl//absl/strings:str_format",
|
|
],
|
|
)
|
|
|
|
cc_test(
|
|
name = "progress_tracker_test",
|
|
srcs = ["progress_tracker_test.cc"],
|
|
deps = [
|
|
":progress_tracker",
|
|
"//cdc_rsync/protos:messages_cc_proto",
|
|
"//common:test_main",
|
|
"//common:testing_clock",
|
|
"@com_google_googletest//:gtest",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "server_arch",
|
|
srcs = ["server_arch.cc"],
|
|
hdrs = ["server_arch.h"],
|
|
deps = [
|
|
"//common:ansi_filter",
|
|
"//common:arch_type",
|
|
"//common:path",
|
|
"//common:remote_util",
|
|
"@com_google_absl//absl/strings",
|
|
],
|
|
)
|
|
|
|
cc_test(
|
|
name = "server_arch_test",
|
|
srcs = ["server_arch_test.cc"],
|
|
deps = [
|
|
":server_arch",
|
|
"//common:test_main",
|
|
"@com_google_absl//absl/strings",
|
|
"@com_google_googletest//:gtest",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "zstd_stream",
|
|
srcs = ["zstd_stream.cc"],
|
|
hdrs = ["zstd_stream.h"],
|
|
deps = [
|
|
"//common:buffer",
|
|
"//common:client_socket",
|
|
"//common:status",
|
|
"//common:status_macros",
|
|
"//common:stopwatch",
|
|
"@com_github_zstd//:zstd",
|
|
],
|
|
)
|
|
|
|
cc_test(
|
|
name = "zstd_stream_test",
|
|
srcs = ["zstd_stream_test.cc"],
|
|
deps = [
|
|
":zstd_stream",
|
|
"//cdc_rsync_server:unzstd_stream",
|
|
"//common:fake_socket",
|
|
"//common:status_test_macros",
|
|
"//common:test_main",
|
|
"@com_github_zstd//:zstd",
|
|
],
|
|
)
|
|
|
|
filegroup(
|
|
name = "all_test_sources",
|
|
srcs = glob(["*_test.cc"]),
|
|
)
|
|
|
|
filegroup(
|
|
name = "all_test_data",
|
|
srcs = glob(["testdata/**"]),
|
|
)
|