Skip to content

Commit d85adfd

Browse files
authored
initial public import (#1)
Signed-off-by: Matt Klein <[email protected]>
1 parent 90980fb commit d85adfd

File tree

659 files changed

+70173
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

659 files changed

+70173
-2
lines changed

.bazelproject

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import examples/android/.bazelproject
2+
3+
android_sdk_platform: android-33

.bazelrc

+150
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
common --experimental_allow_tags_propagation
2+
3+
mobile-install --config=android
4+
5+
build --enable_platform_specific_config
6+
# https://github.com/bazelbuild/bazel/issues/18958
7+
build --noenable_bzlmod
8+
build:macos --apple_crosstool_top=@local_config_apple_cc//:toolchain
9+
build:macos --crosstool_top=@local_config_apple_cc//:toolchain
10+
build:macos --host_crosstool_top=@local_config_apple_cc//:toolchain
11+
12+
# We need access to ld in order to build libunwind on Linux
13+
build:libunwind --action_env=PATH=/usr/bin
14+
15+
build --action_env=CC --host_action_env=CC
16+
build --action_env=CXX --host_action_env=CXX
17+
build --action_env=LLVM_CONFIG --host_action_env=LLVM_CONFIG
18+
build --action_env=PATH --host_action_env=PATH
19+
20+
build --features=debug_prefix_map_pwd_is_dot
21+
build --features=oso_prefix_is_pwd
22+
build --features=relative_ast_path
23+
build --features=remap_xcode_path
24+
build --features=swift.cacheable_swiftmodules
25+
build --features=swift.coverage_prefix_map
26+
build --features=swift.opt_uses_osize
27+
build --features=swift.opt_uses_wmo
28+
build --features=swift.remap_xcode_path
29+
build --features=swift.use_global_module_cache
30+
31+
# Gate the references to androidndk behind a flag to support building on arm linux.
32+
build:android --android_crosstool_top=@androidndk//:toolchain
33+
build:android --extra_toolchains=@androidndk//...
34+
build --platform_mappings=bazel/platform_mappings
35+
36+
build --@rules_rust//:rustfmt.toml=//:rustfmt.toml
37+
build --@rules_rust//:clippy.toml=//:.clippy.toml
38+
39+
build --macos_minimum_os=12.5
40+
build --host_macos_minimum_os=12.5
41+
42+
build --ios_minimum_os=12.0
43+
build --ios_simulator_device="iPhone 13"
44+
build --ios_simulator_version=17.5
45+
build --xcode_version=15.4
46+
47+
build:clippy --aspects=@rules_rust//rust:defs.bzl%rust_clippy_aspect
48+
build:clippy --output_groups=+clippy_checks
49+
50+
build:compdb --build_tag_filters=-nocompdb,-clippy_checks,-macos_only
51+
build:compdb --config=noclippy
52+
53+
build:noclippy --output_groups=-clippy_checks
54+
55+
test --test_env=RUST_BACKTRACE=full
56+
57+
# Shared configuration for all CI tasks.
58+
build:ci --config=clippy
59+
build:ci --swiftcopt=-warnings-as-errors
60+
61+
# Common debug configuration for iOS/Android. Used when building examples apps.
62+
build:dbg-common --compilation_mode=opt
63+
build:dbg-common --config=abort-panic
64+
65+
build:dbg-ios --config=dbg-common
66+
67+
# Ensure that the output of the `ios_static_framework` rule is a zip as opposed to an unzipped
68+
# framework. Without this, the output of `ios_static_framework` is a zip when invoked with the use of
69+
# command line tool and an unzipped framework when invoked with the use of Xcode UI.
70+
# Ideally we should allow for an unzipped output of `ios_static_framework` so that we can avoid having
71+
# to zip/unzip framework when building it but for simplicity purposes, we force the output to be always
72+
# zipped.
73+
build:rules_xcodeproj --config=dbg-ios
74+
build:rules_xcodeproj --define=apple.experimental.tree_artifact_outputs=0
75+
76+
# Common release configuration for iOS/Android
77+
# TODO(mattklein123): Should we be compiling the rust code size optimized?
78+
build:release-common --compilation_mode=opt
79+
# TODO(mattklein123): This doesn't work for whatever reason when building tests, but we should be
80+
# running tests with release settings.
81+
build:release-common --config=abort-panic
82+
83+
# Size optimizations, codegen-units=1 go along side LTO, which accounts for
84+
# about 10% reduction; -z has a non-zero smaller impact (a few pp).
85+
build:release-common --@rules_rust//:extra_rustc_flag='-Ccodegen-units=1'
86+
build:release-common --@rules_rust//:extra_rustc_flag='-Clto=fat'
87+
build:release-common --@rules_rust//:extra_rustc_flag='-Copt-level=s'
88+
89+
build:release-android --define android_strip_symbols=true
90+
build:release-android --fat_apk_cpu=x86,x86_64,armeabi-v7a,arm64-v8a
91+
build:release-android --config=release-common
92+
build:release-android --copt=-flto=thin --linkopt=-flto=thin
93+
build:release-android --config=android
94+
# TODO(snowp): Enable relr once we no longer need to support Android 8. The system linker is not
95+
# able to understand RELR relocations, see https://bugs.chromium.org/p/chromium/issues/detail?id=900049.
96+
# Enabling relr provides a small binary size decrease.
97+
# build:release-android --linkopt=-Wl,--pack-dyn-relocs=relr
98+
# build:release-android --linkopt=-Wl,--use-android-relr-tags
99+
100+
# Custom iOS release configuration
101+
build:release-ios --config=release-common
102+
103+
# Allows disabling the cache for cases where the cache might be slow, e.g. slow networks.
104+
build:nocache --remote_accept_cached=false
105+
build:nocache --noremote_upload_local_results
106+
build:nocache --bes_results_url=
107+
build:nocache --bes_backend=
108+
build:nocache --remote_cache=
109+
110+
# Convenience config for disabling targets that build on macos only (e.g. iOS targets).
111+
build:nomacos --test_tag_filters=-macos_only --build_tag_filters=-macos_only
112+
113+
# We run this with release-common to be as indicative of production as possible, and add in as much debug information we
114+
# can to allow using perf to generate flamegraphs.
115+
build:benchmark --config=release-common
116+
build:benchmark-profile --config=benchmark --@rules_rust//:extra_rustc_flag='-Cdebuginfo=2' --force_pic
117+
118+
# Specifies that panics should automatically be treated as a panic.
119+
build:abort-panic --@rules_rust//:extra_rustc_flag=-C
120+
build:abort-panic --@rules_rust//:extra_rustc_flag=panic=abort
121+
122+
# This attempts to match what cargo-fuzz does, but it's likely a moving target with many options.
123+
# Occasionally check back to see if anything has changed over there.
124+
# https://github.com/rust-fuzz/cargo-fuzz/blob/fa18f0d77aef036302d9f948e80aa12c6b95d57b/src/project.rs#L163
125+
build:fuzz --config=release-common
126+
build:fuzz --@rules_rust//:extra_rustc_flag=-Cpasses=sancov-module
127+
build:fuzz --@rules_rust//:extra_rustc_flag=-Cllvm-args=-sanitizer-coverage-level=4
128+
build:fuzz --@rules_rust//:extra_rustc_flag=-Cllvm-args=-sanitizer-coverage-inline-8bit-counters
129+
build:fuzz --@rules_rust//:extra_rustc_flag=-Cllvm-args=-sanitizer-coverage-pc-table
130+
build:fuzz --@rules_rust//:extra_rustc_flag=-Cllvm-args=-sanitizer-coverage-trace-compares
131+
build:fuzz --@rules_rust//:extra_rustc_flag=-Cllvm-args=-sanitizer-coverage-stack-depth
132+
build:fuzz --@rules_rust//:extra_rustc_flag=-Zsanitizer=address
133+
build:fuzz --@rules_rust//:extra_rustc_flag=--cfg=fuzzing
134+
build:fuzz --@rules_rust//rust/toolchain/channel=nightly
135+
136+
build:fake-nightly --action_env=RUSTC_BOOTSTRAP=1
137+
138+
# Enables TSAN for all targets. This does not currently work when targeting platforms where TSAN is not enabled in the Rust toolchain (e.g. ios-sim).
139+
build:tsan --config=fake-nightly
140+
build:tsan --features=tsan
141+
build:tsan --@rules_rust//:extra_rustc_flag=-Zsanitizer=thread
142+
143+
# Enables using TSAN with iOS tests. This does not enable tsan in Rust and may therefore result in false positivies.
144+
build:ios-tsan --features=tsan
145+
146+
build:asan --config=fake-nightly
147+
build:asan --features=address
148+
build:tsan --@rules_rust//:extra_rustc_flag=-Zsanitizer=address
149+
150+
try-import %workspace%/tmp/ci-bazelrc

.bazelversion

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
7.0.0-pre.20231018.3

.cargo/config.toml

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
########################################
2+
# Optimization / Compile Configuration #
3+
########################################
4+
5+
[target.'cfg(target_vendor="apple")']
6+
rustflags = ["-Csplit-debuginfo=unpacked"]
7+
8+
[target.x86_64-unknown-linux-gnu]
9+
rustflags = ["-C", "link-arg=-fuse-ld=lld"]
10+
11+
#####################################
12+
# Warnings and Linter Configuration #
13+
#####################################
14+
# This is a hack to work around the fact that neither rustc, cargo, nor clippy
15+
# allows globally configuring lints. To avoid having to copy a massive block of
16+
# allow/warn/deny statements to the top of every file, we configure them as
17+
# all-profile compiler flags here.
18+
[target.'cfg(all())']
19+
rustflags = [
20+
"-Dwarnings",
21+
"-Dfuture-incompatible",
22+
"-Dnonstandard-style",
23+
"-Drust-2018-compatibility",
24+
"-Drust-2018-idioms",
25+
"-Drust-2021-compatibility",
26+
"-Dunused",
27+
"-Dclippy::all",
28+
"-Dclippy::correctness",
29+
"-Dclippy::suspicious",
30+
"-Dclippy::style",
31+
"-Dclippy::complexity",
32+
"-Dclippy::perf",
33+
"-Dclippy::pedantic",
34+
"-Dclippy::nursery",
35+
36+
# The following produces very annoying error lines over entire async functions when there
37+
# are compile errors. Trying enabling this again later.
38+
"-Arust_2021_incompatible_closure_captures",
39+
40+
"-Aclippy::future-not-send",
41+
"-Aclippy::missing-errors-doc",
42+
"-Aclippy::missing-panics-doc",
43+
"-Aclippy::similar-names",
44+
"-Aclippy::too-many-arguments",
45+
"-Aclippy::too-many-lines",
46+
"-Aclippy::unnecessary-wraps",
47+
"-Aclippy::unused-async",
48+
49+
# Appears spurious on 1.62. Try to remove later.
50+
"-Aclippy::redundant-pub-crate",
51+
"-Aclippy::significant_drop_tightening",
52+
"-Aclippy::significant_drop_in_scrutinee",
53+
54+
# ProtoHashWrapper causes this to trigger due to the mutable cached size within the message.
55+
# The cache sized field is correctly handled but there doesn't seem to be a way to turn this
56+
# off for a type.
57+
"-Aclippy::mutable-key-type",
58+
]
59+
60+
# Fetch internal repos via git
61+
[net]
62+
git-fetch-with-cli = true
63+
64+
# Make sure we don't compile protoc
65+
[env]
66+
PROTOC_NO_VENDOR = "true"

.clang-format

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
Language: Cpp
3+
AccessModifierOffset: -2
4+
ColumnLimit: 100
5+
DerivePointerAlignment: false
6+
PointerAlignment: Left
7+
SortIncludes: false
8+
...
9+
10+
---
11+
Language: Java
12+
AccessModifierOffset: -2
13+
ColumnLimit: 100
14+
DerivePointerAlignment: false
15+
IndentWidth: 2
16+
PointerAlignment: Left
17+
SortIncludes: false
18+
...
19+
20+
---
21+
Language: ObjC
22+
AccessModifierOffset: -2
23+
ColumnLimit: 100
24+
DerivePointerAlignment: false
25+
IndentWidth: 2
26+
ObjCBlockIndentWidth: 2
27+
ObjCSpaceAfterProperty: true
28+
ObjCSpaceBeforeProtocolList: true
29+
PointerAlignment: Right
30+
SortIncludes: false
31+
...
32+
33+
---
34+
Language: Proto
35+
ColumnLimit: 100
36+
SpacesInContainerLiterals: false
37+
AllowShortFunctionsOnASingleLine: false
38+
...

.clippy.toml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
doc-valid-idents = ["gRPC", ".."]

.devcontainer/Dockerfile

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.234.0/containers/rust/.devcontainer/base.Dockerfile
2+
3+
# [Choice] Debian OS version (use bullseye on local arm64/Apple Silicon): buster, bullseye
4+
ARG VARIANT="buster"
5+
FROM mcr.microsoft.com/vscode/devcontainers/rust:0-${VARIANT}
6+
7+
# [Optional] Uncomment this section to install additional packages.
8+
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
9+
&& apt-get -y install --no-install-recommends clang

.devcontainer/devcontainer.json

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
2+
// https://github.com/microsoft/vscode-dev-containers/tree/v0.234.0/containers/rust
3+
{
4+
"name": "loop-sdk-dev",
5+
"build": {
6+
"dockerfile": "Dockerfile",
7+
"args": {
8+
// Use the VARIANT arg to pick a Debian OS version: buster, bullseye
9+
// Use bullseye when on local on arm64/Apple Silicon.
10+
// We use buster since the tooling situation for aarch64 linux is not so great.
11+
"VARIANT": "buster"
12+
}
13+
},
14+
"runArgs": [
15+
"--cap-add=SYS_PTRACE",
16+
"--security-opt",
17+
"seccomp=unconfined"
18+
],
19+
"remoteEnv": {
20+
"CC": "/usr/bin/clang",
21+
"CXX": "/usr/bin/clang++"
22+
},
23+
24+
// Set *default* container specific settings.json values on container create.
25+
"settings": {
26+
"lldb.executable": "/usr/bin/lldb",
27+
// VS Code don't watch files under ./target
28+
"files.watcherExclude": {
29+
"**/target/**": true
30+
},
31+
"rust-analyzer.checkOnSave.command": "clippy"
32+
},
33+
34+
// Add the IDs of extensions you want installed when the container is created.
35+
"extensions": [
36+
"vadimcn.vscode-lldb",
37+
"mutantdino.resourcemonitor",
38+
"matklad.rust-analyzer",
39+
"tamasfe.even-better-toml",
40+
"serayuzgur.crates"
41+
],
42+
43+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
44+
// "forwardPorts": [],
45+
46+
// Use 'postCreateCommand' to run commands after the container is created.
47+
// "postCreateCommand": "rustc --version",
48+
49+
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
50+
"remoteUser": "vscode"
51+
}

.drstring.toml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
align-after-colon = ["throws", "returns", "parameters"]
2+
column-limit = 110
3+
empty-patterns = true
4+
first-letter = "lowercase"
5+
ignore-throws = true
6+
include = ["platform/swift/**.swift", "test/platform/swift/**.swift", "examples/swift/**.swift"]
7+
needs-separation = ["description", "parameters"]
8+
parameter-style = "separate"
9+
vertical-align = true

.gitattributes

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Cargo.lock linguist-generated=true merge=binary
2+
Cargo.Bazel.lock linguist-generated=true merge=binary
3+
cargo-bazel-lock.json linguist-generated=true merge=binary
4+

0 commit comments

Comments
 (0)