├── .buckconfig.d ├── common.buckconfig └── external_cells │ └── facebook │ └── buck2-shims-meta │ └── external_cell.buckconfig ├── .github └── workflows │ ├── TagIt.yml │ ├── getdeps_linux.yml │ ├── getdeps_mac.yml │ └── getdeps_windows.yml ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── buck2 ├── build ├── README.md ├── buck2 │ ├── README.md │ └── install_deps │ │ ├── BUCK │ │ ├── install_deps.sh │ │ └── repos │ │ ├── fedora │ │ ├── homebrew │ │ └── ubuntu ├── deps │ └── github_hashes │ │ ├── facebook │ │ └── folly-rev.txt │ │ └── facebookincubator │ │ └── fizz-rev.txt └── fbcode_builder │ ├── .gitignore │ ├── CMake │ ├── FBBuildOptions.cmake │ ├── FBCMakeParseArgs.cmake │ ├── FBCompilerSettings.cmake │ ├── FBCompilerSettingsMSVC.cmake │ ├── FBCompilerSettingsUnix.cmake │ ├── FBPythonBinary.cmake │ ├── FBPythonTestAddTests.cmake │ ├── FBThriftCppLibrary.cmake │ ├── FBThriftLibrary.cmake │ ├── FBThriftPyLibrary.cmake │ ├── FindDoubleConversion.cmake │ ├── FindGMock.cmake │ ├── FindGflags.cmake │ ├── FindGlog.cmake │ ├── FindLMDB.cmake │ ├── FindLibEvent.cmake │ ├── FindLibUnwind.cmake │ ├── FindPCRE.cmake │ ├── FindPCRE2.cmake │ ├── FindRe2.cmake │ ├── FindSodium.cmake │ ├── FindXxhash.cmake │ ├── FindZstd.cmake │ ├── RustStaticLibrary.cmake │ ├── fb_py_test_main.py │ ├── fb_py_win_main.c │ └── make_fbpy_archive.py │ ├── LICENSE │ ├── README.md │ ├── getdeps.py │ ├── getdeps │ ├── __init__.py │ ├── builder.py │ ├── buildopts.py │ ├── cache.py │ ├── cargo.py │ ├── copytree.py │ ├── dyndeps.py │ ├── envfuncs.py │ ├── errors.py │ ├── expr.py │ ├── fetcher.py │ ├── load.py │ ├── manifest.py │ ├── platform.py │ ├── py_wheel_builder.py │ ├── runcmd.py │ ├── subcmd.py │ └── test │ │ ├── expr_test.py │ │ ├── fixtures │ │ └── duplicate │ │ │ ├── foo │ │ │ └── subdir │ │ │ └── foo │ │ ├── manifest_test.py │ │ ├── platform_test.py │ │ ├── retry_test.py │ │ └── scratch_test.py │ ├── manifests │ ├── CLI11 │ ├── autoconf │ ├── automake │ ├── benchmark │ ├── blake3 │ ├── boost │ ├── bz2 │ ├── cabal │ ├── cachelib │ ├── clang │ ├── cmake │ ├── cpptoml │ ├── double-conversion │ ├── eden │ ├── edencommon │ ├── exprtk │ ├── fast_float │ ├── fatal │ ├── fb303 │ ├── fboss │ ├── fbthrift │ ├── fizz │ ├── fmt │ ├── folly │ ├── gflags │ ├── ghc │ ├── git-lfs │ ├── glean │ ├── glog │ ├── googletest │ ├── gperf │ ├── hexdump │ ├── hsthrift │ ├── iproute2 │ ├── jom │ ├── jq │ ├── katran │ ├── libaio │ ├── libbpf │ ├── libcurl │ ├── libdwarf │ ├── libelf │ ├── libevent │ ├── libffi │ ├── libgit2 │ ├── libgpiod │ ├── libiberty │ ├── libmnl │ ├── libnl │ ├── liboqs │ ├── libsai │ ├── libsodium │ ├── libtool │ ├── libunwind │ ├── libusb │ ├── libyaml │ ├── llvm │ ├── lmdb │ ├── lz4 │ ├── mcrouter │ ├── mononoke │ ├── mononoke_integration │ ├── mvfst │ ├── ncurses │ ├── nghttp2 │ ├── ninja │ ├── nlohmann-json │ ├── nmap │ ├── numa │ ├── openr │ ├── openssl │ ├── osxfuse │ ├── patchelf │ ├── pcre2 │ ├── perl │ ├── pexpect │ ├── proxygen │ ├── python │ ├── python-click │ ├── python-filelock │ ├── python-ptyprocess │ ├── python-setuptools │ ├── python-six │ ├── python-toml │ ├── ragel │ ├── range-v3 │ ├── re2 │ ├── ripgrep │ ├── rocksdb │ ├── rust-shed │ ├── sapling │ ├── snappy │ ├── sparsemap │ ├── sqlite3 │ ├── systemd │ ├── tree │ ├── wangle │ ├── watchman │ ├── xxhash │ ├── xz │ ├── yaml-cpp │ ├── zlib │ └── zstd │ └── patches │ ├── boost_comparator_operator_fix.patch │ ├── iproute2_oss.patch │ ├── libiberty_install_pic_lib.patch │ └── zlib_dont_build_more_than_needed.patch ├── tutorial.md └── wangle ├── .clang-tidy ├── .gitignore ├── BUILD_MODE.bzl ├── CMakeLists.txt ├── acceptor ├── AcceptObserver.h ├── Acceptor.cpp ├── Acceptor.h ├── AcceptorHandshakeManager.cpp ├── AcceptorHandshakeManager.h ├── ConnectionCounter.h ├── ConnectionManager.cpp ├── ConnectionManager.h ├── EvbHandshakeHelper.cpp ├── EvbHandshakeHelper.h ├── FizzAcceptorHandshakeHelper.cpp ├── FizzAcceptorHandshakeHelper.h ├── FizzConfig.h ├── FizzConfigUtil.cpp ├── FizzConfigUtil.h ├── LoadShedConfiguration.cpp ├── LoadShedConfiguration.h ├── ManagedConnection.cpp ├── ManagedConnection.h ├── NetworkAddress.h ├── PeekingAcceptorHandshakeHelper.h ├── SSLAcceptorHandshakeHelper.cpp ├── SSLAcceptorHandshakeHelper.h ├── SSLContextSelectionMisc.h ├── SecureTransportType.cpp ├── SecureTransportType.h ├── SecurityProtocolContextManager.h ├── ServerSocketConfig.h ├── SharedSSLContextManager.h ├── SocketOptions.cpp ├── SocketOptions.h ├── SocketPeeker.h ├── TLSPlaintextPeekingCallback.cpp ├── TLSPlaintextPeekingCallback.h ├── TransportInfo.cpp ├── TransportInfo.h ├── UnencryptedAcceptorHandshakeHelper.h └── test │ ├── AcceptorHelperMocks.h │ ├── AcceptorTest.cpp │ ├── ConnectionManagerTest.cpp │ ├── EvbHandshakeHelperTest.cpp │ ├── LoadShedConfigurationTest.cpp │ ├── PeekingAcceptorHandshakeHelperTest.cpp │ ├── SecurityProtocolContextManagerTest.cpp │ ├── SharedSSLContextManagerTest.cpp │ └── SocketPeekerTest.cpp ├── bootstrap ├── AcceptRoutingHandler-inl.h ├── AcceptRoutingHandler.h ├── BaseClientBootstrap.h ├── ClientBootstrap.h ├── RoutingDataHandler-inl.h ├── RoutingDataHandler.h ├── ServerBootstrap-inl.h ├── ServerBootstrap.cpp ├── ServerBootstrap.h ├── ServerSocketFactory.h └── test │ ├── AcceptRoutingHandlerTest.cpp │ ├── BootstrapTest.cpp │ └── Mocks.h ├── channel ├── AsyncSocketHandler.h ├── EventBaseHandler.h ├── FileRegion.cpp ├── FileRegion.h ├── Handler.h ├── HandlerContext-inl.h ├── HandlerContext.h ├── OutputBufferingHandler.h ├── Pipeline-inl.h ├── Pipeline.cpp ├── Pipeline.h ├── StaticPipeline.h ├── broadcast │ ├── BroadcastHandler-inl.h │ ├── BroadcastHandler.h │ ├── BroadcastPool-inl.h │ ├── BroadcastPool.h │ ├── ObservingHandler-inl.h │ ├── ObservingHandler.h │ ├── Subscriber.h │ └── test │ │ ├── BroadcastHandlerTest.cpp │ │ ├── BroadcastPoolTest.cpp │ │ ├── Mocks.h │ │ ├── ObservingClientPipelineTest.cpp │ │ └── ObservingHandlerTest.cpp └── test │ ├── AsyncSocketHandlerTest.cpp │ ├── FileRegionTest.cpp │ ├── MockHandler.h │ ├── MockPipeline.h │ ├── OutputBufferingHandlerTest.cpp │ └── PipelineTest.cpp ├── client ├── persistence │ ├── FilePersistenceLayer.cpp │ ├── FilePersistenceLayer.h │ ├── FilePersistentCache.h │ ├── LRUInMemoryCache-inl.h │ ├── LRUInMemoryCache.h │ ├── LRUPersistentCache-inl.h │ ├── LRUPersistentCache.h │ ├── PersistentCache.h │ ├── PersistentCacheCommon.cpp │ ├── PersistentCacheCommon.h │ └── test │ │ ├── FilePersistentCacheTest.cpp │ │ ├── LRUPersistentCacheTest.cpp │ │ ├── Mocks.h │ │ ├── PersistentCacheCommonTest.cpp │ │ ├── TestUtil.cpp │ │ └── TestUtil.h └── ssl │ ├── SSLSessionCacheData.cpp │ ├── SSLSessionCacheData.h │ ├── SSLSessionCacheUtils.cpp │ ├── SSLSessionCacheUtils.h │ ├── SSLSessionCallbacks.cpp │ ├── SSLSessionCallbacks.h │ ├── SSLSessionPersistentCache-inl.h │ ├── SSLSessionPersistentCache.h │ ├── ThreadSafeSSLSessionCache.cpp │ ├── ThreadSafeSSLSessionCache.h │ └── test │ ├── Mocks.h │ ├── SSLSessionCacheDataTest.cpp │ ├── SSLSessionCallbackTest.cpp │ ├── SSLSessionPersistentCacheTest.cpp │ ├── TestUtil.cpp │ ├── TestUtil.h │ └── ThreadSafeSSLSessionCacheTest.cpp ├── cmake ├── CheckAtomic.cmake ├── FindLibrt.cmake └── wangle-config.cmake.in ├── codec ├── ByteToMessageDecoder.h ├── FixedLengthFrameDecoder.h ├── LengthFieldBasedFrameDecoder.cpp ├── LengthFieldBasedFrameDecoder.h ├── LengthFieldPrepender.cpp ├── LengthFieldPrepender.h ├── LineBasedFrameDecoder.cpp ├── LineBasedFrameDecoder.h ├── MessageToByteEncoder.h ├── README.md ├── StringCodec.h └── test │ ├── CodecTest.cpp │ └── CodecTestUtils.h ├── defs.bzl ├── example ├── accept_steering │ └── accept_steering_server.cpp ├── broadcast │ └── BroadcastProxy.cpp ├── echo │ ├── EchoClient.cpp │ └── EchoServer.cpp ├── file │ └── FileServer.cpp ├── proxy │ └── Proxy.cpp ├── rpc │ ├── ClientSerializeHandler.h │ ├── README.md │ ├── RpcClient.cpp │ ├── RpcServer.cpp │ └── ServerSerializeHandler.h ├── ssl │ ├── Client.cpp │ └── Server.cpp └── telnet │ ├── TelnetClient.cpp │ └── TelnetServer.cpp ├── service ├── ClientDispatcher.h ├── CloseOnReleaseFilter.h ├── ExecutorFilter.h ├── ExpiringFilter.h ├── ServerDispatcher.h ├── Service.h └── test │ └── ServiceTest.cpp ├── ssl ├── ClientHelloExtStats.h ├── PasswordInFileFactory.cpp ├── PasswordInFileFactory.h ├── SNIConfig.h ├── SSLCacheOptions.h ├── SSLCacheProvider.h ├── SSLContextConfig.h ├── SSLContextManager.cpp ├── SSLContextManager.h ├── SSLSessionCacheManager.cpp ├── SSLSessionCacheManager.h ├── SSLStats.h ├── SSLUtil.cpp ├── SSLUtil.h ├── ServerSSLContext.cpp ├── ServerSSLContext.h ├── TLSCredProcessor.cpp ├── TLSCredProcessor.h ├── TLSInMemoryTicketProcessor.cpp ├── TLSInMemoryTicketProcessor.h ├── TLSTicketKeyManager.cpp ├── TLSTicketKeyManager.h ├── TLSTicketKeySeeds.h └── test │ ├── MockSSLStats.h │ ├── SSLCacheTest.cpp │ ├── SSLContextManagerTest.cpp │ ├── SSLSessionCacheManagerTest.cpp │ ├── TLSCredProcessorTest.cpp │ ├── TLSInMemoryTicketProcessorTest.cpp │ ├── TLSTicketKeyManagerTest.cpp │ ├── TicketUtil.h │ └── certs │ ├── test.cert.pem │ └── test.key.pem ├── test └── TestMain.cpp └── util ├── FilePoller.cpp ├── FilePoller.h ├── MultiFilePoller.cpp ├── MultiFilePoller.h └── test ├── FilePollerTest.cpp └── MultiFilePollerTest.cpp /.buckconfig.d/common.buckconfig: -------------------------------------------------------------------------------- 1 | [cells] 2 | prelude = prelude 3 | none = none 4 | 5 | [cell_aliases] 6 | config = prelude 7 | ovr_config = prelude 8 | bazel_skylib = gh_facebook_buck2_shims_meta 9 | buck = gh_facebook_buck2_shims_meta 10 | fbcode = gh_facebook_buck2_shims_meta 11 | fbcode_macros = gh_facebook_buck2_shims_meta 12 | fbsource = gh_facebook_buck2_shims_meta 13 | shim = gh_facebook_buck2_shims_meta 14 | toolchains = gh_facebook_buck2_shims_meta 15 | 16 | [external_cells] 17 | prelude = bundled 18 | 19 | [parser] 20 | target_platform_detector_spec = target:root//...->prelude//platforms:default target:shim//...->prelude//platforms:default 21 | -------------------------------------------------------------------------------- /.buckconfig.d/external_cells/facebook/buck2-shims-meta/external_cell.buckconfig: -------------------------------------------------------------------------------- 1 | [cells] 2 | gh_facebook_buck2_shims_meta = gh_facebook_buck2_shims_meta 3 | 4 | [external_cells] 5 | gh_facebook_buck2_shims_meta = git 6 | 7 | [external_cell_gh_facebook_buck2_shims_meta] 8 | git_origin = https://github.com/facebook/buck2-shims-meta.git 9 | commit_hash = 1efa0e48109175e29ff9cef8b33c0f3c9a68e017 10 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to wangle 2 | We want to make contributing to this project as easy and transparent as 3 | possible. 4 | 5 | ## Our Development Process 6 | External pull requests are first applied to facebook's internal 7 | branch, then synced with wangle github repository. 8 | 9 | ## Pull Requests 10 | We actively welcome your pull requests. 11 | 1. Fork the repo and create your branch from `master`. 12 | 2. If you've added code that should be tested, add tests 13 | 3. If you've changed APIs, update the documentation. 14 | 4. Ensure the test suite passes. 15 | 5. Make sure your code lints. 16 | 6. If you haven't already, complete the Contributor License Agreement ("CLA"). 17 | 18 | ## Contributor License Agreement ("CLA") 19 | In order to accept your pull request, we need you to submit a CLA. You only need 20 | to do this once to work on any of Facebook's open source projects. 21 | 22 | Complete your CLA here: 23 | 24 | ## Issues 25 | We use GitHub issues to track public bugs. Please ensure your description is 26 | clear and has sufficient instructions to be able to reproduce the issue. 27 | 28 | Facebook has a [bounty program](https://www.facebook.com/whitehat/) for the safe 29 | disclosure of security bugs. In those cases, please go through the process 30 | outlined on that page and do not file a public issue. 31 | 32 | ## Coding Style 33 | * 80 character line length 34 | * 2 spaces for indentation rather than tabs 35 | * Match existing style as much as possible 36 | 37 | ## License 38 | By contributing to wangle, you agree that your contributions will be licensed 39 | under its Apache 2.0 license. 40 | -------------------------------------------------------------------------------- /buck2: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env dotslash 2 | 3 | { 4 | "name": "buck2", 5 | "platforms": { 6 | "macos-aarch64": { 7 | "size": 29351270, 8 | "hash": "blake3", 9 | "digest": "1eecee4697ee80e05f3d766d00d9da0a57b85c88f9d06f44819aeef488c2f504", 10 | "format": "zst", 11 | "path": "buck2-aarch64-apple-darwin", 12 | "providers": [ 13 | { 14 | "url": "https://github.com/facebook/buck2/releases/download/2025-06-01/buck2-aarch64-apple-darwin.zst" 15 | } 16 | ] 17 | }, 18 | "linux-aarch64": { 19 | "size": 30401083, 20 | "hash": "blake3", 21 | "digest": "56b08d4a935fd1e0e709a87c7ef2d39e631a74638ea51214a2909016f2bd4b5d", 22 | "format": "zst", 23 | "path": "buck2-aarch64-unknown-linux-musl", 24 | "providers": [ 25 | { 26 | "url": "https://github.com/facebook/buck2/releases/download/2025-06-01/buck2-aarch64-unknown-linux-musl.zst" 27 | } 28 | ] 29 | }, 30 | "macos-x86_64": { 31 | "size": 30912953, 32 | "hash": "blake3", 33 | "digest": "bc839b6d766635694ed4febd552d9bd17bbbb7a7c019c16765fcb54ac1a1e912", 34 | "format": "zst", 35 | "path": "buck2-x86_64-apple-darwin", 36 | "providers": [ 37 | { 38 | "url": "https://github.com/facebook/buck2/releases/download/2025-06-01/buck2-x86_64-apple-darwin.zst" 39 | } 40 | ] 41 | }, 42 | "windows-x86_64": { 43 | "size": 26119750, 44 | "hash": "blake3", 45 | "digest": "9069b88169fe56f1490ccaa60b1647db428859046db4b7c2b52743c0b06e9fac", 46 | "format": "zst", 47 | "path": "buck2-x86_64-pc-windows-msvc.exe", 48 | "providers": [ 49 | { 50 | "url": "https://github.com/facebook/buck2/releases/download/2025-06-01/buck2-x86_64-pc-windows-msvc.exe.zst" 51 | } 52 | ] 53 | }, 54 | "linux-x86_64": { 55 | "size": 31652275, 56 | "hash": "blake3", 57 | "digest": "6925fbb87be96414f1bd6b3397e9035dadf67fa496e9baa2ac91e55f79ac6793", 58 | "format": "zst", 59 | "path": "buck2-x86_64-unknown-linux-musl", 60 | "providers": [ 61 | { 62 | "url": "https://github.com/facebook/buck2/releases/download/2025-06-01/buck2-x86_64-unknown-linux-musl.zst" 63 | } 64 | ] 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /build/README.md: -------------------------------------------------------------------------------- 1 | # Building using `fbcode_builder` 2 | 3 | Continuous integration builds are powered by `fbcode_builder`, a tiny tool 4 | shared by several Facebook projects. Its files are in `./fbcode_builder` 5 | (on Github) or in `fbcode/opensource/fbcode_builder` (inside Facebook's 6 | repo). 7 | 8 | Start with the READMEs in the `fbcode_builder` directory. 9 | 10 | `./fbcode_builder_config.py` contains the project-specific configuration. 11 | -------------------------------------------------------------------------------- /build/buck2/README.md: -------------------------------------------------------------------------------- 1 | # Easy buck2 builds for Facebook projects 2 | 3 | This directory contains buck2 targets designed to simplify buck2 builds of 4 | Meta open source projects. 5 | 6 | The most notable target is `//build/buck2/install_deps`, which will attempt to 7 | discover and install necessary third party packages from apt / dnf / etc. 8 | See the "repos" directory for the currently supported platforms. 9 | 10 | ## Deployment 11 | 12 | This directory is copied literally into a number of different Facebook open 13 | source repositories. Any change made to code in this directory will be 14 | automatically be replicated by our open source tooling into all GitHub hosted 15 | repositories that use `buck2`. Typically this directory is copied 16 | into the open source repositories as `build/buck2/`. 17 | -------------------------------------------------------------------------------- /build/buck2/install_deps/BUCK: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under the LICENSE file found in the root 4 | # directory of this source tree. 5 | load("@fbcode_macros//build_defs:native_rules.bzl", "buck_sh_binary") 6 | 7 | oncall("open_source") 8 | 9 | buck_sh_binary( 10 | name = "install_deps", 11 | main = "install_deps.sh", 12 | resources = glob(["repos/*"]), 13 | ) 14 | -------------------------------------------------------------------------------- /build/buck2/install_deps/install_deps.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (c) Meta Platforms, Inc. and affiliates. 3 | # 4 | # This source code is licensed under the LICENSE file found in the root 5 | # directory of this source tree. 6 | 7 | if [ -z "$INSTALL_COMMAND" ]; then 8 | if [ -f /etc/os-release ]; then 9 | . /etc/os-release; 10 | fi 11 | 12 | if command -v brew >/dev/null; then 13 | ID="homebrew"; 14 | fi 15 | 16 | if [ -f "$BUCK_DEFAULT_RUNTIME_RESOURCES/repos/$ID" ]; then 17 | # shellcheck disable=SC1090 18 | . "$BUCK_DEFAULT_RUNTIME_RESOURCES/repos/$ID"; 19 | else 20 | echo "Unable to determine platform id / install commands"; 21 | return 1; 22 | fi 23 | fi 24 | 25 | if [ -z "${BUCK2_COMMAND}" ]; then 26 | if command -v buck2 >/dev/null; then 27 | BUCK2_COMMAND="buck2" 28 | elif command -v dotslash >/dev/null && [ -f ./buck2 ]; then 29 | BUCK2_COMMAND="dotslash ./buck2" 30 | else 31 | echo "Unable to determine buck2 command"; 32 | return 1; 33 | fi 34 | fi 35 | 36 | __confirm() { 37 | echo "Press \"y\" to continue" 38 | read -r REPLY 39 | expr "X$REPLY" : '^X[Yy]$' >/dev/null 40 | } 41 | 42 | PKG_FILE=$(mktemp /tmp/buck2-install-pkgs.XXXXXX) 43 | 44 | if ! command -v jq >/dev/null; then 45 | echo "Failed to find jq command, attempting to install with" 46 | echo 47 | echo "$INSTALL_COMMAND" jq 48 | echo 49 | if __confirm; then 50 | eval "$INSTALL_COMMAND jq" 51 | else 52 | echo "Not confirmed, exiting"; 53 | exit 1 54 | fi 55 | fi 56 | 57 | eval "$BUCK2_COMMAND cquery 'kind(system_packages, deps(//...))' \\ 58 | --output-attribute=packages --modifier $ID --json 2>/dev/null \\ 59 | | jq -r '.[].packages[]' \\ 60 | | sort \\ 61 | | uniq \\ 62 | > $PKG_FILE" 63 | 64 | echo "About to install the project dependencies with the following command:" 65 | echo 66 | eval "cat $PKG_FILE | xargs echo $INSTALL_COMMAND" 67 | echo 68 | if __confirm; then 69 | eval "cat $PKG_FILE | xargs -r $INSTALL_COMMAND" 70 | else 71 | echo "Not installing dependencies" 72 | fi 73 | 74 | rm "$PKG_FILE" 75 | -------------------------------------------------------------------------------- /build/buck2/install_deps/repos/fedora: -------------------------------------------------------------------------------- 1 | INSTALL_COMMAND="sudo -E dnf install -y" 2 | -------------------------------------------------------------------------------- /build/buck2/install_deps/repos/homebrew: -------------------------------------------------------------------------------- 1 | INSTALL_COMMAND="brew install" 2 | -------------------------------------------------------------------------------- /build/buck2/install_deps/repos/ubuntu: -------------------------------------------------------------------------------- 1 | INSTALL_COMMAND="sudo -E apt-get install -y" 2 | -------------------------------------------------------------------------------- /build/deps/github_hashes/facebook/folly-rev.txt: -------------------------------------------------------------------------------- 1 | Subproject commit 82bfe10e7180d5537639a3717963c0049f8591f9 2 | -------------------------------------------------------------------------------- /build/deps/github_hashes/facebookincubator/fizz-rev.txt: -------------------------------------------------------------------------------- 1 | Subproject commit 9d59cc8565a2accb2416a94e2633e1404e3b3968 2 | -------------------------------------------------------------------------------- /build/fbcode_builder/.gitignore: -------------------------------------------------------------------------------- 1 | # Facebook-internal CI builds don't have write permission outside of the 2 | # source tree, so we install all projects into this directory. 3 | /facebook_ci 4 | __pycache__/ 5 | *.pyc 6 | -------------------------------------------------------------------------------- /build/fbcode_builder/CMake/FBBuildOptions.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | 3 | function (fb_activate_static_library_option) 4 | option(USE_STATIC_DEPS_ON_UNIX 5 | "If enabled, use static dependencies on unix systems. This is generally discouraged." 6 | OFF 7 | ) 8 | # Mark USE_STATIC_DEPS_ON_UNIX as an "advanced" option, since enabling it 9 | # is generally discouraged. 10 | mark_as_advanced(USE_STATIC_DEPS_ON_UNIX) 11 | 12 | if(UNIX AND USE_STATIC_DEPS_ON_UNIX) 13 | SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a" PARENT_SCOPE) 14 | endif() 15 | endfunction() 16 | -------------------------------------------------------------------------------- /build/fbcode_builder/CMake/FBCompilerSettings.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | 3 | # This file applies common compiler settings that are shared across 4 | # a number of Facebook opensource projects. 5 | # Please use caution and your best judgement before making changes 6 | # to these shared compiler settings in order to avoid accidentally 7 | # breaking a build in another project! 8 | 9 | if (WIN32) 10 | include(FBCompilerSettingsMSVC) 11 | else() 12 | include(FBCompilerSettingsUnix) 13 | endif() 14 | -------------------------------------------------------------------------------- /build/fbcode_builder/CMake/FBCompilerSettingsMSVC.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | 3 | # This file applies common compiler settings that are shared across 4 | # a number of Facebook opensource projects. 5 | # Please use caution and your best judgement before making changes 6 | # to these shared compiler settings in order to avoid accidentally 7 | # breaking a build in another project! 8 | 9 | add_compile_options( 10 | /wd4250 # 'class1' : inherits 'class2::member' via dominance 11 | ) 12 | -------------------------------------------------------------------------------- /build/fbcode_builder/CMake/FBCompilerSettingsUnix.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | 3 | # This file applies common compiler settings that are shared across 4 | # a number of Facebook opensource projects. 5 | # Please use caution and your best judgement before making changes 6 | # to these shared compiler settings in order to avoid accidentally 7 | # breaking a build in another project! 8 | 9 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall -Wextra -Wno-deprecated -Wno-deprecated-declarations") 10 | -------------------------------------------------------------------------------- /build/fbcode_builder/CMake/FBPythonTestAddTests.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | 3 | # Add a command to be emitted to the CTest file 4 | set(ctest_script) 5 | function(add_command CMD) 6 | set(escaped_args "") 7 | foreach(arg ${ARGN}) 8 | # Escape all arguments using "Bracket Argument" syntax 9 | # We could skip this for argument that don't contain any special 10 | # characters if we wanted to make the output slightly more human-friendly. 11 | set(escaped_args "${escaped_args} [==[${arg}]==]") 12 | endforeach() 13 | set(ctest_script "${ctest_script}${CMD}(${escaped_args})\n" PARENT_SCOPE) 14 | endfunction() 15 | 16 | if(NOT EXISTS "${TEST_EXECUTABLE}") 17 | message(FATAL_ERROR "Test executable does not exist: ${TEST_EXECUTABLE}") 18 | endif() 19 | execute_process( 20 | COMMAND ${CMAKE_COMMAND} -E env ${TEST_ENV} "${TEST_INTERPRETER}" "${TEST_EXECUTABLE}" --list-tests 21 | WORKING_DIRECTORY "${TEST_WORKING_DIR}" 22 | OUTPUT_VARIABLE output 23 | RESULT_VARIABLE result 24 | ) 25 | if(NOT "${result}" EQUAL 0) 26 | string(REPLACE "\n" "\n " output "${output}") 27 | message( 28 | FATAL_ERROR 29 | "Error running test executable: ${TEST_EXECUTABLE}\n" 30 | "Output:\n" 31 | " ${output}\n" 32 | ) 33 | endif() 34 | 35 | # Parse output 36 | string(REPLACE "\n" ";" tests_list "${output}") 37 | foreach(test_name ${tests_list}) 38 | add_command( 39 | add_test 40 | "${TEST_PREFIX}${test_name}" 41 | ${CMAKE_COMMAND} -E env ${TEST_ENV} 42 | "${TEST_INTERPRETER}" "${TEST_EXECUTABLE}" "${test_name}" 43 | ) 44 | add_command( 45 | set_tests_properties 46 | "${TEST_PREFIX}${test_name}" 47 | PROPERTIES 48 | WORKING_DIRECTORY "${TEST_WORKING_DIR}" 49 | ${TEST_PROPERTIES} 50 | ) 51 | endforeach() 52 | 53 | # Set a list of discovered tests in the parent scope, in case users 54 | # want access to this list as a CMake variable 55 | if(TEST_LIST) 56 | add_command(set ${TEST_LIST} ${tests_list}) 57 | endif() 58 | 59 | file(WRITE "${CTEST_FILE}" "${ctest_script}") 60 | -------------------------------------------------------------------------------- /build/fbcode_builder/CMake/FindDoubleConversion.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | 3 | # Finds libdouble-conversion. 4 | # 5 | # This module defines: 6 | # DOUBLE_CONVERSION_INCLUDE_DIR 7 | # DOUBLE_CONVERSION_LIBRARY 8 | # 9 | 10 | find_path(DOUBLE_CONVERSION_INCLUDE_DIR double-conversion/double-conversion.h) 11 | find_library(DOUBLE_CONVERSION_LIBRARY NAMES double-conversion) 12 | 13 | include(FindPackageHandleStandardArgs) 14 | find_package_handle_standard_args( 15 | DoubleConversion 16 | DEFAULT_MSG 17 | DOUBLE_CONVERSION_LIBRARY DOUBLE_CONVERSION_INCLUDE_DIR) 18 | 19 | mark_as_advanced(DOUBLE_CONVERSION_INCLUDE_DIR DOUBLE_CONVERSION_LIBRARY) 20 | -------------------------------------------------------------------------------- /build/fbcode_builder/CMake/FindGlog.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # - Try to find Glog 3 | # Once done, this will define 4 | # 5 | # GLOG_FOUND - system has Glog 6 | # GLOG_INCLUDE_DIRS - the Glog include directories 7 | # GLOG_LIBRARIES - link these to use Glog 8 | 9 | include(FindPackageHandleStandardArgs) 10 | include(SelectLibraryConfigurations) 11 | 12 | find_library(GLOG_LIBRARY_RELEASE glog 13 | PATHS ${GLOG_LIBRARYDIR}) 14 | find_library(GLOG_LIBRARY_DEBUG glogd 15 | PATHS ${GLOG_LIBRARYDIR}) 16 | 17 | find_path(GLOG_INCLUDE_DIR glog/logging.h 18 | PATHS ${GLOG_INCLUDEDIR}) 19 | 20 | select_library_configurations(GLOG) 21 | 22 | find_package_handle_standard_args(Glog DEFAULT_MSG 23 | GLOG_LIBRARY 24 | GLOG_INCLUDE_DIR) 25 | 26 | mark_as_advanced( 27 | GLOG_LIBRARY 28 | GLOG_INCLUDE_DIR) 29 | 30 | set(GLOG_LIBRARIES ${GLOG_LIBRARY}) 31 | set(GLOG_INCLUDE_DIRS ${GLOG_INCLUDE_DIR}) 32 | 33 | if (NOT TARGET glog::glog) 34 | add_library(glog::glog UNKNOWN IMPORTED) 35 | set_target_properties(glog::glog PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${GLOG_INCLUDE_DIRS}") 36 | set_target_properties(glog::glog PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "C" IMPORTED_LOCATION "${GLOG_LIBRARIES}") 37 | 38 | find_package(Gflags) 39 | if(GFLAGS_FOUND) 40 | message(STATUS "Found gflags as a dependency of glog::glog, include=${LIBGFLAGS_INCLUDE_DIR}, libs=${LIBGFLAGS_LIBRARY}") 41 | set_property(TARGET glog::glog APPEND PROPERTY IMPORTED_LINK_INTERFACE_LIBRARIES ${LIBGFLAGS_LIBRARY}) 42 | endif() 43 | 44 | find_package(LibUnwind) 45 | if(LIBUNWIND_FOUND) 46 | message(STATUS "Found LibUnwind as a dependency of glog::glog, include=${LIBUNWIND_INCLUDE_DIR}, libs=${LIBUNWIND_LIBRARY}") 47 | set_property(TARGET glog::glog APPEND PROPERTY IMPORTED_LINK_INTERFACE_LIBRARIES ${LIBUNWIND_LIBRARY}) 48 | endif() 49 | endif() 50 | -------------------------------------------------------------------------------- /build/fbcode_builder/CMake/FindLMDB.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This software may be used and distributed according to the terms of the 4 | # GNU General Public License version 2. 5 | 6 | find_library(LMDB_LIBRARIES NAMES lmdb liblmdb) 7 | mark_as_advanced(LMDB_LIBRARIES) 8 | 9 | find_path(LMDB_INCLUDE_DIR NAMES lmdb.h) 10 | mark_as_advanced(LMDB_INCLUDE_DIR) 11 | 12 | find_package_handle_standard_args( 13 | LMDB 14 | REQUIRED_VARS LMDB_LIBRARIES LMDB_INCLUDE_DIR) 15 | 16 | if(LMDB_FOUND) 17 | set(LMDB_LIBRARIES ${LMDB_LIBRARIES}) 18 | set(LMDB_INCLUDE_DIR, ${LMDB_INCLUDE_DIR}) 19 | endif() 20 | -------------------------------------------------------------------------------- /build/fbcode_builder/CMake/FindLibUnwind.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | find_path(LIBUNWIND_INCLUDE_DIR NAMES libunwind.h) 16 | mark_as_advanced(LIBUNWIND_INCLUDE_DIR) 17 | 18 | find_library(LIBUNWIND_LIBRARY NAMES unwind) 19 | mark_as_advanced(LIBUNWIND_LIBRARY) 20 | 21 | include(FindPackageHandleStandardArgs) 22 | FIND_PACKAGE_HANDLE_STANDARD_ARGS( 23 | LIBUNWIND 24 | REQUIRED_VARS LIBUNWIND_LIBRARY LIBUNWIND_INCLUDE_DIR) 25 | 26 | if(LIBUNWIND_FOUND) 27 | set(LIBUNWIND_LIBRARIES ${LIBUNWIND_LIBRARY}) 28 | set(LIBUNWIND_INCLUDE_DIRS ${LIBUNWIND_INCLUDE_DIR}) 29 | endif() 30 | -------------------------------------------------------------------------------- /build/fbcode_builder/CMake/FindPCRE.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | include(FindPackageHandleStandardArgs) 3 | find_path(PCRE_INCLUDE_DIR NAMES pcre.h) 4 | find_library(PCRE_LIBRARY NAMES pcre) 5 | find_package_handle_standard_args( 6 | PCRE 7 | DEFAULT_MSG 8 | PCRE_LIBRARY 9 | PCRE_INCLUDE_DIR 10 | ) 11 | mark_as_advanced(PCRE_INCLUDE_DIR PCRE_LIBRARY) 12 | -------------------------------------------------------------------------------- /build/fbcode_builder/CMake/FindPCRE2.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | include(FindPackageHandleStandardArgs) 3 | find_path(PCRE2_INCLUDE_DIR NAMES pcre2.h) 4 | find_library(PCRE2_LIBRARY NAMES pcre2-8) 5 | find_package_handle_standard_args( 6 | PCRE2 7 | DEFAULT_MSG 8 | PCRE2_LIBRARY 9 | PCRE2_INCLUDE_DIR 10 | ) 11 | set(PCRE2_DEFINES "PCRE2_CODE_UNIT_WIDTH=8") 12 | mark_as_advanced(PCRE2_INCLUDE_DIR PCRE2_LIBRARY PCRE2_DEFINES) 13 | -------------------------------------------------------------------------------- /build/fbcode_builder/CMake/FindRe2.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This software may be used and distributed according to the terms of the 4 | # GNU General Public License version 2. 5 | 6 | find_library(RE2_LIBRARY re2) 7 | mark_as_advanced(RE2_LIBRARY) 8 | 9 | find_path(RE2_INCLUDE_DIR NAMES re2/re2.h) 10 | mark_as_advanced(RE2_INCLUDE_DIR) 11 | 12 | include(FindPackageHandleStandardArgs) 13 | FIND_PACKAGE_HANDLE_STANDARD_ARGS( 14 | RE2 15 | REQUIRED_VARS RE2_LIBRARY RE2_INCLUDE_DIR) 16 | 17 | if(RE2_FOUND) 18 | set(RE2_LIBRARY ${RE2_LIBRARY}) 19 | set(RE2_INCLUDE_DIR, ${RE2_INCLUDE_DIR}) 20 | endif() 21 | -------------------------------------------------------------------------------- /build/fbcode_builder/CMake/FindXxhash.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # 16 | # - Try to find Facebook xxhash library 17 | # This will define 18 | # Xxhash_FOUND 19 | # Xxhash_INCLUDE_DIR 20 | # Xxhash_LIBRARY 21 | # 22 | 23 | find_path(Xxhash_INCLUDE_DIR NAMES xxhash.h) 24 | 25 | find_library(Xxhash_LIBRARY_RELEASE NAMES xxhash) 26 | 27 | include(SelectLibraryConfigurations) 28 | SELECT_LIBRARY_CONFIGURATIONS(Xxhash) 29 | 30 | include(FindPackageHandleStandardArgs) 31 | FIND_PACKAGE_HANDLE_STANDARD_ARGS( 32 | Xxhash DEFAULT_MSG 33 | Xxhash_LIBRARY Xxhash_INCLUDE_DIR 34 | ) 35 | 36 | if (Xxhash_FOUND) 37 | message(STATUS "Found xxhash: ${Xxhash_LIBRARY}") 38 | endif() 39 | 40 | mark_as_advanced(Xxhash_INCLUDE_DIR Xxhash_LIBRARY) 41 | -------------------------------------------------------------------------------- /build/fbcode_builder/CMake/FindZstd.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # 16 | # - Try to find Facebook zstd library 17 | # This will define 18 | # ZSTD_FOUND 19 | # ZSTD_INCLUDE_DIR 20 | # ZSTD_LIBRARY 21 | # 22 | 23 | find_path(ZSTD_INCLUDE_DIR NAMES zstd.h) 24 | 25 | find_library(ZSTD_LIBRARY_DEBUG NAMES zstdd zstd_staticd) 26 | find_library(ZSTD_LIBRARY_RELEASE NAMES zstd zstd_static) 27 | 28 | include(SelectLibraryConfigurations) 29 | SELECT_LIBRARY_CONFIGURATIONS(ZSTD) 30 | 31 | include(FindPackageHandleStandardArgs) 32 | FIND_PACKAGE_HANDLE_STANDARD_ARGS( 33 | Zstd DEFAULT_MSG 34 | ZSTD_LIBRARY ZSTD_INCLUDE_DIR 35 | ) 36 | 37 | if (ZSTD_FOUND) 38 | message(STATUS "Found Zstd: ${ZSTD_LIBRARY}") 39 | endif() 40 | 41 | mark_as_advanced(ZSTD_INCLUDE_DIR ZSTD_LIBRARY) 42 | -------------------------------------------------------------------------------- /build/fbcode_builder/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Facebook, Inc. and its affiliates. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /build/fbcode_builder/README.md: -------------------------------------------------------------------------------- 1 | # Easy builds for Facebook projects 2 | 3 | This directory contains tools designed to simplify continuous-integration 4 | (and other builds) of Facebook open source projects. In particular, this helps 5 | manage builds for cross-project dependencies. 6 | 7 | The main entry point is the `getdeps.py` script. This script has several 8 | subcommands, but the most notable is the `build` command. This will download 9 | and build all dependencies for a project, and then build the project itself. 10 | 11 | ## Deployment 12 | 13 | This directory is copied literally into a number of different Facebook open 14 | source repositories. Any change made to code in this directory will be 15 | automatically be replicated by our open source tooling into all GitHub hosted 16 | repositories that use `fbcode_builder`. Typically this directory is copied 17 | into the open source repositories as `build/fbcode_builder/`. 18 | 19 | 20 | # Project Configuration Files 21 | 22 | The `manifests` subdirectory contains configuration files for many different 23 | projects, describing how to build each project. These files also list 24 | dependencies between projects, enabling `getdeps.py` to build all dependencies 25 | for a project before building the project itself. 26 | 27 | 28 | # Shared CMake utilities 29 | 30 | Since this directory is copied into many Facebook open source repositories, 31 | it is also used to help share some CMake utility files across projects. The 32 | `CMake/` subdirectory contains a number of `.cmake` files that are shared by 33 | the CMake-based build systems across several different projects. 34 | 35 | 36 | # Older Build Scripts 37 | 38 | This directory also still contains a handful of older build scripts that 39 | pre-date the current `getdeps.py` build system. Most of the other `.py` files 40 | in this top directory, apart from `getdeps.py` itself, are from this older 41 | build system. This older system is only used by a few remaining projects, and 42 | new projects should generally use the newer `getdeps.py` script, by adding a 43 | new configuration file in the `manifests/` subdirectory. 44 | -------------------------------------------------------------------------------- /build/fbcode_builder/getdeps/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebook/wangle/439be1013c5934e1ae4b52510edd8d5b57fc127d/build/fbcode_builder/getdeps/__init__.py -------------------------------------------------------------------------------- /build/fbcode_builder/getdeps/cache.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | # pyre-unsafe 7 | 8 | 9 | class ArtifactCache(object): 10 | """The ArtifactCache is a small abstraction that allows caching 11 | named things in some external storage mechanism. 12 | The primary use case is for storing the build products on CI 13 | systems to accelerate the build""" 14 | 15 | def download_to_file(self, name, dest_file_name) -> bool: 16 | """If `name` exists in the cache, download it and place it 17 | in the specified `dest_file_name` location on the filesystem. 18 | If a transient issue was encountered a TransientFailure shall 19 | be raised. 20 | If `name` doesn't exist in the cache `False` shall be returned. 21 | If `dest_file_name` was successfully updated `True` shall be 22 | returned. 23 | All other conditions shall raise an appropriate exception.""" 24 | return False 25 | 26 | def upload_from_file(self, name, source_file_name) -> None: 27 | """Causes `name` to be populated in the cache by uploading 28 | the contents of `source_file_name` to the storage system. 29 | If a transient issue was encountered a TransientFailure shall 30 | be raised. 31 | If the upload failed for some other reason, an appropriate 32 | exception shall be raised.""" 33 | pass 34 | 35 | 36 | def create_cache() -> None: 37 | """This function is monkey patchable to provide an actual 38 | implementation""" 39 | return None 40 | -------------------------------------------------------------------------------- /build/fbcode_builder/getdeps/errors.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | # pyre-unsafe 7 | 8 | 9 | class TransientFailure(Exception): 10 | """Raising this error causes getdeps to return with an error code 11 | that Sandcastle will consider to be a retryable transient 12 | infrastructure error""" 13 | 14 | pass 15 | 16 | 17 | class ManifestNotFound(Exception): 18 | def __init__(self, manifest_name) -> None: 19 | super(Exception, self).__init__("Unable to find manifest '%s'" % manifest_name) 20 | -------------------------------------------------------------------------------- /build/fbcode_builder/getdeps/subcmd.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | # pyre-unsafe 7 | 8 | 9 | class SubCmd(object): 10 | NAME = None 11 | HELP = None 12 | 13 | def run(self, args) -> int: 14 | """perform the command""" 15 | return 0 16 | 17 | def setup_parser(self, parser) -> None: 18 | # Subclasses should override setup_parser() if they have any 19 | # command line options or arguments. 20 | pass 21 | 22 | 23 | CmdTable = [] 24 | 25 | 26 | def add_subcommands(parser, common_args, cmd_table=CmdTable) -> None: 27 | """Register parsers for the defined commands with the provided parser""" 28 | for cls in cmd_table: 29 | command = cls() 30 | command_parser = parser.add_parser( 31 | command.NAME, help=command.HELP, parents=[common_args] 32 | ) 33 | command.setup_parser(command_parser) 34 | command_parser.set_defaults(func=command.run) 35 | 36 | 37 | def cmd(name, help=None, cmd_table=CmdTable): 38 | """ 39 | @cmd() is a decorator that can be used to help define Subcmd instances 40 | 41 | Example usage: 42 | 43 | @subcmd('list', 'Show the result list') 44 | class ListCmd(Subcmd): 45 | def run(self, args): 46 | # Perform the command actions here... 47 | pass 48 | """ 49 | 50 | def wrapper(cls): 51 | class SubclassedCmd(cls): 52 | NAME = name 53 | HELP = help 54 | 55 | cmd_table.append(SubclassedCmd) 56 | return SubclassedCmd 57 | 58 | return wrapper 59 | -------------------------------------------------------------------------------- /build/fbcode_builder/getdeps/test/expr_test.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | # pyre-unsafe 7 | 8 | 9 | import unittest 10 | 11 | from ..expr import parse_expr 12 | 13 | 14 | class ExprTest(unittest.TestCase): 15 | def test_equal(self) -> None: 16 | valid_variables = {"foo", "some_var", "another_var"} 17 | e = parse_expr("foo=bar", valid_variables) 18 | self.assertTrue(e.eval({"foo": "bar"})) 19 | self.assertFalse(e.eval({"foo": "not-bar"})) 20 | self.assertFalse(e.eval({"not-foo": "bar"})) 21 | 22 | def test_not_equal(self) -> None: 23 | valid_variables = {"foo"} 24 | e = parse_expr("not(foo=bar)", valid_variables) 25 | self.assertFalse(e.eval({"foo": "bar"})) 26 | self.assertTrue(e.eval({"foo": "not-bar"})) 27 | 28 | def test_bad_not(self) -> None: 29 | valid_variables = {"foo"} 30 | with self.assertRaises(Exception): 31 | parse_expr("foo=not(bar)", valid_variables) 32 | 33 | def test_bad_variable(self) -> None: 34 | valid_variables = {"bar"} 35 | with self.assertRaises(Exception): 36 | parse_expr("foo=bar", valid_variables) 37 | 38 | def test_all(self) -> None: 39 | valid_variables = {"foo", "baz"} 40 | e = parse_expr("all(foo = bar, baz = qux)", valid_variables) 41 | self.assertTrue(e.eval({"foo": "bar", "baz": "qux"})) 42 | self.assertFalse(e.eval({"foo": "bar", "baz": "nope"})) 43 | self.assertFalse(e.eval({"foo": "nope", "baz": "nope"})) 44 | 45 | def test_any(self) -> None: 46 | valid_variables = {"foo", "baz"} 47 | e = parse_expr("any(foo = bar, baz = qux)", valid_variables) 48 | self.assertTrue(e.eval({"foo": "bar", "baz": "qux"})) 49 | self.assertTrue(e.eval({"foo": "bar", "baz": "nope"})) 50 | self.assertFalse(e.eval({"foo": "nope", "baz": "nope"})) 51 | -------------------------------------------------------------------------------- /build/fbcode_builder/getdeps/test/fixtures/duplicate/foo: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = foo 3 | -------------------------------------------------------------------------------- /build/fbcode_builder/getdeps/test/fixtures/duplicate/subdir/foo: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = foo 3 | -------------------------------------------------------------------------------- /build/fbcode_builder/getdeps/test/platform_test.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | # pyre-unsafe 7 | 8 | 9 | import unittest 10 | 11 | from ..platform import HostType 12 | 13 | 14 | class PlatformTest(unittest.TestCase): 15 | def test_create(self) -> None: 16 | p = HostType() 17 | self.assertNotEqual(p.ostype, None, msg="probed and returned something") 18 | 19 | tuple_string = p.as_tuple_string() 20 | round_trip = HostType.from_tuple_string(tuple_string) 21 | self.assertEqual(round_trip, p) 22 | 23 | def test_rendering_of_none(self) -> None: 24 | p = HostType(ostype="foo") 25 | self.assertEqual(p.as_tuple_string(), "foo-none-none") 26 | 27 | def test_is_methods(self) -> None: 28 | p = HostType(ostype="windows") 29 | self.assertTrue(p.is_windows()) 30 | self.assertFalse(p.is_darwin()) 31 | self.assertFalse(p.is_linux()) 32 | 33 | p = HostType(ostype="darwin") 34 | self.assertFalse(p.is_windows()) 35 | self.assertTrue(p.is_darwin()) 36 | self.assertFalse(p.is_linux()) 37 | 38 | p = HostType(ostype="linux") 39 | self.assertFalse(p.is_windows()) 40 | self.assertFalse(p.is_darwin()) 41 | self.assertTrue(p.is_linux()) 42 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/CLI11: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = CLI11 3 | 4 | [download] 5 | url = https://github.com/CLIUtils/CLI11/archive/v2.0.0.tar.gz 6 | sha256 = 2c672f17bf56e8e6223a3bfb74055a946fa7b1ff376510371902adb9cb0ab6a3 7 | 8 | [build] 9 | builder = cmake 10 | subdir = CLI11-2.0.0 11 | 12 | [cmake.defines] 13 | CLI11_BUILD_TESTS = OFF 14 | CLI11_BUILD_EXAMPLES = OFF 15 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/autoconf: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = autoconf 3 | 4 | [debs] 5 | autoconf 6 | 7 | [homebrew] 8 | autoconf 9 | 10 | [rpms] 11 | autoconf 12 | 13 | [pps] 14 | autoconf 15 | 16 | [download] 17 | url = http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz 18 | sha256 = 954bd69b391edc12d6a4a51a2dd1476543da5c6bbf05a95b59dc0dd6fd4c2969 19 | 20 | [build] 21 | builder = autoconf 22 | subdir = autoconf-2.69 23 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/automake: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = automake 3 | 4 | [homebrew] 5 | automake 6 | 7 | [debs] 8 | automake 9 | 10 | [rpms] 11 | automake 12 | 13 | [pps] 14 | automake 15 | 16 | [download] 17 | url = http://ftp.gnu.org/gnu/automake/automake-1.16.1.tar.gz 18 | sha256 = 608a97523f97db32f1f5d5615c98ca69326ced2054c9f82e65bade7fc4c9dea8 19 | 20 | [build] 21 | builder = autoconf 22 | subdir = automake-1.16.1 23 | 24 | [dependencies] 25 | autoconf 26 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/benchmark: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = benchmark 3 | 4 | [download] 5 | url = https://github.com/google/benchmark/archive/refs/tags/v1.8.0.tar.gz 6 | sha256 = ea2e94c24ddf6594d15c711c06ccd4486434d9cf3eca954e2af8a20c88f9f172 7 | 8 | [build] 9 | builder = cmake 10 | subdir = benchmark-1.8.0/ 11 | 12 | [cmake.defines] 13 | BENCHMARK_ENABLE_TESTING=OFF 14 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/blake3: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = blake3 3 | 4 | [download] 5 | url = https://github.com/BLAKE3-team/BLAKE3/archive/refs/tags/1.5.1.tar.gz 6 | sha256 = 822cd37f70152e5985433d2c50c8f6b2ec83aaf11aa31be9fe71486a91744f37 7 | 8 | [build] 9 | builder = cmake 10 | subdir = BLAKE3-1.5.1/c 11 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/bz2: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = bz2 3 | 4 | [debs] 5 | libbz2-dev 6 | bzip2 7 | 8 | [homebrew] 9 | bzip2 10 | 11 | [rpms] 12 | bzip2-devel 13 | bzip2 14 | 15 | [download] 16 | url = https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz 17 | sha256 = ab5a03176ee106d3f0fa90e381da478ddae405918153cca248e682cd0c4a2269 18 | 19 | [build.not(os=windows)] 20 | builder = make 21 | subdir = bzip2-1.0.8 22 | 23 | [make.build_args.os=linux] 24 | # python bz2 support on linux needs dynamic library 25 | -f 26 | Makefile-libbz2_so 27 | 28 | [make.install_args] 29 | install 30 | 31 | [build.os=windows] 32 | builder = nop 33 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/cabal: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = cabal 3 | 4 | [download.os=linux] 5 | url = https://downloads.haskell.org/~cabal/cabal-install-3.6.2.0/cabal-install-3.6.2.0-x86_64-linux-deb10.tar.xz 6 | sha256 = 4759b56e9257e02f29fa374a6b25d6cb2f9d80c7e3a55d4f678a8e570925641c 7 | 8 | [build] 9 | builder = nop 10 | 11 | [install.files] 12 | cabal = bin/cabal 13 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/cachelib: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = cachelib 3 | fbsource_path = fbcode/cachelib 4 | shipit_project = cachelib 5 | shipit_fbcode_builder = true 6 | 7 | [git] 8 | repo_url = https://github.com/facebook/cachelib.git 9 | 10 | [build] 11 | builder = cmake 12 | subdir = cachelib 13 | job_weight_mib = 2048 14 | 15 | [dependencies] 16 | zlib 17 | fizz 18 | fmt 19 | folly 20 | fbthrift 21 | googletest 22 | sparsemap 23 | wangle 24 | zstd 25 | mvfst 26 | numa 27 | libaio 28 | # cachelib also depends on openssl but since the latter requires a platform- 29 | # specific configuration we rely on the folly manifest to provide this 30 | # dependency to avoid duplication. 31 | 32 | [shipit.pathmap] 33 | fbcode/cachelib = cachelib 34 | fbcode/cachelib/public_tld = . 35 | 36 | [shipit.strip] 37 | ^fbcode/cachelib/examples(/|$) 38 | ^fbcode/cachelib/facebook(/|$) 39 | ^fbcode/cachelib/public_tld/website/docs/facebook(/|$) 40 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/clang: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = clang 3 | 4 | [rpms] 5 | clang15-devel 6 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/cmake: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = cmake 3 | 4 | [homebrew] 5 | cmake 6 | 7 | # 18.04 cmake is too old 8 | [debs.not(all(distro=ubuntu,distro_vers="18.04"))] 9 | cmake 10 | 11 | [rpms] 12 | cmake 13 | 14 | [pps] 15 | cmake 16 | 17 | [dependencies] 18 | ninja 19 | 20 | [download.os=windows] 21 | url = https://github.com/Kitware/CMake/releases/download/v3.20.2/cmake-3.20.2-windows-x86_64.zip 22 | sha256 = 15a49e2ab81c1822d75b1b1a92f7863f58e31f6d6aac1c4103eef2b071be3112 23 | 24 | [download.os=darwin] 25 | url = https://github.com/Kitware/CMake/releases/download/v3.20.2/cmake-3.20.2-macos-universal.tar.gz 26 | sha256 = 0100663380a3bd977b001183cd487412db7aad9de6859927bde97e1e6e44e645 27 | 28 | [download.any(os=linux,os=freebsd)] 29 | url = https://github.com/Kitware/CMake/releases/download/v3.20.2/cmake-3.20.2.tar.gz 30 | sha256 = aecf6ecb975179eb3bb6a4a50cae192d41e92b9372b02300f9e8f1d5f559544e 31 | 32 | [build.os=windows] 33 | builder = nop 34 | subdir = cmake-3.20.2-windows-x86_64 35 | 36 | [build.os=darwin] 37 | builder = nop 38 | subdir = cmake-3.20.2-macos-universal 39 | 40 | [install.files.os=darwin] 41 | CMake.app/Contents/bin = bin 42 | CMake.app/Contents/share = share 43 | 44 | [build.any(os=linux,os=freebsd)] 45 | builder = cmakebootstrap 46 | subdir = cmake-3.20.2 47 | 48 | [make.install_args.any(os=linux,os=freebsd)] 49 | install 50 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/cpptoml: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = cpptoml 3 | 4 | [homebrew] 5 | cpptoml 6 | 7 | [download] 8 | url = https://github.com/chadaustin/cpptoml/archive/refs/tags/v0.1.2.tar.gz 9 | sha256 = beda37e94f9746874436c8090c045fd80ae6f8a51f7c668c932a2b110a4fc277 10 | 11 | [build] 12 | builder = cmake 13 | subdir = cpptoml-0.1.2 14 | 15 | [cmake.defines.os=freebsd] 16 | ENABLE_LIBCXX=NO 17 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/double-conversion: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = double-conversion 3 | 4 | [download] 5 | url = https://github.com/google/double-conversion/archive/v3.1.4.tar.gz 6 | sha256 = 95004b65e43fefc6100f337a25da27bb99b9ef8d4071a36a33b5e83eb1f82021 7 | 8 | [homebrew] 9 | double-conversion 10 | 11 | [debs] 12 | libdouble-conversion-dev 13 | 14 | [rpms] 15 | double-conversion 16 | double-conversion-devel 17 | 18 | [pps] 19 | double-conversion 20 | 21 | [build] 22 | builder = cmake 23 | subdir = double-conversion-3.1.4 24 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/edencommon: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = edencommon 3 | fbsource_path = fbcode/eden/common 4 | shipit_project = edencommon 5 | shipit_fbcode_builder = true 6 | 7 | [git] 8 | repo_url = https://github.com/facebookexperimental/edencommon.git 9 | 10 | [build] 11 | builder = cmake 12 | 13 | [dependencies] 14 | fbthrift 15 | fb303 16 | fmt 17 | folly 18 | gflags 19 | glog 20 | 21 | [cmake.defines.test=on] 22 | BUILD_TESTS=ON 23 | 24 | [cmake.defines.test=off] 25 | BUILD_TESTS=OFF 26 | 27 | [shipit.pathmap] 28 | fbcode/eden/common = eden/common 29 | fbcode/eden/common/oss = . 30 | 31 | [shipit.strip] 32 | @README.facebook@ 33 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/exprtk: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = exprtk 3 | 4 | [download] 5 | url = https://github.com/ArashPartow/exprtk/archive/refs/tags/0.0.1.tar.gz 6 | sha256 = fb72791c88ae3b3426e14fdad630027715682584daf56b973569718c56e33f28 7 | 8 | [build.not(os=windows)] 9 | builder = nop 10 | subdir = exprtk-0.0.1 11 | 12 | [install.files] 13 | exprtk.hpp = exprtk.hpp 14 | 15 | [dependencies] 16 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/fast_float: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = fast_float 3 | 4 | [download] 5 | url = https://github.com/fastfloat/fast_float/archive/refs/tags/v8.0.0.tar.gz 6 | sha256 = f312f2dc34c61e665f4b132c0307d6f70ad9420185fa831911bc24408acf625d 7 | 8 | [build] 9 | builder = cmake 10 | subdir = fast_float-8.0.0 11 | 12 | [cmake.defines] 13 | FASTFLOAT_TEST = OFF 14 | FASTFLOAT_SANITIZE = OFF 15 | 16 | [debs.not(all(distro=ubuntu,any(distro_vers="18.04",distro_vers="20.04",distro_vers="22.04",distro_vers="24.04")))] 17 | libfast-float-dev 18 | 19 | [rpms.distro=fedora] 20 | fast_float-devel 21 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/fatal: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = fatal 3 | fbsource_path = fbcode/fatal 4 | shipit_project = fatal 5 | 6 | [git] 7 | repo_url = https://github.com/facebook/fatal.git 8 | 9 | [shipit.pathmap] 10 | fbcode/fatal = fatal 11 | fbcode/fatal/public_tld = . 12 | 13 | [build] 14 | builder = nop 15 | subdir = . 16 | 17 | [install.files] 18 | fatal/portability.h = fatal/portability.h 19 | fatal/preprocessor.h = fatal/preprocessor.h 20 | fatal/container = fatal/container 21 | fatal/functional = fatal/functional 22 | fatal/math = fatal/math 23 | fatal/string = fatal/string 24 | fatal/type = fatal/type 25 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/fb303: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = fb303 3 | fbsource_path = fbcode/fb303 4 | shipit_project = fb303 5 | shipit_fbcode_builder = true 6 | 7 | [git] 8 | repo_url = https://github.com/facebook/fb303.git 9 | 10 | [cargo] 11 | cargo_config_file = source/fb303/thrift/.cargo/config.toml 12 | 13 | [crate.pathmap] 14 | fb303_core = fb303/thrift 15 | 16 | [build] 17 | builder = cmake 18 | 19 | [dependencies] 20 | folly 21 | gflags 22 | glog 23 | fbthrift 24 | 25 | [cmake.defines.test=on] 26 | BUILD_TESTS=ON 27 | 28 | [cmake.defines.test=off] 29 | BUILD_TESTS=OFF 30 | 31 | [shipit.pathmap] 32 | fbcode/fb303/github = . 33 | fbcode/fb303/public_autocargo = fb303 34 | fbcode/fb303 = fb303 35 | 36 | [shipit.strip] 37 | ^fbcode/fb303/(?!public_autocargo).+/Cargo\.toml$ 38 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/fboss: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = fboss 3 | fbsource_path = fbcode/fboss 4 | shipit_project = fboss 5 | shipit_fbcode_builder = true 6 | 7 | [git] 8 | repo_url = https://github.com/facebook/fboss.git 9 | 10 | [build.os=linux] 11 | builder = cmake 12 | # fboss files take a lot of RAM to compile. 13 | job_weight_mib = 3072 14 | 15 | [build.not(os=linux)] 16 | builder = nop 17 | 18 | [dependencies] 19 | folly 20 | fb303 21 | wangle 22 | fizz 23 | fmt 24 | libsodium 25 | googletest 26 | zstd 27 | fatal 28 | fbthrift 29 | iproute2 30 | libusb 31 | libcurl 32 | libnl 33 | libsai 34 | re2 35 | python 36 | yaml-cpp 37 | libyaml 38 | CLI11 39 | exprtk 40 | nlohmann-json 41 | libgpiod 42 | systemd 43 | range-v3 44 | 45 | [shipit.pathmap] 46 | fbcode/fboss/github = . 47 | fbcode/fboss/common = common 48 | fbcode/fboss = fboss 49 | 50 | [sandcastle] 51 | run_tests = off 52 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/fbthrift: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = fbthrift 3 | fbsource_path = xplat/thrift 4 | shipit_project = fbthrift 5 | shipit_fbcode_builder = true 6 | 7 | [git] 8 | repo_url = https://github.com/facebook/fbthrift.git 9 | 10 | [cargo] 11 | cargo_config_file = source/thrift/lib/rust/.cargo/config.toml 12 | 13 | [crate.pathmap] 14 | fbthrift = thrift/lib/rust 15 | 16 | [build] 17 | builder = cmake 18 | job_weight_mib = 2048 19 | 20 | [dependencies] 21 | fizz 22 | fmt 23 | folly 24 | googletest 25 | libsodium 26 | wangle 27 | zstd 28 | mvfst 29 | xxhash 30 | # Thrift also depends on openssl but since the latter requires a platform- 31 | # specific configuration we rely on the folly manifest to provide this 32 | # dependency to avoid duplication. 33 | 34 | [shipit.pathmap] 35 | xplat/thrift/public_tld = . 36 | xplat/thrift = thrift 37 | 38 | [shipit.strip] 39 | ^xplat/thrift/thrift-config\.h$ 40 | ^xplat/thrift/perf/canary.py$ 41 | ^xplat/thrift/perf/loadtest.py$ 42 | ^xplat/thrift/.castle/.* 43 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/fizz: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = fizz 3 | fbsource_path = fbcode/fizz 4 | shipit_project = fizz 5 | shipit_fbcode_builder = true 6 | 7 | [git] 8 | repo_url = https://github.com/facebookincubator/fizz.git 9 | 10 | [build] 11 | builder = cmake 12 | subdir = fizz 13 | 14 | [cmake.defines] 15 | BUILD_EXAMPLES = OFF 16 | 17 | [cmake.defines.test=on] 18 | BUILD_TESTS = ON 19 | 20 | [cmake.defines.all(os=windows, test=on)] 21 | BUILD_TESTS = OFF 22 | 23 | [cmake.defines.test=off] 24 | BUILD_TESTS = OFF 25 | 26 | [dependencies] 27 | folly 28 | liboqs 29 | libsodium 30 | zlib 31 | zstd 32 | 33 | [dependencies.all(test=on, not(os=windows))] 34 | googletest 35 | 36 | [shipit.pathmap] 37 | fbcode/fizz/public_tld = . 38 | fbcode/fizz = fizz 39 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/fmt: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = fmt 3 | 4 | [download] 5 | url = https://github.com/fmtlib/fmt/archive/refs/tags/11.0.2.tar.gz 6 | sha256 = 6cb1e6d37bdcb756dbbe59be438790db409cdb4868c66e888d5df9f13f7c027f 7 | 8 | [build] 9 | builder = cmake 10 | subdir = fmt-11.0.2 11 | 12 | [cmake.defines] 13 | FMT_TEST = OFF 14 | FMT_DOC = OFF 15 | 16 | [homebrew] 17 | fmt 18 | 19 | [rpms.distro=fedora] 20 | fmt-devel 21 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/folly: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = folly 3 | fbsource_path = fbcode/folly 4 | shipit_project = folly 5 | shipit_fbcode_builder = true 6 | 7 | [git] 8 | repo_url = https://github.com/facebook/folly.git 9 | 10 | [build] 11 | builder = cmake 12 | job_weight_mib = 1024 13 | 14 | [dependencies] 15 | gflags 16 | glog 17 | googletest 18 | boost 19 | libdwarf 20 | libevent 21 | libsodium 22 | double-conversion 23 | fast_float 24 | fmt 25 | lz4 26 | snappy 27 | zstd 28 | # no openssl or zlib in the linux case, why? 29 | # these are usually installed on the system 30 | # and are the easiest system deps to pull in. 31 | # In the future we want to be able to express 32 | # that a system dep is sufficient in the manifest 33 | # for eg: openssl and zlib, but for now we don't 34 | # have it. 35 | 36 | # macOS doesn't expose the openssl api so we need 37 | # to build our own. 38 | [dependencies.os=darwin] 39 | openssl 40 | 41 | # Windows has neither openssl nor zlib, so we get 42 | # to provide both 43 | [dependencies.os=windows] 44 | openssl 45 | zlib 46 | 47 | [dependencies.os=linux] 48 | libiberty 49 | libunwind 50 | 51 | # xz depends on autoconf which does not build on 52 | # Windows 53 | [dependencies.not(os=windows)] 54 | xz 55 | 56 | [shipit.pathmap] 57 | fbcode/folly/public_tld = . 58 | fbcode/folly = folly 59 | 60 | [shipit.strip] 61 | ^fbcode/folly/folly-config\.h$ 62 | ^fbcode/folly/public_tld/build/facebook_.* 63 | 64 | [cmake.defines] 65 | BUILD_SHARED_LIBS=OFF 66 | BOOST_LINK_STATIC=ON 67 | 68 | [cmake.defines.os=freebsd] 69 | LIBDWARF_FOUND=NO 70 | 71 | [cmake.defines.test=on] 72 | BUILD_TESTS=ON 73 | BUILD_BENCHMARKS=OFF 74 | 75 | [cmake.defines.test=off] 76 | BUILD_TESTS=OFF 77 | BUILD_BENCHMARKS=OFF 78 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/gflags: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = gflags 3 | 4 | [download] 5 | url = https://github.com/gflags/gflags/archive/v2.2.2.tar.gz 6 | sha256 = 34af2f15cf7367513b352bdcd2493ab14ce43692d2dcd9dfc499492966c64dcf 7 | 8 | [build] 9 | builder = cmake 10 | subdir = gflags-2.2.2 11 | 12 | [cmake.defines] 13 | BUILD_SHARED_LIBS = ON 14 | BUILD_STATIC_LIBS = ON 15 | #BUILD_gflags_nothreads_LIB = OFF 16 | BUILD_gflags_LIB = ON 17 | 18 | [homebrew] 19 | gflags 20 | 21 | [debs] 22 | libgflags-dev 23 | 24 | [rpms.distro=fedora] 25 | gflags-devel 26 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/ghc: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = ghc 3 | 4 | [download.os=linux] 5 | url = https://downloads.haskell.org/~ghc/9.2.8/ghc-9.2.8-x86_64-fedora27-linux.tar.xz 6 | sha256 = 845f63cd365317bb764d81025554a2527dbe315d6fa268c9859e21b911bf2d3c 7 | 8 | [build] 9 | builder = autoconf 10 | subdir = ghc-9.2.8 11 | build_in_src_dir = true 12 | only_install = true 13 | 14 | [make.install_args] 15 | install 16 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/git-lfs: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = git-lfs 3 | 4 | [rpms] 5 | git-lfs 6 | 7 | [debs] 8 | git-lfs 9 | 10 | [homebrew] 11 | git-lfs 12 | 13 | # only used from system packages currently 14 | [build] 15 | builder = nop 16 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/glean: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = glean 3 | fbsource_path = fbcode/glean 4 | shipit_project = facebookincubator/Glean 5 | use_shipit = true 6 | 7 | [shipit.pathmap] 8 | # These are only used by target determinator to trigger builds, the 9 | # real path mappings are in the ShipIt config. 10 | fbcode/glean = glean 11 | fbcode/common/hs = hsthrift 12 | 13 | [subprojects] 14 | hsthrift = hsthrift 15 | 16 | [dependencies] 17 | cabal 18 | ghc 19 | gflags 20 | glog 21 | folly 22 | rocksdb 23 | xxhash 24 | llvm 25 | clang 26 | re2 27 | 28 | [build] 29 | builder = make 30 | 31 | [make.build_args] 32 | cabal-update 33 | all 34 | glean-hie 35 | glass 36 | glean-clang 37 | EXTRA_GHC_OPTS=-j4 +RTS -A32m -n4m -RTS 38 | CABAL_CONFIG_FLAGS=-f-hack-tests -f-typescript-tests -f-python-tests -f-dotnet-tests -f-go-tests -f-rust-tests -f-java-lsif-tests -f-flow-tests 39 | 40 | [make.install_args] 41 | install 42 | 43 | [make.test_args] 44 | test 45 | EXTRA_GHC_OPTS=-j4 +RTS -A32m -n4m -RTS 46 | CABAL_CONFIG_FLAGS=-f-hack-tests -f-typescript-tests -f-python-tests -f-dotnet-tests -f-go-tests -f-rust-tests -f-java-lsif-tests -f-flow-tests 47 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/glog: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = glog 3 | 4 | [download] 5 | url = https://github.com/google/glog/archive/v0.5.0.tar.gz 6 | sha256 = eede71f28371bf39aa69b45de23b329d37214016e2055269b3b5e7cfd40b59f5 7 | 8 | [build] 9 | builder = cmake 10 | subdir = glog-0.5.0 11 | 12 | [dependencies] 13 | gflags 14 | 15 | [cmake.defines] 16 | BUILD_SHARED_LIBS=ON 17 | BUILD_TESTING=NO 18 | WITH_PKGCONFIG=ON 19 | 20 | [cmake.defines.os=freebsd] 21 | HAVE_TR1_UNORDERED_MAP=OFF 22 | HAVE_TR1_UNORDERED_SET=OFF 23 | 24 | [homebrew] 25 | glog 26 | 27 | # on ubuntu glog brings in liblzma-dev, which in turn breaks watchman tests 28 | [debs.not(distro=ubuntu)] 29 | libgoogle-glog-dev 30 | 31 | [rpms.distro=fedora] 32 | glog-devel 33 | 34 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/googletest: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = googletest 3 | 4 | [download] 5 | url = https://github.com/google/googletest/archive/refs/tags/release-1.12.1.tar.gz 6 | sha256 = 81964fe578e9bd7c94dfdb09c8e4d6e6759e19967e397dbea48d1c10e45d0df2 7 | 8 | [build] 9 | builder = cmake 10 | subdir = googletest-release-1.12.1 11 | 12 | [cmake.defines] 13 | # Everything else defaults to the shared runtime, so tell gtest that 14 | # it should not use its choice of the static runtime 15 | gtest_force_shared_crt=ON 16 | 17 | [cmake.defines.os=windows] 18 | BUILD_SHARED_LIBS=ON 19 | 20 | [homebrew] 21 | googletest 22 | 23 | # packaged googletest is too old 24 | [debs.not(all(distro=ubuntu,any(distro_vers="18.04",distro_vers="20.04",distro_vers="22.04")))] 25 | libgtest-dev 26 | libgmock-dev 27 | 28 | [rpms.distro=fedora] 29 | gmock-devel 30 | gtest-devel 31 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/gperf: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = gperf 3 | 4 | [download] 5 | url = http://ftp.gnu.org/pub/gnu/gperf/gperf-3.1.tar.gz 6 | sha256 = 588546b945bba4b70b6a3a616e80b4ab466e3f33024a352fc2198112cdbb3ae2 7 | 8 | [build.not(os=windows)] 9 | builder = autoconf 10 | subdir = gperf-3.1 11 | 12 | [build.os=windows] 13 | builder = nop 14 | 15 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/hexdump: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = hexdump 3 | 4 | [rpms] 5 | util-linux 6 | 7 | [debs] 8 | bsdmainutils 9 | 10 | # only used from system packages currently 11 | [build] 12 | builder = nop 13 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/hsthrift: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = hsthrift 3 | fbsource_path = fbcode/common/hs 4 | shipit_project = facebookincubator/hsthrift 5 | use_shipit = true 6 | 7 | [shipit.pathmap] 8 | # These are only used by target determinator to trigger builds, the 9 | # real path mappings are in the ShipIt config. 10 | fbcode/common/hs = . 11 | 12 | [dependencies] 13 | cabal 14 | ghc 15 | gflags 16 | glog 17 | folly 18 | fbthrift 19 | wangle 20 | fizz 21 | boost 22 | 23 | [build] 24 | builder = make 25 | 26 | [make.build_args] 27 | cabal-update 28 | all 29 | 30 | [make.install_args] 31 | install 32 | 33 | [make.test_args] 34 | test 35 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/iproute2: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = iproute2 3 | 4 | [download] 5 | url = https://mirrors.edge.kernel.org/pub/linux/utils/net/iproute2/iproute2-4.12.0.tar.gz 6 | sha256 = 46612a1e2d01bb31932557bccdb1b8618cae9a439dfffc08ef35ed8e197f14ce 7 | 8 | [build.os=linux] 9 | builder = iproute2 10 | subdir = iproute2-4.12.0 11 | patchfile = iproute2_oss.patch 12 | 13 | [build.not(os=linux)] 14 | builder = nop 15 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/jom: -------------------------------------------------------------------------------- 1 | # jom is compatible with MSVC nmake, but adds the /j argment which 2 | # speeds up openssl build a lot 3 | [manifest] 4 | name = jom 5 | 6 | # see https://download.qt.io/official_releases/jom/changelog.txt for latest version 7 | [download.os=windows] 8 | url = https://download.qt.io/official_releases/jom/jom_1_1_4.zip 9 | sha256 = d533c1ef49214229681e90196ed2094691e8c4a0a0bef0b2c901debcb562682b 10 | 11 | [build.os=windows] 12 | builder = nop 13 | 14 | [install.files.os=windows] 15 | . = bin 16 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/jq: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = jq 3 | 4 | [rpms.distro=fedora] 5 | jq 6 | 7 | [homebrew] 8 | jq 9 | 10 | [download.not(os=windows)] 11 | # we use jq-1.7+ to get fix for number truncation https://github.com/jqlang/jq/pull/1752 12 | url = https://github.com/jqlang/jq/releases/download/jq-1.7.1/jq-1.7.1.tar.gz 13 | sha256 = 478c9ca129fd2e3443fe27314b455e211e0d8c60bc8ff7df703873deeee580c2 14 | 15 | [build.not(os=windows)] 16 | builder = autoconf 17 | subdir = jq-1.7.1 18 | 19 | [build.os=windows] 20 | builder = nop 21 | 22 | [autoconf.args] 23 | # This argument turns off some developers tool and it is recommended in jq's 24 | # README 25 | --disable-maintainer-mode 26 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/katran: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = katran 3 | fbsource_path = fbcode/katran 4 | shipit_project = katran 5 | shipit_fbcode_builder = true 6 | 7 | [git] 8 | repo_url = https://github.com/facebookincubator/katran.git 9 | 10 | [build.not(os=linux)] 11 | builder = nop 12 | 13 | [build.os=linux] 14 | builder = cmake 15 | subdir = . 16 | 17 | [cmake.defines.test=on] 18 | BUILD_TESTS=ON 19 | 20 | [cmake.defines.test=off] 21 | BUILD_TESTS=OFF 22 | 23 | [dependencies] 24 | folly 25 | fizz 26 | libbpf 27 | libmnl 28 | zlib 29 | googletest 30 | fmt 31 | 32 | [debs] 33 | libssl-dev 34 | 35 | [shipit.pathmap] 36 | fbcode/katran/public_root = . 37 | fbcode/katran = katran 38 | 39 | [shipit.strip] 40 | ^fbcode/katran/facebook 41 | ^fbcode/katran/OSS_SYNC 42 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/libaio: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = libaio 3 | 4 | [debs] 5 | libaio-dev 6 | 7 | [rpms.distro=centos_stream] 8 | libaio-devel 9 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/libbpf: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = libbpf 3 | 4 | [download] 5 | url = https://github.com/libbpf/libbpf/archive/refs/tags/v0.7.0.tar.gz 6 | sha256 = 5083588ce5a3a620e395ee1e596af77b4ec5771ffc71cff2af49dfee38c06361 7 | 8 | # BPF only builds on linux, so make it a NOP on other platforms 9 | [build.not(os=linux)] 10 | builder = nop 11 | 12 | [build.os=linux] 13 | builder = make 14 | subdir = libbpf-0.7.0/src 15 | 16 | [make.build_args] 17 | BUILD_STATIC_ONLY=y 18 | 19 | # libbpf-0.3 requires uapi headers >= 5.8 20 | [make.install_args] 21 | install 22 | install_uapi_headers 23 | BUILD_STATIC_ONLY=y 24 | 25 | [dependencies] 26 | libelf 27 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/libcurl: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = libcurl 3 | 4 | [rpms] 5 | libcurl-devel 6 | libcurl-minimal 7 | 8 | [debs] 9 | libcurl4-openssl-dev 10 | 11 | [pps] 12 | libcurl-gnutls 13 | 14 | [download] 15 | url = https://curl.haxx.se/download/curl-7.65.1.tar.gz 16 | sha256 = 821aeb78421375f70e55381c9ad2474bf279fc454b791b7e95fc83562951c690 17 | 18 | [dependencies] 19 | nghttp2 20 | 21 | # We use system OpenSSL on Linux (see folly's manifest for details) 22 | [dependencies.not(os=linux)] 23 | openssl 24 | 25 | [build.not(os=windows)] 26 | builder = autoconf 27 | subdir = curl-7.65.1 28 | 29 | [autoconf.args] 30 | # fboss (which added the libcurl dep) doesn't need ldap so it is disabled here. 31 | # if someone in the future wants to add ldap for something else, it won't hurt 32 | # fboss. However, that would require adding an ldap manifest. 33 | # 34 | # For the same reason, we disable libssh2 and libidn2 which aren't really used 35 | # but would require adding manifests if we don't disable them. 36 | --disable-ldap 37 | --without-libssh2 38 | --without-libidn2 39 | 40 | [build.os=windows] 41 | builder = cmake 42 | subdir = curl-7.65.1 43 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/libdwarf: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = libdwarf 3 | 4 | [rpms] 5 | libdwarf-devel 6 | libdwarf 7 | 8 | [debs] 9 | libdwarf-dev 10 | 11 | [homebrew] 12 | dwarfutils 13 | 14 | [download] 15 | url = https://www.prevanders.net/libdwarf-0.9.2.tar.xz 16 | sha256 = 22b66d06831a76f6a062126cdcad3fcc58540b89a1acb23c99f8861f50999ec3 17 | 18 | [build] 19 | builder = cmake 20 | subdir = libdwarf-0.9.2 21 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/libelf: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = libelf 3 | 4 | [rpms] 5 | elfutils-libelf-devel-static 6 | 7 | [debs] 8 | libelf-dev 9 | 10 | [pps] 11 | libelf 12 | 13 | [download] 14 | url = https://ftp.osuosl.org/pub/blfs/conglomeration/libelf/libelf-0.8.13.tar.gz 15 | sha256 = 591a9b4ec81c1f2042a97aa60564e0cb79d041c52faa7416acb38bc95bd2c76d 16 | 17 | # libelf only makes sense on linux, so make it a NOP on other platforms 18 | [build.not(os=linux)] 19 | builder = nop 20 | 21 | [build.os=linux] 22 | builder = autoconf 23 | subdir = libelf-0.8.13 24 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/libevent: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = libevent 3 | 4 | [debs] 5 | libevent-dev 6 | 7 | [homebrew] 8 | libevent 9 | 10 | [rpms] 11 | libevent-devel 12 | 13 | [pps] 14 | libevent 15 | 16 | # Note that the CMakeLists.txt file is present only in 17 | # git repo and not in the release tarball, so take care 18 | # to use the github generated source tarball rather than 19 | # the explicitly uploaded source tarball 20 | [download] 21 | url = https://github.com/libevent/libevent/releases/download/release-2.1.12-stable/libevent-2.1.12-stable.tar.gz 22 | sha256 = 92e6de1be9ec176428fd2367677e61ceffc2ee1cb119035037a27d346b0403bb 23 | 24 | [build] 25 | builder = cmake 26 | subdir = libevent-2.1.12-stable 27 | 28 | [cmake.defines] 29 | EVENT__DISABLE_TESTS = ON 30 | EVENT__DISABLE_BENCHMARK = ON 31 | EVENT__DISABLE_SAMPLES = ON 32 | EVENT__DISABLE_REGRESS = ON 33 | 34 | [cmake.defines.shared_libs=on] 35 | EVENT__BUILD_SHARED_LIBRARIES = ON 36 | 37 | [cmake.defines.os=windows] 38 | EVENT__LIBRARY_TYPE = STATIC 39 | 40 | [dependencies.not(any(os=linux, os=freebsd))] 41 | openssl 42 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/libffi: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = libffi 3 | 4 | [debs] 5 | libffi-dev 6 | 7 | [homebrew] 8 | libffi 9 | 10 | [rpms] 11 | libffi-devel 12 | libffi 13 | 14 | [pps] 15 | libffi 16 | 17 | [download] 18 | url = https://github.com/libffi/libffi/releases/download/v3.4.2/libffi-3.4.2.tar.gz 19 | sha256 = 540fb721619a6aba3bdeef7d940d8e9e0e6d2c193595bc243241b77ff9e93620 20 | 21 | [build] 22 | builder = autoconf 23 | subdir = libffi-3.4.2 24 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/libgit2: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = libgit2 3 | 4 | [homebrew] 5 | libgit2 6 | 7 | [rpms] 8 | libgit2-devel 9 | 10 | [pps] 11 | libgit2 12 | 13 | # Ubuntu 18.04 libgit2 has clash with libcurl4-openssl-dev as it depends on 14 | # libcurl4-gnutls-dev. Should be ok from 20.04 again 15 | # There is a description at https://github.com/r-hub/sysreqsdb/issues/77 16 | [debs.not(all(distro=ubuntu,distro_vers="18.04"))] 17 | libgit2-dev 18 | 19 | [download] 20 | url = https://github.com/libgit2/libgit2/archive/v0.28.1.tar.gz 21 | sha256 = 0ca11048795b0d6338f2e57717370208c2c97ad66c6d5eac0c97a8827d13936b 22 | 23 | [build] 24 | builder = cmake 25 | subdir = libgit2-0.28.1 26 | 27 | [cmake.defines] 28 | # Could turn this on if we also wanted to add a manifest for libssh2 29 | USE_SSH = OFF 30 | BUILD_CLAR = OFF 31 | # Have to build shared to work around annoying problems with cmake 32 | # mis-parsing the frameworks required to link this on macos :-/ 33 | BUILD_SHARED_LIBS = ON 34 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/libgpiod: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = libgpiod 3 | 4 | [download] 5 | url = https://cdn.kernel.org/pub/software/libs/libgpiod/libgpiod-1.6.tar.xz 6 | sha256 = 62908023d59e8cbb9137ddd14deec50ced862d8f9b8749f288d3dbe7967151ef 7 | 8 | [build] 9 | builder = autoconf 10 | subdir = libgpiod-1.6 11 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/libiberty: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = libiberty 3 | 4 | [rpms] 5 | binutils-devel 6 | binutils 7 | 8 | [debs] 9 | binutils-dev 10 | 11 | [download] 12 | url = https://ftp.gnu.org/gnu/binutils/binutils-2.43.tar.xz 13 | sha256 = b53606f443ac8f01d1d5fc9c39497f2af322d99e14cea5c0b4b124d630379365 14 | 15 | [dependencies] 16 | zlib 17 | 18 | [build] 19 | builder = autoconf 20 | subdir = binutils-2.43/libiberty 21 | patchfile = libiberty_install_pic_lib.patch 22 | 23 | # only build the parts needed for demangling 24 | # as we still want to use system linker and assembler etc 25 | [autoconf.args] 26 | --enable-install-libiberty 27 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/libmnl: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = libmnl 3 | 4 | [rpms] 5 | libmnl-devel 6 | 7 | # all centos 8 distros are missing this, 8 | # but its in fedora so may be back in a later version 9 | [rpms.not(all(any(distro=centos_stream,distro=centos),distro_vers=8))] 10 | libmnl-static 11 | 12 | [debs] 13 | libmnl-dev 14 | 15 | [pps] 16 | libmnl 17 | 18 | [download] 19 | url = http://www.netfilter.org/pub/libmnl/libmnl-1.0.4.tar.bz2 20 | sha256 = 171f89699f286a5854b72b91d06e8f8e3683064c5901fb09d954a9ab6f551f81 21 | 22 | [build.os=linux] 23 | builder = autoconf 24 | subdir = libmnl-1.0.4 25 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/libnl: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = libnl 3 | 4 | [rpms] 5 | libnl3-devel 6 | libnl3 7 | 8 | [debs] 9 | libnl-3-dev 10 | libnl-route-3-dev 11 | 12 | [pps] 13 | libnl 14 | 15 | [download] 16 | url = https://github.com/thom311/libnl/releases/download/libnl3_2_25/libnl-3.2.25.tar.gz 17 | sha256 = 8beb7590674957b931de6b7f81c530b85dc7c1ad8fbda015398bc1e8d1ce8ec5 18 | 19 | [build.os=linux] 20 | builder = autoconf 21 | subdir = libnl-3.2.25 22 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/liboqs: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = liboqs 3 | 4 | [download] 5 | url = https://github.com/open-quantum-safe/liboqs/archive/refs/tags/0.12.0.tar.gz 6 | sha256 = df999915204eb1eba311d89e83d1edd3a514d5a07374745d6a9e5b2dd0d59c08 7 | 8 | [build] 9 | builder = cmake 10 | subdir = liboqs-0.12.0 11 | 12 | [cmake.defines] 13 | OQS_MINIMAL_BUILD = KEM_kyber_512;KEM_kyber_768;KEM_kyber_1024;KEM_ml_kem_512;KEM_ml_kem_768;KEM_ml_kem_1024 14 | 15 | [dependencies] 16 | openssl 17 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/libsai: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = libsai 3 | 4 | [download] 5 | url = https://github.com/opencomputeproject/SAI/archive/v1.14.0.tar.gz 6 | sha256 = 4e3a1d010bda0c589db46e077725a2cd9624a5cc255c89d1caa79deb408d1fa7 7 | 8 | [build] 9 | builder = nop 10 | subdir = SAI-1.14.0 11 | 12 | [install.files] 13 | inc = include 14 | experimental = experimental 15 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/libsodium: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = libsodium 3 | 4 | [debs] 5 | libsodium-dev 6 | 7 | [homebrew] 8 | libsodium 9 | 10 | [rpms] 11 | libsodium-devel 12 | libsodium-static 13 | 14 | [pps] 15 | libsodium 16 | 17 | [download.not(os=windows)] 18 | url = https://github.com/jedisct1/libsodium/releases/download/1.0.20-RELEASE/libsodium-1.0.20.tar.gz 19 | sha256 = ebb65ef6ca439333c2bb41a0c1990587288da07f6c7fd07cb3a18cc18d30ce19 20 | 21 | [build.not(os=windows)] 22 | builder = autoconf 23 | subdir = libsodium-1.0.20 24 | 25 | [download.os=windows] 26 | url = https://github.com/jedisct1/libsodium/releases/download/1.0.20-RELEASE/libsodium-1.0.20-msvc.zip 27 | sha256 = 2ff97f9e3f5b341bdc808e698057bea1ae454f99e29ff6f9b62e14d0eb1b1baa 28 | 29 | [build.os=windows] 30 | builder = nop 31 | 32 | [install.files.os=windows] 33 | libsodium/x64/Release/v143/dynamic/libsodium.dll = bin/libsodium.dll 34 | libsodium/x64/Release/v143/dynamic/libsodium.lib = lib/libsodium.lib 35 | libsodium/x64/Release/v143/dynamic/libsodium.exp = lib/libsodium.exp 36 | libsodium/x64/Release/v143/dynamic/libsodium.pdb = lib/libsodium.pdb 37 | libsodium/include = include 38 | 39 | [autoconf.args] 40 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/libtool: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = libtool 3 | 4 | [homebrew] 5 | libtool 6 | 7 | [rpms] 8 | libtool 9 | 10 | [debs] 11 | libtool 12 | 13 | [pps] 14 | libtool 15 | 16 | [download] 17 | url = http://ftp.gnu.org/gnu/libtool/libtool-2.4.6.tar.gz 18 | sha256 = e3bd4d5d3d025a36c21dd6af7ea818a2afcd4dfc1ea5a17b39d7854bcd0c06e3 19 | 20 | [build] 21 | builder = autoconf 22 | subdir = libtool-2.4.6 23 | 24 | [dependencies] 25 | automake 26 | 27 | [autoconf.args] 28 | --enable-ltdl-install 29 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/libunwind: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = libunwind 3 | 4 | [rpms] 5 | libunwind-devel 6 | libunwind 7 | 8 | # on ubuntu this brings in liblzma-dev, which in turn breaks watchman tests 9 | [debs.not(distro=ubuntu)] 10 | libunwind-dev 11 | 12 | # The current libunwind v1.8.1 release has compiler issues with aarch64 (https://github.com/libunwind/libunwind/issues/702). 13 | # This more recent libunwind version (based on the latest commit, not a release version) got it fixed. 14 | [download] 15 | url = https://github.com/libunwind/libunwind/archive/f081cf42917bdd5c428b77850b473f31f81767cf.tar.gz 16 | sha256 = 4ff5c335c02d225491d6c885db827fb5fa505fee4e68b4d7e866efc0087e7264 17 | 18 | [build] 19 | builder = autoconf 20 | subdir = libunwind-f081cf42917bdd5c428b77850b473f31f81767cf 21 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/libusb: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = libusb 3 | 4 | [debs] 5 | libusb-1.0-0-dev 6 | 7 | [homebrew] 8 | libusb 9 | 10 | [rpms] 11 | libusb-devel 12 | libusb 13 | 14 | [pps] 15 | libusb 16 | 17 | [download] 18 | url = https://github.com/libusb/libusb/releases/download/v1.0.22/libusb-1.0.22.tar.bz2 19 | sha256 = 75aeb9d59a4fdb800d329a545c2e6799f732362193b465ea198f2aa275518157 20 | 21 | [build.os=linux] 22 | builder = autoconf 23 | subdir = libusb-1.0.22 24 | 25 | [autoconf.args] 26 | # fboss (which added the libusb dep) doesn't need udev so it is disabled here. 27 | # if someone in the future wants to add udev for something else, it won't hurt 28 | # fboss. 29 | --disable-udev 30 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/libyaml: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = libyaml 3 | 4 | [download] 5 | url = http://pyyaml.org/download/libyaml/yaml-0.1.7.tar.gz 6 | sha256 = 8088e457264a98ba451a90b8661fcb4f9d6f478f7265d48322a196cec2480729 7 | 8 | [build.os=linux] 9 | builder = autoconf 10 | subdir = yaml-0.1.7 11 | 12 | [build.not(os=linux)] 13 | builder = nop 14 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/llvm: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = llvm 3 | 4 | [rpms] 5 | llvm15-devel 6 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/lmdb: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = lmdb 3 | 4 | [build] 5 | builder = make 6 | subdir = lmdb-LMDB_0.9.31/libraries/liblmdb 7 | 8 | [download] 9 | url = https://github.com/LMDB/lmdb/archive/refs/tags/LMDB_0.9.31.tar.gz 10 | sha256 = dd70a8c67807b3b8532b3e987b0a4e998962ecc28643e1af5ec77696b081c9b0 11 | 12 | [make.build_args] 13 | BUILD_STATIC_ONLY=y 14 | 15 | [make.install_args] 16 | install 17 | BUILD_STATIC_ONLY=y 18 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/lz4: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = lz4 3 | 4 | [homebrew] 5 | lz4 6 | 7 | [rpms] 8 | lz4-devel 9 | # centos 8 and centos_stream 9 are missing this rpm 10 | [rpms.not(any(all(distro=centos,distro_vers=8),all(distro=centos_stream,distro_vers=9)))] 11 | lz4-static 12 | 13 | [debs] 14 | liblz4-dev 15 | 16 | [pps] 17 | lz4 18 | 19 | [download] 20 | url = https://github.com/lz4/lz4/archive/v1.8.3.tar.gz 21 | sha256 = 33af5936ac06536805f9745e0b6d61da606a1f8b4cc5c04dd3cbaca3b9b4fc43 22 | 23 | [build] 24 | builder = cmake 25 | subdir = lz4-1.8.3/contrib/cmake_unofficial 26 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/mcrouter: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = mcrouter 3 | 4 | [git] 5 | repo_url = https://github.com/facebook/mcrouter.git 6 | 7 | [dependencies] 8 | folly 9 | wangle 10 | fizz 11 | fbthrift 12 | mvfst 13 | ragel 14 | 15 | [build] 16 | builder = cmake 17 | subdir = . 18 | 19 | [cmake.defines.test=on] 20 | BUILD_TESTS=ON 21 | 22 | [cmake.defines.test=off] 23 | BUILD_TESTS=OFF 24 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/mononoke: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = mononoke 3 | fbsource_path = fbcode/eden 4 | shipit_project = eden 5 | shipit_fbcode_builder = true 6 | 7 | [git] 8 | repo_url = https://github.com/facebook/sapling.git 9 | 10 | [build.not(os=windows)] 11 | builder = cargo 12 | 13 | [build.os=windows] 14 | # building Mononoke on windows is not supported 15 | builder = nop 16 | 17 | [cargo] 18 | build_doc = true 19 | workspace_dir = eden/mononoke 20 | 21 | [shipit.pathmap] 22 | fbcode/configerator/structs/scm/hg = configerator/structs/scm/hg 23 | fbcode/configerator/structs/scm/hg/public_autocargo = configerator/structs/scm/hg 24 | fbcode/configerator/structs/scm/mononoke/public_autocargo = configerator/structs/scm/mononoke 25 | fbcode/configerator/structs/scm/mononoke = configerator/structs/scm/mononoke 26 | fbcode/eden/oss = . 27 | fbcode/eden = eden 28 | fbcode/eden/fs/public_autocargo = eden/fs 29 | fbcode/eden/mononoke/public_autocargo = eden/mononoke 30 | fbcode/eden/scm/public_autocargo = eden/scm 31 | fbcode/tools/lfs = tools/lfs 32 | tools/rust/ossconfigs = . 33 | 34 | [shipit.strip] 35 | ^fbcode/configerator/structs/scm/hg(?!/public_autocargo).*/Cargo\.toml$ 36 | ^fbcode/configerator/structs/scm/mononoke(?!/public_autocargo).*/Cargo\.toml$ 37 | ^fbcode/eden/fs(?!/public_autocargo).*/Cargo\.toml$ 38 | ^fbcode/eden/scm/lib/third-party/rust/.*/Cargo\.toml$ 39 | ^fbcode/eden/mononoke(?!/public_autocargo).*/Cargo\.toml$ 40 | # strip other scm code unrelated to mononoke to prevent triggering unnecessary checks 41 | ^fbcode/eden(?!/mononoke|/scm/(lib|public_autocargo))/.*$ 42 | ^.*/facebook/.*$ 43 | ^.*/fb/.*$ 44 | 45 | [dependencies] 46 | fb303 47 | fbthrift 48 | rust-shed 49 | 50 | [dependencies.fb=on] 51 | rust 52 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/mononoke_integration: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = mononoke_integration 3 | fbsource_path = fbcode/eden 4 | shipit_project = eden 5 | shipit_fbcode_builder = true 6 | 7 | [git] 8 | repo_url = https://github.com/facebook/sapling.git 9 | 10 | [build.not(os=windows)] 11 | builder = make 12 | subdir = eden/mononoke/tests/integration 13 | 14 | [build.os=windows] 15 | # building Mononoke on windows is not supported 16 | builder = nop 17 | 18 | [make.build_args] 19 | build-getdeps 20 | 21 | [make.install_args] 22 | install-getdeps 23 | 24 | [make.test_args] 25 | test-getdeps 26 | 27 | [shipit.pathmap] 28 | fbcode/eden/mononoke/tests/integration = eden/mononoke/tests/integration 29 | 30 | [shipit.strip] 31 | ^.*/facebook/.*$ 32 | ^.*/fb/.*$ 33 | 34 | [dependencies] 35 | git-lfs 36 | jq 37 | mononoke 38 | nmap 39 | python 40 | python-click 41 | ripgrep 42 | sapling 43 | tree 44 | zstd 45 | 46 | [dependencies.os=linux] 47 | sqlite3 48 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/mvfst: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = mvfst 3 | fbsource_path = fbcode/quic 4 | shipit_project = mvfst 5 | shipit_fbcode_builder = true 6 | 7 | [git] 8 | repo_url = https://github.com/facebook/mvfst.git 9 | 10 | [build] 11 | builder = cmake 12 | subdir = . 13 | 14 | [cmake.defines.test=on] 15 | BUILD_TESTS = ON 16 | 17 | [cmake.defines.all(os=windows, test=on)] 18 | BUILD_TESTS = OFF 19 | 20 | [cmake.defines.test=off] 21 | BUILD_TESTS = OFF 22 | 23 | [dependencies] 24 | folly 25 | fizz 26 | 27 | [dependencies.all(test=on, not(os=windows))] 28 | googletest 29 | 30 | [shipit.pathmap] 31 | fbcode/quic/public_root = . 32 | fbcode/quic = quic 33 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/ncurses: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = ncurses 3 | 4 | [debs] 5 | libncurses-dev 6 | 7 | [homebrew] 8 | ncurses 9 | 10 | [rpms] 11 | ncurses-devel 12 | 13 | [download] 14 | url = https://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.3.tar.gz 15 | sha256 = 97fc51ac2b085d4cde31ef4d2c3122c21abc217e9090a43a30fc5ec21684e059 16 | 17 | [build.not(os=windows)] 18 | builder = autoconf 19 | subdir = ncurses-6.3 20 | 21 | [autoconf.args] 22 | --without-cxx-binding 23 | --without-ada 24 | 25 | [autoconf.args.os=linux] 26 | --enable-shared 27 | --with-shared 28 | 29 | [build.os=windows] 30 | builder = nop 31 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/nghttp2: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = nghttp2 3 | 4 | [rpms] 5 | libnghttp2-devel 6 | libnghttp2 7 | 8 | [debs] 9 | libnghttp2-dev 10 | 11 | [pps] 12 | libnghttp2 13 | 14 | [download] 15 | url = https://github.com/nghttp2/nghttp2/releases/download/v1.47.0/nghttp2-1.47.0.tar.gz 16 | sha256 = 62f50f0e9fc479e48b34e1526df8dd2e94136de4c426b7680048181606832b7c 17 | 18 | [build] 19 | builder = autoconf 20 | subdir = nghttp2-1.47.0 21 | 22 | [autoconf.args] 23 | --enable-lib-only 24 | --disable-dependency-tracking 25 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/ninja: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = ninja 3 | 4 | [debs] 5 | ninja-build 6 | 7 | [homebrew] 8 | ninja 9 | 10 | [rpms] 11 | ninja-build 12 | 13 | [pps] 14 | ninja 15 | 16 | [download.os=windows] 17 | url = https://github.com/ninja-build/ninja/releases/download/v1.10.2/ninja-win.zip 18 | sha256 = bbde850d247d2737c5764c927d1071cbb1f1957dcabda4a130fa8547c12c695f 19 | 20 | [build.os=windows] 21 | builder = nop 22 | 23 | [install.files.os=windows] 24 | ninja.exe = bin/ninja.exe 25 | 26 | [download.not(os=windows)] 27 | url = https://github.com/ninja-build/ninja/archive/v1.10.2.tar.gz 28 | sha256 = ce35865411f0490368a8fc383f29071de6690cbadc27704734978221f25e2bed 29 | 30 | [build.not(os=windows)] 31 | builder = ninja_bootstrap 32 | subdir = ninja-1.10.2 33 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/nlohmann-json: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = nlohmann-json 3 | 4 | [download] 5 | url = https://github.com/nlohmann/json/archive/refs/tags/v3.10.5.tar.gz 6 | sha256 = 5daca6ca216495edf89d167f808d1d03c4a4d929cef7da5e10f135ae1540c7e4 7 | 8 | [dependencies] 9 | 10 | [build] 11 | builder = cmake 12 | subdir = json-3.10.5 13 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/nmap: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = nmap 3 | 4 | [rpms] 5 | nmap 6 | nmap-ncat 7 | 8 | [debs] 9 | nmap 10 | 11 | # 18.04 combines ncat into the nmap package, newer need the separate one 12 | [debs.not(all(distro=ubuntu,distro_vers="18.04"))] 13 | ncat 14 | 15 | [download.not(os=windows)] 16 | url = https://api.github.com/repos/nmap/nmap/tarball/ef8213a36c2e89233c806753a57b5cd473605408 17 | sha256 = eda39e5a8ef4964fac7db16abf91cc11ff568eac0fa2d680b0bfa33b0ed71f4a 18 | 19 | [build.not(os=windows)] 20 | builder = autoconf 21 | subdir = nmap-nmap-ef8213a 22 | build_in_src_dir = true 23 | 24 | [build.os=windows] 25 | builder = nop 26 | 27 | [autoconf.args] 28 | # Without this option the build was filing to find some third party libraries 29 | # that we don't need 30 | enable_rdma=no 31 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/numa: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = numa 3 | 4 | [download] 5 | url = https://github.com/numactl/numactl/releases/download/v2.0.19/numactl-2.0.19.tar.gz 6 | sha256 = f2672a0381cb59196e9c246bf8bcc43d5568bc457700a697f1a1df762b9af884 7 | 8 | [build] 9 | builder = autoconf 10 | subdir = numactl-2.0.19 11 | 12 | [rpms.distro=centos_stream] 13 | numactl-devel 14 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/openr: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = openr 3 | fbsource_path = facebook/openr 4 | shipit_project = openr 5 | shipit_fbcode_builder = true 6 | 7 | [git] 8 | repo_url = https://github.com/facebook/openr.git 9 | 10 | [build.os=linux] 11 | builder = cmake 12 | # openr files take a lot of RAM to compile. 13 | job_weight_mib = 3072 14 | 15 | [build.not(os=linux)] 16 | # boost.fiber is required and that is not available on macos. 17 | builder = nop 18 | 19 | [dependencies] 20 | boost 21 | fb303 22 | fbthrift 23 | folly 24 | googletest 25 | re2 26 | range-v3 27 | 28 | [cmake.defines.test=on] 29 | BUILD_TESTS=ON 30 | ADD_ROOT_TESTS=OFF 31 | 32 | [cmake.defines.test=off] 33 | BUILD_TESTS=OFF 34 | 35 | 36 | [shipit.pathmap] 37 | fbcode/openr = openr 38 | fbcode/openr/public_tld = . 39 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/openssl: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = openssl 3 | 4 | [debs] 5 | libssl-dev 6 | 7 | [homebrew] 8 | openssl 9 | # on homebrew need the matching curl and ca- 10 | 11 | [rpms] 12 | openssl 13 | openssl-devel 14 | openssl-libs 15 | 16 | [pps] 17 | openssl 18 | 19 | # no need to download on the systems where we always use the system libs 20 | [download.not(any(os=linux, os=freebsd))] 21 | # match the openssl version packages in ubuntu LTS folly current supports 22 | url = https://www.openssl.org/source/openssl-3.0.15.tar.gz 23 | sha256 = 23c666d0edf20f14249b3d8f0368acaee9ab585b09e1de82107c66e1f3ec9533 24 | 25 | # We use the system openssl on these platforms even without --allow-system-packages 26 | [build.any(os=linux, os=freebsd)] 27 | builder = nop 28 | 29 | [build.not(any(os=linux, os=freebsd))] 30 | builder = openssl 31 | subdir = openssl-3.0.15 32 | 33 | [dependencies.os=windows] 34 | jom 35 | perl 36 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/osxfuse: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = osxfuse 3 | 4 | [download] 5 | url = https://github.com/osxfuse/osxfuse/archive/osxfuse-3.8.3.tar.gz 6 | sha256 = 93bab6731bdfe8dc1ef069483437270ce7fe5a370f933d40d8d0ef09ba846c0c 7 | 8 | [build] 9 | builder = nop 10 | 11 | [install.files] 12 | osxfuse-osxfuse-3.8.3/common = include 13 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/patchelf: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = patchelf 3 | 4 | [rpms] 5 | patchelf 6 | 7 | [debs] 8 | patchelf 9 | 10 | [pps] 11 | patchelf 12 | 13 | [download] 14 | url = https://github.com/NixOS/patchelf/archive/0.10.tar.gz 15 | sha256 = b3cb6bdedcef5607ce34a350cf0b182eb979f8f7bc31eae55a93a70a3f020d13 16 | 17 | [build] 18 | builder = autoconf 19 | subdir = patchelf-0.10 20 | 21 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/pcre2: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = pcre2 3 | 4 | [homebrew] 5 | pcre2 6 | 7 | [rpms] 8 | pcre2-devel 9 | pcre-static 10 | 11 | [debs] 12 | libpcre2-dev 13 | 14 | [download] 15 | url = https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.40/pcre2-10.40.tar.bz2 16 | sha256 = 14e4b83c4783933dc17e964318e6324f7cae1bc75d8f3c79bc6969f00c159d68 17 | 18 | [build] 19 | builder = cmake 20 | subdir = pcre2-10.40 21 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/perl: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = perl 3 | 4 | [download.os=windows] 5 | url = http://strawberryperl.com/download/5.28.1.1/strawberry-perl-5.28.1.1-64bit-portable.zip 6 | sha256 = 935c95ba096fa11c4e1b5188732e3832d330a2a79e9882ab7ba8460ddbca810d 7 | 8 | [build.os=windows] 9 | builder = nop 10 | subdir = perl 11 | 12 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/pexpect: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = pexpect 3 | 4 | [download] 5 | url = https://files.pythonhosted.org/packages/0e/3e/377007e3f36ec42f1b84ec322ee12141a9e10d808312e5738f52f80a232c/pexpect-4.7.0-py2.py3-none-any.whl 6 | sha256 = 2094eefdfcf37a1fdbfb9aa090862c1a4878e5c7e0e7e7088bdb511c558e5cd1 7 | 8 | [build] 9 | builder = python-wheel 10 | 11 | [dependencies] 12 | python-ptyprocess 13 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/proxygen: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = proxygen 3 | fbsource_path = fbcode/proxygen 4 | shipit_project = proxygen 5 | shipit_fbcode_builder = true 6 | 7 | [git] 8 | repo_url = https://github.com/facebook/proxygen.git 9 | 10 | [build.os=windows] 11 | builder = nop 12 | 13 | [build] 14 | builder = cmake 15 | subdir = . 16 | job_weight_mib = 3072 17 | 18 | [cmake.defines.test=on] 19 | BUILD_TESTS = ON 20 | 21 | [cmake.defines.test=off] 22 | BUILD_TESTS = OFF 23 | 24 | [dependencies] 25 | zlib 26 | gperf 27 | folly 28 | fizz 29 | wangle 30 | mvfst 31 | 32 | [dependencies.test=on] 33 | googletest 34 | 35 | [shipit.pathmap] 36 | fbcode/proxygen/public_tld = . 37 | fbcode/proxygen = proxygen 38 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/python: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = python 3 | 4 | [homebrew] 5 | python@3.8 6 | 7 | [rpms] 8 | python3 9 | python3-devel 10 | 11 | # sapling needs dataclasses which arrive in 3.7, and the bionic python is 3.6 12 | [debs.all(distro=ubuntu,distro_vers="18.04")] 13 | python3.8-dev 14 | 15 | [debs.not(all(distro=ubuntu,distro_vers="18.04"))] 16 | python3-all-dev 17 | 18 | [pps] 19 | python3 20 | 21 | [download] 22 | url = https://www.python.org/ftp/python/3.8.13/Python-3.8.13.tgz 23 | sha256 = 903b92d76354366b1d9c4434d0c81643345cef87c1600adfa36095d7b00eede4 24 | 25 | [build] 26 | builder = autoconf 27 | subdir = Python-3.8.13 28 | 29 | [autoconf.args] 30 | --enable-shared 31 | --with-ensurepip=install 32 | 33 | # python's pkg-config libffi detection is broken 34 | # See https://bugs.python.org/issue34823 for clearest description 35 | # and pending PR https://github.com/python/cpython/pull/20451 36 | # The documented workaround requires an environment variable derived from 37 | # pkg-config to be passed into its configure step 38 | [autoconf.envcmd.LDFLAGS] 39 | pkg-config 40 | --libs-only-L 41 | libffi 42 | 43 | [dependencies] 44 | libffi 45 | # eden tests expect the python bz2 support 46 | bz2 47 | # eden tests expect the python curses support 48 | ncurses 49 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/python-click: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = python-click 3 | 4 | [download] 5 | url = https://files.pythonhosted.org/packages/d2/3d/fa76db83bf75c4f8d338c2fd15c8d33fdd7ad23a9b5e57eb6c5de26b430e/click-7.1.2-py2.py3-none-any.whl 6 | sha256 = dacca89f4bfadd5de3d7489b7c8a566eee0d3676333fbb50030263894c38c0dc 7 | 8 | [build] 9 | builder = python-wheel 10 | 11 | [rpms] 12 | python3-click 13 | 14 | [debs] 15 | python3-click 16 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/python-filelock: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = python-filelock 3 | 4 | [download] 5 | url = https://files.pythonhosted.org/packages/31/24/ee722b92f23b9ebd87783e893a75352c048bbbc1f67dce0d63b58b46cb48/filelock-3.3.2-py3-none-any.whl 6 | sha256 = bb2a1c717df74c48a2d00ed625e5a66f8572a3a30baacb7657add1d7bac4097b 7 | 8 | [build] 9 | builder = python-wheel 10 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/python-ptyprocess: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = python-ptyprocess 3 | 4 | [download] 5 | url = https://files.pythonhosted.org/packages/d1/29/605c2cc68a9992d18dada28206eeada56ea4bd07a239669da41674648b6f/ptyprocess-0.6.0-py2.py3-none-any.whl 6 | sha256 = d7cc528d76e76342423ca640335bd3633420dc1366f258cb31d05e865ef5ca1f 7 | 8 | [build] 9 | builder = python-wheel 10 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/python-setuptools: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = python-setuptools 3 | 4 | [download] 5 | url = https://files.pythonhosted.org/packages/c0/7a/3da654f49c95d0cc6e9549a855b5818e66a917e852ec608e77550c8dc08b/setuptools-69.1.1-py3-none-any.whl 6 | sha256 = 02fa291a0471b3a18b2b2481ed902af520c69e8ae0919c13da936542754b4c56 7 | 8 | [build] 9 | builder = python-wheel 10 | 11 | [rpms] 12 | python3-setuptools 13 | 14 | [homebrew] 15 | python-setuptools 16 | 17 | [debs] 18 | python3-setuptools 19 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/python-six: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = python-six 3 | 4 | [download] 5 | url = https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl 6 | sha256 = 3350809f0555b11f552448330d0b52d5f24c91a322ea4a15ef22629740f3761c 7 | 8 | [build] 9 | builder = python-wheel 10 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/python-toml: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = python-toml 3 | 4 | [download] 5 | url = https://files.pythonhosted.org/packages/a2/12/ced7105d2de62fa7c8fb5fce92cc4ce66b57c95fb875e9318dba7f8c5db0/toml-0.10.0-py2.py3-none-any.whl 6 | sha256 = 235682dd292d5899d361a811df37e04a8828a5b1da3115886b73cf81ebc9100e 7 | 8 | [build] 9 | builder = python-wheel 10 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/ragel: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = ragel 3 | 4 | [debs] 5 | ragel 6 | 7 | [homebrew] 8 | ragel 9 | 10 | [rpms] 11 | ragel 12 | 13 | [download] 14 | url = https://www.colm.net/files/ragel/ragel-6.10.tar.gz 15 | sha256 = 5f156edb65d20b856d638dd9ee2dfb43285914d9aa2b6ec779dac0270cd56c3f 16 | 17 | [build] 18 | builder = autoconf 19 | subdir = ragel-6.10 20 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/range-v3: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = range-v3 3 | 4 | [download] 5 | url = https://github.com/ericniebler/range-v3/archive/refs/tags/0.11.0.tar.gz 6 | sha256 = 376376615dbba43d3bef75aa590931431ecb49eb36d07bb726a19f680c75e20c 7 | 8 | 9 | [build] 10 | builder = cmake 11 | subdir = range-v3-0.11.0 12 | 13 | [cmake.defines] 14 | RANGE_V3_EXAMPLES=OFF 15 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/re2: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = re2 3 | 4 | [homebrew] 5 | re2 6 | 7 | [debs] 8 | libre2-dev 9 | 10 | [rpms] 11 | re2 12 | re2-devel 13 | 14 | [pps] 15 | re2 16 | 17 | [download] 18 | url = https://github.com/google/re2/archive/2020-11-01.tar.gz 19 | sha256 = 8903cc66c9d34c72e2bc91722288ebc7e3ec37787ecfef44d204b2d6281954d7 20 | 21 | [build] 22 | builder = cmake 23 | subdir = re2-2020-11-01 24 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/ripgrep: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = ripgrep 3 | 4 | [rpms] 5 | ripgrep 6 | 7 | [debs] 8 | ripgrep 9 | 10 | [homebrew] 11 | ripgrep 12 | 13 | # only used from system packages currently 14 | [build] 15 | builder = nop 16 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/rocksdb: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = rocksdb 3 | 4 | [download] 5 | url = https://github.com/facebook/rocksdb/archive/refs/tags/v8.7.3.zip 6 | sha256 = 36c06b61dc167f2455990d60dd88d734b73aa8c4dfc095243efd0243834c6cd3 7 | 8 | [dependencies] 9 | lz4 10 | snappy 11 | 12 | [build] 13 | builder = cmake 14 | subdir = rocksdb-8.7.3 15 | 16 | [cmake.defines] 17 | WITH_SNAPPY=ON 18 | WITH_LZ4=ON 19 | WITH_TESTS=OFF 20 | WITH_BENCHMARK_TOOLS=OFF 21 | # We get relocation errors with the static gflags lib, 22 | # and there's no clear way to make it pick the shared gflags 23 | # so just turn it off. 24 | WITH_GFLAGS=OFF 25 | # Disable the use of -Werror 26 | FAIL_ON_WARNINGS = OFF 27 | 28 | [cmake.defines.os=windows] 29 | ROCKSDB_INSTALL_ON_WINDOWS=ON 30 | # RocksDB hard codes the paths to the snappy libs to something 31 | # that doesn't exist; ignoring the usual cmake rules. As a result, 32 | # we can't build it with snappy without either patching rocksdb or 33 | # without introducing more complex logic to the build system to 34 | # connect the snappy build outputs to rocksdb's custom logic here. 35 | # Let's just turn it off on windows. 36 | WITH_SNAPPY=OFF 37 | WITH_LZ4=ON 38 | ROCKSDB_SKIP_THIRDPARTY=ON 39 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/rust-shed: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = rust-shed 3 | fbsource_path = fbcode/common/rust/shed 4 | shipit_project = rust-shed 5 | shipit_fbcode_builder = true 6 | 7 | [git] 8 | repo_url = https://github.com/facebookexperimental/rust-shed.git 9 | 10 | [build] 11 | builder = cargo 12 | 13 | [cargo] 14 | build_doc = true 15 | workspace_dir = 16 | 17 | [shipit.pathmap] 18 | fbcode/common/rust/shed = shed 19 | fbcode/common/rust/shed/public_autocargo = shed 20 | fbcode/common/rust/shed/public_tld = . 21 | tools/rust/ossconfigs = . 22 | 23 | [shipit.strip] 24 | ^fbcode/common/rust/shed/(?!public_autocargo|public_tld).+/Cargo\.toml$ 25 | 26 | [dependencies] 27 | fbthrift 28 | fb303 29 | 30 | # We use the system openssl on linux 31 | [dependencies.not(os=linux)] 32 | openssl 33 | 34 | [dependencies.fbsource=on] 35 | rust 36 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/sapling: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = sapling 3 | fbsource_path = fbcode/eden 4 | shipit_project = eden 5 | shipit_fbcode_builder = true 6 | 7 | [github.actions] 8 | required_locales = en_US.UTF-8 9 | 10 | [git] 11 | repo_url = https://github.com/facebook/sapling.git 12 | 13 | [build.not(os=windows)] 14 | builder = make 15 | subdir = eden/scm 16 | 17 | [build.os=windows] 18 | # For now the biggest blocker is missing "make" on windows, but there are bound 19 | # to be more 20 | builder = nop 21 | 22 | [make.build_args] 23 | getdepsbuild 24 | 25 | [make.install_args] 26 | install-getdeps 27 | 28 | [make.test_args] 29 | test-getdeps 30 | 31 | [shipit.pathmap] 32 | fbcode/configerator/structs/scm/hg = configerator/structs/scm/hg 33 | fbcode/configerator/structs/scm/hg/public_autocargo = configerator/structs/scm/hg 34 | fbcode/eden/oss = . 35 | fbcode/eden = eden 36 | fbcode/eden/fs/public_autocargo = eden/fs 37 | fbcode/eden/mononoke/public_autocargo = eden/mononoke 38 | fbcode/eden/scm/public_autocargo = eden/scm 39 | fbcode/tools/lfs = tools/lfs 40 | 41 | [shipit.strip] 42 | ^fbcode/configerator/structs/scm/hg(?!/public_autocargo).*/Cargo\.toml$ 43 | ^fbcode/eden/addons/.*$ 44 | ^fbcode/eden/fs/eden-config\.h$ 45 | ^fbcode/eden/fs/py/eden/config\.py$ 46 | ^fbcode/eden/hg-server/.*$ 47 | ^fbcode/eden/fs(?!/public_autocargo).*/Cargo\.toml$ 48 | ^fbcode/eden/mononoke(?!/public_autocargo).*/Cargo\.toml$ 49 | ^fbcode/eden/scm(?!/public_autocargo|/edenscmnative/bindings).*/Cargo\.toml$ 50 | ^fbcode/eden/scm/build/.*$ 51 | ^fbcode/eden/website/.*$ 52 | ^fbcode/eden/.*/\.cargo/.*$ 53 | ^.*/facebook/.*$ 54 | ^.*/fb/.*$ 55 | /Cargo\.lock$ 56 | \.pyc$ 57 | 58 | [dependencies] 59 | fb303 60 | fbthrift 61 | rust-shed 62 | 63 | [dependencies.all(test=on,not(os=darwin))] 64 | hexdump 65 | 66 | [dependencies.not(os=windows)] 67 | python 68 | python-setuptools 69 | 70 | # We use the system openssl on linux 71 | [dependencies.not(os=linux)] 72 | openssl 73 | 74 | [dependencies.fbsource=on] 75 | rust 76 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/snappy: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = snappy 3 | 4 | [homebrew] 5 | snappy 6 | 7 | [debs] 8 | libsnappy-dev 9 | 10 | [rpms] 11 | snappy-devel 12 | 13 | [pps] 14 | snappy 15 | 16 | [download] 17 | url = https://github.com/google/snappy/archive/1.1.7.tar.gz 18 | sha256 = 3dfa02e873ff51a11ee02b9ca391807f0c8ea0529a4924afa645fbf97163f9d4 19 | 20 | [build] 21 | builder = cmake 22 | subdir = snappy-1.1.7 23 | 24 | [cmake.defines] 25 | SNAPPY_BUILD_TESTS = OFF 26 | 27 | # Avoid problems like `relocation R_X86_64_PC32 against symbol` on ELF systems 28 | # when linking rocksdb, which builds PIC even when building a static lib 29 | [cmake.defines.os=linux] 30 | BUILD_SHARED_LIBS = ON 31 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/sparsemap: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = sparsemap 3 | 4 | [download] 5 | url = https://github.com/Tessil/sparse-map/archive/refs/tags/v0.6.2.tar.gz 6 | sha256 = 7020c21e8752e59d72e37456cd80000e18671c803890a3e55ae36b295eba99f6 7 | 8 | [build] 9 | builder = cmake 10 | subdir = sparse-map-0.6.2/ 11 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/sqlite3: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = sqlite3 3 | 4 | [debs] 5 | libsqlite3-dev 6 | sqlite3 7 | 8 | [homebrew] 9 | sqlite 10 | 11 | [rpms] 12 | sqlite-devel 13 | sqlite-libs 14 | sqlite 15 | 16 | [pps] 17 | sqlite3 18 | 19 | [download] 20 | url = https://sqlite.org/2019/sqlite-amalgamation-3280000.zip 21 | sha256 = d02fc4e95cfef672b45052e221617a050b7f2e20103661cda88387349a9b1327 22 | 23 | [dependencies] 24 | cmake 25 | ninja 26 | 27 | [build] 28 | builder = sqlite 29 | subdir = sqlite-amalgamation-3280000 30 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/systemd: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = systemd 3 | 4 | [rpms] 5 | systemd 6 | systemd-devel 7 | 8 | [download] 9 | url = https://github.com/systemd/systemd/archive/refs/tags/v256.7.tar.gz 10 | sha256 = 896d76ff65c88f5fd9e42f90d152b0579049158a163431dd77cdc57748b1d7b0 11 | 12 | 13 | [build] 14 | builder = systemd 15 | subdir = systemd-256.7 16 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/tree: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = tree 3 | 4 | [debs] 5 | tree 6 | 7 | [homebrew] 8 | tree 9 | 10 | [rpms] 11 | tree 12 | 13 | [download.os=linux] 14 | url = https://salsa.debian.org/debian/tree-packaging/-/archive/debian/1.8.0-1/tree-packaging-debian-1.8.0-1.tar.gz 15 | sha256 = a841eee1d52bfd64a48f54caab9937b9bd92935055c48885c4ab1ae4dab7fae5 16 | 17 | [download.os=darwin] 18 | # The official package of tree source requires users of non-Linux platform to 19 | # comment/uncomment certain lines in the Makefile to build for their platform. 20 | # Besauce getdeps.py doesn't have that functionality we just use this custom 21 | # fork of tree which has proper lines uncommented for a OSX build 22 | url = https://github.com/lukaspiatkowski/tree-command/archive/debian/1.8.0-1-macos.tar.gz 23 | sha256 = 9cbe889553d95cf5a2791dd0743795d46a3c092c5bba691769c0e5c52e11229e 24 | 25 | [build.os=linux] 26 | builder = make 27 | subdir = tree-packaging-debian-1.8.0-1 28 | 29 | [build.os=darwin] 30 | builder = make 31 | subdir = tree-command-debian-1.8.0-1-macos 32 | 33 | [build.os=windows] 34 | builder = nop 35 | 36 | [make.install_args] 37 | install 38 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/wangle: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = wangle 3 | fbsource_path = fbcode/wangle 4 | shipit_project = wangle 5 | shipit_fbcode_builder = true 6 | 7 | [git] 8 | repo_url = https://github.com/facebook/wangle.git 9 | 10 | [build] 11 | builder = cmake 12 | subdir = wangle 13 | 14 | [cmake.defines.test=on] 15 | BUILD_TESTS=ON 16 | 17 | [cmake.defines.test=off] 18 | BUILD_TESTS=OFF 19 | 20 | [dependencies] 21 | folly 22 | googletest 23 | fizz 24 | 25 | [shipit.pathmap] 26 | fbcode/wangle/public_tld = . 27 | fbcode/wangle = wangle 28 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/watchman: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = watchman 3 | fbsource_path = fbcode/watchman 4 | shipit_project = watchman 5 | shipit_fbcode_builder = true 6 | 7 | [git] 8 | repo_url = https://github.com/facebook/watchman.git 9 | 10 | [build] 11 | builder = cmake 12 | 13 | [dependencies] 14 | boost 15 | cpptoml 16 | edencommon 17 | fb303 18 | fbthrift 19 | folly 20 | pcre2 21 | googletest 22 | python-setuptools 23 | 24 | [dependencies.fbsource=on] 25 | rust 26 | 27 | [shipit.pathmap] 28 | fbcode/watchman = watchman 29 | fbcode/watchman/oss = . 30 | fbcode/eden/fs = eden/fs 31 | 32 | [shipit.strip] 33 | ^fbcode/eden/fs/(?!.*\.thrift|service/shipit_test_file\.txt) 34 | 35 | [cmake.defines.fb=on] 36 | ENABLE_EDEN_SUPPORT=ON 37 | IS_FB_BUILD=ON 38 | 39 | # FB macos specific settings 40 | [cmake.defines.all(fb=on,os=darwin)] 41 | # this path is coupled with the FB internal watchman-osx.spec 42 | WATCHMAN_STATE_DIR=/opt/facebook/watchman/var/run/watchman 43 | # tell cmake not to try to create /opt/facebook/... 44 | INSTALL_WATCHMAN_STATE_DIR=OFF 45 | USE_SYS_PYTHON=OFF 46 | 47 | [depends.environment] 48 | WATCHMAN_VERSION_OVERRIDE 49 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/xxhash: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = xxhash 3 | 4 | [download] 5 | url = https://github.com/Cyan4973/xxHash/archive/refs/tags/v0.8.2.tar.gz 6 | sha256 = baee0c6afd4f03165de7a4e67988d16f0f2b257b51d0e3cb91909302a26a79c4 7 | 8 | [rpms] 9 | xxhash-devel 10 | 11 | [debs] 12 | libxxhash-dev 13 | xxhash 14 | 15 | [homebrew] 16 | xxhash 17 | 18 | [build.not(os=windows)] 19 | builder = make 20 | subdir = xxHash-0.8.2 21 | 22 | [make.build_args] 23 | all 24 | 25 | [make.install_args] 26 | install 27 | 28 | [build.os=windows] 29 | builder = cmake 30 | subdir = xxHash-0.8.2/cmake_unofficial 31 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/xz: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = xz 3 | 4 | # ubuntu's package causes watchman's tests to hang 5 | [debs.not(distro=ubuntu)] 6 | liblzma-dev 7 | 8 | [homebrew] 9 | xz 10 | 11 | [rpms] 12 | xz-devel 13 | 14 | [download] 15 | url = https://tukaani.org/xz/xz-5.2.5.tar.gz 16 | sha256 = f6f4910fd033078738bd82bfba4f49219d03b17eb0794eb91efbae419f4aba10 17 | 18 | [build] 19 | builder = autoconf 20 | subdir = xz-5.2.5 21 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/yaml-cpp: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = yaml-cpp 3 | 4 | [download] 5 | url = https://github.com/jbeder/yaml-cpp/archive/yaml-cpp-0.6.2.tar.gz 6 | sha256 = e4d8560e163c3d875fd5d9e5542b5fd5bec810febdcba61481fe5fc4e6b1fd05 7 | 8 | [build.os=linux] 9 | builder = cmake 10 | subdir = yaml-cpp-yaml-cpp-0.6.2 11 | 12 | [build.not(os=linux)] 13 | builder = nop 14 | 15 | [dependencies] 16 | boost 17 | googletest 18 | 19 | [cmake.defines] 20 | YAML_CPP_BUILD_TESTS=OFF 21 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/zlib: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = zlib 3 | 4 | [debs] 5 | zlib1g-dev 6 | 7 | [homebrew] 8 | zlib 9 | 10 | [rpms.not(distro=fedora)] 11 | zlib-devel 12 | zlib-static 13 | 14 | [rpms.distro=fedora] 15 | zlib-ng-compat-devel 16 | zlib-ng-compat-static 17 | 18 | [pps] 19 | zlib 20 | 21 | [download] 22 | url = https://zlib.net/zlib-1.3.1.tar.gz 23 | sha256 = 9a93b2b7dfdac77ceba5a558a580e74667dd6fede4585b91eefb60f03b72df23 24 | 25 | [build] 26 | builder = cmake 27 | subdir = zlib-1.3.1 28 | patchfile = zlib_dont_build_more_than_needed.patch 29 | -------------------------------------------------------------------------------- /build/fbcode_builder/manifests/zstd: -------------------------------------------------------------------------------- 1 | [manifest] 2 | name = zstd 3 | 4 | [homebrew] 5 | zstd 6 | 7 | # 18.04 zstd is too old 8 | [debs.not(all(distro=ubuntu,distro_vers="18.04"))] 9 | libzstd-dev 10 | zstd 11 | 12 | [rpms] 13 | libzstd-devel 14 | libzstd 15 | 16 | [pps] 17 | zstd 18 | 19 | [download] 20 | url = https://github.com/facebook/zstd/releases/download/v1.5.5/zstd-1.5.5.tar.gz 21 | sha256 = 9c4396cc829cfae319a6e2615202e82aad41372073482fce286fac78646d3ee4 22 | 23 | [build] 24 | builder = cmake 25 | subdir = zstd-1.5.5/build/cmake 26 | 27 | # The zstd cmake build explicitly sets the install name 28 | # for the shared library in such a way that cmake discards 29 | # the path to the library from the install_name, rendering 30 | # the library non-resolvable during the build. The short 31 | # term solution for this is just to link static on macos. 32 | # 33 | # And while we're at it, let's just always link statically. 34 | [cmake.defines] 35 | ZSTD_BUILD_SHARED = OFF 36 | -------------------------------------------------------------------------------- /build/fbcode_builder/patches/boost_comparator_operator_fix.patch: -------------------------------------------------------------------------------- 1 | diff --git a/boost/serialization/strong_typedef.hpp b/boost/serialization/strong_typedef.hpp 2 | --- a/boost/serialization/strong_typedef.hpp 3 | +++ b/boost/serialization/strong_typedef.hpp 4 | @@ -44,6 +44,7 @@ 5 | operator const T&() const {return t;} \ 6 | operator T&() {return t;} \ 7 | bool operator==(const D& rhs) const {return t == rhs.t;} \ 8 | + bool operator==(const T& lhs) const {return t == lhs;} \ 9 | bool operator<(const D& rhs) const {return t < rhs.t;} \ 10 | }; 11 | 12 | -------------------------------------------------------------------------------- /build/fbcode_builder/patches/iproute2_oss.patch: -------------------------------------------------------------------------------- 1 | diff --git a/bridge/fdb.c b/bridge/fdb.c 2 | --- a/bridge/fdb.c 3 | +++ b/bridge/fdb.c 4 | @@ -31,7 +31,7 @@ 5 | 6 | static unsigned int filter_index, filter_vlan, filter_state; 7 | 8 | -json_writer_t *jw_global; 9 | +static json_writer_t *jw_global; 10 | 11 | static void usage(void) 12 | { 13 | diff --git a/ip/ipmroute.c b/ip/ipmroute.c 14 | --- a/ip/ipmroute.c 15 | +++ b/ip/ipmroute.c 16 | @@ -44,7 +44,7 @@ 17 | exit(-1); 18 | } 19 | 20 | -struct rtfilter { 21 | +static struct rtfilter { 22 | int tb; 23 | int af; 24 | int iif; 25 | diff --git a/ip/xfrm_monitor.c b/ip/xfrm_monitor.c 26 | --- a/ip/xfrm_monitor.c 27 | +++ b/ip/xfrm_monitor.c 28 | @@ -34,7 +34,7 @@ 29 | #include "ip_common.h" 30 | 31 | static void usage(void) __attribute__((noreturn)); 32 | -int listen_all_nsid; 33 | +static int listen_all_nsid; 34 | 35 | static void usage(void) 36 | { 37 | -------------------------------------------------------------------------------- /build/fbcode_builder/patches/libiberty_install_pic_lib.patch: -------------------------------------------------------------------------------- 1 | diff --git a/Makefile.in b/Makefile.in 2 | index b77a41c..cbe71fe 100644 3 | --- a/Makefile.in 4 | +++ b/Makefile.in 5 | @@ -389,7 +389,7 @@ MULTIOSDIR = `$(CC) $(CFLAGS) -print-multi-os-directory` 6 | install_to_libdir: all 7 | if test -n "${target_header_dir}"; then \ 8 | ${mkinstalldirs} $(DESTDIR)$(libdir)/$(MULTIOSDIR); \ 9 | - $(INSTALL_DATA) $(TARGETLIB) $(DESTDIR)$(libdir)/$(MULTIOSDIR)/$(TARGETLIB)n; \ 10 | + $(INSTALL_DATA) pic/$(TARGETLIB) $(DESTDIR)$(libdir)/$(MULTIOSDIR)/$(TARGETLIB)n; \ 11 | ( cd $(DESTDIR)$(libdir)/$(MULTIOSDIR) ; chmod 644 $(TARGETLIB)n ;$(RANLIB) $(TARGETLIB)n ); \ 12 | mv -f $(DESTDIR)$(libdir)/$(MULTIOSDIR)/$(TARGETLIB)n $(DESTDIR)$(libdir)/$(MULTIOSDIR)/$(TARGETLIB); \ 13 | case "${target_header_dir}" in \ 14 | -------------------------------------------------------------------------------- /build/fbcode_builder/patches/zlib_dont_build_more_than_needed.patch: -------------------------------------------------------------------------------- 1 | diff -Naur ../zlib-1.3.1/CMakeLists.txt ./CMakeLists.txt 2 | --- ../zlib-1.3.1/CMakeLists.txt 2024-01-22 10:32:37.000000000 -0800 3 | +++ ./CMakeLists.txt 2024-01-23 13:14:09.870289968 -0800 4 | @@ -149,10 +149,8 @@ 5 | set(ZLIB_DLL_SRCS ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj) 6 | endif(MINGW) 7 | 8 | -add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) 9 | +add_library(zlib ${ZLIB_SRCS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) 10 | target_include_directories(zlib PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) 11 | -add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) 12 | -target_include_directories(zlibstatic PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) 13 | set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL) 14 | set_target_properties(zlib PROPERTIES SOVERSION 1) 15 | 16 | @@ -169,7 +167,7 @@ 17 | 18 | if(UNIX) 19 | # On unix-like platforms the library is almost always called libz 20 | - set_target_properties(zlib zlibstatic PROPERTIES OUTPUT_NAME z) 21 | + set_target_properties(zlib PROPERTIES OUTPUT_NAME z) 22 | if(NOT APPLE AND NOT(CMAKE_SYSTEM_NAME STREQUAL AIX)) 23 | set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,\"${CMAKE_CURRENT_SOURCE_DIR}/zlib.map\"") 24 | endif() 25 | @@ -179,7 +177,7 @@ 26 | endif() 27 | 28 | if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL ) 29 | - install(TARGETS zlib zlibstatic 30 | + install(TARGETS zlib 31 | RUNTIME DESTINATION "${INSTALL_BIN_DIR}" 32 | ARCHIVE DESTINATION "${INSTALL_LIB_DIR}" 33 | LIBRARY DESTINATION "${INSTALL_LIB_DIR}" ) 34 | -------------------------------------------------------------------------------- /wangle/.clang-tidy: -------------------------------------------------------------------------------- 1 | # NOTE there must be no spaces before the '-', so put the comma after. 2 | # When making changes, be sure to verify the output of the following command to ensure 3 | # the desired checks are enabled (run from the directory containing a .clang-tidy file): 4 | # `clang-tidy -list-checks` 5 | # NOTE: Please don't disable inheritance from the parent to make sure that common checks get propagated. 6 | --- 7 | InheritParentConfig: true 8 | Checks: ' 9 | facebook-hte-BadCall-mlock, 10 | facebook-hte-PortabilityInclude-WinSock2.h, 11 | facebook-hte-PortabilityInclude-Windows.h, 12 | facebook-hte-PortabilityInclude-arpa/inet.h, 13 | facebook-hte-PortabilityInclude-direct.h, 14 | facebook-hte-PortabilityInclude-dirent.h, 15 | facebook-hte-PortabilityInclude-gflags/gflags.h, 16 | facebook-hte-PortabilityInclude-io.h, 17 | facebook-hte-PortabilityInclude-libgen.h, 18 | facebook-hte-PortabilityInclude-netdb.h, 19 | facebook-hte-PortabilityInclude-netinet/in.h, 20 | facebook-hte-PortabilityInclude-netinet/tcp.h, 21 | facebook-hte-PortabilityInclude-openssl/asn1.h, 22 | facebook-hte-PortabilityInclude-openssl/bio.h, 23 | facebook-hte-PortabilityInclude-openssl/crypto.h, 24 | facebook-hte-PortabilityInclude-openssl/dh.h, 25 | facebook-hte-PortabilityInclude-openssl/ec.h, 26 | facebook-hte-PortabilityInclude-openssl/ecdsa.h, 27 | facebook-hte-PortabilityInclude-openssl/err.h, 28 | facebook-hte-PortabilityInclude-openssl/evp.h, 29 | facebook-hte-PortabilityInclude-openssl/hmac.h, 30 | facebook-hte-PortabilityInclude-openssl/opensslv.h, 31 | facebook-hte-PortabilityInclude-openssl/rand.h, 32 | facebook-hte-PortabilityInclude-openssl/rsa.h, 33 | facebook-hte-PortabilityInclude-openssl/sha.h, 34 | facebook-hte-PortabilityInclude-openssl/ssl.h, 35 | facebook-hte-PortabilityInclude-openssl/tls1.h, 36 | facebook-hte-PortabilityInclude-openssl/x509.h, 37 | facebook-hte-PortabilityInclude-openssl/x509v3.h, 38 | facebook-hte-PortabilityInclude-poll.h, 39 | facebook-hte-PortabilityInclude-pthread.h, 40 | facebook-hte-PortabilityInclude-sched.h, 41 | facebook-hte-PortabilityInclude-semaphore.h, 42 | facebook-hte-PortabilityInclude-strings.h, 43 | facebook-hte-PortabilityInclude-sys/file.h, 44 | facebook-hte-PortabilityInclude-sys/mman.h, 45 | facebook-hte-PortabilityInclude-sys/resource.h, 46 | facebook-hte-PortabilityInclude-sys/socket.h, 47 | facebook-hte-PortabilityInclude-sys/syscall.h, 48 | facebook-hte-PortabilityInclude-sys/time.h, 49 | facebook-hte-PortabilityInclude-sys/uio.h, 50 | facebook-hte-PortabilityInclude-sys/un.h, 51 | facebook-hte-PortabilityInclude-syslog.h, 52 | facebook-hte-PortabilityInclude-unistd.h, 53 | facebook-hte-StdToStringUse, 54 | ' 55 | ... 56 | -------------------------------------------------------------------------------- /wangle/.gitignore: -------------------------------------------------------------------------------- 1 | CMakeCache.txt 2 | CMakeFiles/ 3 | CTestTestfile.cmake 4 | Makefile 5 | Testing/ 6 | cmake_install.cmake 7 | install_manifest.txt 8 | gtest/ 9 | bin/ 10 | lib/ 11 | -------------------------------------------------------------------------------- /wangle/BUILD_MODE.bzl: -------------------------------------------------------------------------------- 1 | """ build mode definitions for wangle """ 2 | 3 | load("@fbcode//:BUILD_MODE.bzl", get_parent_modes = "get_empty_modes") 4 | load("@fbcode_macros//build_defs:create_build_mode.bzl", "extend_build_modes") 5 | 6 | _lsan_suppressions = [ 7 | "AcceptRoutingHandlerTest::SetUp", 8 | "CRYPTO_malloc", 9 | "CRYPTO_realloc", 10 | "folly::IOBuf::createSeparate", 11 | "TestClientPipelineFactory::newPipeline", 12 | "wangle::Acceptor::makeNewAsyncSocket", 13 | "wangle::AsyncSocketHandler::getReadBuffer", 14 | "wangle::ServerAcceptor", 15 | ] 16 | 17 | _tags = [ 18 | ] 19 | 20 | _modes = extend_build_modes( 21 | get_parent_modes(), 22 | lsan_suppressions = _lsan_suppressions, 23 | tags = _tags, 24 | ) 25 | 26 | def get_modes(): 27 | """ Return modes for this file """ 28 | return _modes 29 | -------------------------------------------------------------------------------- /wangle/acceptor/ConnectionCounter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | namespace wangle { 22 | 23 | class IConnectionCounter { 24 | public: 25 | virtual uint64_t getNumConnections() const = 0; 26 | 27 | /** 28 | * Get the maximum number of non-whitelisted client-side connections 29 | * across all Acceptors managed by this. A value 30 | * of zero means "unlimited." 31 | */ 32 | virtual uint64_t getMaxConnections() const = 0; 33 | 34 | /** 35 | * Increment the count of client-side connections. 36 | */ 37 | virtual void onConnectionAdded() = 0; 38 | 39 | /** 40 | * Decrement the count of client-side connections. 41 | */ 42 | virtual void onConnectionRemoved() = 0; 43 | virtual ~IConnectionCounter() = default; 44 | }; 45 | 46 | class SimpleConnectionCounter : public IConnectionCounter { 47 | public: 48 | uint64_t getNumConnections() const override { 49 | return numConnections_; 50 | } 51 | uint64_t getMaxConnections() const override { 52 | return maxConnections_; 53 | } 54 | void setMaxConnections(uint64_t maxConnections) { 55 | maxConnections_ = maxConnections; 56 | } 57 | 58 | void onConnectionAdded() override { 59 | numConnections_++; 60 | } 61 | void onConnectionRemoved() override { 62 | numConnections_--; 63 | } 64 | ~SimpleConnectionCounter() override = default; 65 | 66 | protected: 67 | uint64_t maxConnections_{0}; 68 | uint64_t numConnections_{0}; 69 | }; 70 | 71 | } // namespace wangle 72 | -------------------------------------------------------------------------------- /wangle/acceptor/NetworkAddress.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | namespace wangle { 22 | 23 | /** 24 | * A simple wrapper around SocketAddress that represents 25 | * a network in CIDR notation 26 | */ 27 | class NetworkAddress { 28 | public: 29 | /** 30 | * Create a NetworkAddress for an addr/prefixLen 31 | * @param addr IPv4 or IPv6 address of the network 32 | * @param prefixLen Prefix length, in bits 33 | */ 34 | NetworkAddress(const folly::SocketAddress& addr, unsigned prefixLen) 35 | : addr_(addr), prefixLen_(prefixLen) {} 36 | 37 | /** Get the network address */ 38 | const folly::SocketAddress& getAddress() const { 39 | return addr_; 40 | } 41 | 42 | /** Get the prefix length in bits */ 43 | unsigned getPrefixLength() const { 44 | return prefixLen_; 45 | } 46 | 47 | /** Check whether a given address lies within the network */ 48 | bool contains(const folly::SocketAddress& addr) const { 49 | return addr_.prefixMatch(addr, prefixLen_); 50 | } 51 | 52 | /** Comparison operator to enable use in ordered collections */ 53 | bool operator<(const NetworkAddress& other) const { 54 | if (addr_ < other.addr_) { 55 | return true; 56 | } else if (other.addr_ < addr_) { 57 | return false; 58 | } else { 59 | return (prefixLen_ < other.prefixLen_); 60 | } 61 | } 62 | 63 | bool operator==(const NetworkAddress& other) const { 64 | return addr_ == other.addr_ && prefixLen_ == other.prefixLen_; 65 | } 66 | 67 | private: 68 | folly::SocketAddress addr_; 69 | unsigned prefixLen_; 70 | }; 71 | 72 | } // namespace wangle 73 | -------------------------------------------------------------------------------- /wangle/acceptor/SSLContextSelectionMisc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | 22 | namespace wangle { 23 | 24 | struct dn_char_traits : public std::char_traits { 25 | static bool eq(char c1, char c2) { 26 | return ::tolower(c1) == ::tolower(c2); 27 | } 28 | 29 | static bool ne(char c1, char c2) { 30 | return ::tolower(c1) != ::tolower(c2); 31 | } 32 | 33 | static bool lt(char c1, char c2) { 34 | return ::tolower(c1) < ::tolower(c2); 35 | } 36 | 37 | static int compare(const char* s1, const char* s2, size_t n) { 38 | while (n--) { 39 | if (::tolower(*s1) < ::tolower(*s2)) { 40 | return -1; 41 | } 42 | if (::tolower(*s1) > ::tolower(*s2)) { 43 | return 1; 44 | } 45 | ++s1; 46 | ++s2; 47 | } 48 | return 0; 49 | } 50 | 51 | static const char* find(const char* s, size_t n, char a) { 52 | char la = ::tolower(a); 53 | while (n--) { 54 | if (::tolower(*s) == la) { 55 | return s; 56 | } else { 57 | ++s; 58 | } 59 | } 60 | return nullptr; 61 | } 62 | }; 63 | 64 | // Case insensitive string 65 | using DNString = std::basic_string; 66 | 67 | struct SSLContextKey { 68 | DNString dnString; 69 | 70 | explicit SSLContextKey(DNString dns) : dnString(std::move(dns)) {} 71 | 72 | bool operator==(const SSLContextKey& rhs) const { 73 | return dnString == rhs.dnString; 74 | } 75 | }; 76 | 77 | struct SSLContextKeyHash { 78 | size_t operator()(const SSLContextKey& sslContextKey) const noexcept { 79 | std::string lowercase( 80 | sslContextKey.dnString.data(), sslContextKey.dnString.size()); 81 | folly::toLowerAscii(lowercase); 82 | return std::hash{}(lowercase); 83 | } 84 | }; 85 | 86 | } // namespace wangle 87 | -------------------------------------------------------------------------------- /wangle/acceptor/SecureTransportType.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | 19 | namespace wangle { 20 | 21 | std::string getSecureTransportName(const SecureTransportType& type) { 22 | switch (type) { 23 | case SecureTransportType::TLS: 24 | return "TLS"; 25 | default: 26 | return ""; 27 | } 28 | } 29 | 30 | } // namespace wangle 31 | -------------------------------------------------------------------------------- /wangle/acceptor/SecureTransportType.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | namespace wangle { 22 | 23 | /** 24 | * An enum representing different kinds 25 | * of secure transports we can negotiate. 26 | */ 27 | enum class SecureTransportType { 28 | NONE, // Transport is not secure. 29 | TLS, // Transport is based on TLS 30 | }; 31 | 32 | std::string getSecureTransportName(const SecureTransportType& type); 33 | 34 | } // namespace wangle 35 | 36 | // This enum used to be un-namespaced. This is here for temporary backwards 37 | // compatibility with old uses of this enum. 38 | using wangle::SecureTransportType; 39 | -------------------------------------------------------------------------------- /wangle/acceptor/SecurityProtocolContextManager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | namespace wangle { 22 | 23 | /** 24 | * This class holds different peekers that will be used to get the appropriate 25 | * AcceptorHandshakeHelper to handle the security protocol negotiation. 26 | */ 27 | class SecurityProtocolContextManager { 28 | public: 29 | /** 30 | * Adds a peeker to be used when accepting connections on a secure port. 31 | * Peekers will be used in the order they are added. 32 | */ 33 | void addPeeker(PeekingCallbackPtr peekingCallback) { 34 | if (peekingCallback->getBytesRequired() > numBytes_) { 35 | numBytes_ = peekingCallback->getBytesRequired(); 36 | } 37 | peekingCallbacks_.push_back(std::move(peekingCallback)); 38 | } 39 | 40 | AcceptorHandshakeManager* getHandshakeManager( 41 | Acceptor* acceptor, 42 | const folly::SocketAddress& clientAddr, 43 | std::chrono::steady_clock::time_point acceptTime, 44 | TransportInfo& tinfo) noexcept { 45 | return new PeekingAcceptorHandshakeManager( 46 | acceptor, clientAddr, acceptTime, tinfo, peekingCallbacks_, numBytes_); 47 | } 48 | 49 | size_t getPeekBytes() const { 50 | return numBytes_; 51 | } 52 | 53 | private: 54 | /** 55 | * Peeking callbacks for each handshake protocol. 56 | */ 57 | std::vector peekingCallbacks_; 58 | 59 | /** 60 | * Highest number of bytes required by a peeking callback. 61 | */ 62 | size_t numBytes_{0}; 63 | }; 64 | 65 | } // namespace wangle 66 | -------------------------------------------------------------------------------- /wangle/acceptor/SocketOptions.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | 19 | #include 20 | #include 21 | 22 | namespace wangle { 23 | 24 | folly::SocketOptionMap filterIPSocketOptions( 25 | const folly::SocketOptionMap& allOptions, 26 | const int addrFamily) { 27 | folly::SocketOptionMap opts; 28 | 29 | for (const auto& opt : allOptions) { 30 | if (opt.first.level == SOL_SOCKET) { 31 | opts[opt.first] = opt.second; 32 | continue; 33 | } 34 | 35 | if (addrFamily == AF_INET) { 36 | if (opt.first.level == IPPROTO_IPV6) { 37 | continue; 38 | } 39 | } else if (addrFamily == AF_INET6) { 40 | if (opt.first.level == IPPROTO_IP) { 41 | continue; 42 | } 43 | } else { 44 | LOG(FATAL) << "Address family " << addrFamily << " was not IPv4 or IPv6"; 45 | } 46 | 47 | // Include all other options 48 | opts[opt.first] = opt.second; 49 | } 50 | 51 | return opts; 52 | } 53 | 54 | } // namespace wangle 55 | -------------------------------------------------------------------------------- /wangle/acceptor/SocketOptions.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | 22 | namespace wangle { 23 | 24 | /** 25 | * Returns a copy of the socket options excluding options with the given 26 | * level. 27 | */ 28 | folly::SocketOptionMap filterIPSocketOptions( 29 | const folly::SocketOptionMap& allOptions, 30 | const int addrFamily); 31 | 32 | } // namespace wangle 33 | -------------------------------------------------------------------------------- /wangle/acceptor/TLSPlaintextPeekingCallback.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | 19 | namespace wangle { 20 | 21 | bool TLSPlaintextPeekingCallback::looksLikeTLS( 22 | const std::vector& bytes) { 23 | CHECK_GE(bytes.size(), kPeekCount); 24 | // TLS starts with 25 | // 0: 0x16 - handshake magic 26 | // 1: 0x03 - SSL major version 27 | // 2: 0x00 to 0x03 - minor version 28 | // 3-4: Length 29 | // 5: 0x01 - Handshake type (Client Hello) 30 | if (bytes[0] != 0x16 || bytes[1] != 0x03 || bytes[5] != 0x01) { 31 | return false; 32 | } 33 | return true; 34 | } 35 | 36 | AcceptorHandshakeHelper::UniquePtr TLSPlaintextPeekingCallback::getHelper( 37 | const std::vector& bytes, 38 | const folly::SocketAddress& /* clientAddr */, 39 | std::chrono::steady_clock::time_point /* acceptTime */, 40 | TransportInfo&) { 41 | if (!TLSPlaintextPeekingCallback::looksLikeTLS(bytes)) { 42 | return AcceptorHandshakeHelper::UniquePtr( 43 | new UnencryptedAcceptorHandshakeHelper()); 44 | } 45 | 46 | return nullptr; 47 | } 48 | 49 | } // namespace wangle 50 | -------------------------------------------------------------------------------- /wangle/acceptor/TLSPlaintextPeekingCallback.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | #include 22 | 23 | namespace wangle { 24 | 25 | /** 26 | * A peeking callback that makes it convenient to create a server 27 | * that will accept both TLS and plaintext traffic. 28 | */ 29 | class TLSPlaintextPeekingCallback 30 | : public PeekingAcceptorHandshakeHelper::PeekCallback { 31 | enum { kPeekCount = 9 }; 32 | 33 | public: 34 | TLSPlaintextPeekingCallback() 35 | : PeekingAcceptorHandshakeHelper::PeekCallback(kPeekCount) {} 36 | 37 | AcceptorHandshakeHelper::UniquePtr getHelper( 38 | const std::vector& bytes, 39 | const folly::SocketAddress& clientAddr, 40 | std::chrono::steady_clock::time_point acceptTime, 41 | TransportInfo& tinfo) override; 42 | 43 | private: 44 | static bool looksLikeTLS(const std::vector& peekBytes); 45 | }; 46 | 47 | } // namespace wangle 48 | -------------------------------------------------------------------------------- /wangle/acceptor/UnencryptedAcceptorHandshakeHelper.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | #include 22 | 23 | namespace wangle { 24 | 25 | /** 26 | * This is a dummy handshake helper that immediately returns the socket to the 27 | * acceptor. This can be used with the peeking acceptor if no handshake is 28 | * needed. 29 | */ 30 | class UnencryptedAcceptorHandshakeHelper : public AcceptorHandshakeHelper { 31 | public: 32 | UnencryptedAcceptorHandshakeHelper() = default; 33 | 34 | void start( 35 | folly::AsyncSSLSocket::UniquePtr sock, 36 | AcceptorHandshakeHelper::Callback* callback) noexcept override { 37 | callback->connectionReady( 38 | std::move(sock), "", SecureTransportType::NONE, folly::none); 39 | } 40 | 41 | void dropConnection( 42 | SSLErrorEnum /* reason */ = SSLErrorEnum::NO_ERROR) override { 43 | CHECK(false) << "Nothing to drop"; 44 | } 45 | }; 46 | 47 | } // namespace wangle 48 | -------------------------------------------------------------------------------- /wangle/acceptor/test/SecurityProtocolContextManagerTest.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | 19 | #include 20 | #include 21 | 22 | using namespace wangle; 23 | using namespace testing; 24 | 25 | template 26 | class LengthPeeker : public PeekingAcceptorHandshakeHelper::PeekCallback { 27 | public: 28 | LengthPeeker() : PeekingAcceptorHandshakeHelper::PeekCallback(N) {} 29 | 30 | AcceptorHandshakeHelper::UniquePtr getHelper( 31 | const std::vector& /* bytes */, 32 | const folly::SocketAddress& /* clientAddr */, 33 | std::chrono::steady_clock::time_point /* acceptTime */, 34 | TransportInfo&) override { 35 | return nullptr; 36 | } 37 | }; 38 | 39 | class SecurityProtocolContextManagerTest : public Test { 40 | protected: 41 | SecurityProtocolContextManager manager_; 42 | LengthPeeker<0> p0_; 43 | LengthPeeker<2> p2_; 44 | LengthPeeker<4> p4_; 45 | LengthPeeker<9> p9_; 46 | }; 47 | 48 | TEST_F(SecurityProtocolContextManagerTest, TestZeroLen) { 49 | manager_.addPeeker(&p0_); 50 | 51 | EXPECT_EQ(manager_.getPeekBytes(), 0); 52 | } 53 | 54 | TEST_F(SecurityProtocolContextManagerTest, TestLongAtStart) { 55 | manager_.addPeeker(&p9_); 56 | manager_.addPeeker(&p0_); 57 | manager_.addPeeker(&p4_); 58 | manager_.addPeeker(&p2_); 59 | 60 | EXPECT_EQ(manager_.getPeekBytes(), 9); 61 | } 62 | 63 | TEST_F(SecurityProtocolContextManagerTest, TestLongAtEnd) { 64 | manager_.addPeeker(&p0_); 65 | manager_.addPeeker(&p4_); 66 | manager_.addPeeker(&p2_); 67 | manager_.addPeeker(&p9_); 68 | 69 | EXPECT_EQ(manager_.getPeekBytes(), 9); 70 | } 71 | 72 | TEST_F(SecurityProtocolContextManagerTest, TestLongMiddle) { 73 | manager_.addPeeker(&p0_); 74 | manager_.addPeeker(&p9_); 75 | manager_.addPeeker(&p2_); 76 | manager_.addPeeker(&p0_); 77 | 78 | EXPECT_EQ(manager_.getPeekBytes(), 9); 79 | } 80 | -------------------------------------------------------------------------------- /wangle/bootstrap/RoutingDataHandler-inl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | namespace wangle { 20 | 21 | template 22 | RoutingDataHandler::RoutingDataHandler(uint64_t connId, Callback* cob) 23 | : connId_(connId), cob_(CHECK_NOTNULL(cob)) {} 24 | 25 | template 26 | void RoutingDataHandler::read(Context*, folly::IOBufQueue& q) { 27 | RoutingData routingData; 28 | if (parseRoutingData(q, routingData)) { 29 | parseRoutingDataCallback(routingData); 30 | } 31 | } 32 | 33 | template 34 | void RoutingDataHandler::readEOF(Context*) { 35 | const auto& ex = folly::make_exception_wrapper( 36 | folly::AsyncSocketException::END_OF_FILE, 37 | "Received EOF before parsing routing data"); 38 | cob_->onError(connId_, ex); 39 | } 40 | 41 | template 42 | void RoutingDataHandler::readException( 43 | Context*, 44 | folly::exception_wrapper ex) { 45 | cob_->onError(connId_, ex); 46 | } 47 | 48 | template 49 | void RoutingDataHandler::parseRoutingDataCallback(RoutingData& routingData) { 50 | cob_->onRoutingData(connId_, routingData); 51 | } 52 | 53 | } // namespace wangle 54 | -------------------------------------------------------------------------------- /wangle/channel/EventBaseHandler.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | 22 | namespace wangle { 23 | 24 | class EventBaseHandler : public OutboundBytesToBytesHandler { 25 | public: 26 | folly::Future write( 27 | Context* ctx, 28 | std::unique_ptr buf) override { 29 | folly::Future retval; 30 | DCHECK(ctx->getTransport()); 31 | DCHECK(ctx->getTransport()->getEventBase()); 32 | ctx->getTransport() 33 | ->getEventBase() 34 | ->runImmediatelyOrRunInEventBaseThreadAndWait( 35 | [&]() { retval = ctx->fireWrite(std::move(buf)); }); 36 | return retval; 37 | } 38 | 39 | folly::Future close(Context* ctx) override { 40 | DCHECK(ctx->getTransport()); 41 | DCHECK(ctx->getTransport()->getEventBase()); 42 | folly::Future retval; 43 | ctx->getTransport() 44 | ->getEventBase() 45 | ->runImmediatelyOrRunInEventBaseThreadAndWait( 46 | [&]() { retval = ctx->fireClose(); }); 47 | return retval; 48 | } 49 | }; 50 | 51 | } // namespace wangle 52 | -------------------------------------------------------------------------------- /wangle/channel/broadcast/Subscriber.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | namespace wangle { 22 | 23 | /** 24 | * Subscriber interface for listening to a stream. 25 | */ 26 | template 27 | class Subscriber { 28 | public: 29 | virtual ~Subscriber() = default; 30 | 31 | virtual void onNext(const T&) = 0; 32 | virtual void onError(folly::exception_wrapper ex) = 0; 33 | virtual void onCompleted() = 0; 34 | virtual R& routingData() = 0; 35 | }; 36 | 37 | } // namespace wangle 38 | -------------------------------------------------------------------------------- /wangle/channel/test/MockPipeline.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | 22 | namespace wangle { 23 | 24 | class MockPipelineManager : public wangle::PipelineManager { 25 | public: 26 | MOCK_METHOD1(deletePipeline, void(PipelineBase*)); 27 | }; 28 | 29 | } // namespace wangle 30 | -------------------------------------------------------------------------------- /wangle/channel/test/OutputBufferingHandlerTest.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | using namespace folly; 25 | using namespace wangle; 26 | using namespace testing; 27 | 28 | using MockBytesHandler = 29 | StrictMock>>; 30 | 31 | MATCHER_P(IOBufContains, str, "") { 32 | return arg->moveToFbString() == str; 33 | } 34 | 35 | TEST(OutputBufferingHandlerTest, Basic) { 36 | MockBytesHandler mockHandler; 37 | EXPECT_CALL(mockHandler, attachPipeline(_)); 38 | auto pipeline = StaticPipeline< 39 | IOBufQueue&, 40 | std::unique_ptr, 41 | MockBytesHandler, 42 | OutputBufferingHandler>::create(&mockHandler, OutputBufferingHandler()); 43 | 44 | EventBase eb; 45 | auto socket = AsyncSocket::newSocket(&eb); 46 | pipeline->setTransport(std::move(socket)); 47 | 48 | // Buffering should prevent writes until the EB loops, and the writes should 49 | // be batched into one write call. 50 | auto f1 = pipeline->write(IOBuf::copyBuffer("hello")); 51 | auto f2 = pipeline->write(IOBuf::copyBuffer("world")); 52 | EXPECT_FALSE(f1.isReady()); 53 | EXPECT_FALSE(f2.isReady()); 54 | EXPECT_CALL(mockHandler, write_(_, IOBufContains("helloworld"))); 55 | eb.loopOnce(); 56 | EXPECT_TRUE(f1.isReady()); 57 | EXPECT_TRUE(f2.isReady()); 58 | EXPECT_CALL(mockHandler, detachPipeline(_)); 59 | 60 | // Make sure the SharedPromise resets correctly 61 | auto f = pipeline->write(IOBuf::copyBuffer("foo")); 62 | EXPECT_FALSE(f.isReady()); 63 | EXPECT_CALL(mockHandler, write_(_, IOBufContains("foo"))); 64 | eb.loopOnce(); 65 | EXPECT_TRUE(f.isReady()); 66 | pipeline.reset(); 67 | } 68 | -------------------------------------------------------------------------------- /wangle/client/persistence/FilePersistenceLayer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | namespace wangle { 25 | 26 | class FilePersistenceLayer : public CachePersistence { 27 | public: 28 | explicit FilePersistenceLayer(const std::string& file) : file_(file) {} 29 | ~FilePersistenceLayer() override = default; 30 | 31 | bool persist(const folly::dynamic& arrayOfKvPairs) noexcept override; 32 | 33 | folly::Optional load() noexcept override; 34 | 35 | void clear() override; 36 | 37 | private: 38 | std::string file_; 39 | }; 40 | 41 | } // namespace wangle 42 | -------------------------------------------------------------------------------- /wangle/client/persistence/PersistentCache.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | 22 | namespace wangle { 23 | 24 | /** 25 | * Interface for a persistent cache that backs up the cache on 26 | * storage so that it can be reused. This desribes just the key 27 | * operations common to any cache. Loading from and syncing to 28 | * the storage is in the actual implementation of the class and 29 | * the clients should not have to worry about it. 30 | */ 31 | template 32 | class PersistentCache { 33 | public: 34 | virtual ~PersistentCache() = default; 35 | 36 | /** 37 | * Get a value corresponding to a key 38 | * @param key string, the key to lookup 39 | * 40 | * @returns value associated with key 41 | */ 42 | virtual folly::Optional get(const K& key) = 0; 43 | 44 | /** 45 | * Set a value corresponding to a key 46 | * @param key string, the key to set 47 | * @param val string, the value to set 48 | * 49 | * overwrites value if key has a value associated in the cache 50 | */ 51 | virtual void put(const K& key, const V& val) = 0; 52 | 53 | /** 54 | * Clear a cache entry associated with a key 55 | * @param key string, the key to lookup and clear 56 | * 57 | * @return boolean true if any elements are removed, else false 58 | */ 59 | virtual bool remove(const K& key) = 0; 60 | 61 | /** 62 | * Empty the contents of the cache 63 | */ 64 | virtual void clear(bool clearPersistence = false) = 0; 65 | 66 | /** 67 | * return the size of the cache 68 | * 69 | * @returns size_t, the size of the cache 70 | */ 71 | 72 | virtual size_t size() = 0; 73 | }; 74 | 75 | } // namespace wangle 76 | -------------------------------------------------------------------------------- /wangle/client/persistence/PersistentCacheCommon.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | 19 | namespace wangle { 20 | 21 | PersistentCacheConfig::Builder&& PersistentCacheConfig::Builder::setCapacity( 22 | std::size_t cacheCapacity) && { 23 | capacity = cacheCapacity; 24 | return std::move(*this); 25 | } 26 | 27 | PersistentCacheConfig::Builder&& 28 | PersistentCacheConfig::Builder::setSyncInterval( 29 | std::chrono::milliseconds interval) && { 30 | syncInterval = interval; 31 | return std::move(*this); 32 | } 33 | 34 | PersistentCacheConfig::Builder&& PersistentCacheConfig::Builder::setExecutor( 35 | std::shared_ptr executorIn) && { 36 | executor = std::move(executorIn); 37 | return std::move(*this); 38 | } 39 | 40 | PersistentCacheConfig::Builder&& 41 | PersistentCacheConfig::Builder::setInlinePersistenceLoading( 42 | bool loadInline) && { 43 | inlinePersistenceLoading = loadInline; 44 | return std::move(*this); 45 | } 46 | 47 | PersistentCacheConfig::Builder&& PersistentCacheConfig::Builder::setSyncRetries( 48 | int retries) && { 49 | nSyncRetries = retries; 50 | return std::move(*this); 51 | } 52 | 53 | PersistentCacheConfig PersistentCacheConfig::Builder::build() && { 54 | return PersistentCacheConfig( 55 | capacity.value(), 56 | syncInterval, 57 | nSyncRetries, 58 | std::move(executor), 59 | inlinePersistenceLoading); 60 | } 61 | } // namespace wangle 62 | -------------------------------------------------------------------------------- /wangle/client/persistence/test/Mocks.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | #include 22 | 23 | namespace wangle { 24 | 25 | template 26 | class MockPersistentCache : public PersistentCache { 27 | public: 28 | MOCK_METHOD1_T(get, folly::Optional(const K&)); 29 | MOCK_METHOD2_T(put, void(const K&, const V&)); 30 | MOCK_METHOD1_T(remove, bool(const K&)); 31 | MOCK_METHOD1_T(clear, void(bool)); 32 | MOCK_METHOD0_T(size, size_t()); 33 | }; 34 | 35 | } // namespace wangle 36 | -------------------------------------------------------------------------------- /wangle/client/persistence/test/PersistentCacheCommonTest.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include 19 | #include 20 | 21 | using namespace testing; 22 | 23 | namespace wangle { 24 | 25 | class PersistentCacheConfigTest : public Test {}; 26 | 27 | TEST_F(PersistentCacheConfigTest, ConfigBuilderCanBuild) { 28 | auto executor = std::make_shared(); 29 | auto config = PersistentCacheConfig::Builder() 30 | .setCapacity(135) 31 | .setSyncInterval(std::chrono::seconds(200)) 32 | .setSyncRetries(246) 33 | .setInlinePersistenceLoading(false) 34 | .setExecutor(executor) 35 | .build(); 36 | EXPECT_EQ(135, config.capacity); 37 | EXPECT_EQ(std::chrono::seconds(200), config.syncInterval); 38 | EXPECT_EQ(246, config.nSyncRetries); 39 | EXPECT_FALSE(config.inlinePersistenceLoading); 40 | EXPECT_EQ(executor, config.executor); 41 | } 42 | 43 | } // namespace wangle 44 | -------------------------------------------------------------------------------- /wangle/client/persistence/test/TestUtil.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | 19 | #include 20 | 21 | namespace wangle { 22 | 23 | std::string getPersistentCacheFilename() { 24 | folly::test::TemporaryFile file("fbtls"); 25 | return file.path().string(); 26 | } 27 | 28 | } // namespace wangle 29 | -------------------------------------------------------------------------------- /wangle/client/ssl/SSLSessionCacheData.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | // 18 | #include 19 | 20 | using namespace std::chrono; 21 | 22 | namespace folly { 23 | 24 | template <> 25 | folly::dynamic toDynamic(const wangle::SSLSessionCacheData& data) { 26 | folly::dynamic ret = folly::dynamic::object; 27 | ret["session_data"] = folly::dynamic(data.sessionData.toStdString()); 28 | system_clock::duration::rep rep = data.addedTime.time_since_epoch().count(); 29 | ret["added_time"] = folly::dynamic(static_cast(rep)); 30 | ret["service_identity"] = folly::dynamic(data.serviceIdentity.toStdString()); 31 | ret["peer_identities"] = folly::dynamic(data.peerIdentities.toStdString()); 32 | return ret; 33 | } 34 | 35 | template <> 36 | wangle::SSLSessionCacheData convertTo(const dynamic& d) { 37 | wangle::SSLSessionCacheData data; 38 | data.sessionData = d["session_data"].asString(); 39 | data.addedTime = 40 | system_clock::time_point(system_clock::duration(d["added_time"].asInt())); 41 | data.serviceIdentity = d.getDefault("service_identity", "").asString(); 42 | data.peerIdentities = d.getDefault("peer_identities", "").asString(); 43 | return data; 44 | } 45 | 46 | } // namespace folly 47 | -------------------------------------------------------------------------------- /wangle/client/ssl/SSLSessionCacheData.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | // 18 | #pragma once 19 | 20 | #include 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | namespace wangle { 27 | 28 | struct SSLSessionCacheData { 29 | folly::fbstring sessionData; 30 | std::chrono::time_point addedTime; 31 | folly::fbstring serviceIdentity; 32 | std::shared_ptr sessionDuplicateTemplate; 33 | folly::fbstring peerIdentities; 34 | }; 35 | 36 | } // namespace wangle 37 | 38 | namespace folly { 39 | template <> 40 | folly::dynamic toDynamic(const wangle::SSLSessionCacheData& d); 41 | template <> 42 | wangle::SSLSessionCacheData convertTo(const dynamic& d); 43 | } // namespace folly 44 | -------------------------------------------------------------------------------- /wangle/client/ssl/SSLSessionCacheUtils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | #include 22 | 23 | #include 24 | 25 | namespace wangle { 26 | 27 | // Service identity access on the session. 28 | folly::Optional getSessionServiceIdentity(SSL_SESSION* sess); 29 | bool setSessionServiceIdentity(SSL_SESSION* sess, const std::string& str); 30 | 31 | // Helpers to convert SSLSessionCacheData to/from SSL_SESSION 32 | folly::Optional getCacheDataForSession(SSL_SESSION* sess); 33 | SSL_SESSION* getSessionFromCacheData(const SSLSessionCacheData& data); 34 | 35 | // Does a clone of just the session data and service identity 36 | // Internal links to SSL structs are not kept 37 | SSL_SESSION* cloneSSLSession(SSL_SESSION* toClone); 38 | 39 | folly::Optional getSessionPeerIdentities(SSL_SESSION* sess); 40 | bool setSessionPeerIdentities(SSL_SESSION* sess, const std::string& str); 41 | 42 | } // namespace wangle 43 | -------------------------------------------------------------------------------- /wangle/client/ssl/ThreadSafeSSLSessionCache.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | 19 | using folly::SharedMutex; 20 | 21 | namespace wangle { 22 | 23 | void ThreadSafeSSLSessionCache::setSSLSession( 24 | const std::string& identity, 25 | folly::ssl::SSLSessionUniquePtr session) noexcept { 26 | std::unique_lock lock(mutex_); 27 | delegate_->setSSLSession(identity, std::move(session)); 28 | } 29 | 30 | folly::ssl::SSLSessionUniquePtr ThreadSafeSSLSessionCache::getSSLSession( 31 | const std::string& identity) const noexcept { 32 | std::shared_lock lock(mutex_); 33 | return delegate_->getSSLSession(identity); 34 | } 35 | 36 | bool ThreadSafeSSLSessionCache::removeSSLSession( 37 | const std::string& identity) noexcept { 38 | std::unique_lock lock(mutex_); 39 | return delegate_->removeSSLSession(identity); 40 | } 41 | 42 | bool ThreadSafeSSLSessionCache::supportsPersistence() const noexcept { 43 | std::shared_lock lock(mutex_); 44 | return delegate_->supportsPersistence(); 45 | } 46 | 47 | size_t ThreadSafeSSLSessionCache::size() const { 48 | std::shared_lock lock(mutex_); 49 | return delegate_->size(); 50 | } 51 | 52 | } // namespace wangle 53 | -------------------------------------------------------------------------------- /wangle/client/ssl/ThreadSafeSSLSessionCache.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | 22 | #include 23 | 24 | namespace wangle { 25 | 26 | /** 27 | * A SSL session cache that can be used safely across threads. 28 | * This is useful for clients who cannot avoid sharing the cache 29 | * across threads. It uses a read/write lock for efficiency. 30 | */ 31 | class ThreadSafeSSLSessionCache : public SSLSessionCallbacks { 32 | public: 33 | explicit ThreadSafeSSLSessionCache( 34 | std::unique_ptr delegate) 35 | : delegate_(std::move(delegate)) {} 36 | 37 | // From SSLSessionCallbacks 38 | void setSSLSession( 39 | const std::string& identity, 40 | folly::ssl::SSLSessionUniquePtr session) noexcept override; 41 | folly::ssl::SSLSessionUniquePtr getSSLSession( 42 | const std::string& identity) const noexcept override; 43 | bool removeSSLSession(const std::string& identity) noexcept override; 44 | bool supportsPersistence() const noexcept override; 45 | size_t size() const override; 46 | 47 | private: 48 | std::unique_ptr delegate_; 49 | mutable folly::SharedMutex mutex_; 50 | }; 51 | 52 | } // namespace wangle 53 | -------------------------------------------------------------------------------- /wangle/client/ssl/test/Mocks.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | 22 | namespace wangle { 23 | 24 | class MockSSLSessionCallbacks : public SSLSessionCallbacks { 25 | public: 26 | MOCK_METHOD2(setSSLSessionInternal, void(const std::string&, SSL_SESSION*)); 27 | 28 | MOCK_CONST_METHOD1(getSSLSessionInternal, SSL_SESSION*(const std::string&)); 29 | 30 | MOCK_METHOD1(removeSSLSessionInternal, bool(const std::string&)); 31 | 32 | folly::ssl::SSLSessionUniquePtr getSSLSession( 33 | const std::string& host) const noexcept override { 34 | return folly::ssl::SSLSessionUniquePtr(getSSLSessionInternal(host)); 35 | } 36 | 37 | void setSSLSession( 38 | const std::string& host, 39 | folly::ssl::SSLSessionUniquePtr session) noexcept override { 40 | setSSLSessionInternal(host, session.release()); 41 | } 42 | 43 | bool removeSSLSession(const std::string& identity) noexcept override { 44 | return removeSSLSessionInternal(identity); 45 | } 46 | }; 47 | 48 | } // namespace wangle 49 | -------------------------------------------------------------------------------- /wangle/client/ssl/test/TestUtil.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | #include 22 | 23 | namespace wangle { 24 | 25 | std::vector> getSessions(); 26 | 27 | std::pair getSessionWithTicket(); 28 | 29 | folly::ssl::SSLSessionUniquePtr createPersistentTestSession( 30 | std::pair session); 31 | 32 | std::string getSessionData(SSL_SESSION* s, size_t expectedLength); 33 | 34 | bool isSameSession( 35 | std::pair lhs, 36 | std::pair rhs); 37 | 38 | } // namespace wangle 39 | -------------------------------------------------------------------------------- /wangle/cmake/FindLibrt.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # - Try to find librt 16 | # Once done, this will define 17 | # 18 | # LIBRT_FOUND - system has librt 19 | # LIBRT_LIBRARIES - link these to use librt 20 | 21 | include(FindPackageHandleStandardArgs) 22 | 23 | find_library(LIBRT_LIBRARY rt 24 | PATHS ${LIBRT_LIBRARYDIR}) 25 | 26 | find_package_handle_standard_args(librt DEFAULT_MSG LIBRT_LIBRARY) 27 | 28 | mark_as_advanced(LIBRT_LIBRARY) 29 | 30 | set(LIBRT_LIBRARIES ${LIBRT_LIBRARY}) 31 | -------------------------------------------------------------------------------- /wangle/cmake/wangle-config.cmake.in: -------------------------------------------------------------------------------- 1 | # 2 | # CMake package configuration file for wangle 3 | # 4 | # Defines the target "wangle::wangle" 5 | # Add this to your target_link_libraries() call to depend on wangle. 6 | # 7 | # Also sets the variables WANGLE_INCLUDE_DIR and WANGLE_LIBRARIES. 8 | # However, in most cases using the wangle::wangle target is sufficient, 9 | # and you won't need these variables. 10 | # 11 | 12 | @PACKAGE_INIT@ 13 | 14 | set_and_check(WANGLE_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@") 15 | set_and_check(WANGLE_CMAKE_DIR "@PACKAGE_CMAKE_INSTALL_DIR@") 16 | 17 | if (NOT TARGET wangle::wangle) 18 | include("${WANGLE_CMAKE_DIR}/wangle-targets.cmake") 19 | endif() 20 | 21 | set(WANGLE_LIBRARIES wangle::wangle) 22 | 23 | if (NOT wangle_FIND_QUIETLY) 24 | message(STATUS "Found wangle: ${PACKAGE_PREFIX_DIR}") 25 | endif() 26 | 27 | set(wangle_LIBRARIES 28 | wangle::wangle 29 | ) 30 | -------------------------------------------------------------------------------- /wangle/codec/FixedLengthFrameDecoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | namespace wangle { 22 | 23 | /** 24 | * A decoder that splits the received IOBufs by the fixed number 25 | * of bytes. For example, if you received the following four 26 | * fragmented packets: 27 | * 28 | * +---+----+------+----+ 29 | * | A | BC | DEFG | HI | 30 | * +---+----+------+----+ 31 | * 32 | * A FixedLengthFrameDecoder will decode them into the following three 33 | * packets with the fixed length: 34 | * 35 | * +-----+-----+-----+ 36 | * | ABC | DEF | GHI | 37 | * +-----+-----+-----+ 38 | * 39 | */ 40 | class FixedLengthFrameDecoder : public ByteToByteDecoder { 41 | public: 42 | explicit FixedLengthFrameDecoder(size_t length) : length_(length) {} 43 | 44 | bool decode( 45 | Context*, 46 | folly::IOBufQueue& q, 47 | std::unique_ptr& result, 48 | size_t& needed) override { 49 | if (q.chainLength() < length_) { 50 | needed = length_ - q.chainLength(); 51 | return false; 52 | } 53 | 54 | result = q.split(length_); 55 | return true; 56 | } 57 | 58 | private: 59 | size_t length_; 60 | }; 61 | 62 | } // namespace wangle 63 | -------------------------------------------------------------------------------- /wangle/codec/LengthFieldPrepender.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | 22 | namespace wangle { 23 | 24 | /** 25 | * An encoder that prepends the length of the message. The length value is 26 | * prepended as a binary form. 27 | * 28 | * For example, LengthFieldPrepender(2)will encode the 29 | * following 12-bytes string: 30 | * 31 | * +----------------+ 32 | * | "HELLO, WORLD" | 33 | * +----------------+ 34 | * 35 | * into the following: 36 | * 37 | * +--------+----------------+ 38 | * + 0x000C | "HELLO, WORLD" | 39 | * +--------+----------------+ 40 | * 41 | * If you turned on the lengthIncludesLengthFieldLength flag in the 42 | * constructor, the encoded data would look like the following 43 | * (12 (original data) + 2 (prepended data) = 14 (0xE)): 44 | * 45 | * +--------+----------------+ 46 | * + 0x000E | "HELLO, WORLD" | 47 | * +--------+----------------+ 48 | * 49 | */ 50 | class LengthFieldPrepender : public OutboundBytesToBytesHandler { 51 | public: 52 | explicit LengthFieldPrepender( 53 | int lengthFieldLength = 4, 54 | int lengthAdjustment = 0, 55 | bool lengthIncludesLengthField = false, 56 | bool networkByteOrder = true); 57 | 58 | folly::Future write( 59 | Context* ctx, 60 | std::unique_ptr buf) override; 61 | 62 | private: 63 | int lengthFieldLength_; 64 | int lengthAdjustment_; 65 | bool lengthIncludesLengthField_; 66 | bool networkByteOrder_; 67 | }; 68 | 69 | } // namespace wangle 70 | -------------------------------------------------------------------------------- /wangle/codec/LineBasedFrameDecoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | 22 | namespace wangle { 23 | 24 | /** 25 | * A decoder that splits the received IOBufQueue on line endings. 26 | * 27 | * Both "\n" and "\r\n" are handled, or optionally reqire only 28 | * one or the other. 29 | */ 30 | class LineBasedFrameDecoder : public ByteToByteDecoder { 31 | public: 32 | enum class TerminatorType { BOTH, NEWLINE, CARRIAGENEWLINE }; 33 | 34 | explicit LineBasedFrameDecoder( 35 | uint32_t maxLength = UINT_MAX, 36 | bool stripDelimiter = true, 37 | TerminatorType terminatorType = TerminatorType::BOTH); 38 | 39 | bool decode( 40 | Context* ctx, 41 | folly::IOBufQueue& buf, 42 | std::unique_ptr& result, 43 | size_t&) override; 44 | 45 | private: 46 | int64_t findEndOfLine(folly::IOBufQueue& buf); 47 | 48 | void fail(Context* ctx, std::string len); 49 | 50 | uint32_t maxLength_; 51 | bool stripDelimiter_; 52 | 53 | bool discarding_{false}; 54 | uint32_t discardedBytes_{0}; 55 | 56 | TerminatorType terminatorType_; 57 | }; 58 | 59 | } // namespace wangle 60 | -------------------------------------------------------------------------------- /wangle/codec/MessageToByteEncoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | namespace wangle { 22 | 23 | /** 24 | * An OutboundHandler which encodes message in a stream-like fashion from one 25 | * message to IOBuf. Inverse of ByteToMessageDecoder. 26 | */ 27 | template 28 | class MessageToByteEncoder 29 | : public OutboundHandler> { 30 | public: 31 | using Context = 32 | typename OutboundHandler>::Context; 33 | 34 | virtual std::unique_ptr encode(M& msg) = 0; 35 | 36 | folly::Future write(Context* ctx, M msg) override { 37 | auto buf = encode(msg); 38 | return buf ? ctx->fireWrite(std::move(buf)) : folly::makeFuture(); 39 | } 40 | }; 41 | 42 | } // namespace wangle 43 | -------------------------------------------------------------------------------- /wangle/codec/README.md: -------------------------------------------------------------------------------- 1 | Codecs are modeled after netty's codecs: 2 | 3 | https://github.com/netty/netty/tree/master/codec/src/main/java/io/netty/handler/codec 4 | 5 | Most of the changes are due to differing memory allocation strategies. 6 | -------------------------------------------------------------------------------- /wangle/codec/StringCodec.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | namespace wangle { 22 | 23 | /* 24 | * StringCodec converts a pipeline from IOBufs to std::strings. 25 | */ 26 | class StringCodec : public Handler< 27 | std::unique_ptr, 28 | std::string, 29 | std::string, 30 | std::unique_ptr> { 31 | public: 32 | using Context = typename Handler< 33 | std::unique_ptr, 34 | std::string, 35 | std::string, 36 | std::unique_ptr>::Context; 37 | 38 | void read(Context* ctx, std::unique_ptr buf) override { 39 | if (buf) { 40 | buf->coalesce(); 41 | std::string data((const char*)buf->data(), buf->length()); 42 | ctx->fireRead(data); 43 | } 44 | } 45 | 46 | folly::Future write(Context* ctx, std::string msg) override { 47 | auto buf = folly::IOBuf::copyBuffer(msg.data(), msg.length()); 48 | return ctx->fireWrite(std::move(buf)); 49 | } 50 | }; 51 | 52 | } // namespace wangle 53 | -------------------------------------------------------------------------------- /wangle/codec/test/CodecTestUtils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | namespace wangle { 26 | namespace test { 27 | 28 | class FrameTester 29 | : public wangle::InboundHandler> { 30 | public: 31 | explicit FrameTester( 32 | folly::Function)> test) 33 | : test_(std::move(test)) {} 34 | 35 | void read(Context*, std::unique_ptr buf) override { 36 | test_(std::move(buf)); 37 | } 38 | 39 | void readException(Context*, folly::exception_wrapper) override { 40 | test_(nullptr); 41 | } 42 | 43 | private: 44 | folly::Function)> test_; 45 | }; 46 | 47 | class BytesReflector : public wangle::BytesToBytesHandler { 48 | public: 49 | folly::Future write( 50 | Context* ctx, 51 | std::unique_ptr buf) override { 52 | folly::IOBufQueue q_(folly::IOBufQueue::cacheChainLength()); 53 | q_.append(std::move(buf)); 54 | ctx->fireRead(q_); 55 | 56 | return folly::makeFuture(); 57 | } 58 | }; 59 | } // namespace test 60 | } // namespace wangle 61 | -------------------------------------------------------------------------------- /wangle/example/echo/EchoServer.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | using namespace folly; 26 | using namespace wangle; 27 | 28 | DEFINE_int32(port, 8080, "echo server port"); 29 | 30 | typedef Pipeline EchoPipeline; 31 | 32 | // the main logic of our echo server; receives a string and writes it straight 33 | // back 34 | class EchoHandler : public HandlerAdapter { 35 | public: 36 | void read(Context* ctx, std::string msg) override { 37 | std::cout << "handling " << msg << std::endl; 38 | write(ctx, msg + "\r\n"); 39 | } 40 | }; 41 | 42 | // where we define the chain of handlers for each messeage received 43 | class EchoPipelineFactory : public PipelineFactory { 44 | public: 45 | EchoPipeline::Ptr newPipeline(std::shared_ptr sock) override { 46 | auto pipeline = EchoPipeline::create(); 47 | pipeline->addBack(AsyncSocketHandler(sock)); 48 | pipeline->addBack(LineBasedFrameDecoder(8192)); 49 | pipeline->addBack(StringCodec()); 50 | pipeline->addBack(EchoHandler()); 51 | pipeline->finalize(); 52 | return pipeline; 53 | } 54 | }; 55 | 56 | int main(int argc, char** argv) { 57 | folly::Init init(&argc, &argv); 58 | 59 | ServerBootstrap server; 60 | server.childPipeline(std::make_shared()); 61 | server.bind(FLAGS_port); 62 | server.waitForStop(); 63 | 64 | return 0; 65 | } 66 | -------------------------------------------------------------------------------- /wangle/example/rpc/ClientSerializeHandler.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | #include 22 | #include 23 | 24 | // Do some serialization / deserialization using thrift. 25 | // A real rpc server would probably use generated client/server stubs 26 | class ClientSerializeHandler : public wangle::Handler< 27 | std::unique_ptr, 28 | thrift::test::Xtruct, 29 | thrift::test::Bonk, 30 | std::unique_ptr> { 31 | public: 32 | void read(Context* ctx, std::unique_ptr msg) override { 33 | thrift::test::Xtruct received = 34 | apache::thrift::CompactSerializer::deserialize( 35 | msg.get()); 36 | ctx->fireRead(received); 37 | } 38 | 39 | folly::Future write(Context* ctx, thrift::test::Bonk b) 40 | override { 41 | std::string out; 42 | apache::thrift::CompactSerializer::serialize(b, &out); 43 | return ctx->fireWrite(folly::IOBuf::copyBuffer(out)); 44 | } 45 | }; 46 | -------------------------------------------------------------------------------- /wangle/example/rpc/README.md: -------------------------------------------------------------------------------- 1 | # RPC client/server example 2 | --------------------------- 3 | 4 | Similar to the telnet example, this provides examples of using a 5 | Pipeline and Server/Client bootstrap libraries. In addition, it 6 | provides examples of: 7 | 8 | * Custom codec for serialization 9 | * Service interface, to match up requests with replies. Various 10 | versions of this are in the comments 11 | * ServiceFilters, for timeouts, logging, etc. 12 | -------------------------------------------------------------------------------- /wangle/example/rpc/ServerSerializeHandler.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | #include 22 | #include 23 | 24 | // Do some serialization / deserialization using thrift. 25 | // A real rpc server would probably use generated client/server stubs 26 | class ServerSerializeHandler : public wangle::Handler< 27 | std::unique_ptr, 28 | thrift::test::Bonk, 29 | thrift::test::Xtruct, 30 | std::unique_ptr> { 31 | public: 32 | void read(Context* ctx, std::unique_ptr msg) override { 33 | thrift::test::Bonk received = 34 | apache::thrift::CompactSerializer::deserialize( 35 | msg.get()); 36 | ctx->fireRead(received); 37 | } 38 | 39 | folly::Future write(Context* ctx, thrift::test::Xtruct b) 40 | override { 41 | std::string out; 42 | apache::thrift::CompactSerializer::serialize(b, &out); 43 | return ctx->fireWrite(folly::IOBuf::copyBuffer(out)); 44 | } 45 | }; 46 | -------------------------------------------------------------------------------- /wangle/service/CloseOnReleaseFilter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | namespace wangle { 22 | 23 | /** 24 | * A service that rejects all requests after its 'close' method has 25 | * been invoked. 26 | */ 27 | template 28 | class CloseOnReleaseFilter : public ServiceFilter { 29 | public: 30 | explicit CloseOnReleaseFilter(std::shared_ptr> service) 31 | : ServiceFilter(service) {} 32 | 33 | folly::Future operator()(Req req) override { 34 | if (!released) { 35 | return (*this->service_)(std::move(req)); 36 | } else { 37 | return folly::makeFuture( 38 | folly::make_exception_wrapper("Service Closed")); 39 | } 40 | } 41 | 42 | folly::Future close() override { 43 | if (!released.exchange(true)) { 44 | return this->service_->close(); 45 | } else { 46 | return folly::makeFuture(); 47 | } 48 | } 49 | 50 | private: 51 | std::atomic released{false}; 52 | }; 53 | 54 | } // namespace wangle 55 | -------------------------------------------------------------------------------- /wangle/service/ExecutorFilter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | namespace wangle { 22 | 23 | /** 24 | * A service that runs all requests through an executor. 25 | */ 26 | template 27 | class ExecutorFilter : public ServiceFilter { 28 | public: 29 | explicit ExecutorFilter( 30 | std::shared_ptr exe, 31 | std::shared_ptr> service) 32 | : ServiceFilter(service), exe_(exe) {} 33 | 34 | folly::Future operator()(Req req) override { 35 | return via(exe_.get()) 36 | .thenValue([req = std::move(req), this](auto&&) mutable { 37 | return (*this->service_)(std::move(req)); 38 | }); 39 | } 40 | 41 | private: 42 | std::shared_ptr exe_; 43 | }; 44 | 45 | } // namespace wangle 46 | -------------------------------------------------------------------------------- /wangle/ssl/ClientHelloExtStats.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | namespace wangle { 22 | 23 | class ClientHelloExtStats { 24 | public: 25 | virtual ~ClientHelloExtStats() noexcept = default; 26 | 27 | // client hello 28 | virtual void recordAbsentHostname() noexcept = 0; 29 | virtual void recordMatch() noexcept = 0; 30 | virtual void recordNotMatch() noexcept = 0; 31 | }; 32 | 33 | } // namespace wangle 34 | -------------------------------------------------------------------------------- /wangle/ssl/PasswordInFileFactory.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | 19 | namespace wangle { 20 | std::shared_ptr 21 | PasswordInFileFactory::getPasswordCollector(const std::string& passwordPath) { 22 | // Check if we've got one saved 23 | auto it = collectors_.find(passwordPath); 24 | if (it != collectors_.end()) { 25 | return it->second; 26 | } 27 | 28 | // No saved one, make a new one. 29 | auto sslPassword = std::make_shared(passwordPath); 30 | collectors_[passwordPath] = sslPassword; 31 | return sslPassword; 32 | } 33 | } // namespace wangle 34 | -------------------------------------------------------------------------------- /wangle/ssl/PasswordInFileFactory.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | #include 22 | 23 | #include 24 | 25 | namespace wangle { 26 | /** 27 | * Password file caching class that provides a very simple cache. Whenever 28 | * a given password file path is loaded, the collector is saved and returned 29 | * whenever that path is requested again. It doesn't invalidate previous 30 | * entries on file changes; it's assumed that the contents of a given file path 31 | * will not change. 32 | */ 33 | class PasswordInFileFactory { 34 | public: 35 | std::shared_ptr getPasswordCollector( 36 | const std::string& passwordPath); 37 | 38 | private: 39 | std::unordered_map> 40 | collectors_; 41 | }; 42 | } // namespace wangle 43 | -------------------------------------------------------------------------------- /wangle/ssl/SNIConfig.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | namespace wangle { 22 | 23 | /** 24 | * Defines TLS related configuration for a list of SNIs. 25 | * The SNIs are associated with single context (x509 identity). 26 | */ 27 | struct SNIConfig { 28 | std::vector snis; 29 | SSLContextConfig contextConfig; 30 | }; 31 | } // namespace wangle 32 | -------------------------------------------------------------------------------- /wangle/ssl/SSLCacheOptions.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | 22 | namespace wangle { 23 | 24 | struct SSLCacheOptions { 25 | std::chrono::seconds sslCacheTimeout; 26 | uint64_t maxSSLCacheSize; 27 | uint64_t sslCacheFlushSize; 28 | std::chrono::seconds handshakeValidity; 29 | }; 30 | 31 | } // namespace wangle 32 | -------------------------------------------------------------------------------- /wangle/ssl/SSLStats.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | namespace wangle { 22 | 23 | class SSLStats { 24 | public: 25 | virtual ~SSLStats() noexcept = default; 26 | 27 | // downstream 28 | virtual void recordSSLAcceptLatency(int64_t latency) noexcept = 0; 29 | virtual void recordTLSTicket(bool ticketNew, bool ticketHit) noexcept = 0; 30 | virtual void 31 | recordSSLSession(bool sessionNew, bool sessionHit, bool foreign) noexcept = 0; 32 | virtual void recordSSLSessionRemove() noexcept = 0; 33 | virtual void recordSSLSessionFree(uint32_t freed) noexcept = 0; 34 | virtual void recordSSLSessionSetError(uint32_t err) noexcept = 0; 35 | virtual void recordSSLSessionGetError(uint32_t err) noexcept = 0; 36 | virtual void recordClientRenegotiation() noexcept = 0; 37 | virtual void recordSSLClientCertificateMismatch() noexcept = 0; 38 | virtual void recordTLSTicketRotation(bool valid) noexcept = 0; 39 | 40 | // upstream 41 | virtual void recordSSLUpstreamConnection(bool handshake) noexcept = 0; 42 | virtual void recordSSLUpstreamConnectionError(bool verifyError) noexcept = 0; 43 | }; 44 | 45 | } // namespace wangle 46 | -------------------------------------------------------------------------------- /wangle/ssl/ServerSSLContext.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | 19 | #include 20 | #include 21 | #include 22 | 23 | namespace wangle { 24 | 25 | ServerSSLContext::ServerSSLContext(SSLVersion version) 26 | : folly::SSLContext(version) { 27 | setSessionCacheContext("ServerSSLContext"); 28 | } 29 | 30 | void ServerSSLContext::setupSessionCache( 31 | const SSLContextConfig& ctxConfig, 32 | const SSLCacheOptions& cacheOptions, 33 | const std::shared_ptr& externalCache, 34 | const std::string& sessionIdContext, 35 | SSLStats* stats) { 36 | // the internal cache never does what we want (per-thread-per-vip). 37 | // Disable it. SSLSessionCacheManager will set it appropriately. 38 | SSL_CTX_set_session_cache_mode(getSSLCtx(), SSL_SESS_CACHE_OFF); 39 | SSL_CTX_set_timeout(getSSLCtx(), cacheOptions.sslCacheTimeout.count()); 40 | if (ctxConfig.sessionCacheEnabled && cacheOptions.maxSSLCacheSize > 0 && 41 | cacheOptions.sslCacheFlushSize > 0) { 42 | sessionCacheManager_ = std::make_unique( 43 | cacheOptions.maxSSLCacheSize, 44 | cacheOptions.sslCacheFlushSize, 45 | this, 46 | sessionIdContext, 47 | stats, 48 | externalCache); 49 | } else { 50 | sessionCacheManager_.reset(); 51 | } 52 | } 53 | 54 | } // namespace wangle 55 | -------------------------------------------------------------------------------- /wangle/ssl/ServerSSLContext.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | 22 | #include 23 | 24 | namespace folly { 25 | 26 | class EventBase; 27 | class SocketAddress; 28 | 29 | } // namespace folly 30 | 31 | namespace wangle { 32 | 33 | struct SSLCacheOptions; 34 | struct SSLContextConfig; 35 | class SSLStats; 36 | class SSLSessionCacheManager; 37 | class SSLCacheProvider; 38 | 39 | // A SSL Context that owns a session cache and ticket key manager. 40 | // It is used for server side SSL connections. 41 | class ServerSSLContext : public folly::SSLContext { 42 | public: 43 | explicit ServerSSLContext(SSLVersion version = TLSv1_2); 44 | 45 | virtual ~ServerSSLContext() override = default; 46 | 47 | void setupSessionCache( 48 | const SSLContextConfig& ctxConfig, 49 | const SSLCacheOptions& cacheOptions, 50 | const std::shared_ptr& externalCache, 51 | const std::string& sessionIdContext, 52 | SSLStats* stats); 53 | 54 | // Get the session cache manager that this context manages. 55 | SSLSessionCacheManager* getSessionCacheManager() { 56 | return sessionCacheManager_.get(); 57 | } 58 | 59 | private: 60 | std::unique_ptr sessionCacheManager_; 61 | }; 62 | 63 | } // namespace wangle 64 | -------------------------------------------------------------------------------- /wangle/ssl/TLSInMemoryTicketProcessor.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include 19 | #include 20 | 21 | namespace { 22 | std::string generateRandomSeed() { 23 | uint8_t seed[32] = {0}; 24 | folly::Random::secureRandom(seed, sizeof(seed)); 25 | return wangle::SSLUtil::hexlify(std::string((char*)seed, sizeof(seed))); 26 | } 27 | } // namespace 28 | 29 | namespace wangle { 30 | TLSInMemoryTicketProcessor::TLSInMemoryTicketProcessor() = default; 31 | 32 | TLSInMemoryTicketProcessor::TLSInMemoryTicketProcessor( 33 | std::vector> callbacks, 34 | std::chrono::milliseconds updateInterval) 35 | : updateInterval_(updateInterval), ticketCallbacks_(callbacks) {} 36 | 37 | TLSInMemoryTicketProcessor::~TLSInMemoryTicketProcessor() { 38 | if (scheduler_) { 39 | scheduler_->cancelAllFunctionsAndWait(); 40 | } 41 | } 42 | 43 | TLSTicketKeySeeds TLSInMemoryTicketProcessor::initInMemoryTicketSeeds() { 44 | TLSTicketKeySeeds seedData; 45 | seedData.currentSeeds.push_back(generateRandomSeed()); 46 | seedData.newSeeds.push_back(generateRandomSeed()); 47 | ticketSeeds_ = seedData; 48 | initScheduler(); 49 | return seedData; 50 | } 51 | 52 | void TLSInMemoryTicketProcessor::initScheduler() { 53 | scheduler_ = std::make_unique(); 54 | scheduler_->setThreadName("TLSInMemoryTicketProcessor"); 55 | scheduler_->addFunction( 56 | [this] { this->updateTicketSeeds(); }, 57 | updateInterval_, 58 | "TLSInMemoryTicketProcessor", 59 | updateInterval_); 60 | scheduler_->start(); 61 | } 62 | 63 | void TLSInMemoryTicketProcessor::updateTicketSeeds() noexcept { 64 | TLSTicketKeySeeds updatedSeeds = { 65 | ticketSeeds_.currentSeeds, ticketSeeds_.newSeeds, {generateRandomSeed()}}; 66 | ticketSeeds_ = updatedSeeds; 67 | for (auto& callback : ticketCallbacks_) { 68 | callback(updatedSeeds); 69 | } 70 | } 71 | } // namespace wangle 72 | -------------------------------------------------------------------------------- /wangle/ssl/TLSInMemoryTicketProcessor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | #pragma once 23 | 24 | namespace wangle { 25 | 26 | /** 27 | * A class that updates in memory ticket seeds and fires callbacks periodically 28 | * based on the updateInterval duration, which defaults to 4 hours. 29 | */ 30 | class TLSInMemoryTicketProcessor { 31 | static constexpr std::chrono::milliseconds kDefaultUpdateInterval = 32 | std::chrono::duration_cast( 33 | std::chrono::hours(2)); 34 | 35 | public: 36 | TLSInMemoryTicketProcessor(); 37 | explicit TLSInMemoryTicketProcessor( 38 | std::vector> callbacks, 39 | std::chrono::milliseconds updateInterval = kDefaultUpdateInterval); 40 | 41 | TLSInMemoryTicketProcessor(TLSInMemoryTicketProcessor&&) = default; 42 | TLSInMemoryTicketProcessor& operator=(TLSInMemoryTicketProcessor&&) = default; 43 | 44 | virtual ~TLSInMemoryTicketProcessor(); 45 | TLSTicketKeySeeds initInMemoryTicketSeeds(); 46 | 47 | /* Add a callback fucntion to be fired periodically. */ 48 | 49 | private: 50 | void initScheduler(); 51 | void updateTicketSeeds() noexcept; 52 | 53 | std::unique_ptr scheduler_; 54 | std::chrono::milliseconds updateInterval_{kDefaultUpdateInterval}; 55 | std::vector> ticketCallbacks_; 56 | TLSTicketKeySeeds ticketSeeds_; 57 | }; 58 | 59 | } // namespace wangle 60 | -------------------------------------------------------------------------------- /wangle/ssl/test/MockSSLStats.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | 22 | namespace wangle { 23 | 24 | class MockSSLStats : public wangle::SSLStats { 25 | public: 26 | MOCK_METHOD(void, recordTLSTicketRotation, (bool valid), (noexcept)); 27 | 28 | // downstream 29 | void recordSSLAcceptLatency(int64_t /* unused */) noexcept override {} 30 | void recordTLSTicket(bool /* unused */, bool /* unused */) noexcept override { 31 | } 32 | void recordSSLSession( 33 | bool /* unused */, 34 | bool /* unused */, 35 | bool /* unused */) noexcept override {} 36 | void recordSSLSessionRemove() noexcept override {} 37 | void recordSSLSessionFree(uint32_t /* unused */) noexcept override {} 38 | void recordSSLSessionSetError(uint32_t /* unused */) noexcept override {} 39 | void recordSSLSessionGetError(uint32_t /* unused */) noexcept override {} 40 | void recordClientRenegotiation() noexcept override {} 41 | void recordSSLClientCertificateMismatch() noexcept override {} 42 | 43 | // upstream 44 | MOCK_METHOD(void, recordSSLUpstreamConnection, (bool handshake), (noexcept)); 45 | void recordSSLUpstreamConnectionError(bool /* unused */) noexcept override {} 46 | }; 47 | 48 | } // namespace wangle 49 | -------------------------------------------------------------------------------- /wangle/ssl/test/SSLSessionCacheManagerTest.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | using namespace folly; 23 | using namespace wangle; 24 | 25 | TEST(ShardedLocalSSLSessionCacheTest, TestHash) { 26 | uint32_t buckets = 10; 27 | uint32_t cacheSize = 20; 28 | uint32_t cacheCullSize = 100; 29 | 30 | std::array id; 31 | Random::secureRandom(id.data(), id.size()); 32 | 33 | ShardedLocalSSLSessionCache cache(buckets, cacheSize, cacheCullSize); 34 | cache.hash(std::string((char*)id.data(), id.size())); 35 | } 36 | -------------------------------------------------------------------------------- /wangle/ssl/test/TLSInMemoryTicketProcessorTest.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include 19 | #include 20 | 21 | using namespace folly; 22 | using namespace wangle; 23 | 24 | class TestInMemoryTicket : public testing::Test {}; 25 | 26 | TEST_F(TestInMemoryTicket, TestInitInMemoryTicket) { 27 | auto processor = TLSInMemoryTicketProcessor(); 28 | auto seeds = processor.initInMemoryTicketSeeds(); 29 | // When new in memory ticket seeds are created, the old seeds should be empty 30 | ASSERT_EQ(0, seeds.oldSeeds.size()); 31 | ASSERT_EQ(1, seeds.currentSeeds.size()); 32 | ASSERT_EQ(1, seeds.newSeeds.size()); 33 | } 34 | 35 | TEST_F(TestInMemoryTicket, TestUpdateInMemoryTicket) { 36 | Baton<> ticketBaton; 37 | TLSTicketKeySeeds rotatedSeeds; 38 | auto callback = [&rotatedSeeds, &ticketBaton](TLSTicketKeySeeds seeds) { 39 | ticketBaton.post(); 40 | rotatedSeeds = seeds; 41 | }; 42 | auto processor = TLSInMemoryTicketProcessor( 43 | {callback}, 44 | std::chrono::duration_cast( 45 | std::chrono::seconds(3))); 46 | auto originalSeeds = processor.initInMemoryTicketSeeds(); 47 | // Test the processor generates valid ticket seeds 48 | EXPECT_TRUE(ticketBaton.try_wait_for(std::chrono::seconds(4))); 49 | EXPECT_TRUE(originalSeeds.isValidRotation(rotatedSeeds)); 50 | ticketBaton.reset(); 51 | originalSeeds = rotatedSeeds; 52 | // Test the processor still generates valid ticket seeds for second rotation 53 | EXPECT_TRUE(ticketBaton.try_wait_for(std::chrono::seconds(4))); 54 | EXPECT_TRUE(originalSeeds.isValidRotation(rotatedSeeds)); 55 | } 56 | -------------------------------------------------------------------------------- /wangle/ssl/test/certs/test.cert.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIICFzCCAb6gAwIBAgIJAO6xBdXUFQqgMAkGByqGSM49BAEwaDELMAkGA1UEBhMC 3 | VVMxFTATBgNVBAcMDERlZmF1bHQgQ2l0eTEcMBoGA1UECgwTRGVmYXVsdCBDb21w 4 | YW55IEx0ZDERMA8GA1UECwwIdGVzdC5jb20xETAPBgNVBAMMCHRlc3QuY29tMCAX 5 | DTE2MDMxNjE4MDg1M1oYDzQ3NTQwMjExMTgwODUzWjBoMQswCQYDVQQGEwJVUzEV 6 | MBMGA1UEBwwMRGVmYXVsdCBDaXR5MRwwGgYDVQQKDBNEZWZhdWx0IENvbXBhbnkg 7 | THRkMREwDwYDVQQLDAh0ZXN0LmNvbTERMA8GA1UEAwwIdGVzdC5jb20wWTATBgcq 8 | hkjOPQIBBggqhkjOPQMBBwNCAARZ4vDgSPwytxU2HfQG/wxhsk0uHfr1eUmheqoC 9 | yiQPB7aXZPbFs3JtvhzKc8DZ0rrZIQpkVLAGEIAa5UbuCy32o1AwTjAdBgNVHQ4E 10 | FgQU05wwrHKWuyGM0qAIzeprza/FM9UwHwYDVR0jBBgwFoAU05wwrHKWuyGM0qAI 11 | zeprza/FM9UwDAYDVR0TBAUwAwEB/zAJBgcqhkjOPQQBA0gAMEUCIBofo+kW0kxn 12 | wzvNvopVKr/cFuDzwRKHdozoiZ492g6QAiEAo55BTcbSwBeszWR6Cr8gOCS4Oq7Z 13 | Mt8v4GYjd1KT4fE= 14 | -----END CERTIFICATE----- 15 | -------------------------------------------------------------------------------- /wangle/ssl/test/certs/test.key.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN EC PARAMETERS----- 2 | BggqhkjOPQMBBw== 3 | -----END EC PARAMETERS----- 4 | -----BEGIN EC PRIVATE KEY----- 5 | MHcCAQEEIKhuz+7RoCLvsXzcD1+Bq5ahrOViFJmgHiGR3w3OmXEroAoGCCqGSM49 6 | AwEHoUQDQgAEWeLw4Ej8MrcVNh30Bv8MYbJNLh369XlJoXqqAsokDwe2l2T2xbNy 7 | bb4cynPA2dK62SEKZFSwBhCAGuVG7gst9g== 8 | -----END EC PRIVATE KEY----- 9 | -------------------------------------------------------------------------------- /wangle/test/TestMain.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include 19 | 20 | /* 21 | * This is the recommended main function for all tests. 22 | * The Makefile links it into all of the test programs so that tests do not need 23 | * to - and indeed should typically not - define their own main() functions 24 | */ 25 | FOLLY_ATTR_WEAK int main(int argc, char** argv); 26 | 27 | int main(int argc, char** argv) { 28 | ::testing::InitGoogleTest(&argc, argv); 29 | folly::init(&argc, &argv); 30 | return RUN_ALL_TESTS(); 31 | } 32 | --------------------------------------------------------------------------------