├── .buckconfig ├── .buckconfig.d └── common.buckconfig ├── .cargo └── config.toml ├── .github └── workflows │ ├── buck-build-and-test.yml │ └── cargo-build-and-test.yml ├── .gitignore ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── Cargo.toml ├── LICENSE ├── README-BUCK.md ├── README.md ├── buck2 ├── build └── buck2 │ ├── README.md │ └── install_deps │ ├── BUCK │ ├── install_deps.sh │ └── repos │ ├── fedora │ ├── homebrew │ └── ubuntu ├── cargo_test_utils ├── BUCK ├── Cargo.toml └── cargo_test_utils.rs ├── defs.bzl ├── macro_test_util ├── BUCK ├── Cargo.toml └── macro_test_util.rs ├── ocaml-setup.sh ├── ocamlrep ├── BUCK ├── Cargo.toml ├── arena.rs ├── block.rs ├── cache.rs ├── error.rs ├── from.rs ├── impls.rs ├── lib.rs ├── ptr.rs ├── rc.rs ├── test │ ├── BUCK │ ├── test_add_root.rs │ ├── test_add_root │ │ └── Cargo.toml │ ├── test_bindings.rs │ ├── test_bindings │ │ └── Cargo.toml │ ├── test_from_ocamlrep.rs │ ├── test_from_ocamlrep │ │ └── Cargo.toml │ ├── test_from_ocamlrep_in.rs │ ├── test_from_ocamlrep_in │ │ └── Cargo.toml │ └── test_ocamlrep.ml └── value.rs ├── ocamlrep_caml_builtins ├── BUCK ├── Cargo.toml └── lib.rs ├── ocamlrep_custom ├── BUCK ├── Cargo.toml ├── lib.rs └── test │ ├── BUCK │ ├── Cargo.toml │ ├── counter.rs │ ├── counter_client.ml │ ├── test_custom.ml │ └── test_custom.rs ├── ocamlrep_derive ├── BUCK ├── Cargo.toml └── lib.rs ├── ocamlrep_marshal ├── BUCK ├── Cargo.toml ├── build.rs ├── deser.rs ├── dune ├── intext.rs ├── ocaml_version.c ├── ocamlrep_marshal.rs ├── ser.rs └── test │ ├── BUCK │ ├── Cargo.toml │ ├── ocamlrep_marshal_ffi_bindings.rs │ └── test_ocamlrep_marshal.ml ├── ocamlrep_ocamlpool ├── BUCK ├── Cargo.toml ├── build.rs ├── lib.rs ├── ocamlpool.c ├── ocamlpool.h └── test │ ├── BUCK │ ├── Cargo.toml │ ├── ocamlpool_test.ml │ └── ocamlpool_test.rs ├── rust-toolchain ├── rust_to_ocaml ├── BUCK ├── attr_parser │ ├── Cargo.toml │ └── attr_parser.rs ├── rust_to_ocaml │ ├── Cargo.toml │ ├── config.rs │ ├── convert.rs │ ├── ir.rs │ ├── ir │ │ └── display.rs │ ├── macros.rs │ ├── rewrite_module_names.rs │ ├── rewrite_types.rs │ └── rust_to_ocaml.rs ├── rust_to_ocaml_attr │ ├── Cargo.toml │ └── rust_to_ocaml_attr.rs └── test │ ├── BUCK │ ├── Cargo.toml │ ├── cases │ ├── .ocamlformat │ ├── BUCK │ ├── attrs.rs │ ├── attrs.rs.exp │ ├── bool_alias.rs │ ├── bool_alias.rs.exp │ ├── doc_comment.rs │ ├── doc_comment.rs.exp │ ├── inline_tuple.rs │ ├── inline_tuple.rs.exp │ ├── inline_tuple_bad.rs │ ├── inline_tuple_bad.rs.exp │ ├── int.rs │ ├── int.rs.exp │ ├── keywords.rs │ ├── keywords.rs.exp │ ├── lists.rs │ ├── lists.rs.exp │ ├── mutual_rec.rs │ ├── mutual_rec.rs.exp │ ├── my_result.rs │ ├── my_result.rs.exp │ ├── name_attribute.rs │ ├── name_attribute.rs.exp │ ├── option.rs │ ├── option.rs.exp │ ├── pointers.rs │ ├── pointers.rs.exp │ ├── qualified_name.rs │ ├── qualified_name.rs.exp │ ├── struct.rs │ ├── struct.rs.exp │ ├── tuple.rs │ ├── tuple.rs.exp │ ├── tuple_structs.rs │ ├── tuple_structs.rs.exp │ ├── type_args.rs │ ├── type_args.rs.exp │ ├── type_name_matches_module_name.rs │ ├── type_name_matches_module_name.rs.exp │ ├── variants.rs │ └── variants.rs.exp │ ├── config.toml │ └── test_rust_to_ocaml.rs ├── shim ├── .buckconfig ├── .buckroot ├── .gitignore ├── BUCK ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE-APACHE ├── LICENSE-MIT ├── PACKAGE ├── README.md ├── antlir │ └── fbpkg │ │ └── fbpkg.bzl ├── buck2 │ ├── buck_rust_binary.bzl │ └── proto_defs.bzl ├── build_defs │ ├── auto_headers.bzl │ ├── config.bzl │ ├── cpp_benchmark.bzl │ ├── cpp_binary.bzl │ ├── cpp_library.bzl │ ├── cpp_unittest.bzl │ ├── custom_rule.bzl │ ├── custom_unittest.bzl │ ├── cython_library.bzl │ ├── export_files.bzl │ ├── lib │ │ ├── oss.bzl │ │ ├── python_common.bzl │ │ └── test │ │ │ ├── BUCK │ │ │ └── oss.bzl │ ├── native_rules.bzl │ ├── ocaml_binary.bzl │ ├── platform_utils.bzl │ ├── prebuilt_cpp_library.bzl │ ├── python_binary.bzl │ ├── python_library.bzl │ ├── python_unittest.bzl │ ├── rust_binary.bzl │ ├── rust_library.bzl │ ├── rust_linkable_symbol.bzl │ └── rust_unittest.bzl ├── cfg.bzl ├── common │ └── ocaml │ │ └── interop │ │ └── defs.bzl ├── folly │ └── io │ │ └── async │ │ └── test │ │ └── certs │ │ └── defs.bzl ├── grpc_fb │ └── codegen │ │ └── buck_macros.bzl ├── lib │ ├── dicts.bzl │ ├── paths.bzl │ └── shell.bzl ├── opensource │ └── macros │ │ ├── BUCK │ │ └── broken_in_oss │ │ └── constraints │ │ └── BUCK ├── os │ ├── BUCK │ └── linux │ │ └── distro │ │ └── constraints │ │ └── BUCK ├── shims.bzl ├── third-party │ ├── binutils │ │ └── BUCK │ ├── boost │ │ ├── BUCK │ │ └── boost.bzl │ ├── brotli │ │ └── BUCK │ ├── bzip2 │ │ └── BUCK │ ├── defs.bzl │ ├── double_conversion │ │ └── BUCK │ ├── fast_float │ │ └── BUCK │ ├── fmt │ │ └── BUCK │ ├── gflags │ │ └── BUCK │ ├── glibc │ │ └── BUCK │ ├── glog │ │ └── BUCK │ ├── googletest │ │ ├── BUCK │ │ └── gtest_main.cpp │ ├── jemalloc │ │ └── BUCK │ ├── jvm │ │ └── BUCK │ ├── libaegis │ │ └── BUCK │ ├── libaio │ │ └── BUCK │ ├── libdwarf │ │ └── BUCK │ ├── libevent │ │ └── BUCK │ ├── libgcc │ │ └── BUCK │ ├── liboqs │ │ └── BUCK │ ├── libsodium │ │ └── BUCK │ ├── libunwind │ │ └── BUCK │ ├── liburing │ │ └── BUCK │ ├── lz4 │ │ └── BUCK │ ├── macros │ │ └── rust_third_party.bzl │ ├── ocaml │ │ ├── BUCK │ │ └── opam │ │ │ └── lib │ │ │ └── ocaml │ ├── openssl │ │ └── BUCK │ ├── proto │ │ ├── BUCK │ │ ├── defs.bzl │ │ ├── releases.bzl │ │ └── update.py │ ├── python │ │ └── BUCK │ ├── range-v3 │ │ └── BUCK │ ├── rust │ │ ├── .gitignore │ │ ├── BUCK │ │ ├── Cargo.toml │ │ ├── defs.bzl │ │ ├── fixups │ │ │ ├── ahash │ │ │ │ └── fixups.toml │ │ │ ├── anyhow │ │ │ │ └── fixups.toml │ │ │ ├── argmin-math │ │ │ │ └── fixups.toml │ │ │ ├── async-trait │ │ │ │ └── fixups.toml │ │ │ ├── atomic │ │ │ │ └── fixups.toml │ │ │ ├── axum-core │ │ │ │ └── fixups.toml │ │ │ ├── axum │ │ │ │ └── fixups.toml │ │ │ ├── backtrace │ │ │ │ └── fixups.toml │ │ │ ├── blake3 │ │ │ │ └── fixups.toml │ │ │ ├── bumpalo │ │ │ │ └── fixups.toml │ │ │ ├── bzip2-sys │ │ │ │ └── fixups.toml │ │ │ ├── clap │ │ │ │ └── fixups.toml │ │ │ ├── clap_builder │ │ │ │ └── fixups.toml │ │ │ ├── clap_derive │ │ │ │ └── fixups.toml │ │ │ ├── core-foundation-sys │ │ │ │ └── fixups.toml │ │ │ ├── crc32fast │ │ │ │ └── fixups.toml │ │ │ ├── criterion │ │ │ │ └── fixups.toml │ │ │ ├── crossbeam-epoch │ │ │ │ └── fixups.toml │ │ │ ├── crossbeam-queue │ │ │ │ └── fixups.toml │ │ │ ├── crossbeam-utils │ │ │ │ └── fixups.toml │ │ │ ├── crunchy │ │ │ │ └── fixups.toml │ │ │ ├── darwin-libproc-sys │ │ │ │ └── fixups.toml │ │ │ ├── debugserver-types │ │ │ │ └── fixups.toml │ │ │ ├── derive_more-impl │ │ │ │ └── fixups.toml │ │ │ ├── derive_more │ │ │ │ └── fixups.toml │ │ │ ├── erased-serde │ │ │ │ └── fixups.toml │ │ │ ├── fs-err │ │ │ │ └── fixups.toml │ │ │ ├── fs4 │ │ │ │ └── fixups.toml │ │ │ ├── futures-channel │ │ │ │ └── fixups.toml │ │ │ ├── futures-core │ │ │ │ └── fixups.toml │ │ │ ├── futures-task │ │ │ │ └── fixups.toml │ │ │ ├── futures-util │ │ │ │ └── fixups.toml │ │ │ ├── generic-array │ │ │ │ └── fixups.toml │ │ │ ├── getrandom │ │ │ │ └── fixups.toml │ │ │ ├── httparse │ │ │ │ └── fixups.toml │ │ │ ├── hyper │ │ │ │ └── fixups.toml │ │ │ ├── indexmap │ │ │ │ └── fixups.toml │ │ │ ├── io-lifetimes │ │ │ │ └── fixups.toml │ │ │ ├── jemalloc-sys │ │ │ │ └── fixups.toml │ │ │ ├── lalrpop │ │ │ │ └── fixups.toml │ │ │ ├── lexical-core │ │ │ │ └── fixups.toml │ │ │ ├── libc │ │ │ │ └── fixups.toml │ │ │ ├── libm │ │ │ │ └── fixups.toml │ │ │ ├── libmimalloc-sys │ │ │ │ └── fixups.toml │ │ │ ├── libsqlite3-sys │ │ │ │ ├── BUCK │ │ │ │ ├── bindgen.rs │ │ │ │ └── fixups.toml │ │ │ ├── linkme-impl │ │ │ │ └── fixups.toml │ │ │ ├── lock_api │ │ │ │ └── fixups.toml │ │ │ ├── log │ │ │ │ └── fixups.toml │ │ │ ├── memchr │ │ │ │ └── fixups.toml │ │ │ ├── memoffset │ │ │ │ └── fixups.toml │ │ │ ├── mio │ │ │ │ └── fixups.toml │ │ │ ├── native-tls │ │ │ │ └── fixups.toml │ │ │ ├── nix │ │ │ │ └── fixups.toml │ │ │ ├── nom │ │ │ │ └── fixups.toml │ │ │ ├── ntapi │ │ │ │ └── fixups.toml │ │ │ ├── num-bigint │ │ │ │ └── fixups.toml │ │ │ ├── num-integer │ │ │ │ └── fixups.toml │ │ │ ├── num-traits │ │ │ │ └── fixups.toml │ │ │ ├── oid-registry │ │ │ │ └── fixups.toml │ │ │ ├── parking_lot │ │ │ │ └── fixups.toml │ │ │ ├── parking_lot_core │ │ │ │ └── fixups.toml │ │ │ ├── paste │ │ │ │ └── fixups.toml │ │ │ ├── perf-event-open-sys │ │ │ │ └── fixups.toml │ │ │ ├── pest │ │ │ │ └── fixups.toml │ │ │ ├── pin-project-internal │ │ │ │ └── fixups.toml │ │ │ ├── platforms │ │ │ │ └── fixups.toml │ │ │ ├── prettyplease │ │ │ │ └── fixups.toml │ │ │ ├── proc-macro-error-attr │ │ │ │ └── fixups.toml │ │ │ ├── proc-macro-error │ │ │ │ └── fixups.toml │ │ │ ├── proc-macro-hack │ │ │ │ └── fixups.toml │ │ │ ├── proc-macro2 │ │ │ │ └── fixups.toml │ │ │ ├── prost-build │ │ │ │ └── fixups.toml │ │ │ ├── pulldown-cmark │ │ │ │ └── fixups.toml │ │ │ ├── quote │ │ │ │ └── fixups.toml │ │ │ ├── radium │ │ │ │ └── fixups.toml │ │ │ ├── rayon-core │ │ │ │ └── fixups.toml │ │ │ ├── ref-cast │ │ │ │ └── fixups.toml │ │ │ ├── reqwest │ │ │ │ └── fixups.toml │ │ │ ├── ring │ │ │ │ ├── fixups.toml │ │ │ │ └── include │ │ │ │ │ └── ring_core_generated │ │ │ │ │ ├── prefix_symbols.h │ │ │ │ │ ├── prefix_symbols_asm.h │ │ │ │ │ └── prefix_symbols_nasm.inc │ │ │ ├── rustix │ │ │ │ └── fixups.toml │ │ │ ├── rustls │ │ │ │ └── fixups.toml │ │ │ ├── rustversion │ │ │ │ └── fixups.toml │ │ │ ├── serde │ │ │ │ └── fixups.toml │ │ │ ├── serde_derive │ │ │ │ └── fixups.toml │ │ │ ├── serde_json │ │ │ │ └── fixups.toml │ │ │ ├── signal-hook │ │ │ │ └── fixups.toml │ │ │ ├── slab │ │ │ │ └── fixups.toml │ │ │ ├── slog │ │ │ │ └── fixups.toml │ │ │ ├── syn │ │ │ │ └── fixups.toml │ │ │ ├── sys-info │ │ │ │ └── fixups.toml │ │ │ ├── sysinfo │ │ │ │ └── fixups.toml │ │ │ ├── target-triple │ │ │ │ └── fixups.toml │ │ │ ├── tempfile │ │ │ │ └── fixups.toml │ │ │ ├── terminfo │ │ │ │ └── fixups.toml │ │ │ ├── termwiz │ │ │ │ └── fixups.toml │ │ │ ├── test-case │ │ │ │ └── fixups.toml │ │ │ ├── thiserror │ │ │ │ └── fixups.toml │ │ │ ├── tiny-keccak │ │ │ │ └── fixups.toml │ │ │ ├── tokio-stream │ │ │ │ └── fixups.toml │ │ │ ├── tokio-util │ │ │ │ └── fixups.toml │ │ │ ├── tokio │ │ │ │ └── fixups.toml │ │ │ ├── tonic │ │ │ │ └── fixups.toml │ │ │ ├── tracing-subscriber │ │ │ │ └── fixups.toml │ │ │ ├── trybuild │ │ │ │ └── fixups.toml │ │ │ ├── typenum │ │ │ │ └── fixups.toml │ │ │ ├── unicase │ │ │ │ └── fixups.toml │ │ │ ├── winapi-x86_64-pc-windows-gnu │ │ │ │ └── fixups.toml │ │ │ ├── winapi │ │ │ │ └── fixups.toml │ │ │ ├── windows-targets │ │ │ │ └── fixups.toml │ │ │ ├── windows_aarch64_gnullvm │ │ │ │ └── fixups.toml │ │ │ ├── windows_x86_64_gnu │ │ │ │ └── fixups.toml │ │ │ ├── windows_x86_64_gnullvm │ │ │ │ └── fixups.toml │ │ │ ├── windows_x86_64_msvc │ │ │ │ └── fixups.toml │ │ │ ├── winreg │ │ │ │ └── fixups.toml │ │ │ ├── zerocopy │ │ │ │ └── fixups.toml │ │ │ ├── zstd-safe │ │ │ │ └── fixups.toml │ │ │ └── zstd-sys │ │ │ │ └── fixups.toml │ │ ├── reindeer.toml │ │ └── top │ │ │ └── main.rs │ ├── snappy │ │ └── BUCK │ ├── toolchains │ │ └── win │ │ │ └── BUCK │ ├── xz │ │ └── BUCK │ ├── zlib │ │ └── BUCK │ └── zstd │ │ └── BUCK ├── tools │ ├── build_defs │ │ ├── audit_dependencies_test.bzl │ │ ├── buck2 │ │ │ └── is_buck2.bzl │ │ ├── buckconfig.bzl │ │ ├── default_platform_defs.bzl │ │ ├── fb_native_wrapper.bzl │ │ └── glob_defs.bzl │ └── target_determinator │ │ └── macros │ │ └── ci.bzl └── xplat │ └── executorch │ └── kernels │ └── optimized │ ├── lib_defs.bzl │ └── op_registration_util.bzl └── signed_source ├── BUCK ├── Cargo.toml └── signed_source.rs /.buckconfig: -------------------------------------------------------------------------------- 1 | [cells] 2 | gh_facebook_ocamlrep = . 3 | gh_facebook_buck2_shims_meta = shim 4 | 5 | [cell_aliases] 6 | root = gh_facebook_ocamlrep 7 | 8 | [oss] 9 | internal_cell = fbcode 10 | stripped_root_dirs = common/ocaml/interop 11 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /.cargo/config.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | [build] 9 | rustflags = [ 10 | "-Drust-2018-idioms", 11 | "-Dwarnings", 12 | "-Dunused-crate-dependencies" 13 | ] 14 | -------------------------------------------------------------------------------- /.github/workflows/buck-build-and-test.yml: -------------------------------------------------------------------------------- 1 | name: Buck build and test 2 | on: 3 | push: 4 | pull_request: 5 | workflow_dispatch: 6 | jobs: 7 | buck-build-and-test: 8 | name: ${{ matrix.os }} 9 | runs-on: ${{ matrix.os }}-latest 10 | strategy: 11 | fail-fast: false 12 | matrix: 13 | os: [ubuntu, macos] 14 | steps: 15 | - uses: actions/checkout@v4 16 | - uses: Swatinem/rust-cache@v2 17 | - uses: facebook/install-dotslash@latest 18 | - run: sudo apt-get update && sudo apt-get install opam 19 | if: matrix.os == 'ubuntu' 20 | - run: brew install opam 21 | if: matrix.os == 'macos' 22 | - run: | 23 | opam init --compiler=5.3.0 --disable-sandboxing -y 24 | opam env | sed -e "s/ export .*//g" -e "s/'//g" -e "s/\;//g" >> $GITHUB_ENV 25 | - run: ./ocaml-setup.sh 26 | - run: cargo install --git https://github.com/facebookincubator/reindeer.git reindeer --force 27 | - run: reindeer --third-party-dir shim/third-party/rust buckify 28 | - run: ./buck2 build root//... -v 2 29 | -------------------------------------------------------------------------------- /.github/workflows/cargo-build-and-test.yml: -------------------------------------------------------------------------------- 1 | name: Cargo build and test 2 | on: 3 | push: 4 | pull_request: 5 | workflow_dispatch: 6 | jobs: 7 | cargo-build-and-test: 8 | name: ${{ matrix.os }} 9 | runs-on: ${{ matrix.os }}-latest 10 | strategy: 11 | fail-fast: false 12 | matrix: 13 | os: [ubuntu, macos] 14 | steps: 15 | - uses: actions/checkout@v4 16 | - uses: Swatinem/rust-cache@v2 17 | - run: sudo apt-get update && sudo apt-get install opam 18 | if: matrix.os == 'ubuntu' 19 | - run: brew install opam 20 | if: matrix.os == 'macos' 21 | - run: | 22 | opam init --compiler=5.3.0 --disable-sandboxing -y 23 | opam env | sed "s/ export .*//g" | sed "s/'//g" | sed "s/\;//g" >> $GITHUB_ENV 24 | - run: ./ocaml-setup.sh 25 | - run: cargo build 26 | - run: cargo test 27 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | target 2 | cargo-out 3 | Cargo.lock 4 | buck-out 5 | shim/third-party/rust/BUCK 6 | shim/third-party/rust/vendor 7 | shim/third-party/ocaml/opam 8 | shim/third-party/ocaml/standard_library 9 | **/.DS_Store 10 | **/.cargo 11 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ### 0.alpha (December, 2022) 2 | Creation of the repository 3 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to ocamlrep 2 | We want to make contributing to this project as easy and transparent as 3 | possible. 4 | 5 | ## Our Development Process 6 | The project is in its early steps and the process is not yet finalized. 7 | 8 | ## Pull Requests 9 | We actively welcome your pull requests. 10 | 11 | 1. Fork the repo and create your branch from `main`. 12 | 2. Code shall pass our test-suite. 13 | 3. If you've changed APIs, update the documentation. 14 | 4. If you haven't already, complete the Contributor License Agreement ("CLA"). 15 | 16 | ## Contributor License Agreement ("CLA") 17 | In order to accept your pull request, we need you to submit a CLA. You only need 18 | to do this once to work on any of Facebook's open source projects. 19 | 20 | Complete your CLA here: 21 | 22 | ## Issues 23 | We use GitHub issues to track public bugs. Please ensure your description is 24 | clear and has sufficient instructions to be able to reproduce the issue. 25 | 26 | Facebook has a [bounty program](https://www.facebook.com/whitehat/) for the safe 27 | disclosure of security bugs. In those cases, please go through the process 28 | outlined on that page and do not file a public issue. 29 | 30 | ## Coding Style 31 | * 2 spaces for indentation rather than tabs 32 | * 80 character line length if possible 33 | 34 | ## License 35 | By contributing to ocamlrep, you agree that your contributions will be licensed 36 | under the LICENSE file in the root directory of this source tree. 37 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | 3 | exclude = [ 4 | # This directory relates to the buck build, not the cargo build. 5 | "shim/third-party/rust", 6 | ] 7 | 8 | members = [ 9 | "macro_test_util", 10 | "ocamlrep", 11 | "ocamlrep_caml_builtins", 12 | "ocamlrep_custom", 13 | "ocamlrep_derive", 14 | "ocamlrep_marshal", 15 | "ocamlrep_ocamlpool", 16 | "rust_to_ocaml/attr_parser", 17 | "rust_to_ocaml/rust_to_ocaml", 18 | "rust_to_ocaml/rust_to_ocaml_attr", 19 | "signed_source", 20 | 21 | "cargo_test_utils", 22 | "ocamlrep_custom/test", 23 | "ocamlrep_ocamlpool/test", 24 | "ocamlrep_marshal/test", 25 | "ocamlrep/test/test_bindings", 26 | "ocamlrep/test/test_from_ocamlrep", 27 | "ocamlrep/test/test_from_ocamlrep_in", 28 | "ocamlrep/test/test_add_root", 29 | ] 30 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Meta Platforms, Inc. and 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 | -------------------------------------------------------------------------------- /README-BUCK.md: -------------------------------------------------------------------------------- 1 | # Building ocamlrep with Buck2 and Reindeer 2 | 3 | Instructions on how to setup a Buck2 build of ocamlrep. More Buck2 information & examples can be found on the [Buck2 website](https://buck2.build/). 4 | 5 | ## Setup 6 | 7 | ### Install Buck2 8 | 9 | #### Buck2 binary 10 | - Get the latest prebuilt `buck2` binary (and symlink it into '/usr/local/bin'). 11 | 12 | ```bash 13 | wget https://github.com/facebook/buck2/releases/download/latest/buck2-"$PLAT".zst 14 | zstd -d buck2-"$PLAT".zst -o buck2 15 | chmod +x buck2 16 | sudo ln -s "$(pwd)"/buck2 /usr/local/bin/buck2 17 | ``` 18 | *Valid values for `$PLAT` are `x86_64-unknown-linux-gnu` on Linux, `x86_64-apple-darwin` on x86 macOS and `aarch64-apple-darwin` on ARM macOS.* 19 | 20 | #### Buck2 prelude 21 | - Initialize a Buck2 prelude Git submodule. 22 | 23 | ```bash 24 | git submodule update --init 25 | ``` 26 | 27 | ### Reindeer 28 | [Reindeer](https://github.com/facebookincubator/reindeer) is a tool to generate Buck2 rules for Rust crates. 29 | 30 | - Install the `reindeer` binary from source (into '~/.cargo/bin'). 31 | 32 | ```bash 33 | cargo install --git https://github.com/facebookincubator/reindeer.git reindeer 34 | ``` 35 | 36 | ### OPAM 37 | - Initialize [OPAM](https://opam.ocaml.org/). 38 | 39 | ```bash 40 | opam init --compiler=5.1.1 --disable-sandboxing -y 41 | eval $(opam env) 42 | ``` 43 | ### Symlink OPAM 44 | - Run the script 'ocaml-setup.sh'. 45 | 46 | ```bash 47 | ./ocaml-setup.sh 48 | ``` 49 | *Note: The script assumes that [`OPAM_SWITCH_PREFIX`](https://opam.ocaml.org/doc/Manual.html#Switches) is set.* 50 | 51 | ### Generate BUCK rules for third-party Rust. 52 | - Run `reindeer buckify`. 53 | 54 | ```bash 55 | reindeer --third-party-dir shim/third-party/rust buckify 56 | ``` 57 | 58 | ## Build 59 | 60 | - Build the complete set of ocamlrep targets. 61 | 62 | ```bash 63 | buck2 build root//... 64 | ``` 65 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ocamlrep: Interop OCaml and Rust code [![Buck build and test](https://github.com/facebook/ocamlrep/actions/workflows/buck-build-and-test.yml/badge.svg)](https://github.com/facebook/ocamlrep/actions/workflows/buck-build-and-test.yml) [![Cargo build and test](https://github.com/facebook/ocamlrep/actions/workflows/cargo-build-and-test.yml/badge.svg)](https://github.com/facebook/ocamlrep/actions/workflows/cargo-build-and-test.yml) 2 | 3 | The goal of this project is to make OCaml and Rust code interoperable. While in its early stage of development, this library is actively used by the [HHVM](https://github.com/facebook/hhvm) project, mostly in the Hack type checker, to enable OCaml code to rely on Rust. 4 | 5 | ## Requirements 6 | This project is stand-alone and is currently tested with: 7 | - OCaml 5.1.1; 8 | - The Rust toolchain in [./rust-toolchain](rust-toolchain) 9 | 10 | ## Building ocamlrep 11 | 12 | There are two build methods. One way is to use [Cargo](https://doc.rust-lang.org/cargo/guide/cargo-home.html) and the other is to use [Buck2](https://buck2.build/). 13 | 14 | - Cargo: Install OPAM then `cargo build`. 15 | - Buck2: See [Building ocamlrep with Buck2 and Reindeer](README-BUCK.md). 16 | 17 | ## Contributing 18 | See the [CONTRIBUTING](CONTRIBUTING.md) file for how to help out. 19 | 20 | ## License 21 | ocamlrep has an MIT license. See the LICENSE file included in this distribution. 22 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /cargo_test_utils/BUCK: -------------------------------------------------------------------------------- 1 | load("@fbcode//common/ocaml/interop:defs.bzl", "RUST_FLAGS_2018") 2 | load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") 3 | 4 | oncall("hack") 5 | 6 | rust_library( 7 | name = "cargo_test_utils", 8 | srcs = ["cargo_test_utils.rs"], 9 | rustc_flags = RUST_FLAGS_2018, 10 | ) 11 | -------------------------------------------------------------------------------- /cargo_test_utils/Cargo.toml: -------------------------------------------------------------------------------- 1 | # @generated by autocargo from //common/ocaml/interop/cargo_test_utils:cargo_test_utils 2 | 3 | [package] 4 | name = "cargo_test_utils" 5 | version = "0.1.0" 6 | authors = ["Shayne Fletcher ", "Jake Bailey ", "Vincent Siles ", "Meta"] 7 | edition = "2024" 8 | readme = "../README.md" 9 | repository = "https://github.com/facebook/ocamlrep" 10 | license = "MIT" 11 | 12 | [lib] 13 | path = "cargo_test_utils.rs" 14 | -------------------------------------------------------------------------------- /cargo_test_utils/cargo_test_utils.rs: -------------------------------------------------------------------------------- 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 | #![feature(exit_status_error)] 6 | 7 | use std::process::Command; 8 | use std::process::ExitStatusError; 9 | 10 | pub fn cmd(prog: &str, args: &[&str], dir: Option<&std::path::Path>) -> Command { 11 | let mut prog_cmd = Command::new(prog); 12 | if let Some(path) = dir { 13 | prog_cmd.current_dir(path); 14 | } 15 | prog_cmd.args(args); 16 | prog_cmd 17 | } 18 | 19 | pub fn workspace_dir(ds: &[&str]) -> std::path::PathBuf { 20 | let mut cargo_cmd = cmd( 21 | "cargo", 22 | &["locate-project", "--workspace", "--message-format=plain"], 23 | None, 24 | ); 25 | let output = cargo_cmd.output().unwrap().stdout; 26 | let root_cargo_toml = std::path::Path::new(std::str::from_utf8(&output).unwrap().trim()); 27 | let mut p = root_cargo_toml.parent().unwrap().to_path_buf(); 28 | for d in ds { 29 | p.push(d); 30 | } 31 | p 32 | } 33 | 34 | pub fn run(mut cmd: Command) -> Result<(), ExitStatusError> { 35 | cmd.spawn().unwrap().wait().ok().unwrap().exit_ok() 36 | } 37 | 38 | pub fn fmt_exit_status_err(err: ExitStatusError) -> String { 39 | format!("error status: {err}") 40 | } 41 | 42 | pub fn build_flavor() -> &'static str { 43 | if cfg!(debug_assertions) { 44 | "debug" 45 | } else { 46 | "release" 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /defs.bzl: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | # Try to keep in sync with all the client projects, like hack 9 | RUST_FLAGS_2018 = [ 10 | "-Drust-2018-idioms", 11 | "-Dwarnings", 12 | "-Dunused-crate-dependencies", 13 | ] 14 | -------------------------------------------------------------------------------- /macro_test_util/BUCK: -------------------------------------------------------------------------------- 1 | load("@fbcode//common/ocaml/interop:defs.bzl", "RUST_FLAGS_2018") 2 | load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") 3 | 4 | oncall("hack") 5 | 6 | rust_library( 7 | name = "macro_test_util", 8 | srcs = ["macro_test_util.rs"], 9 | autocargo = { 10 | "cargo_target_config": { 11 | "doctest": False, 12 | "test": False, 13 | }, 14 | }, 15 | rustc_flags = RUST_FLAGS_2018, 16 | deps = [ 17 | "fbsource//third-party/rust:proc-macro2", 18 | ], 19 | ) 20 | -------------------------------------------------------------------------------- /macro_test_util/Cargo.toml: -------------------------------------------------------------------------------- 1 | # @generated by autocargo from //common/ocaml/interop/macro_test_util:macro_test_util 2 | 3 | [package] 4 | name = "macro_test_util" 5 | version = "0.1.0" 6 | authors = ["Shayne Fletcher ", "Jake Bailey ", "Vincent Siles ", "Meta"] 7 | edition = "2024" 8 | readme = "../README.md" 9 | repository = "https://github.com/facebook/ocamlrep" 10 | license = "MIT" 11 | 12 | [lib] 13 | path = "macro_test_util.rs" 14 | test = false 15 | doctest = false 16 | 17 | [dependencies] 18 | proc-macro2 = { version = "1.0.70", features = ["span-locations"] } 19 | -------------------------------------------------------------------------------- /ocaml-setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright (c) Meta Platforms, Inc. and affiliates. 4 | # 5 | # This source code is licensed under both the MIT license found in the 6 | # LICENSE-MIT file in the root directory of this source tree and the Apache 7 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 8 | # of this source tree. 9 | 10 | set -euxo pipefail 11 | 12 | if ! command -v opam &> /dev/null 13 | then 14 | echo "opam is not installed, which is a dependency for building targets in ocaml." 15 | exit 16 | fi 17 | 18 | set +u 19 | if [ -z "$OPAM_SWITCH_PREFIX" ]; then 20 | echo "OPAM_SWITCH_PREFIX is undefined. First execute \`eval (\$opam env)\` and then try running $0 again." 21 | exit 22 | fi 23 | set -u 24 | 25 | # Link 'third-party/ocaml/opam'. 26 | if [ ! -L shim/third-party/ocaml/opam ]; then 27 | (cd shim/third-party/ocaml && rm -rf opam && ln -s "$OPAM_SWITCH_PREFIX" opam) 28 | else 29 | echo "Link 'shim/third-party/ocaml/opam' exists. To overwrite it, first remove it and run $0 again" 30 | fi 31 | -------------------------------------------------------------------------------- /ocamlrep/BUCK: -------------------------------------------------------------------------------- 1 | load("@fbcode//common/ocaml/interop:defs.bzl", "RUST_FLAGS_2018") 2 | load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") 3 | 4 | oncall("hack") 5 | 6 | rust_library( 7 | name = "ocamlrep", 8 | srcs = glob(["*.rs"]), 9 | autocargo = { 10 | "cargo_target_config": { 11 | "doctest": False, 12 | }, 13 | "cargo_toml_config": { 14 | "dependencies_override": { 15 | "dependencies": { 16 | "bumpalo": {"features": ["collections"]}, 17 | }, 18 | }, 19 | }, 20 | }, 21 | doctests = False, 22 | rustc_flags = RUST_FLAGS_2018, 23 | deps = [ 24 | "fbcode//common/ocaml/interop/ocamlrep_derive:ocamlrep_derive", 25 | "fbsource//third-party/rust:bstr", 26 | "fbsource//third-party/rust:bumpalo", 27 | "fbsource//third-party/rust:indexmap", 28 | "fbsource//third-party/rust:rustc-hash", 29 | "fbsource//third-party/rust:serde", 30 | ], 31 | ) 32 | -------------------------------------------------------------------------------- /ocamlrep/Cargo.toml: -------------------------------------------------------------------------------- 1 | # @generated by autocargo from //common/ocaml/interop/ocamlrep:ocamlrep 2 | 3 | [package] 4 | name = "ocamlrep" 5 | version = "0.1.0" 6 | authors = ["Shayne Fletcher ", "Jake Bailey ", "Vincent Siles ", "Meta"] 7 | edition = "2024" 8 | readme = "../README.md" 9 | repository = "https://github.com/facebook/ocamlrep" 10 | license = "MIT" 11 | 12 | [lib] 13 | path = "lib.rs" 14 | doctest = false 15 | 16 | [dependencies] 17 | bstr = { version = "1.10.0", features = ["serde", "std", "unicode"] } 18 | bumpalo = { version = "3.14.0", features = ["collections"] } 19 | indexmap = { version = "2.9.0", features = ["arbitrary", "rayon", "serde"] } 20 | ocamlrep_derive = { path = "../ocamlrep_derive" } 21 | rustc-hash = "2.1.1" 22 | serde = { version = "1.0.185", features = ["derive", "rc"] } 23 | -------------------------------------------------------------------------------- /ocamlrep/test/test_add_root/Cargo.toml: -------------------------------------------------------------------------------- 1 | # @generated by autocargo from //common/ocaml/interop/ocamlrep/test:test_add_root 2 | 3 | [package] 4 | name = "test_add_root" 5 | version = "0.1.0" 6 | authors = ["Shayne Fletcher ", "Jake Bailey ", "Vincent Siles ", "Meta"] 7 | edition = "2024" 8 | readme = "../../../README.md" 9 | repository = "https://github.com/facebook/ocamlrep" 10 | license = "MIT" 11 | 12 | [lib] 13 | path = "../test_add_root.rs" 14 | doctest = false 15 | crate-type = ["lib", "staticlib"] 16 | 17 | [dev-dependencies] 18 | ocamlrep = { path = "../.." } 19 | -------------------------------------------------------------------------------- /ocamlrep/test/test_bindings/Cargo.toml: -------------------------------------------------------------------------------- 1 | # @generated by autocargo from //common/ocaml/interop/ocamlrep/test:test_bindings 2 | 3 | [package] 4 | name = "test_bindings" 5 | version = "0.1.0" 6 | authors = ["Shayne Fletcher ", "Jake Bailey ", "Vincent Siles ", "Meta"] 7 | edition = "2024" 8 | readme = "../../../README.md" 9 | repository = "https://github.com/facebook/ocamlrep" 10 | license = "MIT" 11 | 12 | [lib] 13 | path = "../test_bindings.rs" 14 | doctest = false 15 | crate-type = ["lib", "staticlib"] 16 | 17 | [dependencies] 18 | anyhow = "1.0.95" 19 | cargo_test_utils = { path = "../../../cargo_test_utils" } 20 | ocamlrep = { path = "../.." } 21 | ocamlrep_caml_builtins = { path = "../../../ocamlrep_caml_builtins" } 22 | ocamlrep_ocamlpool = { path = "../../../ocamlrep_ocamlpool" } 23 | tempfile = "3.15" 24 | -------------------------------------------------------------------------------- /ocamlrep/test/test_from_ocamlrep/Cargo.toml: -------------------------------------------------------------------------------- 1 | # @generated by autocargo from //common/ocaml/interop/ocamlrep/test:test_from_ocamlrep 2 | 3 | [package] 4 | name = "test_from_ocamlrep" 5 | version = "0.1.0" 6 | authors = ["Shayne Fletcher ", "Jake Bailey ", "Vincent Siles ", "Meta"] 7 | edition = "2024" 8 | readme = "../../../README.md" 9 | repository = "https://github.com/facebook/ocamlrep" 10 | license = "MIT" 11 | 12 | [lib] 13 | path = "../test_from_ocamlrep.rs" 14 | doctest = false 15 | crate-type = ["lib", "staticlib"] 16 | 17 | [dev-dependencies] 18 | ocamlrep = { path = "../.." } 19 | -------------------------------------------------------------------------------- /ocamlrep/test/test_from_ocamlrep_in/Cargo.toml: -------------------------------------------------------------------------------- 1 | # @generated by autocargo from //common/ocaml/interop/ocamlrep/test:test_from_ocamlrep_in 2 | 3 | [package] 4 | name = "test_from_ocamlrep_in" 5 | version = "0.1.0" 6 | authors = ["Shayne Fletcher ", "Jake Bailey ", "Vincent Siles ", "Meta"] 7 | edition = "2024" 8 | readme = "../../../README.md" 9 | repository = "https://github.com/facebook/ocamlrep" 10 | license = "MIT" 11 | 12 | [lib] 13 | path = "../test_from_ocamlrep_in.rs" 14 | doctest = false 15 | crate-type = ["lib", "staticlib"] 16 | 17 | [dev-dependencies] 18 | bumpalo = { version = "3.14.0", features = ["collections"] } 19 | ocamlrep = { path = "../.." } 20 | -------------------------------------------------------------------------------- /ocamlrep_caml_builtins/BUCK: -------------------------------------------------------------------------------- 1 | load("@fbcode//common/ocaml/interop:defs.bzl", "RUST_FLAGS_2018") 2 | load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") 3 | 4 | oncall("hack") 5 | 6 | rust_library( 7 | name = "ocamlrep_caml_builtins", 8 | srcs = [ 9 | "lib.rs", 10 | ], 11 | autocargo = { 12 | "cargo_target_config": { 13 | "doctest": False, 14 | "test": False, 15 | }, 16 | }, 17 | crate_root = "lib.rs", 18 | rustc_flags = RUST_FLAGS_2018, 19 | deps = [ 20 | "fbcode//common/ocaml/interop/ocamlrep:ocamlrep", 21 | "fbcode//common/ocaml/interop/ocamlrep_custom:ocamlrep_custom", 22 | "fbsource//third-party/rust:serde", 23 | ], 24 | ) 25 | -------------------------------------------------------------------------------- /ocamlrep_caml_builtins/Cargo.toml: -------------------------------------------------------------------------------- 1 | # @generated by autocargo from //common/ocaml/interop/ocamlrep_caml_builtins:ocamlrep_caml_builtins 2 | 3 | [package] 4 | name = "ocamlrep_caml_builtins" 5 | version = "0.1.0" 6 | authors = ["Shayne Fletcher ", "Jake Bailey ", "Vincent Siles ", "Meta"] 7 | edition = "2024" 8 | readme = "../README.md" 9 | repository = "https://github.com/facebook/ocamlrep" 10 | license = "MIT" 11 | 12 | [lib] 13 | path = "lib.rs" 14 | test = false 15 | doctest = false 16 | 17 | [dependencies] 18 | ocamlrep = { path = "../ocamlrep" } 19 | ocamlrep_custom = { path = "../ocamlrep_custom" } 20 | serde = { version = "1.0.185", features = ["derive", "rc"] } 21 | -------------------------------------------------------------------------------- /ocamlrep_custom/BUCK: -------------------------------------------------------------------------------- 1 | load("@fbcode//common/ocaml/interop:defs.bzl", "RUST_FLAGS_2018") 2 | load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") 3 | 4 | oncall("hack") 5 | 6 | rust_library( 7 | name = "ocamlrep_custom", 8 | srcs = glob(["*.rs"]), 9 | autocargo = { 10 | "cargo_target_config": { 11 | "doctest": False, 12 | }, 13 | }, 14 | doctests = False, 15 | rustc_flags = RUST_FLAGS_2018, 16 | deps = [ 17 | "fbcode//common/ocaml/interop/ocamlrep:ocamlrep", 18 | "fbcode//common/ocaml/interop/ocamlrep_ocamlpool:ocamlrep_ocamlpool", 19 | ], 20 | ) 21 | -------------------------------------------------------------------------------- /ocamlrep_custom/Cargo.toml: -------------------------------------------------------------------------------- 1 | # @generated by autocargo from //common/ocaml/interop/ocamlrep_custom:ocamlrep_custom 2 | 3 | [package] 4 | name = "ocamlrep_custom" 5 | version = "0.1.0" 6 | authors = ["Shayne Fletcher ", "Jake Bailey ", "Vincent Siles ", "Meta"] 7 | edition = "2024" 8 | readme = "../README.md" 9 | repository = "https://github.com/facebook/ocamlrep" 10 | license = "MIT" 11 | 12 | [lib] 13 | path = "lib.rs" 14 | doctest = false 15 | 16 | [dependencies] 17 | ocamlrep = { path = "../ocamlrep" } 18 | ocamlrep_ocamlpool = { path = "../ocamlrep_ocamlpool" } 19 | -------------------------------------------------------------------------------- /ocamlrep_custom/test/Cargo.toml: -------------------------------------------------------------------------------- 1 | # @generated by autocargo from //common/ocaml/interop/ocamlrep_custom/test:counter 2 | 3 | [package] 4 | name = "counter" 5 | version = "0.1.0" 6 | authors = ["Shayne Fletcher ", "Jake Bailey ", "Vincent Siles ", "Meta"] 7 | edition = "2024" 8 | readme = "../../README.md" 9 | repository = "https://github.com/facebook/ocamlrep" 10 | license = "MIT" 11 | 12 | [lib] 13 | path = "counter.rs" 14 | doctest = false 15 | crate-type = ["lib", "staticlib"] 16 | 17 | [dependencies] 18 | anyhow = "1.0.95" 19 | cargo_test_utils = { path = "../../cargo_test_utils" } 20 | ocamlrep_custom = { path = ".." } 21 | ocamlrep_ocamlpool = { path = "../../ocamlrep_ocamlpool" } 22 | tempfile = "3.15" 23 | -------------------------------------------------------------------------------- /ocamlrep_custom/test/counter_client.ml: -------------------------------------------------------------------------------- 1 | (* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | * 7 | *) 8 | 9 | type counter 10 | 11 | external counter_new : unit -> counter = "counter_new" 12 | 13 | external counter_inc : counter -> unit = "counter_inc" 14 | 15 | external counter_read : counter -> int = "counter_read" 16 | 17 | let () = begin 18 | print_endline "[counter_test][info]: start"; 19 | let counter = counter_new () in 20 | assert (counter_read counter == 0); 21 | counter_inc counter; 22 | assert (counter_read counter == 1); 23 | print_endline "[counter_test][info]: finish"; 24 | end 25 | -------------------------------------------------------------------------------- /ocamlrep_derive/BUCK: -------------------------------------------------------------------------------- 1 | load("@fbcode//common/ocaml/interop:defs.bzl", "RUST_FLAGS_2018") 2 | load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") 3 | 4 | oncall("hack") 5 | 6 | rust_library( 7 | name = "ocamlrep_derive", 8 | srcs = ["lib.rs"], 9 | proc_macro = True, 10 | rustc_flags = RUST_FLAGS_2018, 11 | test_deps = [ 12 | "fbcode//common/ocaml/interop/macro_test_util:macro_test_util", 13 | "fbsource//third-party/rust:anyhow", 14 | ], 15 | deps = [ 16 | "fbsource//third-party/rust:proc-macro2", 17 | "fbsource//third-party/rust:quote", 18 | "fbsource//third-party/rust:syn1", 19 | "fbsource//third-party/rust:synstructure", 20 | ], 21 | ) 22 | -------------------------------------------------------------------------------- /ocamlrep_derive/Cargo.toml: -------------------------------------------------------------------------------- 1 | # @generated by autocargo from //common/ocaml/interop/ocamlrep_derive:ocamlrep_derive 2 | 3 | [package] 4 | name = "ocamlrep_derive" 5 | version = "0.1.0" 6 | authors = ["Shayne Fletcher ", "Jake Bailey ", "Vincent Siles ", "Meta"] 7 | edition = "2024" 8 | readme = "../README.md" 9 | repository = "https://github.com/facebook/ocamlrep" 10 | license = "MIT" 11 | 12 | [lib] 13 | path = "lib.rs" 14 | test = false 15 | doctest = false 16 | proc-macro = true 17 | 18 | [dependencies] 19 | proc-macro2 = { version = "1.0.70", features = ["span-locations"] } 20 | quote = "1.0.29" 21 | syn = { version = "1.0.109", features = ["extra-traits", "fold", "full", "visit", "visit-mut"] } 22 | synstructure = "0.12" 23 | 24 | [dev-dependencies] 25 | anyhow = "1.0.95" 26 | macro_test_util = { path = "../macro_test_util" } 27 | -------------------------------------------------------------------------------- /ocamlrep_marshal/BUCK: -------------------------------------------------------------------------------- 1 | load("@fbcode//common/ocaml/interop:defs.bzl", "RUST_FLAGS_2018") 2 | load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") 3 | load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") 4 | 5 | oncall("hack") 6 | 7 | cpp_library( 8 | name = "ocaml_version", 9 | srcs = ["ocaml_version.c"], 10 | exported_external_deps = [ 11 | ("supercaml", None, "ocaml-dev"), 12 | ], 13 | ) 14 | 15 | rust_library( 16 | name = "ocamlrep_marshal", 17 | srcs = [ 18 | "deser.rs", 19 | "intext.rs", 20 | "ocamlrep_marshal.rs", 21 | "ser.rs", 22 | ], 23 | autocargo = { 24 | "cargo_target_config": { 25 | "crate_type": [ 26 | "lib", 27 | "staticlib", 28 | ], 29 | }, 30 | "cargo_toml_config": { 31 | "dependencies_override": { 32 | "build-dependencies": { 33 | "cc": {"version": "1.0.78"}, 34 | }, 35 | }, 36 | "package": { 37 | "build": "build.rs", 38 | }, 39 | }, 40 | }, 41 | rustc_flags = RUST_FLAGS_2018, 42 | unittests = False, 43 | deps = [ 44 | "fbcode//common/ocaml/interop/ocamlrep:ocamlrep", 45 | "fbsource//third-party/rust:bitflags", 46 | ":ocaml_version", 47 | ], 48 | ) 49 | -------------------------------------------------------------------------------- /ocamlrep_marshal/Cargo.toml: -------------------------------------------------------------------------------- 1 | # @generated by autocargo from //common/ocaml/interop/ocamlrep_marshal:ocamlrep_marshal 2 | 3 | [package] 4 | name = "ocamlrep_marshal" 5 | version = "0.1.0" 6 | authors = ["Shayne Fletcher ", "Jake Bailey ", "Vincent Siles ", "Meta"] 7 | edition = "2024" 8 | readme = "../README.md" 9 | repository = "https://github.com/facebook/ocamlrep" 10 | license = "MIT" 11 | build = "build.rs" 12 | 13 | [lib] 14 | path = "ocamlrep_marshal.rs" 15 | test = false 16 | doctest = false 17 | crate-type = ["lib", "staticlib"] 18 | 19 | [dependencies] 20 | bitflags = { version = "2.6", features = ["serde", "std"], default-features = false } 21 | ocamlrep = { path = "../ocamlrep" } 22 | 23 | [build-dependencies] 24 | cc = "1.0.78" 25 | -------------------------------------------------------------------------------- /ocamlrep_marshal/build.rs: -------------------------------------------------------------------------------- 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 | // Assume an opam environment (`eval "$(opam env --switch=default 7 | // --set-switch)"`) then to find the prevailing standard library caml 8 | // headers, `OCAMLLIB=$(ocamlopt.opt -config | grep standard_library: 9 | // | awk '{ print $2 }')`. 10 | fn ocamllib_dir() -> std::path::PathBuf { 11 | let mut sh = std::process::Command::new("sh"); 12 | sh.args([ 13 | "-c", 14 | "ocamlopt.opt -config | grep standard_library: | awk '{ print $2 }'", 15 | ]); 16 | let output = sh.output().unwrap().stdout; 17 | let proposed_path = std::path::Path::new(std::str::from_utf8(&output).unwrap().trim()); 18 | // A supercaml 'ocamlopt.opt' can report standard library paths that don't 19 | // exist. 20 | if proposed_path.exists() { 21 | proposed_path.to_path_buf() 22 | } else { 23 | // Fallback to guessing the location given knowledge of where 24 | // 'ocamlopt.opt' itself it. 25 | let mut sh = std::process::Command::new("sh"); 26 | sh.args(["-c", "which ocamlopt.opt"]); 27 | let output = sh.output().unwrap().stdout; 28 | std::path::Path::new(std::str::from_utf8(&output).unwrap().trim()) 29 | .ancestors() 30 | .nth(2) 31 | .unwrap() 32 | .join("lib/ocaml") 33 | } 34 | } 35 | 36 | fn main() { 37 | // Tell Cargo that if the given file changes, to rerun this build script. 38 | println!("cargo:rerun-if-changed=../../ocaml_version.c"); 39 | cc::Build::new() 40 | .include(ocamllib_dir().as_path().to_str().unwrap()) 41 | .file("ocaml_version.c") 42 | .compile("ocaml_version"); 43 | } 44 | -------------------------------------------------------------------------------- /ocamlrep_marshal/dune: -------------------------------------------------------------------------------- 1 | (data_only_dirs cargo) 2 | 3 | (library 4 | (name ocamlrep_marshal_ffi) 5 | (modules ocamlrep_marshal_ffi) 6 | (wrapped false) 7 | (libraries ocamlpool) 8 | (c_library_flags -lpthread) 9 | (foreign_archives ocamlrep_marshal_ffi_bindings)) 10 | 11 | (rule 12 | (targets libocamlrep_marshal_ffi_bindings.a) 13 | (deps 14 | (source_tree %{workspace_root}/hack/src)) 15 | (locks cargo) 16 | (action 17 | (run %{workspace_root}/hack/scripts/invoke_cargo.sh ocamlrep_marshal_ffi_bindings ocamlrep_marshal_ffi_bindings))) 18 | -------------------------------------------------------------------------------- /ocamlrep_marshal/ocaml_version.c: -------------------------------------------------------------------------------- 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 | #include 7 | 8 | unsigned int ocaml_version() { 9 | return OCAML_VERSION; 10 | } 11 | -------------------------------------------------------------------------------- /ocamlrep_marshal/ocamlrep_marshal.rs: -------------------------------------------------------------------------------- 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 | #![feature(new_zeroed_alloc)] 7 | 8 | mod deser; // deserialize; c.f 'runtime/intern.c' 9 | mod intext; // c.f. 'runtime/caml/intext.h' 10 | mod ser; // serialize; c.f. 'runtime/extern.c' 11 | 12 | pub use deser::input_value; 13 | pub use ser::ExternFlags; 14 | pub use ser::output_value; 15 | -------------------------------------------------------------------------------- /ocamlrep_marshal/test/BUCK: -------------------------------------------------------------------------------- 1 | load("@fbcode//common/ocaml/interop:defs.bzl", "RUST_FLAGS_2018") 2 | load("@fbcode_macros//build_defs:custom_unittest.bzl", "custom_unittest") 3 | load("@fbcode_macros//build_defs:ocaml_binary.bzl", "ocaml_binary") 4 | load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") 5 | 6 | oncall("hack") 7 | 8 | rust_library( 9 | name = "ocamlrep_marshal_ffi_bindings", 10 | srcs = ["ocamlrep_marshal_ffi_bindings.rs"], 11 | autocargo = { 12 | "cargo_target_config": { 13 | "crate_type": [ 14 | "lib", 15 | "staticlib", 16 | ], 17 | "doctest": False, 18 | "test": True, # Say yes to `cargo test`. 19 | }, 20 | }, 21 | crate_root = "ocamlrep_marshal_ffi_bindings.rs", 22 | rustc_flags = RUST_FLAGS_2018, 23 | unittests = False, # Say no to `buck test`. 24 | 25 | # `cargo_test_utils`, `anyhow` & `tempdir` are for the cargo unitests. See 26 | # [Note: Test blocks for Cargo] in 27 | # `ocamlrep_ocamlpool/test/ocamlpool_test.rs` for details. 28 | deps = [ 29 | "fbcode//common/ocaml/interop/cargo_test_utils:cargo_test_utils", 30 | "fbcode//common/ocaml/interop/ocamlrep:ocamlrep", 31 | "fbcode//common/ocaml/interop/ocamlrep_marshal:ocamlrep_marshal", 32 | "fbcode//common/ocaml/interop/ocamlrep_ocamlpool:ocamlrep_ocamlpool", 33 | "fbsource//third-party/rust:anyhow", 34 | "fbsource//third-party/rust:tempfile", 35 | ], 36 | ) 37 | 38 | ocaml_binary( 39 | name = "test_runner", 40 | srcs = ["test_ocamlrep_marshal.ml"], 41 | deps = [ 42 | ":ocamlrep_marshal_ffi_bindings", 43 | ], 44 | ) 45 | 46 | custom_unittest( 47 | name = "ocamlrep_marshal_test", 48 | command = ["$(exe :test_runner)"], 49 | emails = ["oncall+hack@xmail.facebook.com"], 50 | type = "simple", 51 | ) 52 | -------------------------------------------------------------------------------- /ocamlrep_marshal/test/Cargo.toml: -------------------------------------------------------------------------------- 1 | # @generated by autocargo from //common/ocaml/interop/ocamlrep_marshal/test:ocamlrep_marshal_ffi_bindings 2 | 3 | [package] 4 | name = "ocamlrep_marshal_ffi_bindings" 5 | version = "0.1.0" 6 | authors = ["Shayne Fletcher ", "Jake Bailey ", "Vincent Siles ", "Meta"] 7 | edition = "2024" 8 | readme = "../../README.md" 9 | repository = "https://github.com/facebook/ocamlrep" 10 | license = "MIT" 11 | 12 | [lib] 13 | path = "ocamlrep_marshal_ffi_bindings.rs" 14 | doctest = false 15 | crate-type = ["lib", "staticlib"] 16 | 17 | [dependencies] 18 | anyhow = "1.0.95" 19 | cargo_test_utils = { path = "../../cargo_test_utils" } 20 | ocamlrep = { path = "../../ocamlrep" } 21 | ocamlrep_marshal = { path = ".." } 22 | ocamlrep_ocamlpool = { path = "../../ocamlrep_ocamlpool" } 23 | tempfile = "3.15" 24 | -------------------------------------------------------------------------------- /ocamlrep_ocamlpool/BUCK: -------------------------------------------------------------------------------- 1 | load("@fbcode//common/ocaml/interop:defs.bzl", "RUST_FLAGS_2018") 2 | load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") 3 | load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") 4 | 5 | oncall("hack") 6 | 7 | cpp_library( 8 | # @autodeps-skip 9 | name = "ocamlpool-cpp", 10 | srcs = ["ocamlpool.c"], 11 | headers = ["ocamlpool.h"], 12 | undefined_symbols = True, 13 | external_deps = [("supercaml", None, "ocaml-dev")], 14 | ) 15 | 16 | rust_library( 17 | name = "ocamlrep_ocamlpool", 18 | srcs = glob(["*.rs"]), 19 | autocargo = { 20 | "cargo_target_config": { 21 | "crate_type": [ 22 | "lib", 23 | "staticlib", 24 | ], 25 | "doctest": False, 26 | }, 27 | "cargo_toml_config": { 28 | "dependencies_override": { 29 | "build-dependencies": { 30 | "cc": {"version": "1.0.78"}, 31 | }, 32 | "dependencies": { 33 | "bumpalo": {"features": ["collections"]}, 34 | }, 35 | }, 36 | "package": { 37 | "build": "build.rs", 38 | }, 39 | }, 40 | }, 41 | doctests = False, 42 | rustc_flags = RUST_FLAGS_2018, 43 | unittests = False, 44 | deps = [ 45 | "fbcode//common/ocaml/interop/ocamlrep:ocamlrep", 46 | "fbsource//third-party/rust:bumpalo", 47 | ":ocamlpool-cpp", 48 | ], 49 | ) 50 | -------------------------------------------------------------------------------- /ocamlrep_ocamlpool/Cargo.toml: -------------------------------------------------------------------------------- 1 | # @generated by autocargo from //common/ocaml/interop/ocamlrep_ocamlpool:ocamlrep_ocamlpool 2 | 3 | [package] 4 | name = "ocamlrep_ocamlpool" 5 | version = "0.1.0" 6 | authors = ["Shayne Fletcher ", "Jake Bailey ", "Vincent Siles ", "Meta"] 7 | edition = "2024" 8 | readme = "../README.md" 9 | repository = "https://github.com/facebook/ocamlrep" 10 | license = "MIT" 11 | build = "build.rs" 12 | 13 | [lib] 14 | path = "lib.rs" 15 | test = false 16 | doctest = false 17 | crate-type = ["lib", "staticlib"] 18 | 19 | [dependencies] 20 | bumpalo = { version = "3.14.0", features = ["collections"] } 21 | ocamlrep = { path = "../ocamlrep" } 22 | 23 | [build-dependencies] 24 | cc = "1.0.78" 25 | -------------------------------------------------------------------------------- /ocamlrep_ocamlpool/build.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Meta Platforms, Inc. and affiliates. 2 | 3 | // Assume an opam environment (`eval "$(opam env --switch=default 4 | // --set-switch)"`) then to find the prevailing standard library caml 5 | // headers, `OCAMLLIB=$(ocamlopt.opt -config | grep standard_library: 6 | // | awk '{ print $2 }')`. 7 | fn ocamllib_dir() -> std::path::PathBuf { 8 | let mut sh = std::process::Command::new("sh"); 9 | sh.args([ 10 | "-c", 11 | "ocamlopt.opt -config | grep standard_library: | awk '{ print $2 }'", 12 | ]); 13 | let output = sh.output().unwrap().stdout; 14 | let proposed_path = std::path::Path::new(std::str::from_utf8(&output).unwrap().trim()); 15 | // A supercaml 'ocamlopt.opt' can report standard library paths that don't 16 | // exist. 17 | if proposed_path.exists() { 18 | proposed_path.to_path_buf() 19 | } else { 20 | // Fallback to guessing the location given knowledge of where 21 | // 'ocamlopt.opt' itself it. 22 | let mut sh = std::process::Command::new("sh"); 23 | sh.args(["-c", "which ocamlopt.opt"]); 24 | let output = sh.output().unwrap().stdout; 25 | std::path::Path::new(std::str::from_utf8(&output).unwrap().trim()) 26 | .ancestors() 27 | .nth(2) 28 | .unwrap() 29 | .join("lib/ocaml") 30 | } 31 | } 32 | 33 | fn main() { 34 | // Tell Cargo that if the given file changes, to rerun this build script. 35 | println!("cargo:rerun-if-changed=ocamlpool.c"); 36 | cc::Build::new() 37 | .include(ocamllib_dir().as_path().to_str().unwrap()) 38 | .file("ocamlpool.c") 39 | .compile("ocamlpool"); 40 | } 41 | -------------------------------------------------------------------------------- /ocamlrep_ocamlpool/test/BUCK: -------------------------------------------------------------------------------- 1 | load("@fbcode//common/ocaml/interop:defs.bzl", "RUST_FLAGS_2018") 2 | load("@fbcode_macros//build_defs:custom_unittest.bzl", "custom_unittest") 3 | load("@fbcode_macros//build_defs:ocaml_binary.bzl", "ocaml_binary") 4 | load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") 5 | 6 | oncall("hack") 7 | 8 | rust_library( 9 | name = "ocamlpool_test", 10 | srcs = [ 11 | "ocamlpool_test.rs", 12 | ], 13 | autocargo = { 14 | "cargo_target_config": { 15 | "crate_type": [ 16 | "lib", 17 | "staticlib", 18 | ], 19 | "doctest": False, 20 | "test": True, # Say yes to `cargo test`. 21 | }, 22 | }, 23 | crate_root = "ocamlpool_test.rs", 24 | rustc_flags = RUST_FLAGS_2018, 25 | unittests = False, # Don't try to build/run unittests with buck. 26 | 27 | # `cargo_test_utils`, `anyhow` & `tempdir` are for the cargo unitests. See 28 | # [Note: Test blocks for Cargo] in `ocamlpool_test.rs` for details. 29 | deps = [ 30 | "fbcode//common/ocaml/interop/cargo_test_utils:cargo_test_utils", 31 | "fbcode//common/ocaml/interop/ocamlrep_ocamlpool:ocamlrep_ocamlpool", 32 | "fbsource//third-party/rust:anyhow", 33 | "fbsource//third-party/rust:once_cell", 34 | "fbsource//third-party/rust:tempfile", 35 | ], 36 | ) 37 | 38 | ocaml_binary( 39 | name = "ocamlpool_runner", 40 | srcs = [ 41 | "ocamlpool_test.ml", 42 | ], 43 | deps = [ 44 | ":ocamlpool_test", 45 | ], 46 | ) 47 | 48 | custom_unittest( 49 | name = "ocamlpool", 50 | command = [ 51 | "$(exe :ocamlpool_runner)", 52 | ], 53 | type = "simple", 54 | ) 55 | -------------------------------------------------------------------------------- /ocamlrep_ocamlpool/test/Cargo.toml: -------------------------------------------------------------------------------- 1 | # @generated by autocargo from //common/ocaml/interop/ocamlrep_ocamlpool/test:ocamlpool_test 2 | 3 | [package] 4 | name = "ocamlpool_test" 5 | version = "0.1.0" 6 | authors = ["Shayne Fletcher ", "Jake Bailey ", "Vincent Siles ", "Meta"] 7 | edition = "2024" 8 | readme = "../../README.md" 9 | repository = "https://github.com/facebook/ocamlrep" 10 | license = "MIT" 11 | 12 | [lib] 13 | path = "ocamlpool_test.rs" 14 | doctest = false 15 | crate-type = ["lib", "staticlib"] 16 | 17 | [dependencies] 18 | anyhow = "1.0.95" 19 | cargo_test_utils = { path = "../../cargo_test_utils" } 20 | ocamlrep_ocamlpool = { path = ".." } 21 | once_cell = "1.12" 22 | tempfile = "3.15" 23 | -------------------------------------------------------------------------------- /ocamlrep_ocamlpool/test/ocamlpool_test.ml: -------------------------------------------------------------------------------- 1 | (* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | * 7 | *) 8 | 9 | external test : unit -> unit = "test" 10 | external test_call_ocaml_from_rust : unit -> unit = "test_call_ocaml_from_rust" 11 | 12 | let f_unit_to_unit (): unit = () 13 | let f_one_arg_to_unit (x: int) = assert (x = 3) 14 | let f_sum_tuple ((x,y):int*int): int = x + y 15 | 16 | (* Although the test is entirely written in rust, 17 | * we need to build the rust code with the ocaml runtime dependencies 18 | * in order to allocate memory for ocaml. Calling rust from ocaml 19 | * is a good way of ensuring this dependecy is built. 20 | *) 21 | let () = begin 22 | print_endline "[ocamlpool_test][info]: start"; 23 | 24 | Callback.register "f_unit_to_unit" f_unit_to_unit; 25 | Callback.register "f_one_arg_to_unit" f_one_arg_to_unit; 26 | Callback.register "f_sum_tuple" f_sum_tuple; 27 | 28 | test (); 29 | 30 | test_call_ocaml_from_rust (); 31 | 32 | print_endline "[ocamlpool_test][info]: finish" 33 | end 34 | -------------------------------------------------------------------------------- /rust-toolchain: -------------------------------------------------------------------------------- 1 | [toolchain] 2 | channel = "nightly-2025-03-29" 3 | -------------------------------------------------------------------------------- /rust_to_ocaml/BUCK: -------------------------------------------------------------------------------- 1 | load("@fbcode//common/ocaml/interop:defs.bzl", "RUST_FLAGS_2018") 2 | load("@fbcode_macros//build_defs:rust_binary.bzl", "rust_binary") 3 | load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") 4 | 5 | oncall("hack") 6 | 7 | rust_binary( 8 | name = "rust_to_ocaml", 9 | srcs = glob(["rust_to_ocaml/**/*.rs"]), 10 | autocargo = { 11 | "cargo_target_config": { 12 | "doctest": False, 13 | "test": False, 14 | }, 15 | "cargo_toml_dir": "rust_to_ocaml", 16 | }, 17 | rustc_flags = RUST_FLAGS_2018, 18 | deps = [ 19 | "fbcode//common/ocaml/interop/signed_source:signed_source", 20 | "fbsource//third-party/rust:anyhow", 21 | "fbsource//third-party/rust:clap-3", 22 | "fbsource//third-party/rust:convert_case", 23 | "fbsource//third-party/rust:derive_more", 24 | "fbsource//third-party/rust:indexmap", 25 | "fbsource//third-party/rust:serde", 26 | "fbsource//third-party/rust:syn1", 27 | "fbsource//third-party/rust:toml", 28 | ":attr_parser", 29 | ], 30 | ) 31 | 32 | rust_library( 33 | name = "rust_to_ocaml_attr", 34 | srcs = glob(["rust_to_ocaml_attr/**/*.rs"]), 35 | autocargo = { 36 | "cargo_target_config": { 37 | "doctest": False, 38 | "test": False, 39 | }, 40 | "cargo_toml_dir": "rust_to_ocaml_attr", 41 | }, 42 | proc_macro = True, 43 | rustc_flags = RUST_FLAGS_2018, 44 | ) 45 | 46 | rust_library( 47 | name = "attr_parser", 48 | srcs = glob(["attr_parser/**/*.rs"]), 49 | autocargo = { 50 | "cargo_target_config": { 51 | "doctest": False, 52 | "test": False, 53 | }, 54 | "cargo_toml_dir": "attr_parser", 55 | }, 56 | doctests = False, 57 | rustc_flags = RUST_FLAGS_2018, 58 | deps = [ 59 | "fbsource//third-party/rust:syn1", 60 | ], 61 | ) 62 | -------------------------------------------------------------------------------- /rust_to_ocaml/attr_parser/Cargo.toml: -------------------------------------------------------------------------------- 1 | # @generated by autocargo from //common/ocaml/interop/rust_to_ocaml:attr_parser 2 | 3 | [package] 4 | name = "attr_parser" 5 | version = "0.1.0" 6 | authors = ["Shayne Fletcher ", "Jake Bailey ", "Vincent Siles ", "Meta"] 7 | edition = "2024" 8 | readme = "../../README.md" 9 | repository = "https://github.com/facebook/ocamlrep" 10 | license = "MIT" 11 | 12 | [lib] 13 | path = "attr_parser.rs" 14 | test = false 15 | doctest = false 16 | 17 | [dependencies] 18 | syn = { version = "1.0.109", features = ["extra-traits", "fold", "full", "visit", "visit-mut"] } 19 | -------------------------------------------------------------------------------- /rust_to_ocaml/rust_to_ocaml/Cargo.toml: -------------------------------------------------------------------------------- 1 | # @generated by autocargo from //common/ocaml/interop/rust_to_ocaml:rust_to_ocaml 2 | 3 | [package] 4 | name = "rust_to_ocaml" 5 | version = "0.1.0" 6 | authors = ["Shayne Fletcher ", "Jake Bailey ", "Vincent Siles ", "Meta"] 7 | edition = "2024" 8 | readme = "../../README.md" 9 | repository = "https://github.com/facebook/ocamlrep" 10 | license = "MIT" 11 | 12 | [[bin]] 13 | name = "rust_to_ocaml" 14 | path = "rust_to_ocaml.rs" 15 | test = false 16 | 17 | [dependencies] 18 | anyhow = "1.0.95" 19 | attr_parser = { path = "../attr_parser" } 20 | clap = { version = "3.2.25", features = ["derive", "env", "regex", "unicode", "wrap_help"] } 21 | convert_case = "0.6" 22 | derive_more = { version = "1.0.0", features = ["full"] } 23 | indexmap = { version = "2.9.0", features = ["arbitrary", "rayon", "serde"] } 24 | serde = { version = "1.0.185", features = ["derive", "rc"] } 25 | signed_source = { path = "../../signed_source" } 26 | syn = { version = "1.0.109", features = ["extra-traits", "fold", "full", "visit", "visit-mut"] } 27 | toml = "0.8.22" 28 | -------------------------------------------------------------------------------- /rust_to_ocaml/rust_to_ocaml/macros.rs: -------------------------------------------------------------------------------- 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 | /// Provide impls of `Serialize` and `Deserialize` which delegate to the impls 7 | /// of `std::fmt::Display` and `std::str::FromStr` respectively. 8 | macro_rules! serde_from_display { 9 | ($name:ident, $expecting:expr_2021) => { 10 | impl ::serde::Serialize for $name { 11 | fn serialize(&self, serializer: S) -> Result { 12 | serializer.serialize_str(&self.to_string()) 13 | } 14 | } 15 | impl<'de> ::serde::Deserialize<'de> for $name { 16 | fn deserialize(deserializer: D) -> Result 17 | where 18 | D: ::serde::Deserializer<'de>, 19 | { 20 | struct Visitor; 21 | impl<'de> ::serde::de::Visitor<'de> for Visitor { 22 | type Value = $name; 23 | fn expecting( 24 | &self, 25 | formatter: &mut ::std::fmt::Formatter<'_>, 26 | ) -> ::std::fmt::Result { 27 | formatter.write_str($expecting) 28 | } 29 | fn visit_str(self, value: &str) -> Result 30 | where 31 | E: ::serde::de::Error, 32 | { 33 | value.parse().map_err(|e| { 34 | E::invalid_value(::serde::de::Unexpected::Other(&format!("{e}")), &self) 35 | }) 36 | } 37 | } 38 | deserializer.deserialize_str(Visitor) 39 | } 40 | } 41 | }; 42 | } 43 | -------------------------------------------------------------------------------- /rust_to_ocaml/rust_to_ocaml_attr/Cargo.toml: -------------------------------------------------------------------------------- 1 | # @generated by autocargo from //common/ocaml/interop/rust_to_ocaml:rust_to_ocaml_attr 2 | 3 | [package] 4 | name = "rust_to_ocaml_attr" 5 | version = "0.1.0" 6 | authors = ["Shayne Fletcher ", "Jake Bailey ", "Vincent Siles ", "Meta"] 7 | edition = "2024" 8 | readme = "../../README.md" 9 | repository = "https://github.com/facebook/ocamlrep" 10 | license = "MIT" 11 | 12 | [lib] 13 | path = "rust_to_ocaml_attr.rs" 14 | test = false 15 | doctest = false 16 | proc-macro = true 17 | -------------------------------------------------------------------------------- /rust_to_ocaml/rust_to_ocaml_attr/rust_to_ocaml_attr.rs: -------------------------------------------------------------------------------- 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 | use proc_macro::TokenStream; 7 | 8 | /// This attribute macro is intended to be consumed by the rust_to_ocaml codegen 9 | /// tool, so this proc macro doesn't need to do anything other than return the 10 | /// item (with the rust_to_ocaml attribute stripped by rustc). 11 | /// 12 | /// Use of the rust_to_ocaml attribute in positions other than items (like field 13 | /// definitions) are stripped by ocamlrep_derive macros (which is simpler than 14 | /// filtering them from the `item` in this crate). 15 | /// 16 | /// We may want to add validation later so that incorrect use of the attribute 17 | /// emits errors at compile time, but stripping is good enough for now. 18 | #[proc_macro_attribute] 19 | pub fn rust_to_ocaml(_attr: TokenStream, item: TokenStream) -> TokenStream { 20 | item 21 | } 22 | -------------------------------------------------------------------------------- /rust_to_ocaml/test/BUCK: -------------------------------------------------------------------------------- 1 | load("@fbcode//common/ocaml/interop:defs.bzl", "RUST_FLAGS_2018") 2 | load("@fbcode_macros//build_defs:custom_unittest.bzl", "custom_unittest") 3 | load("@fbcode_macros//build_defs:export_files.bzl", "export_file") 4 | load("@fbcode_macros//build_defs:native_rules.bzl", "buck_command_alias") 5 | load("@fbcode_macros//build_defs:rust_binary.bzl", "rust_binary") 6 | 7 | oncall("hack") 8 | 9 | rust_to_ocaml_args = [ 10 | "--no-header", 11 | "--config", 12 | "$(location :config.toml)", 13 | "--formatter", 14 | "$(location fbsource//tools/third-party/ocamlformat:ocamlformat)", 15 | ] 16 | 17 | custom_unittest( 18 | name = "rust_to_ocaml", 19 | command = [ 20 | "$(exe :test_rust_to_ocaml)", 21 | "$(location fbcode//common/ocaml/interop/rust_to_ocaml/test/cases:cases)", 22 | "$(location fbcode//common/ocaml/interop/rust_to_ocaml:rust_to_ocaml)", 23 | "--", 24 | ] + rust_to_ocaml_args, 25 | emails = ["oncall+hack@xmail.facebook.com"], 26 | type = "simple", 27 | ) 28 | 29 | buck_command_alias( 30 | name = "update_snapshots", 31 | args = [ 32 | "./cases", 33 | "$(location fbcode//common/ocaml/interop/rust_to_ocaml:rust_to_ocaml)", 34 | "--update-snapshots", 35 | "--", 36 | ] + rust_to_ocaml_args, 37 | exe = ":test_rust_to_ocaml", 38 | ) 39 | 40 | rust_binary( 41 | name = "test_rust_to_ocaml", 42 | srcs = ["test_rust_to_ocaml.rs"], 43 | rustc_flags = RUST_FLAGS_2018, 44 | deps = [ 45 | "fbsource//third-party/rust:anyhow", 46 | "fbsource//third-party/rust:clap-3", 47 | "fbsource//third-party/rust:similar", 48 | "fbsource//third-party/rust:walkdir", 49 | ], 50 | ) 51 | 52 | export_file(name = "config.toml") 53 | -------------------------------------------------------------------------------- /rust_to_ocaml/test/Cargo.toml: -------------------------------------------------------------------------------- 1 | # @generated by autocargo from //common/ocaml/interop/rust_to_ocaml/test:test_rust_to_ocaml 2 | 3 | [package] 4 | name = "test_rust_to_ocaml" 5 | version = "0.1.0" 6 | authors = ["Shayne Fletcher ", "Jake Bailey ", "Vincent Siles ", "Meta"] 7 | edition = "2024" 8 | readme = "../../README.md" 9 | repository = "https://github.com/facebook/ocamlrep" 10 | license = "MIT" 11 | 12 | [[bin]] 13 | name = "test_rust_to_ocaml" 14 | path = "test_rust_to_ocaml.rs" 15 | 16 | [dependencies] 17 | anyhow = "1.0.95" 18 | clap = { version = "3.2.25", features = ["derive", "env", "regex", "unicode", "wrap_help"] } 19 | similar = { version = "2.2.0", features = ["bytes", "inline"] } 20 | walkdir = "2.3" 21 | -------------------------------------------------------------------------------- /rust_to_ocaml/test/cases/.ocamlformat: -------------------------------------------------------------------------------- 1 | # -*- conf -*- 2 | 3 | doc-comments = before 4 | field-space = tight-decl 5 | module-item-spacing = sparse 6 | space-around-lists = false 7 | type-decl = sparse 8 | -------------------------------------------------------------------------------- /rust_to_ocaml/test/cases/BUCK: -------------------------------------------------------------------------------- 1 | load("@fbcode_macros//build_defs:native_rules.bzl", "buck_filegroup") 2 | 3 | oncall("hack") 4 | 5 | buck_filegroup( 6 | name = "cases", 7 | srcs = [".ocamlformat"] + glob(["**/*"]), 8 | ) 9 | -------------------------------------------------------------------------------- /rust_to_ocaml/test/cases/attrs.rs: -------------------------------------------------------------------------------- 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 | /// type X 7 | #[rust_to_ocaml(attr = "deriving show")] 8 | pub type X = A; 9 | 10 | /// type Y 11 | #[rust_to_ocaml( 12 | prefix = "y_", 13 | attr = r#"deriving visitors { 14 | variety = "iter"; 15 | ancestors = ["iter_ab"]; 16 | }"# 17 | )] 18 | pub struct Y { 19 | /// foo 20 | #[rust_to_ocaml(attr = "opaque")] 21 | #[rust_to_ocaml(attr = "visitors.opaque")] 22 | pub foo: A, 23 | /// bar 24 | pub bar: B, 25 | } 26 | 27 | /// type Visibility 28 | #[rust_to_ocaml(prefix = "V", attr = "deriving eq, ord, show { with_path = false }")] 29 | enum Visibility { 30 | /// Private 31 | #[rust_to_ocaml(attr = "visitors.name \"visibility_VPrivate\"")] 32 | Private, 33 | /// Public 34 | #[rust_to_ocaml(attr = r#"visitors.name "visibility_VPublic""#)] 35 | Public, 36 | } 37 | -------------------------------------------------------------------------------- /rust_to_ocaml/test/cases/attrs.rs.exp: -------------------------------------------------------------------------------- 1 | (** type X *) 2 | type x = a [@@deriving show] 3 | 4 | (** type Y *) 5 | type y = { 6 | y_foo: a; [@opaque] [@visitors.opaque] (** foo *) 7 | y_bar: b; (** bar *) 8 | } 9 | [@@deriving visitors { variety = "iter"; ancestors = ["iter_ab"] }] 10 | 11 | (** type Visibility *) 12 | type visibility = 13 | | VPrivate [@visitors.name "visibility_VPrivate"] (** Private *) 14 | | VPublic [@visitors.name "visibility_VPublic"] (** Public *) 15 | [@@deriving eq, ord, show { with_path = false }] 16 | -------------------------------------------------------------------------------- /rust_to_ocaml/test/cases/bool_alias.rs: -------------------------------------------------------------------------------- 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 | pub type A = bool; 7 | -------------------------------------------------------------------------------- /rust_to_ocaml/test/cases/bool_alias.rs.exp: -------------------------------------------------------------------------------- 1 | type a = bool 2 | -------------------------------------------------------------------------------- /rust_to_ocaml/test/cases/doc_comment.rs: -------------------------------------------------------------------------------- 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 | /// Type A 7 | pub type A = X; 8 | 9 | /// Type B 10 | /// is int 11 | pub type B = X; 12 | 13 | /// Type C has a fenced code block: 14 | /// 15 | /// ``` 16 | /// function f(): int { 17 | /// return 0; 18 | /// } 19 | /// ``` 20 | /// 21 | /// And an unfenced code block: 22 | /// 23 | /// function g(): int { 24 | /// return 0; 25 | /// } 26 | /// 27 | /// It should stay indented. 28 | pub type C = X; 29 | 30 | /** Type D has a multiline delimited comment: 31 | 32 | ``` 33 | function f(): int { 34 | return 0; 35 | } 36 | ``` 37 | 38 | And an indented code block: 39 | 40 | ``` 41 | function g(): int { 42 | return 0; 43 | } 44 | ``` 45 | */ 46 | pub type D = X; 47 | 48 | /// Records can have comments on the fields. 49 | pub struct Record { 50 | /// The comments come after the field declaration in OCaml. 51 | pub foo: X, 52 | /// bar comment 53 | pub bar: X, 54 | } 55 | 56 | /// Variant types can have comments on each variant. 57 | pub enum Variant { 58 | /// Again, the comments come after the variant declaration. 59 | /// Multiline comments are understood. 60 | Foo, 61 | /** Bar has a multiline delimited comment, even though it's 62 | unusual in Rust source. */ 63 | Bar, 64 | /// Baz comment 65 | Baz { a: X, b: X }, 66 | /// Qux is a struct-like variant with a long comment spanning 67 | /// multiple lines. 68 | #[rust_to_ocaml(prefix = "q_")] 69 | Qux { a: X, b: X }, 70 | } 71 | -------------------------------------------------------------------------------- /rust_to_ocaml/test/cases/doc_comment.rs.exp: -------------------------------------------------------------------------------- 1 | (** Type A *) 2 | type a = x 3 | 4 | (** Type B 5 | * is int 6 | *) 7 | type b = x 8 | 9 | (** Type C has a fenced code block: 10 | * 11 | * ``` 12 | * function f(): int { 13 | * return 0; 14 | * } 15 | * ``` 16 | * 17 | * And an unfenced code block: 18 | * 19 | * function g(): int { 20 | * return 0; 21 | * } 22 | * 23 | * It should stay indented. 24 | *) 25 | type c = x 26 | 27 | (** Type D has a multiline delimited comment: 28 | 29 | ``` 30 | function f(): int { 31 | return 0; 32 | } 33 | ``` 34 | 35 | And an indented code block: 36 | 37 | ``` 38 | function g(): int { 39 | return 0; 40 | } 41 | ``` 42 | *) 43 | type d = x 44 | 45 | (** Records can have comments on the fields. *) 46 | type record = { 47 | foo: x; (** The comments come after the field declaration in OCaml. *) 48 | bar: x; (** bar comment *) 49 | } 50 | 51 | (** Variant types can have comments on each variant. *) 52 | type variant = 53 | | Foo 54 | (** Again, the comments come after the variant declaration. 55 | * Multiline comments are understood. *) 56 | | Bar 57 | (** Bar has a multiline delimited comment, even though it's 58 | unusual in Rust source. *) 59 | | Baz of { 60 | a: x; 61 | b: x; 62 | } (** Baz comment *) 63 | | Qux of { 64 | q_a: x; 65 | q_b: x; 66 | } 67 | (** Qux is a struct-like variant with a long comment spanning 68 | * multiple lines. *) 69 | -------------------------------------------------------------------------------- /rust_to_ocaml/test/cases/inline_tuple.rs: -------------------------------------------------------------------------------- 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 | pub enum E { 7 | Foo((A, B)), 8 | Bar(Box<(A, B)>), 9 | #[rust_to_ocaml(inline_tuple)] 10 | Baz((A, B)), 11 | #[rust_to_ocaml(inline_tuple)] 12 | Qux(Box<(A, B)>), 13 | } 14 | -------------------------------------------------------------------------------- /rust_to_ocaml/test/cases/inline_tuple.rs.exp: -------------------------------------------------------------------------------- 1 | type e = 2 | | Foo of (a * b) 3 | | Bar of (a * b) 4 | | Baz of a * b 5 | | Qux of a * b 6 | -------------------------------------------------------------------------------- /rust_to_ocaml/test/cases/inline_tuple_bad.rs: -------------------------------------------------------------------------------- 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 | pub enum E { 7 | #[rust_to_ocaml(inline_tuple)] 8 | Foo(Box), 9 | } 10 | -------------------------------------------------------------------------------- /rust_to_ocaml/test/cases/inline_tuple_bad.rs.exp: -------------------------------------------------------------------------------- 1 | Error: Failed to convert type E 2 | 3 | Caused by: 4 | Variant Foo must have a single argument which is a tuple 5 | -------------------------------------------------------------------------------- /rust_to_ocaml/test/cases/int.rs: -------------------------------------------------------------------------------- 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 | pub type A = i8; 7 | 8 | pub type B = u8; 9 | 10 | pub type C = i16; 11 | 12 | pub type D = u16; 13 | 14 | pub type E = i32; 15 | 16 | pub type F = u32; 17 | 18 | pub type G = i64; 19 | 20 | pub type H = u64; 21 | 22 | pub type I = i128; 23 | 24 | pub type J = u128; 25 | 26 | pub type K = isize; 27 | 28 | pub type L = usize; 29 | -------------------------------------------------------------------------------- /rust_to_ocaml/test/cases/int.rs.exp: -------------------------------------------------------------------------------- 1 | type a = int 2 | 3 | type b = int 4 | 5 | type c = int 6 | 7 | type d = int 8 | 9 | type e = int 10 | 11 | type f = int 12 | 13 | type g = int 14 | 15 | type h = int 16 | 17 | type i = int 18 | 19 | type j = int 20 | 21 | type k = int 22 | 23 | type l = int 24 | -------------------------------------------------------------------------------- /rust_to_ocaml/test/cases/lists.rs: -------------------------------------------------------------------------------- 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 | pub type MyVec = Vec; 7 | pub type BoxedSlice = Box<[X]>; 8 | pub type Slice<'a> = &'a [X]; 9 | 10 | pub type StdVec = std::vec::Vec; 11 | pub type StdBoxedSlice = std::boxed::Box<[X]>; 12 | -------------------------------------------------------------------------------- /rust_to_ocaml/test/cases/lists.rs.exp: -------------------------------------------------------------------------------- 1 | type my_vec = x list 2 | 3 | type boxed_slice = x list 4 | 5 | type slice = x list 6 | 7 | type std_vec = x list 8 | 9 | type std_boxed_slice = x list 10 | -------------------------------------------------------------------------------- /rust_to_ocaml/test/cases/mutual_rec.rs: -------------------------------------------------------------------------------- 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 | pub struct Foo(pub Bar, pub Bar); 7 | 8 | #[rust_to_ocaml(and)] 9 | pub struct Bar(pub Option, pub Option); 10 | -------------------------------------------------------------------------------- /rust_to_ocaml/test/cases/mutual_rec.rs.exp: -------------------------------------------------------------------------------- 1 | type foo = bar * bar 2 | 3 | and bar = foo option * foo option 4 | -------------------------------------------------------------------------------- /rust_to_ocaml/test/cases/my_result.rs: -------------------------------------------------------------------------------- 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 | pub enum Result { 7 | Ok(T), 8 | Err(E), 9 | } 10 | -------------------------------------------------------------------------------- /rust_to_ocaml/test/cases/my_result.rs.exp: -------------------------------------------------------------------------------- 1 | type ('t, 'e) result = 2 | | Ok of 't 3 | | Err of 'e 4 | -------------------------------------------------------------------------------- /rust_to_ocaml/test/cases/name_attribute.rs: -------------------------------------------------------------------------------- 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 | #[rust_to_ocaml(name = "aa")] // ignored 7 | type A = X; 8 | 9 | #[rust_to_ocaml(name = "bb")] // ignored 10 | struct B { 11 | #[rust_to_ocaml(name = "bb_x")] 12 | foo: x, 13 | #[rust_to_ocaml(name = "bb_y")] 14 | bar: y, 15 | } 16 | 17 | #[rust_to_ocaml(name = "cc")] // ignored 18 | #[rust_to_ocaml(prefix = "C")] 19 | enum C { 20 | #[rust_to_ocaml(name = "C_foo")] 21 | Foo, 22 | #[rust_to_ocaml(name = "Bar")] 23 | Bar { 24 | #[rust_to_ocaml(name = "bar_x")] 25 | foo: x, 26 | #[rust_to_ocaml(name = "bar_y")] 27 | bar: y, 28 | }, 29 | Baz, 30 | } 31 | 32 | type a_alias = a; 33 | 34 | type b_alias = b; 35 | 36 | type c_alias = c; 37 | -------------------------------------------------------------------------------- /rust_to_ocaml/test/cases/name_attribute.rs.exp: -------------------------------------------------------------------------------- 1 | type a = x 2 | 3 | type b = { 4 | bb_x: x; 5 | bb_y: y; 6 | } 7 | 8 | type c = 9 | | C_foo 10 | | Bar of { 11 | bar_x: x; 12 | bar_y: y; 13 | } 14 | | CBaz 15 | 16 | type a_alias = a 17 | 18 | type b_alias = b 19 | 20 | type c_alias = c 21 | -------------------------------------------------------------------------------- /rust_to_ocaml/test/cases/option.rs: -------------------------------------------------------------------------------- 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 | pub enum MyOption { 7 | None, 8 | Some(A), 9 | } 10 | -------------------------------------------------------------------------------- /rust_to_ocaml/test/cases/option.rs.exp: -------------------------------------------------------------------------------- 1 | type 'a my_option = 2 | | None 3 | | Some of 'a 4 | -------------------------------------------------------------------------------- /rust_to_ocaml/test/cases/pointers.rs: -------------------------------------------------------------------------------- 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 | pub type BoxA = Box; 7 | pub type RcA = Rc; 8 | pub type ArcA = Arc; 9 | pub type RcOcA = RcOc; 10 | 11 | pub type StdBoxA = std::boxed::Box; 12 | pub type StdRcA = std::rc::Rc; 13 | pub type StdArcA = std::sync::Arc; 14 | pub type OcamlrepRcOcA = ocamlrep::rc::RcOc; 15 | 16 | pub type BoxedTuple = Box<(Box, Box)>; 17 | -------------------------------------------------------------------------------- /rust_to_ocaml/test/cases/pointers.rs.exp: -------------------------------------------------------------------------------- 1 | type box_a = a 2 | 3 | type rc_a = a 4 | 5 | type arc_a = a 6 | 7 | type rc_oc_a = a 8 | 9 | type std_box_a = a 10 | 11 | type std_rc_a = a 12 | 13 | type std_arc_a = a 14 | 15 | type ocamlrep_rc_oc_a = a 16 | 17 | type boxed_tuple = a * b 18 | -------------------------------------------------------------------------------- /rust_to_ocaml/test/cases/qualified_name.rs: -------------------------------------------------------------------------------- 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 | pub type A = x::Foo; 7 | 8 | pub type B = y::z::Foo; 9 | 10 | pub type C = my_module::some_submodule::Foo; 11 | 12 | pub type D = i_map::IMap; 13 | -------------------------------------------------------------------------------- /rust_to_ocaml/test/cases/qualified_name.rs.exp: -------------------------------------------------------------------------------- 1 | type a = X.foo 2 | 3 | type b = Y.Z.foo 4 | 5 | type c = My_module.Some_submodule.foo 6 | 7 | type d = x IMap.t 8 | -------------------------------------------------------------------------------- /rust_to_ocaml/test/cases/struct.rs: -------------------------------------------------------------------------------- 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 | pub struct MyStruct { 7 | pub foo: isize, 8 | pub bar: isize, 9 | } 10 | 11 | #[rust_to_ocaml(prefix = "a_")] 12 | pub struct StructA { 13 | pub foo: isize, 14 | pub bar: isize, 15 | } 16 | 17 | #[rust_to_ocaml(prefix = "b_")] 18 | pub struct StructB { 19 | pub foo: isize, 20 | pub bar: isize, 21 | } 22 | -------------------------------------------------------------------------------- /rust_to_ocaml/test/cases/struct.rs.exp: -------------------------------------------------------------------------------- 1 | type my_struct = { 2 | foo: int; 3 | bar: int; 4 | } 5 | 6 | type struct_a = { 7 | a_foo: int; 8 | a_bar: int; 9 | } 10 | 11 | type struct_b = { 12 | b_foo: int; 13 | b_bar: int; 14 | } 15 | -------------------------------------------------------------------------------- /rust_to_ocaml/test/cases/tuple.rs: -------------------------------------------------------------------------------- 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 | type TupleA = (A, B); 7 | 8 | type TupleB = (A, (B, C)); 9 | -------------------------------------------------------------------------------- /rust_to_ocaml/test/cases/tuple.rs.exp: -------------------------------------------------------------------------------- 1 | type tuple_a = a * b 2 | 3 | type tuple_b = a * (b * c) 4 | -------------------------------------------------------------------------------- /rust_to_ocaml/test/cases/tuple_structs.rs: -------------------------------------------------------------------------------- 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 | pub struct A; 7 | 8 | pub struct B(); 9 | 10 | pub struct C(()); 11 | 12 | pub struct D(pub X); 13 | 14 | pub struct E(pub Y, pub Z); 15 | -------------------------------------------------------------------------------- /rust_to_ocaml/test/cases/tuple_structs.rs.exp: -------------------------------------------------------------------------------- 1 | type a = unit 2 | 3 | type b = unit 4 | 5 | type c = unit 6 | 7 | type d = x 8 | 9 | type e = y * z 10 | -------------------------------------------------------------------------------- /rust_to_ocaml/test/cases/type_args.rs: -------------------------------------------------------------------------------- 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 | pub type MaybeA = Option; 7 | 8 | pub type MyResult = Result; 9 | 10 | pub type Bar = foo::Bar; 11 | -------------------------------------------------------------------------------- /rust_to_ocaml/test/cases/type_args.rs.exp: -------------------------------------------------------------------------------- 1 | type maybe_a = a option 2 | 3 | type my_result = (b, c) result 4 | 5 | type bar = (d, e, f) Foo.bar 6 | -------------------------------------------------------------------------------- /rust_to_ocaml/test/cases/type_name_matches_module_name.rs: -------------------------------------------------------------------------------- 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 | pub type A = pos::Pos; 7 | 8 | pub type B = crate::relative_path::RelativePath; 9 | 10 | pub type C = collections::s_set::SSet; 11 | 12 | pub type TypeNameMatchesModuleName = D; 13 | 14 | pub mod foo { 15 | pub type Foo = E; 16 | pub type Maybe = Option; 17 | } 18 | -------------------------------------------------------------------------------- /rust_to_ocaml/test/cases/type_name_matches_module_name.rs.exp: -------------------------------------------------------------------------------- 1 | type a = Pos.t 2 | 3 | type b = Relative_path.t 4 | 5 | type c = Collections.SSet.t 6 | 7 | type t = d 8 | 9 | module Foo = struct 10 | type t = e 11 | 12 | type maybe = t option 13 | end 14 | -------------------------------------------------------------------------------- /rust_to_ocaml/test/cases/variants.rs: -------------------------------------------------------------------------------- 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 | pub enum A { 7 | I, 8 | J(isize), 9 | K(isize, isize), 10 | L((isize, isize)), 11 | M { x: isize, y: isize }, 12 | } 13 | 14 | #[rust_to_ocaml(prefix = "P")] 15 | pub enum Prefixed { 16 | I, 17 | J(isize), 18 | K(isize, isize), 19 | L((isize, isize)), 20 | #[rust_to_ocaml(prefix = "m_")] 21 | M { 22 | x: isize, 23 | y: isize, 24 | }, 25 | } 26 | -------------------------------------------------------------------------------- /rust_to_ocaml/test/cases/variants.rs.exp: -------------------------------------------------------------------------------- 1 | type a = 2 | | I 3 | | J of int 4 | | K of int * int 5 | | L of (int * int) 6 | | M of { 7 | x: int; 8 | y: int; 9 | } 10 | 11 | type prefixed = 12 | | PI 13 | | PJ of int 14 | | PK of int * int 15 | | PL of (int * int) 16 | | PM of { 17 | m_x: int; 18 | m_y: int; 19 | } 20 | -------------------------------------------------------------------------------- /rust_to_ocaml/test/config.toml: -------------------------------------------------------------------------------- 1 | [modules] 2 | rename = [ 3 | ["i_map", "IMap"], 4 | ["i_set", "ISet"], 5 | ["s_map", "SMap"], 6 | ["s_set", "SSet"], 7 | ] 8 | 9 | [types] 10 | transparent = [ 11 | "Box", "std::boxed::Box", 12 | "Rc", "std::rc::Rc", 13 | "Arc", "std::sync::Arc", 14 | "RcOc", "ocamlrep::rc::RcOc", 15 | ] 16 | rename = [ 17 | ["Vec", "list"], 18 | ["std::vec::Vec", "list"], 19 | ] 20 | -------------------------------------------------------------------------------- /shim/.buckconfig: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | [buildfile] 9 | # see -- this helps us make 10 | # error messages when the user doesn't run "reindeer" much more obvious, 11 | # because the default BUCK file just errors out. We then make reindeer generate 12 | # BUCK.reindeer to override that. 13 | name = BUCK.reindeer,BUCK 14 | 15 | [cells] 16 | gh_facebook_buck2_shims_meta = . 17 | 18 | [cell_aliases] 19 | root = gh_facebook_buck2_shims_meta 20 | 21 | # This is a duplicate of .buckconfig.d/common.buckconfig, but due to the way 22 | # we vendor the shim directory, common.buckconfig won't show up in the 23 | # vendored .buckconfig.d directory. 24 | # When the shim cell is no longer vendored in individual projects, this 25 | # duplication cam be removed. 26 | [cells] 27 | prelude = prelude 28 | none = none 29 | 30 | [cell_aliases] 31 | config = prelude 32 | ovr_config = prelude 33 | bazel_skylib = gh_facebook_buck2_shims_meta 34 | buck = gh_facebook_buck2_shims_meta 35 | fbcode = gh_facebook_buck2_shims_meta 36 | fbcode_macros = gh_facebook_buck2_shims_meta 37 | fbsource = gh_facebook_buck2_shims_meta 38 | shim = gh_facebook_buck2_shims_meta 39 | toolchains = gh_facebook_buck2_shims_meta 40 | 41 | [external_cells] 42 | prelude = bundled 43 | 44 | [parser] 45 | target_platform_detector_spec = target:root//...->prelude//platforms:default target:shim//...->prelude//platforms:default 46 | -------------------------------------------------------------------------------- /shim/.buckroot: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | -------------------------------------------------------------------------------- /shim/.gitignore: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | # We currently expect end users to run reindeer vendor themselves 9 | # so mark these things as to ignore 10 | /third-party/rust/.cargo/ 11 | /third-party/rust/BUCK.reindeer 12 | /third-party/rust/vendor/ 13 | -------------------------------------------------------------------------------- /shim/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | We want to make contributing to this project as easy and transparent as 3 | possible. 4 | 5 | ## Pull Requests 6 | We actively welcome your pull requests. 7 | 8 | 1. Fork the repo and create your branch from `main`. 9 | 2. If you've added code that should be tested, add tests. 10 | 3. If you've changed APIs, update the documentation. 11 | 4. Ensure the test suite passes. 12 | 5. Make sure your code lints. 13 | 6. If you haven't already, complete the Contributor License Agreement ("CLA"). 14 | 15 | ## Contributor License Agreement ("CLA") 16 | In order to accept your pull request, we need you to submit a CLA. You only need 17 | to do this once to work on any of Facebook's open source projects. 18 | 19 | Complete your CLA here: 20 | 21 | ## Issues 22 | We use GitHub issues to track public bugs. Please ensure your description is 23 | clear and has sufficient instructions to be able to reproduce the issue. 24 | 25 | Facebook has a [bounty program](https://www.facebook.com/whitehat/) for the safe 26 | disclosure of security bugs. In those cases, please go through the process 27 | outlined on that page and do not file a public issue. 28 | 29 | ## License 30 | By contributing to this repo, you agree that your contributions will be licensed 31 | under the LICENSE file in the root directory of this source tree. 32 | -------------------------------------------------------------------------------- /shim/LICENSE-MIT: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Meta Platforms, Inc. and 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 | -------------------------------------------------------------------------------- /shim/PACKAGE: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | load(":cfg.bzl", "SHIM_ALIASES", "set_cfg_constructor", "get_shim_modifiers") 9 | load("@prelude//cfg/modifier:set_cfg_modifiers.bzl", "set_cfg_modifiers") 10 | 11 | # Activate cfg modifiers from CLI / PACKAGE / targets 12 | set_cfg_constructor(SHIM_ALIASES) 13 | 14 | modifiers = get_shim_modifiers() 15 | set_cfg_modifiers(modifiers) 16 | -------------------------------------------------------------------------------- /shim/README.md: -------------------------------------------------------------------------------- 1 | # Buck2 Shims for Meta 2 | 3 | These files implement shims for Meta internal buck2 cells, macros, and targets. 4 | 5 | Via these shims, the buck2 experience when building Meta open source projects 6 | should be nearly identical to the internal buck2 experience. 7 | 8 | ## These shims are not recommended for non-Meta projects!!! 9 | 10 | Prefer to use [rules from the buck2 prelude](https://buck2.build/docs/prelude/globals/) 11 | and the [buck2 build apis](https://buck2.build/docs/api/build/globals/) 12 | 13 | ## License 14 | 15 | This source code is licensed under both the MIT license found in the 16 | LICENSE-MIT file in the root directory of this source tree and the Apache 17 | License, Version 2.0 found in the LICENSE-APACHE file in the root directory 18 | of this source tree. 19 | -------------------------------------------------------------------------------- /shim/antlir/fbpkg/fbpkg.bzl: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | def _builder(**_): 9 | pass 10 | 11 | def _buck_opts(**_): 12 | pass 13 | 14 | fbpkg = struct( 15 | builder = _builder, 16 | buck_opts = _buck_opts, 17 | ) 18 | -------------------------------------------------------------------------------- /shim/buck2/buck_rust_binary.bzl: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | load( 9 | "@shim//:shims.bzl", 10 | _rust_binary = "rust_binary", 11 | ) 12 | 13 | buck_rust_binary = _rust_binary 14 | -------------------------------------------------------------------------------- /shim/buck2/proto_defs.bzl: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | load( 9 | "@shim//:shims.bzl", 10 | _proto_srcs = "proto_srcs", 11 | _rust_protobuf_library = "rust_protobuf_library", 12 | ) 13 | 14 | rust_protobuf_library = _rust_protobuf_library 15 | proto_srcs = _proto_srcs 16 | -------------------------------------------------------------------------------- /shim/build_defs/auto_headers.bzl: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | load("@prelude//utils:buckconfig.bzl", "read_choice") 9 | 10 | AutoHeaders = struct( 11 | NONE = "none", 12 | # Infer headers from sources of the rule. 13 | SOURCES = "sources", 14 | ) 15 | 16 | _VALUES = [ 17 | AutoHeaders.NONE, 18 | AutoHeaders.SOURCES, 19 | ] 20 | 21 | def get_auto_headers(auto_headers): 22 | """ 23 | Returns the level of auto-headers to apply to a rule. 24 | 25 | Args: 26 | auto_headers: One of the values in `AutoHeaders` 27 | 28 | Returns: 29 | The value passed in as auto_headers, or the value from configuration if 30 | `auto_headers` is None 31 | """ 32 | if auto_headers != None: 33 | if auto_headers not in _VALUES: 34 | fail("unexpected `auto_headers` value: {!r}".format(auto_headers)) 35 | return auto_headers 36 | return read_choice("cxx", "auto_headers", _VALUES, AutoHeaders.SOURCES) 37 | -------------------------------------------------------------------------------- /shim/build_defs/config.bzl: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | def _get_build_mode(): 9 | return "" 10 | 11 | config = struct( 12 | get_build_mode = _get_build_mode, 13 | ) 14 | -------------------------------------------------------------------------------- /shim/build_defs/cpp_benchmark.bzl: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | def cpp_benchmark(**_): 9 | pass 10 | -------------------------------------------------------------------------------- /shim/build_defs/cpp_binary.bzl: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | load("@shim//:shims.bzl", _cpp_binary = "cpp_binary") 9 | 10 | cpp_binary = _cpp_binary 11 | -------------------------------------------------------------------------------- /shim/build_defs/cpp_library.bzl: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | load("@shim//:shims.bzl", _cpp_library = "cpp_library") 9 | 10 | cpp_library = _cpp_library 11 | -------------------------------------------------------------------------------- /shim/build_defs/cpp_unittest.bzl: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | load("@shim//:shims.bzl", _cpp_unittest = "cpp_unittest") 9 | 10 | cpp_unittest = _cpp_unittest 11 | -------------------------------------------------------------------------------- /shim/build_defs/custom_rule.bzl: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | def custom_rule(**_): 9 | pass 10 | -------------------------------------------------------------------------------- /shim/build_defs/custom_unittest.bzl: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | def custom_unittest(**_): 9 | pass 10 | -------------------------------------------------------------------------------- /shim/build_defs/cython_library.bzl: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | load("@shim//build_defs:python_library.bzl", "python_library") 9 | 10 | def cython_library(name, visibility = ["PUBLIC"], **_): 11 | python_library(name = name, visibility = visibility) 12 | -------------------------------------------------------------------------------- /shim/build_defs/export_files.bzl: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | def export_file(visibility = ["PUBLIC"], **kwargs): 9 | # @lint-ignore BUCKLINT: avoid "native is forbidden in fbcode" 10 | native.export_file(visibility = visibility, **kwargs) 11 | 12 | def export_files(files, visibility = ["PUBLIC"], **kwargs): 13 | # @lint-ignore BUCKLINT: avoid "native is forbidden in fbcode" 14 | for file in files: 15 | native.export_file(name = file, visibility = visibility, **kwargs) 16 | -------------------------------------------------------------------------------- /shim/build_defs/lib/python_common.bzl: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | def get_ldflags(*args): 9 | _unused = args # @unused 10 | return [] 11 | 12 | def get_strip_mode(*args): 13 | _unused = args # @unused 14 | return "" 15 | -------------------------------------------------------------------------------- /shim/build_defs/lib/test/BUCK: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | load("@shim//build_defs/lib/test:oss.bzl", "test_translate_target") 9 | 10 | test_translate_target() 11 | -------------------------------------------------------------------------------- /shim/build_defs/native_rules.bzl: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | def buck_genrule(visibility = ["PUBLIC"], **kwargs): 9 | # @lint-ignore BUCKLINT: avoid "native is forbidden in fbcode" 10 | native.genrule(visibility = visibility, **kwargs) 11 | 12 | def buck_command_alias(**_): 13 | pass 14 | 15 | def buck_filegroup(visibility = ["PUBLIC"], **kwargs): 16 | # @lint-ignore BUCKLINT: avoid "native is forbidden in fbcode" 17 | native.filegroup(visibility = visibility, **kwargs) 18 | 19 | def alias(actual, visibility = ["PUBLIC"], **kwargs): 20 | if actual.startswith("//buck2/"): 21 | actual = "root//" + actual.removeprefix("//buck2/") 22 | native.alias(actual = actual, visibility = visibility, **kwargs) 23 | 24 | def buck_sh_binary(visibility = ["PUBLIC"], **kwargs): 25 | # @lint-ignore BUCKLINT: avoid "native is forbidden in fbcode" 26 | native.sh_binary(visibility = visibility, **kwargs) 27 | -------------------------------------------------------------------------------- /shim/build_defs/ocaml_binary.bzl: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | load("@shim//:shims.bzl", _ocaml_binary = "ocaml_binary") 9 | 10 | ocaml_binary = _ocaml_binary 11 | -------------------------------------------------------------------------------- /shim/build_defs/platform_utils.bzl: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | def _get_cxx_platform_for_base_path(_base_path): 9 | return struct(target_platform = None) 10 | 11 | platform_utils = struct(get_cxx_platform_for_base_path = _get_cxx_platform_for_base_path) 12 | -------------------------------------------------------------------------------- /shim/build_defs/prebuilt_cpp_library.bzl: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | load("@shim//:shims.bzl", _prebuilt_cpp_library = "prebuilt_cpp_library") 9 | 10 | prebuilt_cpp_library = _prebuilt_cpp_library 11 | -------------------------------------------------------------------------------- /shim/build_defs/python_binary.bzl: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | def python_binary(srcs = [], **kwargs): 9 | _unused = srcs # @unused 10 | 11 | # @lint-ignore BUCKLINT: avoid "Direct usage of native rules is not allowed." 12 | native.python_binary(**kwargs) 13 | -------------------------------------------------------------------------------- /shim/build_defs/python_library.bzl: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | def python_library(srcs = [], visibility = ["PUBLIC"], **kwargs): 9 | _unused = srcs # @unused 10 | 11 | # @lint-ignore BUCKLINT: avoid "Direct usage of native rules is not allowed." 12 | native.python_library(visibility = visibility, **kwargs) 13 | -------------------------------------------------------------------------------- /shim/build_defs/python_unittest.bzl: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | def python_unittest(srcs = [], **kwargs): 9 | _unused = srcs # @unused 10 | 11 | # @lint-ignore BUCKLINT: avoid "Direct usage of native rules is not allowed." 12 | native.python_test(**kwargs) 13 | -------------------------------------------------------------------------------- /shim/build_defs/rust_binary.bzl: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | load("@shim//:shims.bzl", _rust_binary = "rust_binary") 9 | 10 | rust_binary = _rust_binary 11 | -------------------------------------------------------------------------------- /shim/build_defs/rust_library.bzl: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | load("@shim//:shims.bzl", _rust_library = "rust_library") 9 | 10 | rust_library = _rust_library 11 | -------------------------------------------------------------------------------- /shim/build_defs/rust_linkable_symbol.bzl: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | load("@prelude//rust:linkable_symbol.bzl", prelude_rust_linkable_symbol = "rust_linkable_symbol") 9 | load("@shim//:shims.bzl", _rust_library = "rust_library") 10 | 11 | def rust_linkable_symbol( 12 | visibility = ["PUBLIC"], 13 | **kwargs): 14 | prelude_rust_linkable_symbol( 15 | visibility = visibility, 16 | rust_library_macro = _rust_library, 17 | **kwargs 18 | ) 19 | -------------------------------------------------------------------------------- /shim/build_defs/rust_unittest.bzl: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | load("@shim//:shims.bzl", _rust_unittest = "rust_unittest") 9 | 10 | rust_unittest = _rust_unittest 11 | -------------------------------------------------------------------------------- /shim/cfg.bzl: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | load("@prelude//cfg/modifier:cfg_constructor.bzl", "cfg_constructor_post_constraint_analysis", "cfg_constructor_pre_constraint_analysis") 9 | load("@prelude//cfg/modifier:common.bzl", "MODIFIER_METADATA_KEY") 10 | 11 | SHIM_ALIASES = { 12 | "fedora": "shim//os/linux/distro/constraints:fedora", 13 | "ubuntu": "shim//os/linux/distro/constraints:ubuntu", 14 | } 15 | 16 | def set_cfg_constructor(aliases = dict()): 17 | project_root_cell = read_root_config("cell_aliases", "root") 18 | current_root_cell = read_config("cell_aliases", "root") 19 | if project_root_cell == current_root_cell: 20 | native.set_cfg_constructor( 21 | stage0 = cfg_constructor_pre_constraint_analysis, 22 | stage1 = cfg_constructor_post_constraint_analysis, 23 | key = MODIFIER_METADATA_KEY, 24 | aliases = struct(**aliases), 25 | extra_data = struct(), 26 | ) 27 | 28 | def get_shim_modifiers(): 29 | modifiers = [] 30 | 31 | linux_distro = read_config("linux", "distro") 32 | 33 | if linux_distro: 34 | modifiers.append("shim//os/linux/distro/constraints:{}".format(linux_distro)) 35 | 36 | known_broken = read_config("oss", "known_broken", "disable") 37 | modifiers.append("shim//opensource/macros/broken_in_oss/constraints:{}".format(known_broken)) 38 | 39 | return modifiers 40 | -------------------------------------------------------------------------------- /shim/common/ocaml/interop/defs.bzl: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | # Try to keep in sync with all the client projects, like hack 9 | RUST_FLAGS_2018 = [ 10 | "-Drust-2018-idioms", 11 | "-Dwarnings", 12 | "-Dunused-crate-dependencies", 13 | ] 14 | -------------------------------------------------------------------------------- /shim/folly/io/async/test/certs/defs.bzl: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | load("@fbcode_macros//build_defs:native_rules.bzl", "alias") 9 | 10 | def alias_pem(pems: list[str]): 11 | for pem in pems: 12 | alias( 13 | name = pem, 14 | actual = "//folly/io/async/test/certs:{pem}".format(pem = pem), 15 | ) 16 | 17 | def alias_pem_for_xplat(pems: list[str]): 18 | # in xplat these pem files are exported in //xplat/folly/io/async/test/certs 19 | for pem in pems: 20 | alias( 21 | name = pem, 22 | actual = "//xplat/folly/io/async/test/certs:{pem}".format(pem = pem), 23 | ) 24 | -------------------------------------------------------------------------------- /shim/grpc_fb/codegen/buck_macros.bzl: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | def grpc_library(**kwargs): 9 | _unused = kwargs # @unused 10 | pass 11 | -------------------------------------------------------------------------------- /shim/lib/dicts.bzl: -------------------------------------------------------------------------------- 1 | # Copyright 2017 The Bazel Authors. All rights reserved. 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 | """Skylib module containing functions that operate on dictionaries.""" 16 | 17 | def _add(*dictionaries): 18 | """Returns a new `dict` that has all the entries of the given dictionaries. 19 | 20 | If the same key is present in more than one of the input dictionaries, the 21 | last of them in the argument list overrides any earlier ones. 22 | 23 | This function is designed to take zero or one arguments as well as multiple 24 | dictionaries, so that it follows arithmetic identities and callers can avoid 25 | special cases for their inputs: the sum of zero dictionaries is the empty 26 | dictionary, and the sum of a single dictionary is a copy of itself. 27 | 28 | Args: 29 | *dictionaries: Zero or more dictionaries to be added. 30 | 31 | Returns: 32 | A new `dict` that has all the entries of the given dictionaries. 33 | """ 34 | result = {} 35 | for d in dictionaries: 36 | result.update(d) 37 | return result 38 | 39 | dicts = struct( 40 | add = _add, 41 | ) 42 | -------------------------------------------------------------------------------- /shim/opensource/macros/BUCK: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | config_setting( 9 | name = "broken-in-oss", 10 | constraint_values = [ 11 | "//opensource/macros/broken_in_oss/constraints:enable", 12 | ], 13 | visibility = ["PUBLIC"], 14 | ) 15 | -------------------------------------------------------------------------------- /shim/opensource/macros/broken_in_oss/constraints/BUCK: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | constraint_setting( 9 | name = "broken_in_oss", 10 | visibility = ["PUBLIC"], 11 | ) 12 | 13 | constraint_value( 14 | name = "enable", 15 | constraint_setting = ":broken_in_oss", 16 | visibility = ["PUBLIC"], 17 | ) 18 | 19 | constraint_value( 20 | name = "disable", 21 | constraint_setting = ":broken_in_oss", 22 | visibility = ["PUBLIC"], 23 | ) 24 | -------------------------------------------------------------------------------- /shim/os/BUCK: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | config_setting( 9 | name = "linux-fedora", 10 | constraint_values = [ 11 | "prelude//os/constraints:linux", 12 | "//os/linux/distro/constraints:fedora", 13 | ], 14 | visibility = ["PUBLIC"], 15 | ) 16 | 17 | config_setting( 18 | name = "linux-ubuntu", 19 | constraint_values = [ 20 | "prelude//os/constraints:linux", 21 | "//os/linux/distro/constraints:ubuntu", 22 | ], 23 | visibility = ["PUBLIC"], 24 | ) 25 | 26 | config_setting( 27 | name = "macos-homebrew", 28 | constraint_values = [ 29 | "prelude//os/constraints:macos", 30 | ], 31 | visibility = ["PUBLIC"], 32 | ) 33 | -------------------------------------------------------------------------------- /shim/os/linux/distro/constraints/BUCK: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | constraint_setting( 9 | name = "distro", 10 | visibility = ["PUBLIC"], 11 | ) 12 | 13 | constraint_value( 14 | name = "fedora", 15 | constraint_setting = ":distro", 16 | visibility = ["PUBLIC"], 17 | ) 18 | 19 | constraint_value( 20 | name = "ubuntu", 21 | constraint_setting = ":distro", 22 | visibility = ["PUBLIC"], 23 | ) 24 | -------------------------------------------------------------------------------- /shim/third-party/binutils/BUCK: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | load("@//third-party:defs.bzl", "system_library") 9 | 10 | oncall("open_source") 11 | 12 | system_library( 13 | name = "iberty", 14 | exported_linker_flags = ["-liberty"], 15 | packages = { 16 | "//os:linux-fedora": ["binutils-devel"], 17 | "//os:linux-ubuntu": ["libiberty-dev"], 18 | }, 19 | ) 20 | -------------------------------------------------------------------------------- /shim/third-party/boost/BUCK: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | load("@//third-party/boost:boost.bzl", "boost_libs") 9 | 10 | oncall("open_source") 11 | 12 | boost_libs( 13 | header_only = [ 14 | "algorithm", 15 | "interprocess", 16 | "lexical_cast", 17 | "multi_index", 18 | "preprocessor", 19 | "range", 20 | "sort", 21 | "variant", 22 | ], 23 | libraries = [ 24 | "container", 25 | "context", 26 | "filesystem", 27 | "program_options", 28 | "random", 29 | "regex", 30 | "thread", 31 | ], 32 | ) 33 | -------------------------------------------------------------------------------- /shim/third-party/boost/boost.bzl: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | load("@//third-party:defs.bzl", "system_library") 9 | 10 | def boost_libs(libraries, header_only): 11 | system_library( 12 | name = "boost", 13 | packages = { 14 | "//os:linux-fedora": ["boost-devel"], 15 | "//os:linux-ubuntu": ["libboost-all-dev"], 16 | "//os:macos-homebrew": ["boost"], 17 | }, 18 | ) 19 | 20 | for library in libraries: 21 | boost_library(library, False) 22 | 23 | for library in header_only: 24 | boost_library(library, True) 25 | 26 | def boost_library(library: str, header_only: bool): 27 | exported_linker_flags = [] if header_only else ["-lboost_{}".format(library)] 28 | 29 | system_library( 30 | name = "boost_{}".format(library), 31 | packages = { 32 | "//os:linux-fedora": ["boost-devel"], 33 | "//os:linux-ubuntu": [ 34 | "libboost-dev" if header_only else "libboost-{}-dev".format(library.replace("_", "-")), 35 | ], 36 | "//os:macos-homebrew": ["boost"], 37 | }, 38 | exported_linker_flags = exported_linker_flags, 39 | ) 40 | -------------------------------------------------------------------------------- /shim/third-party/brotli/BUCK: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | load("@//third-party:defs.bzl", "pkgconfig_system_library") 9 | 10 | oncall("open_source") 11 | 12 | PACKAGES = { 13 | "//os:linux-fedora": ["brotli-devel"], 14 | "//os:linux-ubuntu": ["libbrotli-dev"], 15 | "//os:macos-homebrew": ["brotli"], 16 | } 17 | 18 | pkgconfig_system_library( 19 | name = "brotli_decode", 20 | packages = PACKAGES, 21 | pkgconfig_name = "libbrotlidec", 22 | ) 23 | 24 | pkgconfig_system_library( 25 | name = "brotli_encode", 26 | packages = PACKAGES, 27 | pkgconfig_name = "libbrotlienc", 28 | ) 29 | -------------------------------------------------------------------------------- /shim/third-party/bzip2/BUCK: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | load("@//third-party:defs.bzl", "pkgconfig_system_library") 9 | 10 | oncall("open_source") 11 | 12 | prebuilt_cxx_library( 13 | name = "pkgconfig_unsupported", 14 | exported_linker_flags = select({ 15 | "//os:linux-ubuntu": ["-lbz2"], 16 | "DEFAULT": [], 17 | }), 18 | target_compatible_with = [ 19 | "//os:linux-ubuntu", 20 | ], 21 | visibility = [], 22 | ) 23 | 24 | pkgconfig_system_library( 25 | name = "bz2", 26 | packages = { 27 | "//os:linux-fedora": ["bzip2-devel"], 28 | "//os:linux-ubuntu": ["libbz2-dev"], 29 | "//os:macos-homebrew": ["bzip2"], 30 | }, 31 | pkgconfig_name = "bzip2", 32 | unsupported = { 33 | "//os:linux-ubuntu": [":pkgconfig_unsupported"], 34 | }, 35 | ) 36 | -------------------------------------------------------------------------------- /shim/third-party/double_conversion/BUCK: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | load("@//third-party:defs.bzl", "system_library") 9 | 10 | oncall("open_source") 11 | 12 | system_library( 13 | name = "double_conversion", 14 | exported_linker_flags = ["-ldouble-conversion"], 15 | packages = { 16 | "//os:linux-fedora": ["double-conversion-devel"], 17 | "//os:linux-ubuntu": ["libdouble-conversion-dev"], 18 | "//os:macos-homebrew": ["double-conversion"], 19 | }, 20 | ) 21 | -------------------------------------------------------------------------------- /shim/third-party/fast_float/BUCK: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | load("@//third-party:defs.bzl", "system_library") 9 | 10 | oncall("open_source") 11 | 12 | system_library( 13 | name = "fast_float", 14 | packages = { 15 | "//os:linux-fedora": ["fast_float-devel"], 16 | "//os:linux-ubuntu": ["libfast-float-dev"], 17 | "//os:macos-homebrew": ["fast_float"], 18 | }, 19 | ) 20 | -------------------------------------------------------------------------------- /shim/third-party/fmt/BUCK: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | load("@//third-party:defs.bzl", "pkgconfig_system_library") 9 | 10 | oncall("open_source") 11 | 12 | pkgconfig_system_library( 13 | name = "fmt", 14 | packages = { 15 | "//os:linux-fedora": ["fmt-devel"], 16 | "//os:linux-ubuntu": ["libfmt-dev"], 17 | "//os:macos-homebrew": ["fmt"], 18 | }, 19 | ) 20 | -------------------------------------------------------------------------------- /shim/third-party/gflags/BUCK: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | load("@//third-party:defs.bzl", "pkgconfig_system_library") 9 | 10 | oncall("open_source") 11 | 12 | pkgconfig_system_library( 13 | name = "gflags", 14 | packages = { 15 | "//os:linux-fedora": ["gflags-devel"], 16 | "//os:linux-ubuntu": ["libgflags-dev"], 17 | "//os:macos-homebrew": ["gflags"], 18 | }, 19 | ) 20 | -------------------------------------------------------------------------------- /shim/third-party/glibc/BUCK: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | load("@shim//build_defs:prebuilt_cpp_library.bzl", "prebuilt_cpp_library") 9 | 10 | oncall("open_source") 11 | 12 | prebuilt_cpp_library(name = "glibc") 13 | 14 | alias( 15 | name = "rt", 16 | actual = ":glibc", 17 | visibility = ["PUBLIC"], 18 | ) 19 | 20 | alias( 21 | name = "ct", 22 | actual = ":glibc", 23 | visibility = ["PUBLIC"], 24 | ) 25 | 26 | alias( 27 | name = "dl", 28 | actual = ":glibc", 29 | visibility = ["PUBLIC"], 30 | ) 31 | 32 | alias( 33 | name = "pthread", 34 | actual = ":glibc", 35 | visibility = ["PUBLIC"], 36 | ) 37 | -------------------------------------------------------------------------------- /shim/third-party/glog/BUCK: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | load("@//third-party:defs.bzl", "pkgconfig_system_library") 9 | 10 | oncall("open_source") 11 | 12 | pkgconfig_system_library( 13 | name = "glog", 14 | packages = { 15 | "//os:linux-fedora": ["glog-devel"], 16 | "//os:linux-ubuntu": ["libgoogle-glog-dev"], 17 | "//os:macos-homebrew": ["glog"], 18 | }, 19 | pkgconfig_name = "libglog", 20 | exported_deps = [ 21 | "//third-party/gflags:gflags", 22 | ], 23 | ) 24 | -------------------------------------------------------------------------------- /shim/third-party/googletest/BUCK: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | load("@//third-party:defs.bzl", "pkgconfig_system_library") 9 | 10 | oncall("open_source") 11 | 12 | pkgconfig_system_library( 13 | name = "gtest", 14 | packages = { 15 | "//os:linux-fedora": ["gtest-devel"], 16 | "//os:linux-ubuntu": ["libgtest-dev"], 17 | "//os:macos-homebrew": ["googletest"], 18 | }, 19 | ) 20 | 21 | pkgconfig_system_library( 22 | name = "gmock", 23 | packages = { 24 | "//os:linux-fedora": ["gmock-devel"], 25 | "//os:linux-ubuntu": ["libgmock-dev"], 26 | "//os:macos-homebrew": ["googletest"], 27 | }, 28 | ) 29 | 30 | cxx_library( 31 | name = "cpp_unittest_main", 32 | srcs = ["gtest_main.cpp"], 33 | visibility = ["PUBLIC"], 34 | deps = [":gtest"], 35 | ) 36 | -------------------------------------------------------------------------------- /shim/third-party/jemalloc/BUCK: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | load("@//third-party:defs.bzl", "pkgconfig_system_library") 9 | 10 | oncall("open_source") 11 | 12 | pkgconfig_system_library( 13 | name = "headers", 14 | packages = { 15 | "//os:linux-fedora": ["jemalloc-devel"], 16 | "//os:linux-ubuntu": ["libjemalloc-dev"], 17 | "//os:macos-homebrew": ["jemalloc"], 18 | }, 19 | pkgconfig_name = "jemalloc", 20 | ) 21 | -------------------------------------------------------------------------------- /shim/third-party/jvm/BUCK: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | load("@//third-party:defs.bzl", "system_library") 9 | 10 | oncall("open_source") 11 | 12 | FEDORA_JVM_ROOT = "/usr/lib/jvm/java-23-openjdk-23.0.1.0.11-1.rolling.fc40.x86_64" 13 | 14 | UBUNTU_JVM_ROOT = "/usr/lib/jvm/java-21-openjdk-amd64" 15 | 16 | system_library( 17 | name = "jvm", 18 | exported_preprocessor_flags = select({ 19 | "//os:linux-fedora": [ 20 | "-I{root}/include/".format(root = FEDORA_JVM_ROOT), 21 | "-I{root}/include/linux/".format(root = FEDORA_JVM_ROOT), 22 | ], 23 | "//os:linux-ubuntu": [ 24 | "-I{root}/include/".format(root = UBUNTU_JVM_ROOT), 25 | "-I{root}/include/linux/".format(root = UBUNTU_JVM_ROOT), 26 | ], 27 | "DEFAULT": [], 28 | }), 29 | packages = { 30 | "//os:linux-fedora": ["java-latest-openjdk-devel"], 31 | "//os:linux-ubuntu": ["openjdk-21-jdk-headless"], 32 | "//os:macos-homebrew": ["openjdk"], 33 | }, 34 | ) 35 | -------------------------------------------------------------------------------- /shim/third-party/libaegis/BUCK: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | oncall("open_source") 9 | 10 | git_fetch( 11 | name = "libaegis.git", 12 | repo = "https://github.com/jedisct1/libaegis.git", 13 | rev = "9c7677d742aaae312e09b1574998acba620188d8", # tag 0.1.23 14 | ) 15 | 16 | genrule( 17 | name = "libaegis-cmake", 18 | out = "out", 19 | cmd = """ 20 | cmake \ 21 | -DCMAKE_INSTALL_PREFIX=$OUT \ 22 | -DCMAKE_INSTALL_LIBDIR=lib \ 23 | -DCMAKE_INSTALL_INCLUDEDIR=include \ 24 | $(location :libaegis.git) && \ 25 | make install 26 | """, 27 | ) 28 | 29 | prebuilt_cxx_library( 30 | name = "aegis", 31 | exported_linker_flags = [ 32 | "-L$(location :libaegis-cmake)/lib", 33 | "-laegis", 34 | ], 35 | exported_preprocessor_flags = ["-I$(location :libaegis-cmake)/include"], 36 | visibility = ["PUBLIC"], 37 | ) 38 | -------------------------------------------------------------------------------- /shim/third-party/libaio/BUCK: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | load("@//third-party:defs.bzl", "system_library") 9 | 10 | oncall("open_source") 11 | 12 | system_library( 13 | name = "aio", 14 | exported_linker_flags = ["-laio"], 15 | packages = { 16 | "//os:linux-fedora": ["libaio-devel"], 17 | "//os:linux-ubuntu": ["libaio-dev"], 18 | "//os:macos-homebrew": ["libaio"], 19 | }, 20 | ) 21 | -------------------------------------------------------------------------------- /shim/third-party/libdwarf/BUCK: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | load("@//third-party:defs.bzl", "pkgconfig_system_library") 9 | 10 | oncall("open_source") 11 | 12 | prebuilt_cxx_library( 13 | name = "pkgconfig_unsupported", 14 | exported_preprocessor_flags = select({ 15 | "//os:linux-ubuntu": ["-I/usr/include/libdwarf"], 16 | "DEFAULT": [], 17 | }), 18 | target_compatible_with = [ 19 | "//os:linux-ubuntu", 20 | ], 21 | visibility = [], 22 | ) 23 | 24 | pkgconfig_system_library( 25 | name = "dwarf", 26 | packages = { 27 | "//os:linux-fedora": ["libdwarf-devel"], 28 | "//os:linux-ubuntu": ["libdwarf-dev"], 29 | "//os:macos-homebrew": ["libdwarf"], 30 | }, 31 | pkgconfig_name = "libdwarf", 32 | unsupported = { 33 | "//os:linux-ubuntu": [":pkgconfig_unsupported"], 34 | }, 35 | ) 36 | -------------------------------------------------------------------------------- /shim/third-party/libevent/BUCK: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | load("@//third-party:defs.bzl", "pkgconfig_system_library") 9 | 10 | oncall("open_source") 11 | 12 | pkgconfig_system_library( 13 | name = "libevent", 14 | packages = { 15 | "//os:linux-fedora": ["libevent-devel"], 16 | "//os:linux-ubuntu": ["libevent-dev"], 17 | "//os:macos-homebrew": ["libevent"], 18 | }, 19 | ) 20 | -------------------------------------------------------------------------------- /shim/third-party/libgcc/BUCK: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | load("@//third-party:defs.bzl", "system_library") 9 | 10 | oncall("open_source") 11 | 12 | system_library( 13 | name = "stdc++fs", 14 | packages = { 15 | "//os:linux-fedora": ["gcc"], 16 | "//os:linux-ubuntu": ["gcc"], 17 | "//os:macos-homebrew": ["gcc"], 18 | }, 19 | ) 20 | -------------------------------------------------------------------------------- /shim/third-party/liboqs/BUCK: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | load("@//third-party:defs.bzl", "pkgconfig_system_library") 9 | 10 | oncall("open_source") 11 | 12 | prebuilt_cxx_library( 13 | name = "pkgconfig_unsupported", 14 | target_compatible_with = [ 15 | "//os:linux-ubuntu", 16 | ], 17 | visibility = [], 18 | ) 19 | 20 | pkgconfig_system_library( 21 | name = "oqs", 22 | packages = { 23 | "//os:linux-fedora": ["liboqs-devel"], 24 | "//os:macos-homebrew": ["liboqs"], 25 | }, 26 | pkgconfig_name = "liboqs", 27 | unsupported = { 28 | "//os:linux-ubuntu": [":pkgconfig_unsupported"], 29 | }, 30 | ) 31 | -------------------------------------------------------------------------------- /shim/third-party/libsodium/BUCK: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | load("@//third-party:defs.bzl", "pkgconfig_system_library") 9 | 10 | oncall("open_source") 11 | 12 | pkgconfig_system_library( 13 | name = "sodium", 14 | packages = { 15 | "//os:linux-fedora": ["libsodium-devel"], 16 | "//os:linux-ubuntu": ["libsodium-dev"], 17 | "//os:macos-homebrew": ["libsodium"], 18 | }, 19 | pkgconfig_name = "libsodium", 20 | ) 21 | -------------------------------------------------------------------------------- /shim/third-party/libunwind/BUCK: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | load("@//third-party:defs.bzl", "pkgconfig_system_library") 9 | 10 | oncall("open_source") 11 | 12 | pkgconfig_system_library( 13 | name = "unwind", 14 | packages = { 15 | "//os:linux-fedora": ["libunwind-devel"], 16 | "//os:linux-ubuntu": ["libunwind-dev"], 17 | "//os:macos-homebrew": ["libunwind"], 18 | }, 19 | pkgconfig_name = "libunwind", 20 | ) 21 | -------------------------------------------------------------------------------- /shim/third-party/liburing/BUCK: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | load("@//third-party:defs.bzl", "pkgconfig_system_library") 9 | 10 | oncall("open_source") 11 | 12 | pkgconfig_system_library( 13 | name = "uring", 14 | packages = { 15 | "//os:linux-fedora": ["liburing-devel"], 16 | "//os:linux-ubuntu": ["liburing-dev"], 17 | "//os:macos-homebrew": ["liburing"], 18 | }, 19 | pkgconfig_name = "liburing", 20 | ) 21 | -------------------------------------------------------------------------------- /shim/third-party/lz4/BUCK: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | load("@//third-party:defs.bzl", "pkgconfig_system_library") 9 | 10 | oncall("open_source") 11 | 12 | pkgconfig_system_library( 13 | name = "lz4", 14 | packages = { 15 | "//os:linux-fedora": ["lz4-devel"], 16 | "//os:linux-ubuntu": ["liblz4-dev"], 17 | "//os:macos-homebrew": ["lz4"], 18 | }, 19 | pkgconfig_name = "liblz4", 20 | ) 21 | -------------------------------------------------------------------------------- /shim/third-party/macros/rust_third_party.bzl: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | def third_party_rust_prebuilt_cxx_library(name, **kwargs): 9 | # FIXME: This should probably be a fixup.toml, but it currently can't be expressed. 10 | # The windows-sys crate does -lwindows to find windows. We pass libwindows.a on the command line, 11 | # which resolves the symbols, but the linker still needs to "find" windows, so we also put its 12 | # directory on the link options. 13 | if name.endswith("libwindows.a"): 14 | kwargs["exported_linker_flags"] = ["-Lshim/third-party/rust/" + kwargs["static_lib"].rpartition("/")[0]] 15 | 16 | # @lint-ignore BUCKLINT 17 | native.prebuilt_cxx_library(name = name, **kwargs) 18 | -------------------------------------------------------------------------------- /shim/third-party/ocaml/BUCK: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | # @lint-ignore BUCKLINT: avoid "Direct usage of native rules is not allowed." 9 | prebuilt_cxx_library( 10 | name = "ocaml-dev", 11 | header_dirs = ["opam/lib/ocaml"], 12 | header_only = True, 13 | visibility = ["PUBLIC"], 14 | ) 15 | -------------------------------------------------------------------------------- /shim/third-party/ocaml/opam/lib/ocaml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | # Fake file so that buck2 can run in non-ocamlrep repos 9 | -------------------------------------------------------------------------------- /shim/third-party/openssl/BUCK: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | load("@//third-party:defs.bzl", "pkgconfig_system_library") 9 | 10 | oncall("open_source") 11 | 12 | pkgconfig_system_library( 13 | name = "ssl", 14 | packages = { 15 | "//os:linux-fedora": ["openssl-devel"], 16 | "//os:linux-ubuntu": ["libssl-dev"], 17 | "//os:macos-homebrew": ["openssl"], 18 | }, 19 | pkgconfig_name = "openssl", 20 | ) 21 | 22 | alias( 23 | name = "crypto", 24 | actual = ":ssl", 25 | visibility = ["PUBLIC"], 26 | ) 27 | -------------------------------------------------------------------------------- /shim/third-party/proto/BUCK: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | # @lint-ignore BUCKLINT: avoid "Direct usage of native rules is not allowed." 9 | load(":defs.bzl", "protoc_distribution") 10 | 11 | protoc_distribution( 12 | name = "distribution", 13 | version = "21.4", 14 | ) 15 | 16 | # @lint-ignore BUCKLINT: avoid "Direct usage of native rules is not allowed." 17 | alias( 18 | name = "protoc", 19 | actual = ":distribution[protoc]", 20 | visibility = ["PUBLIC"], 21 | ) 22 | 23 | # @lint-ignore BUCKLINT: avoid "Direct usage of native rules is not allowed." 24 | alias( 25 | name = "google_protobuf", 26 | actual = ":distribution[google_protobuf]", 27 | visibility = ["PUBLIC"], 28 | ) 29 | -------------------------------------------------------------------------------- /shim/third-party/python/BUCK: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | load("@//third-party:defs.bzl", "pkgconfig_system_library") 9 | 10 | oncall("open_source") 11 | 12 | pkgconfig_system_library( 13 | name = "python", 14 | packages = { 15 | "//os:linux-fedora": ["python3-devel"], 16 | "//os:linux-ubuntu": ["python3-dev"], 17 | "//os:macos-homebrew": ["python3"], 18 | }, 19 | pkgconfig_name = "python3", 20 | ) 21 | -------------------------------------------------------------------------------- /shim/third-party/range-v3/BUCK: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | load("@//third-party:defs.bzl", "system_library") 9 | 10 | oncall("open_source") 11 | 12 | system_library( 13 | name = "range-v3", 14 | packages = { 15 | "//os:linux-fedora": ["range-v3-devel"], 16 | "//os:linux-ubuntu": ["librange-v3-dev"], 17 | "//os:macos-homebrew": ["range-v3"], 18 | }, 19 | ) 20 | -------------------------------------------------------------------------------- /shim/third-party/rust/.gitignore: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | # Ignore Cargo-related stuff 9 | .cargo/registry 10 | .cargo/git 11 | /registry 12 | /git 13 | .package-cache 14 | 15 | # Various cruft in vendored packages 16 | vendor/*/target 17 | vendor/*/Cargo.lock 18 | vendor/**/.buckconfig 19 | vendor/**/BUCK 20 | vendor/**/OWNERS 21 | vendor/**/*~ 22 | vendor/**/*.bzl 23 | vendor/*/.github/** 24 | vendor/*/.appveyor.yml 25 | vendor/*/.travis.yml 26 | /target/** 27 | 28 | # Bad Windows names - oh for case-insensitive regex matching! 29 | vendor/**/[Aa][Uu][Xx] 30 | vendor/**/[Aa][Uu][Xx].* 31 | vendor/**/[Cc][Oo][Mm][1-9] 32 | vendor/**/[Cc][Oo][Mm][1-9].* 33 | vendor/**/[Cc][Oo][Nn] 34 | vendor/**/[Cc][Oo][Nn].* 35 | vendor/**/[Ll][Pp][Tt][1-9] 36 | vendor/**/[Ll][Pp][Tt][1-9].* 37 | vendor/**/[Nn][Uu][Ll] 38 | vendor/**/[Nn][Uu][Ll].* 39 | -------------------------------------------------------------------------------- /shim/third-party/rust/BUCK: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | fail("""---------------------------------------------------- 9 | 10 | You need to generate BUCK dependencies from Cargo.toml using reindeer! 11 | 12 | Try this: 13 | 14 | ./bootstrap/reindeer --third-party-dir shim/third-party/rust buckify 15 | 16 | See the following links for more information: 17 | 18 | 19 | 20 | 21 | ----------------------------------------------------""") 22 | -------------------------------------------------------------------------------- /shim/third-party/rust/defs.bzl: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | def rust_library_from_crates(name): 9 | # @lint-ignore BUCKLINT: avoid "Direct usage of native rules is not allowed." 10 | native.export_file(name = name, src = "BUCK", visibility = ["PUBLIC"]) 11 | 12 | def rust_binary_from_crates(name): 13 | # @lint-ignore BUCKLINT: avoid "Direct usage of native rules is not allowed." 14 | native.genrule(name = name, cmd = "exit 1", executable = True, out = "out", visibility = ["PUBLIC"]) 15 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/ahash/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/anyhow/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/argmin-math/fixups.toml: -------------------------------------------------------------------------------- 1 | cargo_env = ["CARGO_PKG_NAME", "CARGO_PKG_VERSION"] 2 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/async-trait/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/atomic/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = true 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/axum-core/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/axum/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/backtrace/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/bumpalo/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | extra_srcs = ["README.md"] 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/bzip2-sys/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/clap/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | omit_features = ["deprecated"] 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/clap_builder/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | extra_srcs = ["README.md"] 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/clap_derive/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | omit_features = ["deprecated"] 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/core-foundation-sys/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/crc32fast/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/criterion/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | cargo_env = true 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/crossbeam-epoch/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | cargo_env = true 10 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/crossbeam-queue/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | cargo_env = true 10 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/crossbeam-utils/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | cargo_env = true 10 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/crunchy/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = true 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/darwin-libproc-sys/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/debugserver-types/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | extra_srcs = ["src/schema.json"] 9 | cargo_env = true 10 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/derive_more-impl/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | extra_srcs = ["README.md", "doc/*.md"] 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/derive_more/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | extra_srcs = ["README.md"] 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/erased-serde/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/fs-err/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = true 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/fs4/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | extra_srcs = ["src/**/*.rs"] 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/futures-channel/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | cargo_env = true 10 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/futures-core/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | cargo_env = true 10 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/futures-task/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | cargo_env = true 10 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/futures-util/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | cargo_env = true 10 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/generic-array/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/getrandom/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/httparse/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/hyper/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = true 9 | 10 | # reindeer cannot see through `cfg_proto!` macros and the like 11 | extra_srcs = ["src/**/*.rs"] 12 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/indexmap/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | cfgs = ["has_std"] 10 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/io-lifetimes/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/jemalloc-sys/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/lalrpop/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | cargo_env = true 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/lexical-core/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = true 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/libc/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = true 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/libm/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/libmimalloc-sys/fixups.toml: -------------------------------------------------------------------------------- 1 | buildscript.run = false 2 | 3 | [[cxx_library]] 4 | name = "libmimalloc" 5 | add_dep = true 6 | srcs = [ 7 | "c_src/mimalloc/src/alloc.c", 8 | "c_src/mimalloc/src/alloc-aligned.c", 9 | "c_src/mimalloc/src/alloc-posix.c", 10 | "c_src/mimalloc/src/arena.c", 11 | "c_src/mimalloc/src/bitmap.c", 12 | "c_src/mimalloc/src/heap.c", 13 | "c_src/mimalloc/src/init.c", 14 | "c_src/mimalloc/src/libc.c", 15 | "c_src/mimalloc/src/options.c", 16 | "c_src/mimalloc/src/os.c", 17 | "c_src/mimalloc/src/page.c", 18 | "c_src/mimalloc/src/prim/prim.c", 19 | "c_src/mimalloc/src/random.c", 20 | "c_src/mimalloc/src/segment-map.c", 21 | "c_src/mimalloc/src/segment.c", 22 | "c_src/mimalloc/src/stats.c", 23 | ] 24 | headers = [ 25 | "c_src/mimalloc/include/**/*.h", 26 | "c_src/mimalloc/src/alloc-override.c", 27 | "c_src/mimalloc/src/arena-abandon.c", 28 | "c_src/mimalloc/src/bitmap.h", 29 | "c_src/mimalloc/src/free.c", 30 | "c_src/mimalloc/src/page-queue.c", 31 | "c_src/mimalloc/src/prim/**/*.c", 32 | ] 33 | exported_headers = [] 34 | include_paths = ["c_src/mimalloc/include"] 35 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/libsqlite3-sys/BUCK: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | filegroup( 9 | name = "out_dir", 10 | srcs = ["bindgen.rs"], 11 | visibility = ["//third-party/rust/..."], 12 | ) 13 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/libsqlite3-sys/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | # libsqlite3-sys uses a bindgen binding to libsqlite. 9 | # We can't easily import bindgen because of its libclang dependency, 10 | # so in the meantime we need to use pre-generated bindgen files. 11 | buildscript.run = false 12 | 13 | [env] 14 | OUT_DIR = "$(location //third-party/rust/fixups/libsqlite3-sys:out_dir)" 15 | 16 | [[cxx_library]] 17 | name = "sqlite3" 18 | srcs = ["sqlite3/sqlite3.c"] 19 | headers = ["sqlite3/*.h"] 20 | preprocessor_flags = [ 21 | "-DSQLITE_ENABLE_COLUMN_METADATA", 22 | "-DSQLITE_ENABLE_FTS3", 23 | "-DSQLITE_ENABLE_RTREE", 24 | ] 25 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/linkme-impl/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = true 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/lock_api/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | # the build script for lock_api is a version check for rust 1.61. 9 | buildscript.run = true 10 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/log/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = true 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/memchr/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/memoffset/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/mio/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | extra_srcs = ["src/**/*.rs"] 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/native-tls/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/nix/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = true 9 | extra_srcs = ["src/**/*.rs"] 10 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/nom/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/ntapi/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/num-bigint/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = true 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/num-integer/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = true 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/num-traits/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = true 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/oid-registry/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = true 9 | cargo_env = [ 10 | "CARGO_PKG_NAME", # Needed by _buck1_handle_manifest_dir 11 | "CARGO_MANIFEST_DIR", 12 | ] 13 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/parking_lot/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = true 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/parking_lot_core/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = true 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/paste/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/perf-event-open-sys/fixups.toml: -------------------------------------------------------------------------------- 1 | ['cfg(all())'] 2 | version = ">=5.0" 3 | extra_srcs = ["src/version"] 4 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/pest/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | extra_srcs = ["src/**/*.rs"] 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/pin-project-internal/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/platforms/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | # Buildscript sets TARGET in environment 9 | buildscript.run = false 10 | 11 | ['cfg(all(target_os = "linux", target_arch = "aarch64"))'] 12 | env = { TARGET = "aarch64-unknown-linux-gnu" } 13 | 14 | ['cfg(all(target_os = "linux", target_arch = "x86_64"))'] 15 | env = { TARGET = "x86_64-unknown-linux-gnu" } 16 | 17 | ['cfg(all(target_os = "macos", target_arch = "aarch64"))'] 18 | env = { TARGET = "aarch64-apple-darwin" } 19 | 20 | ['cfg(all(target_os = "macos", target_arch = "x86_64"))'] 21 | env = { TARGET = "x86_64-apple-darwin" } 22 | 23 | ['cfg(all(target_os = "windows", target_env = "gnu"))'] 24 | env = { TARGET = "x86_64-pc-windows-gnu" } 25 | 26 | ['cfg(all(target_os = "windows", target_env = "msvc"))'] 27 | env = { TARGET = "x86_64-pc-windows-msvc" } 28 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/prettyplease/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | cargo_env = true 10 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/proc-macro-error-attr/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/proc-macro-error/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/proc-macro-hack/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/proc-macro2/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = true 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/prost-build/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | 10 | # These are here because the crate uses the env! macro 11 | # We override them at runtime. 12 | [env] 13 | PROTOC = "" 14 | PROTOC_INCLUDE = "" 15 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/pulldown-cmark/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/quote/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/radium/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/rayon-core/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/ref-cast/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/reqwest/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | extra_srcs = ["src/**/*.rs"] 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/rustix/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = true 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/rustls/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/rustversion/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = true 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/serde/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/serde_derive/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | # To set `CARGO_MANIFEST_DIR` 9 | cargo_env = true 10 | buildscript.run = false 11 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/serde_json/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = true 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/signal-hook/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/slab/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/slog/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/syn/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/sys-info/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | 10 | [['cfg(target_os = "linux")'.cxx_library]] 11 | name = "linux" 12 | srcs = ["c/linux.c"] 13 | headers = ["c/*.h"] 14 | 15 | [['cfg(target_os = "macos")'.cxx_library]] 16 | name = "macos" 17 | srcs = ["c/darwin.c"] 18 | headers = ["c/*.h"] 19 | 20 | [['cfg(target_os = "windows")'.cxx_library]] 21 | name = "windows" 22 | srcs = ["c/windows.c"] 23 | headers = ["c/*.h"] 24 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/sysinfo/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | extra_srcs = ["README.md", "md_doc/**/*.md"] 10 | 11 | ['cfg(target_os = "macos")'] 12 | rustc_flags = [ 13 | "-lframework=IOKit", 14 | "-lframework=Foundation", 15 | "-lframework=CoreFoundation", 16 | "-lframework=DiskArbitration", 17 | ] 18 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/target-triple/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = true 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/tempfile/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = true 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/terminfo/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = true 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/termwiz/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | cargo_env = true 9 | extra_srcs = ["src/**/*.pest"] 10 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/test-case/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/thiserror/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/tiny-keccak/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/tokio-stream/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | # reindeer cannot see through `cfg_sync!` macros and the like 9 | extra_srcs = ["src/**/*.rs"] 10 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/tokio-util/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | extra_srcs = ["src/**/*.rs"] 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/tokio/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | cfgs = ["tokio_unstable", "tokio_track_caller"] 9 | 10 | extra_srcs = ["src/**/*.rs"] 11 | 12 | buildscript.run = false 13 | features = ["tokio_track_caller"] 14 | 15 | extra_deps = [ ":tracing" ] 16 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/tonic/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | cargo_env = true 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/tracing-subscriber/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | # Reindeer can't find the dependencies due to being confused by the feature! macro. 9 | extra_srcs = ["src/**/*.rs"] 10 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/trybuild/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = true 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/typenum/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = true 9 | features = ["force_unix_path_separator"] 10 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/unicase/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/winapi-x86_64-pc-windows-gnu/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | 10 | [['cfg(target_os = "windows")'.prebuilt_cxx_library]] 11 | name = "extra_libraries" 12 | # The static_libs this crate provides overlaps quite heavily with those in a default 13 | # MinGW install, and there are also many that are DirectX specific. 14 | # We list only those we actually need, since the others are more likely to cause problems. 15 | static_libs = ["lib/libwinapi_ole32.a", "lib/libwinapi_shell32.a"] 16 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/windows-targets/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | ['cfg(any(target_os = "windows", target_os = "linux"))'] 9 | version = ">=0.48.0" 10 | cfgs = ["windows_raw_dylib"] 11 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/windows_aarch64_gnullvm/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | 10 | ['cfg(all(target_os = "linux", target_arch = "aarch64"))'] 11 | version = "=0.48.0" 12 | [['cfg(all(target_os = "linux", target_arch = "aarch64"))'.prebuilt_cxx_library]] 13 | name = "libwindows" 14 | static_libs = ["lib/libwindows.0.48.0.a"] 15 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/windows_x86_64_gnu/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | 10 | ['cfg(all(target_os = "windows", target_env = "gnu"))'] 11 | version = "=0.48.0" 12 | [['cfg(all(target_os = "windows", target_env = "gnu"))'.prebuilt_cxx_library]] 13 | name = "libwindows" 14 | static_libs = ["lib/libwindows.0.48.0.a"] 15 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/windows_x86_64_gnullvm/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | 10 | ['cfg(all(target_os = "linux", target_arch = "x86_64"))'] 11 | version = "=0.48.0" 12 | [['cfg(all(target_os = "linux", target_arch = "x86_64"))'.prebuilt_cxx_library]] 13 | name = "libwindows" 14 | static_libs = ["lib/libwindows.0.48.0.a"] 15 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/windows_x86_64_msvc/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | 10 | ['cfg(all(target_os = "windows", target_env = "msvc"))'] 11 | version = "=0.48.0" 12 | [['cfg(all(target_os = "windows", target_env = "msvc"))'.prebuilt_cxx_library]] 13 | name = "windows" 14 | static_libs = ["lib/windows.0.48.0.lib"] 15 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/winreg/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/zerocopy/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | cargo_env = true 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/fixups/zstd-safe/fixups.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | buildscript.run = false 9 | -------------------------------------------------------------------------------- /shim/third-party/rust/reindeer.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | # Configuration for Reindeer to generate Buck targets from Cargo.toml 9 | # 10 | # Overview of available options: 11 | # https://github.com/facebookincubator/reindeer/blob/main/example/third-party/reindeer.toml 12 | 13 | # Parse Rust code to work out the precise set of source files for each crate. 14 | precise_srcs = true 15 | 16 | # Include a public top-level target which depends on all other targets. 17 | include_top_level = true 18 | include_workspace_members = true 19 | 20 | [cargo] 21 | # Support Cargo's unstable "artifact dependencies" functionality, RFC 3028. 22 | bindeps = true 23 | 24 | [buck] 25 | # Name of the generated file. 26 | file_name = "BUCK.reindeer" 27 | 28 | # Rules used for various kinds of targets. 29 | rust_library = "cargo.rust_library" 30 | rust_binary = "cargo.rust_binary" 31 | prebuilt_cxx_library = "third_party_rust_prebuilt_cxx_library" 32 | 33 | buckfile_imports = """ 34 | load("@prelude//rust:cargo_buildscript.bzl", "buildscript_run") 35 | load("@prelude//rust:cargo_package.bzl", "cargo") 36 | load("@shim//third-party/macros:rust_third_party.bzl", "third_party_rust_prebuilt_cxx_library") 37 | """ 38 | -------------------------------------------------------------------------------- /shim/third-party/rust/top/main.rs: -------------------------------------------------------------------------------- 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 | #![allow(unused_crate_dependencies)] 7 | 8 | fn main() {} 9 | -------------------------------------------------------------------------------- /shim/third-party/snappy/BUCK: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | load("@//third-party:defs.bzl", "pkgconfig_system_library") 9 | 10 | oncall("open_source") 11 | 12 | pkgconfig_system_library( 13 | name = "snappy", 14 | packages = { 15 | "//os:linux-fedora": ["snappy-devel"], 16 | "//os:linux-ubuntu": ["libsnappy-dev"], 17 | "//os:macos-homebrew": ["snappy"], 18 | }, 19 | pkgconfig_name = "snappy", 20 | ) 21 | -------------------------------------------------------------------------------- /shim/third-party/xz/BUCK: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | load("@//third-party:defs.bzl", "pkgconfig_system_library") 9 | 10 | oncall("open_source") 11 | 12 | pkgconfig_system_library( 13 | name = "lzma", 14 | packages = { 15 | "//os:linux-fedora": ["xz-devel"], 16 | "//os:linux-ubuntu": ["liblz4-dev"], 17 | "//os:macos-homebrew": ["liblzma"], 18 | }, 19 | pkgconfig_name = "liblzma", 20 | ) 21 | -------------------------------------------------------------------------------- /shim/third-party/zlib/BUCK: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | load("@//third-party:defs.bzl", "pkgconfig_system_library") 9 | 10 | oncall("open_source") 11 | 12 | pkgconfig_system_library( 13 | name = "z", 14 | packages = { 15 | "//os:linux-fedora": ["zlib-devel"], 16 | "//os:linux-ubuntu": ["zlib1g"], 17 | "//os:macos-homebrew": ["zlib"], 18 | }, 19 | pkgconfig_name = "zlib", 20 | ) 21 | -------------------------------------------------------------------------------- /shim/third-party/zstd/BUCK: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | load("@//third-party:defs.bzl", "pkgconfig_system_library") 9 | 10 | oncall("open_source") 11 | 12 | pkgconfig_system_library( 13 | name = "zstd", 14 | packages = { 15 | "//os:linux-fedora": ["libzstd-devel"], 16 | "//os:linux-ubuntu": ["libzstd-dev"], 17 | "//os:macos-homebrew": ["zstd"], 18 | }, 19 | pkgconfig_name = "libzstd", 20 | ) 21 | -------------------------------------------------------------------------------- /shim/tools/build_defs/audit_dependencies_test.bzl: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | # Noop in OSS 9 | def audit_dependencies_test(**_kwargs): 10 | pass 11 | -------------------------------------------------------------------------------- /shim/tools/build_defs/buck2/is_buck2.bzl: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | def is_buck2(): 9 | return True 10 | -------------------------------------------------------------------------------- /shim/tools/build_defs/buckconfig.bzl: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | load("@prelude//utils:buckconfig.bzl", _read = "read", _read_bool = "read_bool", _read_choice = "read_choice", _read_int = "read_int", _read_list = "read_list", _read_string = "read_string", _resolve_alias = "resolve_alias") 9 | 10 | read = _read 11 | read_string = _read_string 12 | read_choice = _read_choice 13 | read_bool = _read_bool 14 | read_int = _read_int 15 | read_list = _read_list 16 | resolve_alias = _resolve_alias 17 | -------------------------------------------------------------------------------- /shim/tools/build_defs/default_platform_defs.bzl: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | DEVSERVER_PLATFORM_REGEX = "UNUSED" 9 | -------------------------------------------------------------------------------- /shim/tools/build_defs/fb_native_wrapper.bzl: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | fb_native = native 9 | -------------------------------------------------------------------------------- /shim/tools/build_defs/glob_defs.bzl: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | glob = native.glob 9 | -------------------------------------------------------------------------------- /shim/tools/target_determinator/macros/ci.bzl: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # 3 | # This source code is licensed under both the MIT license found in the 4 | # LICENSE-MIT file in the root directory of this source tree and the Apache 5 | # License, Version 2.0 found in the LICENSE-APACHE file in the root directory 6 | # of this source tree. 7 | 8 | # https://internalfb.com/code/fbsource/fbcode/target_determinator/macros/README.md 9 | 10 | def _lbl(*_args): 11 | return "" 12 | 13 | def _package( 14 | _values, 15 | # starlark-lint-disable unused-argument 16 | overwrite = False): # @unused 17 | pass 18 | 19 | def _labels(*args): 20 | return [] 21 | 22 | ci = struct( 23 | package = _package, 24 | linux = _lbl, 25 | mac = _lbl, 26 | windows = _lbl, 27 | skip_test = _lbl, 28 | aarch64 = _lbl, 29 | mode = _lbl, 30 | opt = _lbl, 31 | labels = _labels, 32 | ) 33 | -------------------------------------------------------------------------------- /signed_source/BUCK: -------------------------------------------------------------------------------- 1 | load("@fbcode//common/ocaml/interop:defs.bzl", "RUST_FLAGS_2018") 2 | load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") 3 | 4 | oncall("hack") 5 | 6 | rust_library( 7 | name = "signed_source", 8 | srcs = ["signed_source.rs"], 9 | autocargo = { 10 | "cargo_target_config": { 11 | "doctest": False, 12 | }, 13 | }, 14 | rustc_flags = RUST_FLAGS_2018, 15 | deps = [ 16 | "fbsource//third-party/rust:bstr", 17 | "fbsource//third-party/rust:hex", 18 | "fbsource//third-party/rust:md-5", 19 | "fbsource//third-party/rust:once_cell", 20 | "fbsource//third-party/rust:regex", 21 | "fbsource//third-party/rust:thiserror", 22 | ], 23 | ) 24 | -------------------------------------------------------------------------------- /signed_source/Cargo.toml: -------------------------------------------------------------------------------- 1 | # @generated by autocargo from //common/ocaml/interop/signed_source:signed_source 2 | 3 | [package] 4 | name = "signed_source" 5 | version = "0.1.0" 6 | authors = ["Shayne Fletcher ", "Jake Bailey ", "Vincent Siles ", "Meta"] 7 | edition = "2024" 8 | readme = "../README.md" 9 | repository = "https://github.com/facebook/ocamlrep" 10 | license = "MIT" 11 | 12 | [lib] 13 | path = "signed_source.rs" 14 | doctest = false 15 | 16 | [dependencies] 17 | bstr = { version = "1.10.0", features = ["serde", "std", "unicode"] } 18 | hex = { version = "0.4.3", features = ["alloc"] } 19 | md-5 = "0.10" 20 | once_cell = "1.12" 21 | regex = "1.11.1" 22 | thiserror = "2.0.12" 23 | --------------------------------------------------------------------------------