diff --git a/eden/fs/store/hg/HgDatapackStore.h b/eden/fs/store/hg/HgDatapackStore.h index aa3e3e60a3c16..453752b8dfa9d 100644 --- a/eden/fs/store/hg/HgDatapackStore.h +++ b/eden/fs/store/hg/HgDatapackStore.h @@ -16,7 +16,7 @@ #include "eden/fs/model/TreeFwd.h" #include "eden/fs/telemetry/RequestMetricsScope.h" #include "eden/fs/utils/PathFuncs.h" -#include "eden/scm/lib/backingstore/c_api/SaplingNativeBackingStore.h" +#include "eden/scm/lib/backingstore/include/SaplingNativeBackingStore.h" namespace facebook::eden { diff --git a/eden/fs/store/hg/TARGETS b/eden/fs/store/hg/TARGETS index 5a82064ee19f1..15aa4fb15b191 100644 --- a/eden/fs/store/hg/TARGETS +++ b/eden/fs/store/hg/TARGETS @@ -197,7 +197,8 @@ cpp_library( "//eden/fs/model:model-fwd", "//eden/fs/telemetry:telemetry", "//eden/fs/utils:path", - "//eden/scm/lib/backingstore/c_api:c_api", + "//eden/scm/lib/backingstore:sapling_native_backingstore", # @manual + "//eden/scm/lib/backingstore:sapling_native_backingstore-include", "//folly:range", "//folly/futures:core", ], diff --git a/eden/scm/lib/backingstore/CMakeLists.txt b/eden/scm/lib/backingstore/CMakeLists.txt index 211a3cbca024d..0c6ab260e3cb1 100644 --- a/eden/scm/lib/backingstore/CMakeLists.txt +++ b/eden/scm/lib/backingstore/CMakeLists.txt @@ -15,13 +15,14 @@ install_rust_static_library( INSTALL_DIR lib ) -file(GLOB C_API_SRCS "c_api/*.cpp") +file(GLOB C_API_SRCS "src/*.cpp") +file(GLOB C_API_HDRS "include/*.h") add_library(backingstore "${C_API_SRCS}") set_target_properties( backingstore PROPERTIES PUBLIC_HEADER - "c_api/SaplingNativeBackingStore.h;c_api/BackingStoreBindings.h" + "${C_API_HDRS}" ) target_include_directories(backingstore PUBLIC $ @@ -68,5 +69,5 @@ install( TARGETS backingstore EXPORT mercurial LIBRARY DESTINATION ${LIB_INSTALL_DIR} - PUBLIC_HEADER DESTINATION "include/eden/scm/lib/backingstore/c_api" + PUBLIC_HEADER DESTINATION "include/eden/scm/lib/backingstore/include" ) diff --git a/eden/scm/lib/backingstore/TARGETS b/eden/scm/lib/backingstore/TARGETS index d0d104e3a19d6..5d0083260104e 100644 --- a/eden/scm/lib/backingstore/TARGETS +++ b/eden/scm/lib/backingstore/TARGETS @@ -1,7 +1,35 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") oncall("mercurial_release") +cpp_library( + name = "sapling_native_backingstore-include", + srcs = [], + headers = glob(["include/**/*.h"]), + exported_deps = [ + ":backingstore", + "//folly:function", + "//folly:range", + "//folly:try", + ], +) + +cpp_library( + name = "sapling_native_backingstore", + srcs = glob(["src/**/*.cpp"]), + headers = [], + preferred_linkage = "static", + undefined_symbols = True, + deps = [ + ":sapling_native_backingstore-include", + "//folly:range", + "//folly:string", + "//folly/io:iobuf", + "//folly/logging:logging", + ], +) + rust_library( name = "backingstore", srcs = glob(["src/**/*.rs"]), diff --git a/eden/scm/lib/backingstore/c_api/TARGETS b/eden/scm/lib/backingstore/c_api/TARGETS deleted file mode 100644 index 6016a7ec7638e..0000000000000 --- a/eden/scm/lib/backingstore/c_api/TARGETS +++ /dev/null @@ -1,25 +0,0 @@ -load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") - -oncall("scm_client_infra") - -cpp_library( - name = "c_api", - srcs = [ - "SaplingNativeBackingStore.cpp", - ], - headers = [ - "BackingStoreBindings.h", - "SaplingNativeBackingStore.h", - ], - deps = [ - "//folly:string", - "//folly/io:iobuf", - "//folly/logging:logging", - ], - exported_deps = [ - "//eden/scm/lib/backingstore:backingstore", - "//folly:function", - "//folly:range", - "//folly:try", - ], -) diff --git a/eden/scm/lib/backingstore/c_api/BackingStoreBindings.h b/eden/scm/lib/backingstore/include/BackingStoreBindings.h similarity index 100% rename from eden/scm/lib/backingstore/c_api/BackingStoreBindings.h rename to eden/scm/lib/backingstore/include/BackingStoreBindings.h diff --git a/eden/scm/lib/backingstore/c_api/SaplingNativeBackingStore.h b/eden/scm/lib/backingstore/include/SaplingNativeBackingStore.h similarity index 97% rename from eden/scm/lib/backingstore/c_api/SaplingNativeBackingStore.h rename to eden/scm/lib/backingstore/include/SaplingNativeBackingStore.h index 40c79decad9a5..d4d6679b9f7de 100644 --- a/eden/scm/lib/backingstore/c_api/SaplingNativeBackingStore.h +++ b/eden/scm/lib/backingstore/include/SaplingNativeBackingStore.h @@ -14,7 +14,7 @@ #include #include -#include "eden/scm/lib/backingstore/c_api/BackingStoreBindings.h" +#include "eden/scm/lib/backingstore/include/BackingStoreBindings.h" namespace folly { class IOBuf; diff --git a/eden/scm/lib/backingstore/c_api/SaplingNativeBackingStore.cpp b/eden/scm/lib/backingstore/src/SaplingNativeBackingStore.cpp similarity index 99% rename from eden/scm/lib/backingstore/c_api/SaplingNativeBackingStore.cpp rename to eden/scm/lib/backingstore/src/SaplingNativeBackingStore.cpp index d73579e4c71dc..a9fb9620a1b0a 100644 --- a/eden/scm/lib/backingstore/c_api/SaplingNativeBackingStore.cpp +++ b/eden/scm/lib/backingstore/src/SaplingNativeBackingStore.cpp @@ -5,7 +5,7 @@ * GNU General Public License version 2. */ -#include "eden/scm/lib/backingstore/c_api/SaplingNativeBackingStore.h" +#include "eden/scm/lib/backingstore/include/SaplingNativeBackingStore.h" #include #include diff --git a/eden/scm/lib/backingstore/test/CBytesTest.cpp b/eden/scm/lib/backingstore/test/CBytesTest.cpp index ba33aee1046e4..6d19659590595 100644 --- a/eden/scm/lib/backingstore/test/CBytesTest.cpp +++ b/eden/scm/lib/backingstore/test/CBytesTest.cpp @@ -6,10 +6,10 @@ */ #include -#include +#include #include -#include "eden/scm/lib/backingstore/c_api/BackingStoreBindings.h" +#include "eden/scm/lib/backingstore/include/BackingStoreBindings.h" namespace { diff --git a/eden/scm/lib/backingstore/test/CFallibleTest.cpp b/eden/scm/lib/backingstore/test/CFallibleTest.cpp index 2d95d4e2a9745..07a28b1d39ff1 100644 --- a/eden/scm/lib/backingstore/test/CFallibleTest.cpp +++ b/eden/scm/lib/backingstore/test/CFallibleTest.cpp @@ -5,10 +5,10 @@ * GNU General Public License version 2. */ -#include +#include #include -#include "eden/scm/lib/backingstore/c_api/BackingStoreBindings.h" +#include "eden/scm/lib/backingstore/include/BackingStoreBindings.h" namespace { diff --git a/eden/scm/lib/backingstore/test/TARGETS b/eden/scm/lib/backingstore/test/TARGETS index 4e8ef64420773..e917142aa9c09 100644 --- a/eden/scm/lib/backingstore/test/TARGETS +++ b/eden/scm/lib/backingstore/test/TARGETS @@ -7,7 +7,9 @@ cpp_unittest( srcs = glob(["*Test.cpp"]), supports_static_listing = False, deps = [ - "//eden/scm/lib/backingstore/c_api:c_api", + "//eden/scm/lib/backingstore:sapling_native_backingstore", # @manual + "//eden/scm/lib/backingstore:sapling_native_backingstore-include", "//folly:range", + "//folly/portability:gtest", ], ) diff --git a/eden/scm/lib/backingstore/tools/cbindgen.sh b/eden/scm/lib/backingstore/tools/cbindgen.sh index 4c0f5120299f3..e3301fbd1d643 100755 --- a/eden/scm/lib/backingstore/tools/cbindgen.sh +++ b/eden/scm/lib/backingstore/tools/cbindgen.sh @@ -15,7 +15,7 @@ cd "$(dirname "$0")"/.. set -e CONFIG="cbindgen.toml" -OUTPUT="c_api/BackingStoreBindings.h" +OUTPUT="include/BackingStoreBindings.h" main() { cbindgen --config "$CONFIG" --output "$OUTPUT"