diff --git a/.bin/rust-1.87.0/cargo-xcode/=1.7.0/bin/cargo-xcode b/.bin/rust-1.87.0/cargo-xcode/=1.7.0/bin/cargo-xcode new file mode 100755 index 0000000..bd50654 Binary files /dev/null and b/.bin/rust-1.87.0/cargo-xcode/=1.7.0/bin/cargo-xcode differ diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..cd923ac --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,2 @@ +[alias] +xcode = ["bin", "cargo-xcode"] diff --git a/.gitignore b/.gitignore index b83d222..8386733 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /target/ +/shared_types/generated/ diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..c9fedaa --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,1414 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "anstyle" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "862ed96ca487e809f1c8e5a8447f6ee2cf102f846893800b20cebdf541fc6bbd" + +[[package]] +name = "anyhow" +version = "1.0.98" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487" + +[[package]] +name = "askama" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d4744ed2eef2645831b441d8f5459689ade2ab27c854488fbab1fbe94fce1a7" +dependencies = [ + "askama_derive", + "itoa", + "percent-encoding", + "serde", + "serde_json", +] + +[[package]] +name = "askama_derive" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d661e0f57be36a5c14c48f78d09011e67e0cb618f269cca9f2fd8d15b68c46ac" +dependencies = [ + "askama_parser", + "basic-toml", + "memchr", + "proc-macro2", + "quote", + "rustc-hash", + "serde", + "serde_derive", + "syn 2.0.104", +] + +[[package]] +name = "askama_parser" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf315ce6524c857bb129ff794935cf6d42c82a6cff60526fe2a63593de4d0d4f" +dependencies = [ + "memchr", + "serde", + "serde_derive", + "winnow", +] + +[[package]] +name = "audio_always_works" +version = "0.1.0" + +[[package]] +name = "autocfg" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" + +[[package]] +name = "basic-toml" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba62675e8242a4c4e806d12f11d136e626e6c8361d6b829310732241652a178a" +dependencies = [ + "serde", +] + +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + +[[package]] +name = "bitflags" +version = "2.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" + +[[package]] +name = "bumpalo" +version = "3.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" + +[[package]] +name = "bytes" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" + +[[package]] +name = "camino" +version = "1.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0da45bc31171d8d6960122e222a67740df867c1dd53b4d51caa297084c185cab" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo-platform" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e35af189006b9c0f00a064685c727031e3ed2d8020f7ba284d78cc2671bd36ea" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo_metadata" +version = "0.19.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd5eb614ed4c27c5d706420e4320fbe3216ab31fa1c33cd8246ac36dae4479ba" +dependencies = [ + "camino", + "cargo-platform", + "semver", + "serde", + "serde_json", + "thiserror 2.0.12", +] + +[[package]] +name = "cfg-if" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268" + +[[package]] +name = "clap" +version = "4.5.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40b6887a1d8685cebccf115538db5c0efe625ccac9696ad45c409d96566e910f" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.5.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0c66c08ce9f0c698cbce5c0279d0bb6ac936d8674174fe48f736533b964f59e" +dependencies = [ + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.5.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2c7947ae4cc3d851207c1adb5b5e260ff0cca11446b1d6d1423788e442257ce" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote", + "syn 2.0.104", +] + +[[package]] +name = "clap_lex" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675" + +[[package]] +name = "crossbeam-channel" +version = "0.5.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82b8f8f868b36967f9606790d1903570de9ceaf870a7bf9fbbd3016d636a2cb2" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[package]] +name = "crux_core" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9f441b75719317153815f1dc93d1fc62380c02e065fa741ab87b709326f415e" +dependencies = [ + "anyhow", + "bincode", + "crossbeam-channel", + "crux_macros", + "erased-serde", + "futures", + "serde", + "serde-generate", + "serde-reflection", + "serde_json", + "slab", + "thiserror 2.0.12", + "uniffi", + "wasm-bindgen", +] + +[[package]] +name = "crux_macros" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63cad109422caffcad1b8ab36c095a5caa332ffc2d8ad4d477af6fc2b621cd75" +dependencies = [ + "darling", + "heck 0.5.0", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 2.0.104", +] + +[[package]] +name = "darling" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.104", +] + +[[package]] +name = "darling_macro" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" +dependencies = [ + "darling_core", + "quote", + "syn 2.0.104", +] + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "erased-serde" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e004d887f51fcb9fef17317a2f3525c887d8aa3f4f50fed920816a688284a5b7" +dependencies = [ + "serde", + "typeid", +] + +[[package]] +name = "errno" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "778e2ac28f6c47af28e4907f13ffd1e1ddbd400980a9abd7c8df189bf578a5ad" +dependencies = [ + "libc", + "windows-sys 0.60.2", +] + +[[package]] +name = "fastrand" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "fs-err" +version = "2.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88a41f105fe1d5b6b34b2055e3dc59bb79b46b48b2040b9e6c7b4b5de097aa41" +dependencies = [ + "autocfg", +] + +[[package]] +name = "futures" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" + +[[package]] +name = "futures-executor" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" + +[[package]] +name = "futures-macro" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.104", +] + +[[package]] +name = "futures-sink" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" + +[[package]] +name = "futures-task" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" + +[[package]] +name = "futures-util" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "getrandom" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.11.1+wasi-snapshot-preview1", +] + +[[package]] +name = "getrandom" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" +dependencies = [ + "cfg-if", + "libc", + "r-efi", + "wasi 0.14.2+wasi-0.2.4", +] + +[[package]] +name = "glob" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" + +[[package]] +name = "goblin" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b363a30c165f666402fe6a3024d3bec7ebc898f96a4a23bd1c99f8dbf3f4f47" +dependencies = [ + "log", + "plain", + "scroll", +] + +[[package]] +name = "hashbrown" +version = "0.15.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5971ac85611da7067dbfcabef3c70ebb5606018acd9e2a3903a0da507521e0d5" + +[[package]] +name = "heck" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "include_dir" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24b56e147e6187d61e9d0f039f10e070d0c0a887e24fe0bb9ca3f29bfde62cab" +dependencies = [ + "glob", + "include_dir_impl", + "proc-macro-hack", +] + +[[package]] +name = "include_dir_impl" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a0c890c85da4bab7bce4204c707396bbd3c6c8a681716a51c8814cfc2b682df" +dependencies = [ + "anyhow", + "proc-macro-hack", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "indexmap" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe4cd85333e22411419a0bcae1297d25e58c9443848b11dc6a86fefe8c78a661" +dependencies = [ + "equivalent", + "hashbrown", +] + +[[package]] +name = "itoa" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" + +[[package]] +name = "libc" +version = "0.2.174" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776" + +[[package]] +name = "linux-raw-sys" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12" + +[[package]] +name = "log" +version = "0.4.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" + +[[package]] +name = "memchr" +version = "2.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "once_cell" +version = "1.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" + +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "phf" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fabbf1ead8a5bcbc20f5f8b939ee3f5b0f6f281b6ad3468b84656b658b455259" +dependencies = [ + "phf_macros", + "phf_shared", + "proc-macro-hack", +] + +[[package]] +name = "phf_generator" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d5285893bb5eb82e6aaf5d59ee909a06a16737a8970984dd7746ba9283498d6" +dependencies = [ + "phf_shared", + "rand", +] + +[[package]] +name = "phf_macros" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58fdf3184dd560f160dd73922bea2d5cd6e8f064bf4b13110abd81b03697b4e0" +dependencies = [ + "phf_generator", + "phf_shared", + "proc-macro-hack", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "phf_shared" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" +dependencies = [ + "siphasher", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "plain" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn 1.0.109", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + +[[package]] +name = "proc-macro-hack" +version = "0.5.20+deprecated" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" + +[[package]] +name = "proc-macro2" +version = "1.0.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.16", +] + +[[package]] +name = "rustc-hash" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" + +[[package]] +name = "rustix" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c71e83d6afe7ff64890ec6b71d6a69bb8a610ab78ce364b3352876bb4c801266" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.59.0", +] + +[[package]] +name = "rustversion" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a0d197bd2c9dc6e53b84da9556a69ba4cdfab8619eb41a8bd1cc2027a0f6b1d" + +[[package]] +name = "ryu" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" + +[[package]] +name = "scroll" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ab8598aa408498679922eff7fa985c25d58a90771bd6be794434c5277eab1a6" +dependencies = [ + "scroll_derive", +] + +[[package]] +name = "scroll_derive" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1783eabc414609e28a5ba76aee5ddd52199f7107a0b24c2e9746a1ecc34a683d" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.104", +] + +[[package]] +name = "semver" +version = "1.0.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0" +dependencies = [ + "serde", +] + +[[package]] +name = "serde" +version = "1.0.219" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde-generate" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8309fc8d475cf5884e92a463b3a003d433684335be19c3f739af0451b027254b" +dependencies = [ + "heck 0.3.3", + "include_dir", + "phf", + "serde", + "serde-reflection", + "textwrap 0.13.4", +] + +[[package]] +name = "serde-reflection" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b6798a64289ff550d8d79847467789a5fd30b42c9c406a4d6dc0bc9b567e55c" +dependencies = [ + "once_cell", + "serde", + "thiserror 1.0.69", +] + +[[package]] +name = "serde_derive" +version = "1.0.219" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.104", +] + +[[package]] +name = "serde_json" +version = "1.0.140" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", +] + +[[package]] +name = "shared" +version = "0.1.0" +dependencies = [ + "crux_core", + "serde", + "uniffi", + "wasm-bindgen", +] + +[[package]] +name = "shared_types" +version = "0.1.0" +dependencies = [ + "anyhow", + "crux_core", + "shared", +] + +[[package]] +name = "siphasher" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" + +[[package]] +name = "slab" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04dc19736151f35336d325007ac991178d504a119863a2fcb3758cdb5e52c50d" + +[[package]] +name = "smawk" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c" + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "tempfile" +version = "3.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8a64e3985349f2441a1a9ef0b853f869006c3855f2cda6862a94d26ebb9d6a1" +dependencies = [ + "fastrand", + "getrandom 0.3.3", + "once_cell", + "rustix", + "windows-sys 0.59.0", +] + +[[package]] +name = "textwrap" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd05616119e612a8041ef58f2b578906cc2531a6069047ae092cfb86a325d835" +dependencies = [ + "smawk", + "unicode-width", +] + +[[package]] +name = "textwrap" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c13547615a44dc9c452a8a534638acdf07120d4b6847c8178705da06306a3057" +dependencies = [ + "smawk", +] + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" +dependencies = [ + "thiserror-impl 2.0.12", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.104", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.104", +] + +[[package]] +name = "toml" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" +dependencies = [ + "serde", +] + +[[package]] +name = "typeid" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc7d623258602320d5c55d1bc22793b57daff0ec7efc270ea7d55ce1d5f5471c" + +[[package]] +name = "unicode-ident" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" + +[[package]] +name = "unicode-segmentation" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" + +[[package]] +name = "unicode-width" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" + +[[package]] +name = "uniffi" +version = "0.29.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b334fd69b3cf198b63616c096aabf9820ab21ed9b2aa1367ddd4b411068bf520" +dependencies = [ + "anyhow", + "camino", + "cargo_metadata", + "clap", + "uniffi_bindgen", + "uniffi_build", + "uniffi_core", + "uniffi_macros", + "uniffi_pipeline", +] + +[[package]] +name = "uniffi_bindgen" +version = "0.29.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ff0132b533483cf19abb30bba5c72c24d9f3e4d9a2ff71cb3e22e73899fd46e" +dependencies = [ + "anyhow", + "askama", + "camino", + "cargo_metadata", + "fs-err", + "glob", + "goblin", + "heck 0.5.0", + "indexmap", + "once_cell", + "serde", + "tempfile", + "textwrap 0.16.2", + "toml", + "uniffi_internal_macros", + "uniffi_meta", + "uniffi_pipeline", + "uniffi_udl", +] + +[[package]] +name = "uniffi_build" +version = "0.29.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d84d607076008df3c32dd2100ee4e727269f11d3faa35691af70d144598f666" +dependencies = [ + "anyhow", + "camino", + "uniffi_bindgen", +] + +[[package]] +name = "uniffi_core" +version = "0.29.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53e3b997192dc15ef1778c842001811ec7f241a093a693ac864e1fc938e64fa9" +dependencies = [ + "anyhow", + "bytes", + "once_cell", + "static_assertions", +] + +[[package]] +name = "uniffi_internal_macros" +version = "0.29.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f64bec2f3a33f2f08df8150e67fa45ba59a2ca740bf20c1beb010d4d791f9a1b" +dependencies = [ + "anyhow", + "indexmap", + "proc-macro2", + "quote", + "syn 2.0.104", +] + +[[package]] +name = "uniffi_macros" +version = "0.29.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d8708716d2582e4f3d7e9f320290b5966eb951ca421d7630571183615453efc" +dependencies = [ + "camino", + "fs-err", + "once_cell", + "proc-macro2", + "quote", + "serde", + "syn 2.0.104", + "toml", + "uniffi_meta", +] + +[[package]] +name = "uniffi_meta" +version = "0.29.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d226fc167754ce548c5ece9828c8a06f03bf1eea525d2659ba6bd648bd8e2f3" +dependencies = [ + "anyhow", + "siphasher", + "uniffi_internal_macros", + "uniffi_pipeline", +] + +[[package]] +name = "uniffi_pipeline" +version = "0.29.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b925b6421df15cf4bedee27714022cd9626fb4d7eee0923522a608b274ba4371" +dependencies = [ + "anyhow", + "heck 0.5.0", + "indexmap", + "tempfile", + "uniffi_internal_macros", +] + +[[package]] +name = "uniffi_udl" +version = "0.29.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c42649b721df759d9d4692a376b82b62ce3028ec9fc466f4780fb8cdf728996" +dependencies = [ + "anyhow", + "textwrap 0.16.2", + "uniffi_meta", + "weedle2", +] + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasi" +version = "0.14.2+wasi-0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" +dependencies = [ + "wit-bindgen-rt", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" +dependencies = [ + "bumpalo", + "log", + "proc-macro2", + "quote", + "syn 2.0.104", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.104", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "weedle2" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "998d2c24ec099a87daf9467808859f9d82b61f1d9c9701251aea037f514eae0e" +dependencies = [ + "nom", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" +dependencies = [ + "windows-targets 0.53.2", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm 0.52.6", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows-targets" +version = "0.53.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c66f69fcc9ce11da9966ddb31a40968cad001c5bedeb5c2b82ede4253ab48aef" +dependencies = [ + "windows_aarch64_gnullvm 0.53.0", + "windows_aarch64_msvc 0.53.0", + "windows_i686_gnu 0.53.0", + "windows_i686_gnullvm 0.53.0", + "windows_i686_msvc 0.53.0", + "windows_x86_64_gnu 0.53.0", + "windows_x86_64_gnullvm 0.53.0", + "windows_x86_64_msvc 0.53.0", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnu" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_i686_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" + +[[package]] +name = "winnow" +version = "0.7.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74c7b26e3480b707944fc872477815d29a8e429d2f93a1ce000f5fa84a15cbcd" +dependencies = [ + "memchr", +] + +[[package]] +name = "wit-bindgen-rt" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" +dependencies = [ + "bitflags", +] + +[[package]] +name = "zerocopy" +version = "0.8.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1039dd0d3c310cf05de012d8a39ff557cb0d23087fd44cad61df08fc31907a2f" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ecf5b4cc5364572d7f4c329661bcc82724222973f2cab6f050a4e5c22f75181" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.104", +] diff --git a/Cargo.toml b/Cargo.toml index 4d9dacd..6fc7ec3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,4 +3,21 @@ name = "audio_always_works" version = "0.1.0" edition = "2024" -[dependencies] +[workspace] +members = ["shared", "shared_types"] +resolver = "1" + +[workspace.package] +authors = ["Pascal de Vink"] +edition = "2021" +repository = "https://gitea.home.privatevoid.nl/pascaldevink/audio_always_works" +license = "AGPL-3.0-or-later" +rust-version = "1.80" + +[workspace.dependencies] +anyhow = "1.0.98" +crux_core = "0.15.0" +serde = "1.0.219" + +[workspace.metadata.bin] +cargo-xcode = { version = "=1.7.0" } diff --git a/audio_always_works.xcodeproj/project.pbxproj b/audio_always_works.xcodeproj/project.pbxproj new file mode 100644 index 0000000..ac19226 --- /dev/null +++ b/audio_always_works.xcodeproj/project.pbxproj @@ -0,0 +1,253 @@ +// !$*UTF8*$! +{ + /* generated with cargo-xcode 1.7.0 */ + archiveVersion = 1; + classes = { + }; + objectVersion = 53; + objects = { + +/* Begin PBXBuildFile section */ + CA002181887C121ACC594768 /* Cargo.toml in Sources */ = {isa = PBXBuildFile; fileRef = CAF97371734F3EF4668187A5 /* Cargo.toml */; settings = {COMPILER_FLAGS = "--bin 'audio_always_works'"; }; }; + +/* End PBXBuildFile section */ + +/* Begin PBXBuildRule section */ + CAF47371734FAC6C1400ACA8 /* PBXBuildRule */ = { + isa = PBXBuildRule; + compilerSpec = com.apple.compilers.proxy.script; + dependencyFile = "$(DERIVED_FILE_DIR)/$(CARGO_XCODE_TARGET_ARCH)-$(EXECUTABLE_NAME).d"; + filePatterns = "*/Cargo.toml"; + fileType = pattern.proxy; + inputFiles = ( + ); + isEditable = 0; + name = "Cargo project build"; + outputFiles = ( + "$(OBJECT_FILE_DIR)/$(CARGO_XCODE_TARGET_ARCH)-$(EXECUTABLE_NAME)", + ); + script = "# generated with cargo-xcode 1.7.0\nset -xeu;\nexport PATH=\"$HOME/.cargo/bin:$PATH:/usr/local/bin:/opt/homebrew/bin\";\n\nif [ \"${IS_MACCATALYST-NO}\" = YES ]; then\n CARGO_XCODE_TARGET_OS=ios-macabi\nfi\nCARGO_XCODE_TARGET_TRIPLE=\"${CARGO_XCODE_TARGET_ARCH}-apple-${CARGO_XCODE_TARGET_OS}\"\nif [ \"$CARGO_XCODE_TARGET_OS\" != darwin ]; then\n export PATH=\"${PATH/\\/Contents\\/Developer\\/Toolchains\\/XcodeDefault.xctoolchain\\/usr\\/bin:/xcode-provided-ld-cant-link-lSystem-for-the-host-build-script:}\"\nfi\nif [ \"$CARGO_XCODE_BUILD_PROFILE\" == release ]; then\n OTHER_INPUT_FILE_FLAGS=\"${OTHER_INPUT_FILE_FLAGS} --release\"\nfi\n\nif [ \"$ACTION\" = clean ]; then\n cargo clean --verbose --manifest-path=\"$SCRIPT_INPUT_FILE\" ${OTHER_INPUT_FILE_FLAGS} --target=\"${CARGO_XCODE_TARGET_TRIPLE}\";\n rm -f \"$SCRIPT_OUTPUT_FILE_0\"\n exit 0\nfi\ncargo build --verbose --manifest-path=\"$SCRIPT_INPUT_FILE\" --features=\"${CARGO_XCODE_FEATURES:-}\" ${OTHER_INPUT_FILE_FLAGS} --target=\"${CARGO_XCODE_TARGET_TRIPLE}\" || {\n if command -v rustup &> /dev/null; then\n if ! rustup target list --installed | grep -Eq \"${CARGO_XCODE_TARGET_TRIPLE}\"; then\n echo >&2 \"warning: this build requires rustup toolchain for $CARGO_XCODE_TARGET_TRIPLE, but it isn't installed (will try rustup next)\"\n rustup target add \"${CARGO_XCODE_TARGET_TRIPLE}\" || echo >&2 \"warning: can't install $CARGO_XCODE_TARGET_TRIPLE\"\n fi\n fi\n echo >&2 \"error: cargo build failed\"; exit 1; }\n\n# it's too hard to explain Cargo's actual exe path to Xcode build graph, so hardlink to a known-good path instead\nBUILT_SRC=\"${CARGO_TARGET_DIR}/${CARGO_XCODE_TARGET_TRIPLE}/${CARGO_XCODE_BUILD_PROFILE}/${CARGO_XCODE_CARGO_FILE_NAME}\"\nln -f -- \"$BUILT_SRC\" \"$SCRIPT_OUTPUT_FILE_0\" || { echo >&2 \"can't hardlink $BUILT_SRC to $SCRIPT_OUTPUT_FILE_0\"; exit 1; }\n\n# cargo generates a dep file, but for its own path, so append our rename to it\nDEP_FILE_SRC=\"${CARGO_TARGET_DIR}/${CARGO_XCODE_TARGET_TRIPLE}/${CARGO_XCODE_BUILD_PROFILE}/${CARGO_XCODE_CARGO_DEP_FILE_NAME}\"\nif [ -f \"$DEP_FILE_SRC\" ]; then\n DEP_FILE_DST=\"${DERIVED_FILE_DIR}/${CARGO_XCODE_TARGET_ARCH}-${EXECUTABLE_NAME}.d\"\n cp -f \"$DEP_FILE_SRC\" \"$DEP_FILE_DST\" || { echo >&2 \"can't copy $DEP_FILE_SRC to $DEP_FILE_DST\"; exit 1; }\n\n echo >> \"$DEP_FILE_DST\" \"${SCRIPT_OUTPUT_FILE_0/ /\\\\ /}: ${BUILT_SRC/ /\\\\ /}\"\nfi\n\n# lipo script needs to know all the platform-specific files that have been built\n# archs is in the file name, so that paths don't stay around after archs change\n# must match input for LipoScript\nFILE_LIST=\"${DERIVED_FILE_DIR}/${ARCHS}-${EXECUTABLE_NAME}.xcfilelist\"\ntouch \"$FILE_LIST\"\nif ! grep -Eq \"$SCRIPT_OUTPUT_FILE_0\" \"$FILE_LIST\" ; then\n echo >> \"$FILE_LIST\" \"$SCRIPT_OUTPUT_FILE_0\"\nfi\n\necho \"success: $ACTION of $SCRIPT_OUTPUT_FILE_0 for $CARGO_XCODE_TARGET_TRIPLE\"\n"; + }; +/* End PBXBuildRule section */ + +/* Begin PBXFileReference section */ + CA00E4546D15B49ACB510D63 /* audio_always_works */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = audio_always_works; sourceTree = BUILT_PRODUCTS_DIR; }; + CAF97371734F3EF4668187A5 /* Cargo.toml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Cargo.toml; sourceTree = ""; }; + +/* End PBXFileReference section */ + +/* Begin PBXGroup section */ + CAF07371734FD65BC3C892A8 = { + isa = PBXGroup; + children = ( + CAF97371734F3EF4668187A5 /* Cargo.toml */, + CAF17371734F22869D176AE5 /* Products */, + CAF27371734F98AF0B5890DB /* Frameworks */, + ); + sourceTree = ""; + }; + CAF17371734F22869D176AE5 /* Products */ = { + isa = PBXGroup; + children = ( + CA00E4546D15B49ACB510D63 /* audio_always_works */, + ); + name = Products; + sourceTree = ""; + }; + CAF27371734F98AF0B5890DB /* Frameworks */ = { + isa = PBXGroup; + children = ( + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + CA00E4546D15121ACC594768 /* audio_always_works-bin */ = { + isa = PBXNativeTarget; + buildConfigurationList = CA001D66D1F3121ACC594768 /* Build configuration list for PBXNativeTarget "audio_always_works-bin" */; + buildPhases = ( + CA0095086913121ACC594768 /* Sources */, + CAF57371734FAF6EBB7F357C /* Universal Binary lipo */, + ); + buildRules = ( + CAF47371734FAC6C1400ACA8 /* PBXBuildRule */, + ); + dependencies = ( + ); + name = "audio_always_works-bin"; + productName = audio_always_works; + productReference = CA00E4546D15B49ACB510D63 /* audio_always_works */; + productType = "com.apple.product-type.tool"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + CAF37371734FE04653AD465F /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 1500; + TargetAttributes = { + CA00E4546D15121ACC594768 = { + CreatedOnToolsVersion = 9.2; + ProvisioningStyle = Automatic; + }; + }; + }; + buildConfigurationList = CAF67371734F80E02D6C7F57 /* Build configuration list for PBXProject "audio_always_works" */; + compatibilityVersion = "Xcode 11.4"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = CAF07371734FD65BC3C892A8; + productRefGroup = CAF17371734F22869D176AE5 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + CA00E4546D15121ACC594768 /* audio_always_works-bin */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXShellScriptBuildPhase section */ + CAF57371734FAF6EBB7F357C /* Universal Binary lipo */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "$(DERIVED_FILE_DIR)/$(ARCHS)-$(EXECUTABLE_NAME).xcfilelist", + ); + name = "Universal Binary lipo"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(TARGET_BUILD_DIR)/$(EXECUTABLE_PATH)", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "# generated with cargo-xcode 1.7.0\nset -eux;\ntr '\\n' '\\0' < \"$DERIVED_FILE_DIR/$ARCHS-$EXECUTABLE_NAME.xcfilelist\" | xargs -0 lipo -create -output \"$TARGET_BUILD_DIR/$EXECUTABLE_PATH\"\nif [ ${LD_DYLIB_INSTALL_NAME:+1} ]; then\n install_name_tool -id \"$LD_DYLIB_INSTALL_NAME\" \"$TARGET_BUILD_DIR/$EXECUTABLE_PATH\"\nfi\n"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + CA0095086913121ACC594768 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + CA002181887C121ACC594768 /* Cargo.toml in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + CA0050355DF4121ACC594768 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CARGO_XCODE_CARGO_DEP_FILE_NAME = audio_always_works.d; + CARGO_XCODE_CARGO_FILE_NAME = audio_always_works; + + PRODUCT_NAME = audio_always_works; + SUPPORTED_PLATFORMS = macosx; + + }; + name = Release; + }; + CA001D9E89C7121ACC594768 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CARGO_XCODE_CARGO_DEP_FILE_NAME = audio_always_works.d; + CARGO_XCODE_CARGO_FILE_NAME = audio_always_works; + + PRODUCT_NAME = audio_always_works; + SUPPORTED_PLATFORMS = macosx; + + }; + name = Debug; + }; + + CAF7BAE0FD163CC16B37690B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CARGO_TARGET_DIR = "$(PROJECT_TEMP_DIR)/cargo_target"; + CARGO_XCODE_BUILD_PROFILE = release; + CARGO_XCODE_FEATURES = ""; + "CARGO_XCODE_TARGET_ARCH[arch=arm64*]" = aarch64; + "CARGO_XCODE_TARGET_ARCH[arch=i386]" = i686; + "CARGO_XCODE_TARGET_ARCH[arch=x86_64*]" = x86_64; + "CARGO_XCODE_TARGET_OS[sdk=appletvos*]" = tvos; + "CARGO_XCODE_TARGET_OS[sdk=appletvsimulator*]" = tvos; + "CARGO_XCODE_TARGET_OS[sdk=iphoneos*]" = ios; + "CARGO_XCODE_TARGET_OS[sdk=iphonesimulator*]" = "ios-sim"; + "CARGO_XCODE_TARGET_OS[sdk=iphonesimulator*][arch=x86_64*]" = ios; + "CARGO_XCODE_TARGET_OS[sdk=macosx*]" = darwin; + CURRENT_PROJECT_VERSION = 0.1; + MARKETING_VERSION = 0.1.0; + PRODUCT_NAME = audio_always_works; + RUSTUP_TOOLCHAIN = ""; + SDKROOT = macosx; + SUPPORTS_MACCATALYST = YES; + }; + name = Release; + }; + CAF8BAE0FD16228BE02872F8 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CARGO_TARGET_DIR = "$(PROJECT_TEMP_DIR)/cargo_target"; + CARGO_XCODE_BUILD_PROFILE = debug; + CARGO_XCODE_FEATURES = ""; + "CARGO_XCODE_TARGET_ARCH[arch=arm64*]" = aarch64; + "CARGO_XCODE_TARGET_ARCH[arch=i386]" = i686; + "CARGO_XCODE_TARGET_ARCH[arch=x86_64*]" = x86_64; + "CARGO_XCODE_TARGET_OS[sdk=appletvos*]" = tvos; + "CARGO_XCODE_TARGET_OS[sdk=appletvsimulator*]" = tvos; + "CARGO_XCODE_TARGET_OS[sdk=iphoneos*]" = ios; + "CARGO_XCODE_TARGET_OS[sdk=iphonesimulator*]" = "ios-sim"; + "CARGO_XCODE_TARGET_OS[sdk=iphonesimulator*][arch=x86_64*]" = ios; + "CARGO_XCODE_TARGET_OS[sdk=macosx*]" = darwin; + CURRENT_PROJECT_VERSION = 0.1; + MARKETING_VERSION = 0.1.0; + ONLY_ACTIVE_ARCH = YES; + PRODUCT_NAME = audio_always_works; + RUSTUP_TOOLCHAIN = ""; + SDKROOT = macosx; + SUPPORTS_MACCATALYST = YES; + }; + name = Debug; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + CA001D66D1F3121ACC594768 /* Build configuration list for PBXNativeTarget "audio_always_works-bin" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + CA0050355DF4121ACC594768 /* Release */, + CA001D9E89C7121ACC594768 /* Debug */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + + CAF67371734F80E02D6C7F57 /* Build configuration list for PBXProject "audio_always_works" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + CAF7BAE0FD163CC16B37690B /* Release */, + CAF8BAE0FD16228BE02872F8 /* Debug */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = CAF37371734FE04653AD465F /* Project object */; +} diff --git a/audio_always_works.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/audio_always_works.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/audio_always_works.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/audio_always_works.xcodeproj/project.xcworkspace/xcuserdata/pascaldevink.xcuserdatad/UserInterfaceState.xcuserstate b/audio_always_works.xcodeproj/project.xcworkspace/xcuserdata/pascaldevink.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..63996a6 Binary files /dev/null and b/audio_always_works.xcodeproj/project.xcworkspace/xcuserdata/pascaldevink.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/audio_always_works.xcodeproj/xcuserdata/pascaldevink.xcuserdatad/xcschemes/xcschememanagement.plist b/audio_always_works.xcodeproj/xcuserdata/pascaldevink.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..81ca105 --- /dev/null +++ b/audio_always_works.xcodeproj/xcuserdata/pascaldevink.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ + + + + + SchemeUserState + + audio_always_works-bin.xcscheme_^#shared#^_ + + orderHint + 0 + + + + diff --git a/macOS/AudioAlwaysWorks.xcodeproj/project.pbxproj b/macOS/AudioAlwaysWorks.xcodeproj/project.pbxproj new file mode 100644 index 0000000..43bccf8 --- /dev/null +++ b/macOS/AudioAlwaysWorks.xcodeproj/project.pbxproj @@ -0,0 +1,475 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 54; + objects = { + +/* Begin PBXBuildFile section */ + 00E8861E16817C505A2ECDE8 /* libshared_static.a.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E85E5699EC0D4ACC3ECF08C7 /* libshared_static.a.a */; }; + 46FF5D3E091859708BFB695D /* AudioAlwaysWorksApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53B12612A4D67D20B81EB2E /* AudioAlwaysWorksApp.swift */; }; + 7F9D6E2F706B4395EB6601CA /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB4929ACDBDFEE04D6BD1450 /* ContentView.swift */; }; + 959935D0681AECAF2C9D286E /* shared.udl in Sources */ = {isa = PBXBuildFile; fileRef = AC29F76997F3C99B413D302C /* shared.udl */; }; + C81403257A4C05A09F8D4204 /* core.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CE412001E7794AD347EBD19 /* core.swift */; }; + D56F70A0151CDB9B5FFDF152 /* SharedTypes in Frameworks */ = {isa = PBXBuildFile; productRef = 0CC389A097C62FD0236B24A7 /* SharedTypes */; }; + EBABE42AB688D7559072487D /* (null) in Resources */ = {isa = PBXBuildFile; fileRef = 950989282E252A7B9B3FD161; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; +/* End PBXBuildFile section */ + +/* Begin PBXBuildRule section */ + E1379C8142E9E6C9D55EE54C /* PBXBuildRule */ = { + isa = PBXBuildRule; + compilerSpec = com.apple.compilers.proxy.script; + filePatterns = "*.udl"; + fileType = pattern.proxy; + isEditable = 1; + name = "Generate FFI"; + outputFiles = ( + "$(PROJECT_DIR)/generated/$(INPUT_FILE_BASE).swift", + "$(PROJECT_DIR)/generated/$(INPUT_FILE_BASE)FFI.h", + ); + outputFilesCompilerFlags = ( + ); + runOncePerArchitecture = 0; + script = "#!/bin/bash\nset -e\n\n# Skip during indexing phase in XCode 13+\nif [ \"$ACTION\" == \"indexbuild\" ]; then\n echo \"Not building *.udl files during indexing.\"\n exit 0\nfi\n\n# Skip for preview builds\nif [ \"$ENABLE_PREVIEWS\" = \"YES\" ]; then\n echo \"Not building *.udl files during preview builds.\"\n exit 0\nfi\n\ncd \"${INPUT_FILE_DIR}/..\"\n\"${BUILD_DIR}/${CONFIGURATION}/uniffi-bindgen\" generate \"src/${INPUT_FILE_NAME}\" --language swift --out-dir \"${PROJECT_DIR}/generated\"\n"; + }; +/* End PBXBuildRule section */ + +/* Begin PBXContainerItemProxy section */ + 2691CEA93CAFF0B4913D0104 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 58D1273A2F85C7E8A1B7A368 /* Shared */; + proxyType = 1; + remoteGlobalIDString = CA02FA85CE9E4296ADE0F606; + remoteInfo = "uniffi-bindgen-bin"; + }; + 36A596DB7199CBE221785B4C /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 58D1273A2F85C7E8A1B7A368 /* Shared */; + proxyType = 2; + remoteGlobalIDString = CA02FA85CE9E8109328FB0D5; + remoteInfo = "uniffi-bindgen-bin"; + }; + 6C009F766D2C7D18C5B54FBD /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 58D1273A2F85C7E8A1B7A368 /* Shared */; + proxyType = 2; + remoteGlobalIDString = CA0049BF7D4FFB09138082B7; + remoteInfo = "shared-staticlib"; + }; + 84766557D1D0D528121CE64B /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 58D1273A2F85C7E8A1B7A368 /* Shared */; + proxyType = 1; + remoteGlobalIDString = CA0049BF7D4FD346A0A05154; + remoteInfo = "shared-staticlib"; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 2CE412001E7794AD347EBD19 /* core.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = core.swift; sourceTree = ""; }; + 462254CE9DE6D2EC30FF3A86 /* AudioAlwaysWorks.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AudioAlwaysWorks.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 58D1273A2F85C7E8A1B7A368 /* Shared */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Shared; path = ../shared/shared.xcodeproj; sourceTree = ""; }; + 875EDCC9B68900ADF353E8B9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = ""; }; + AC29F76997F3C99B413D302C /* shared.udl */ = {isa = PBXFileReference; path = shared.udl; sourceTree = ""; }; + B53B12612A4D67D20B81EB2E /* AudioAlwaysWorksApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AudioAlwaysWorksApp.swift; sourceTree = ""; }; + BB4929ACDBDFEE04D6BD1450 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; + BF6D1C0DFE7DE3DFA9713895 /* SharedTypes */ = {isa = PBXFileReference; lastKnownFileType = folder; name = SharedTypes; path = ../shared_types/generated/swift/SharedTypes; sourceTree = SOURCE_ROOT; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + CB8C2D766232756B7B816714 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 00E8861E16817C505A2ECDE8 /* libshared_static.a.a in Frameworks */, + D56F70A0151CDB9B5FFDF152 /* SharedTypes in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 00F1A536CE165C8B63EE5233 /* Products */ = { + isa = PBXGroup; + children = ( + 950989282E252A7B9B3FD161, + E85E5699EC0D4ACC3ECF08C7 /* libshared_static.a.a */, + ); + name = Products; + sourceTree = ""; + }; + 145344B309F5A46FC5F95985 /* Projects */ = { + isa = PBXGroup; + children = ( + 58D1273A2F85C7E8A1B7A368 /* Shared */, + ); + name = Projects; + sourceTree = ""; + }; + 3F7AF5C4695691A01288E08F /* Products */ = { + isa = PBXGroup; + children = ( + 462254CE9DE6D2EC30FF3A86 /* AudioAlwaysWorks.app */, + ); + name = Products; + sourceTree = ""; + }; + 454476D2D91CEEB0D4374C0E /* src */ = { + isa = PBXGroup; + children = ( + AC29F76997F3C99B413D302C /* shared.udl */, + ); + name = src; + path = ../shared/src; + sourceTree = ""; + }; + 46AF0F5B2FE283356AB99974 = { + isa = PBXGroup; + children = ( + 66C1A14C5F509EC6A51BE396 /* AudioAlwaysWorks */, + 94903FA415C62EF670977E13 /* Packages */, + 454476D2D91CEEB0D4374C0E /* src */, + 3F7AF5C4695691A01288E08F /* Products */, + 145344B309F5A46FC5F95985 /* Projects */, + ); + sourceTree = ""; + }; + 66C1A14C5F509EC6A51BE396 /* AudioAlwaysWorks */ = { + isa = PBXGroup; + children = ( + B53B12612A4D67D20B81EB2E /* AudioAlwaysWorksApp.swift */, + BB4929ACDBDFEE04D6BD1450 /* ContentView.swift */, + 2CE412001E7794AD347EBD19 /* core.swift */, + 875EDCC9B68900ADF353E8B9 /* Info.plist */, + ); + path = AudioAlwaysWorks; + sourceTree = ""; + }; + 94903FA415C62EF670977E13 /* Packages */ = { + isa = PBXGroup; + children = ( + BF6D1C0DFE7DE3DFA9713895 /* SharedTypes */, + ); + name = Packages; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + F6EFF5C544F3BC9C6A9B8E5C /* AudioAlwaysWorks */ = { + isa = PBXNativeTarget; + buildConfigurationList = 8E8D2F01A9911444D404B5B6 /* Build configuration list for PBXNativeTarget "AudioAlwaysWorks" */; + buildPhases = ( + 80164FD90B2E283AA182832A /* Sources */, + C48990381B7BD8C84B9108F1 /* Resources */, + CB8C2D766232756B7B816714 /* Frameworks */, + ); + buildRules = ( + E1379C8142E9E6C9D55EE54C /* PBXBuildRule */, + ); + dependencies = ( + 6FB8261A37F6A141EDC63F61 /* PBXTargetDependency */, + 6FF5790D3621F6EBB9C2C7EA /* PBXTargetDependency */, + ); + name = AudioAlwaysWorks; + packageProductDependencies = ( + 0CC389A097C62FD0236B24A7 /* SharedTypes */, + ); + productName = AudioAlwaysWorks; + productReference = 462254CE9DE6D2EC30FF3A86 /* AudioAlwaysWorks.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + CD31D51CAEA76326143638AA /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = YES; + LastUpgradeCheck = 1430; + TargetAttributes = { + }; + }; + buildConfigurationList = 96DE4556CF1251C69E040258 /* Build configuration list for PBXProject "AudioAlwaysWorks" */; + compatibilityVersion = "Xcode 14.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + Base, + en, + ); + mainGroup = 46AF0F5B2FE283356AB99974; + minimizedProjectReferenceProxies = 1; + packageReferences = ( + 6FABBE062C9537623FCDDE8A /* XCLocalSwiftPackageReference "../shared_types/generated/swift/SharedTypes" */, + ); + preferredProjectObjectVersion = 54; + projectDirPath = ""; + projectReferences = ( + { + ProductGroup = 00F1A536CE165C8B63EE5233 /* Products */; + ProjectRef = 58D1273A2F85C7E8A1B7A368 /* Shared */; + }, + ); + projectRoot = ""; + targets = ( + F6EFF5C544F3BC9C6A9B8E5C /* AudioAlwaysWorks */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXReferenceProxy section */ + 950989282E252A7B9B3FD161 = { + isa = PBXReferenceProxy; + remoteRef = 36A596DB7199CBE221785B4C /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + E85E5699EC0D4ACC3ECF08C7 /* libshared_static.a.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libshared_static.a.a; + remoteRef = 6C009F766D2C7D18C5B54FBD /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; +/* End PBXReferenceProxy section */ + +/* Begin PBXResourcesBuildPhase section */ + C48990381B7BD8C84B9108F1 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + EBABE42AB688D7559072487D /* (null) in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 80164FD90B2E283AA182832A /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 46FF5D3E091859708BFB695D /* AudioAlwaysWorksApp.swift in Sources */, + 7F9D6E2F706B4395EB6601CA /* ContentView.swift in Sources */, + C81403257A4C05A09F8D4204 /* core.swift in Sources */, + 959935D0681AECAF2C9D286E /* shared.udl in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 6FB8261A37F6A141EDC63F61 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "uniffi-bindgen-bin"; + targetProxy = 2691CEA93CAFF0B4913D0104 /* PBXContainerItemProxy */; + }; + 6FF5790D3621F6EBB9C2C7EA /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "shared-staticlib"; + targetProxy = 84766557D1D0D528121CE64B /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + AB847326C9251A1ACEC296CC /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + SWIFT_VERSION = 5.0; + }; + name = Release; + }; + B48AFAF2195277CA789A64BC /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + COMBINE_HIDPI_IMAGES = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + INFOPLIST_FILE = AudioAlwaysWorks/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 15.5; + OTHER_LDFLAGS = ( + "-w", + "-ObjC", + ); + PRODUCT_BUNDLE_IDENTIFIER = nl.pascaldevink.audio_always_works.AudioAlwaysWorks; + SDKROOT = macosx; + SWIFT_OBJC_BRIDGING_HEADER = generated/sharedFFI.h; + }; + name = Debug; + }; + D0294531C3F73284ABF61EC5 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", + "DEBUG=1", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = macosx; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + E5029E47918032BE5848DC2E /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + COMBINE_HIDPI_IMAGES = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + INFOPLIST_FILE = AudioAlwaysWorks/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 15.5; + OTHER_LDFLAGS = ( + "-w", + "-ObjC", + ); + PRODUCT_BUNDLE_IDENTIFIER = nl.pascaldevink.audio_always_works.AudioAlwaysWorks; + SDKROOT = macosx; + SWIFT_OBJC_BRIDGING_HEADER = generated/sharedFFI.h; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 8E8D2F01A9911444D404B5B6 /* Build configuration list for PBXNativeTarget "AudioAlwaysWorks" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + B48AFAF2195277CA789A64BC /* Debug */, + E5029E47918032BE5848DC2E /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + 96DE4556CF1251C69E040258 /* Build configuration list for PBXProject "AudioAlwaysWorks" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D0294531C3F73284ABF61EC5 /* Debug */, + AB847326C9251A1ACEC296CC /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; +/* End XCConfigurationList section */ + +/* Begin XCLocalSwiftPackageReference section */ + 6FABBE062C9537623FCDDE8A /* XCLocalSwiftPackageReference "../shared_types/generated/swift/SharedTypes" */ = { + isa = XCLocalSwiftPackageReference; + relativePath = ../shared_types/generated/swift/SharedTypes; + }; +/* End XCLocalSwiftPackageReference section */ + +/* Begin XCSwiftPackageProductDependency section */ + 0CC389A097C62FD0236B24A7 /* SharedTypes */ = { + isa = XCSwiftPackageProductDependency; + productName = SharedTypes; + }; +/* End XCSwiftPackageProductDependency section */ + }; + rootObject = CD31D51CAEA76326143638AA /* Project object */; +} diff --git a/macOS/AudioAlwaysWorks.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/macOS/AudioAlwaysWorks.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/macOS/AudioAlwaysWorks.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/macOS/AudioAlwaysWorks.xcodeproj/project.xcworkspace/xcuserdata/pascaldevink.xcuserdatad/UserInterfaceState.xcuserstate b/macOS/AudioAlwaysWorks.xcodeproj/project.xcworkspace/xcuserdata/pascaldevink.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..0ebe36a Binary files /dev/null and b/macOS/AudioAlwaysWorks.xcodeproj/project.xcworkspace/xcuserdata/pascaldevink.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/macOS/AudioAlwaysWorks.xcodeproj/xcuserdata/pascaldevink.xcuserdatad/xcschemes/xcschememanagement.plist b/macOS/AudioAlwaysWorks.xcodeproj/xcuserdata/pascaldevink.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..72958f9 --- /dev/null +++ b/macOS/AudioAlwaysWorks.xcodeproj/xcuserdata/pascaldevink.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ + + + + + SchemeUserState + + AudioAlwaysWorks.xcscheme_^#shared#^_ + + orderHint + 0 + + + + diff --git a/macOS/AudioAlwaysWorks/AudioAlwaysWorksApp.swift b/macOS/AudioAlwaysWorks/AudioAlwaysWorksApp.swift new file mode 100644 index 0000000..81d50ad --- /dev/null +++ b/macOS/AudioAlwaysWorks/AudioAlwaysWorksApp.swift @@ -0,0 +1,10 @@ +import SwiftUI + +@main +struct AudioAlwaysWorksApp: App { + var body: some Scene { + WindowGroup { + ContentView(core: Core()) + } + } +} diff --git a/macOS/AudioAlwaysWorks/ContentView.swift b/macOS/AudioAlwaysWorks/ContentView.swift new file mode 100644 index 0000000..8846c21 --- /dev/null +++ b/macOS/AudioAlwaysWorks/ContentView.swift @@ -0,0 +1,47 @@ +import SharedTypes +import SwiftUI + +struct ContentView: View { + @ObservedObject var core: Core + + var body: some View { + VStack { + Image(systemName: "globe") + .imageScale(.large) + .foregroundColor(.accentColor) + Text(core.view.selected_input_device) + Text(core.view.selected_output_device) + } + } +} + +struct ActionButton: View { + var label: String + var color: Color + var action: () -> Void + + init(label: String, color: Color, action: @escaping () -> Void) { + self.label = label + self.color = color + self.action = action + } + + var body: some View { + Button(action: action) { + Text(label) + .fontWeight(.bold) + .font(.body) + .padding(EdgeInsets(top: 10, leading: 15, bottom: 10, trailing: 15)) + .background(color) + .cornerRadius(10) + .foregroundColor(.white) + .padding() + } + } +} + +struct ContentView_Previews: PreviewProvider { + static var previews: some View { + ContentView(core: Core()) + } +} diff --git a/macOS/AudioAlwaysWorks/Info.plist b/macOS/AudioAlwaysWorks/Info.plist new file mode 100644 index 0000000..1301f20 --- /dev/null +++ b/macOS/AudioAlwaysWorks/Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + UILaunchScreen + + + diff --git a/macOS/AudioAlwaysWorks/core.swift b/macOS/AudioAlwaysWorks/core.swift new file mode 100644 index 0000000..2db26fd --- /dev/null +++ b/macOS/AudioAlwaysWorks/core.swift @@ -0,0 +1,27 @@ +import Foundation +import SharedTypes + +@MainActor +class Core: ObservableObject { + @Published var view: ViewModel + + init() { + self.view = try! .bincodeDeserialize(input: [UInt8](AudioAlwaysWorks.view())) + } + + func update(_ event: Event) { + let effects = [UInt8](processEvent(Data(try! event.bincodeSerialize()))) + + let requests: [Request] = try! .bincodeDeserialize(input: effects) + for request in requests { + processEffect(request) + } + } + + func processEffect(_ request: Request) { + switch request.effect { + case .render: + view = try! .bincodeDeserialize(input: [UInt8](AudioAlwaysWorks.view())) + } + } +} diff --git a/macOS/generated/shared.swift b/macOS/generated/shared.swift new file mode 100644 index 0000000..e9e3e0f --- /dev/null +++ b/macOS/generated/shared.swift @@ -0,0 +1,537 @@ +// This file was autogenerated by some hot garbage in the `uniffi` crate. +// Trust me, you don't want to mess with it! + +// swiftlint:disable all +import Foundation + +// Depending on the consumer's build setup, the low-level FFI code +// might be in a separate module, or it might be compiled inline into +// this module. This is a bit of light hackery to work with both. +#if canImport(sharedFFI) +import sharedFFI +#endif + +fileprivate extension RustBuffer { + // Allocate a new buffer, copying the contents of a `UInt8` array. + init(bytes: [UInt8]) { + let rbuf = bytes.withUnsafeBufferPointer { ptr in + RustBuffer.from(ptr) + } + self.init(capacity: rbuf.capacity, len: rbuf.len, data: rbuf.data) + } + + static func empty() -> RustBuffer { + RustBuffer(capacity: 0, len:0, data: nil) + } + + static func from(_ ptr: UnsafeBufferPointer) -> RustBuffer { + try! rustCall { ffi_shared_rustbuffer_from_bytes(ForeignBytes(bufferPointer: ptr), $0) } + } + + // Frees the buffer in place. + // The buffer must not be used after this is called. + func deallocate() { + try! rustCall { ffi_shared_rustbuffer_free(self, $0) } + } +} + +fileprivate extension ForeignBytes { + init(bufferPointer: UnsafeBufferPointer) { + self.init(len: Int32(bufferPointer.count), data: bufferPointer.baseAddress) + } +} + +// For every type used in the interface, we provide helper methods for conveniently +// lifting and lowering that type from C-compatible data, and for reading and writing +// values of that type in a buffer. + +// Helper classes/extensions that don't change. +// Someday, this will be in a library of its own. + +fileprivate extension Data { + init(rustBuffer: RustBuffer) { + self.init( + bytesNoCopy: rustBuffer.data!, + count: Int(rustBuffer.len), + deallocator: .none + ) + } +} + +// Define reader functionality. Normally this would be defined in a class or +// struct, but we use standalone functions instead in order to make external +// types work. +// +// With external types, one swift source file needs to be able to call the read +// method on another source file's FfiConverter, but then what visibility +// should Reader have? +// - If Reader is fileprivate, then this means the read() must also +// be fileprivate, which doesn't work with external types. +// - If Reader is internal/public, we'll get compile errors since both source +// files will try define the same type. +// +// Instead, the read() method and these helper functions input a tuple of data + +fileprivate func createReader(data: Data) -> (data: Data, offset: Data.Index) { + (data: data, offset: 0) +} + +// Reads an integer at the current offset, in big-endian order, and advances +// the offset on success. Throws if reading the integer would move the +// offset past the end of the buffer. +fileprivate func readInt(_ reader: inout (data: Data, offset: Data.Index)) throws -> T { + let range = reader.offset...size + guard reader.data.count >= range.upperBound else { + throw UniffiInternalError.bufferOverflow + } + if T.self == UInt8.self { + let value = reader.data[reader.offset] + reader.offset += 1 + return value as! T + } + var value: T = 0 + let _ = withUnsafeMutableBytes(of: &value, { reader.data.copyBytes(to: $0, from: range)}) + reader.offset = range.upperBound + return value.bigEndian +} + +// Reads an arbitrary number of bytes, to be used to read +// raw bytes, this is useful when lifting strings +fileprivate func readBytes(_ reader: inout (data: Data, offset: Data.Index), count: Int) throws -> Array { + let range = reader.offset..<(reader.offset+count) + guard reader.data.count >= range.upperBound else { + throw UniffiInternalError.bufferOverflow + } + var value = [UInt8](repeating: 0, count: count) + value.withUnsafeMutableBufferPointer({ buffer in + reader.data.copyBytes(to: buffer, from: range) + }) + reader.offset = range.upperBound + return value +} + +// Reads a float at the current offset. +fileprivate func readFloat(_ reader: inout (data: Data, offset: Data.Index)) throws -> Float { + return Float(bitPattern: try readInt(&reader)) +} + +// Reads a float at the current offset. +fileprivate func readDouble(_ reader: inout (data: Data, offset: Data.Index)) throws -> Double { + return Double(bitPattern: try readInt(&reader)) +} + +// Indicates if the offset has reached the end of the buffer. +fileprivate func hasRemaining(_ reader: (data: Data, offset: Data.Index)) -> Bool { + return reader.offset < reader.data.count +} + +// Define writer functionality. Normally this would be defined in a class or +// struct, but we use standalone functions instead in order to make external +// types work. See the above discussion on Readers for details. + +fileprivate func createWriter() -> [UInt8] { + return [] +} + +fileprivate func writeBytes(_ writer: inout [UInt8], _ byteArr: S) where S: Sequence, S.Element == UInt8 { + writer.append(contentsOf: byteArr) +} + +// Writes an integer in big-endian order. +// +// Warning: make sure what you are trying to write +// is in the correct type! +fileprivate func writeInt(_ writer: inout [UInt8], _ value: T) { + var value = value.bigEndian + withUnsafeBytes(of: &value) { writer.append(contentsOf: $0) } +} + +fileprivate func writeFloat(_ writer: inout [UInt8], _ value: Float) { + writeInt(&writer, value.bitPattern) +} + +fileprivate func writeDouble(_ writer: inout [UInt8], _ value: Double) { + writeInt(&writer, value.bitPattern) +} + +// Protocol for types that transfer other types across the FFI. This is +// analogous to the Rust trait of the same name. +fileprivate protocol FfiConverter { + associatedtype FfiType + associatedtype SwiftType + + static func lift(_ value: FfiType) throws -> SwiftType + static func lower(_ value: SwiftType) -> FfiType + static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType + static func write(_ value: SwiftType, into buf: inout [UInt8]) +} + +// Types conforming to `Primitive` pass themselves directly over the FFI. +fileprivate protocol FfiConverterPrimitive: FfiConverter where FfiType == SwiftType { } + +extension FfiConverterPrimitive { +#if swift(>=5.8) + @_documentation(visibility: private) +#endif + public static func lift(_ value: FfiType) throws -> SwiftType { + return value + } + +#if swift(>=5.8) + @_documentation(visibility: private) +#endif + public static func lower(_ value: SwiftType) -> FfiType { + return value + } +} + +// Types conforming to `FfiConverterRustBuffer` lift and lower into a `RustBuffer`. +// Used for complex types where it's hard to write a custom lift/lower. +fileprivate protocol FfiConverterRustBuffer: FfiConverter where FfiType == RustBuffer {} + +extension FfiConverterRustBuffer { +#if swift(>=5.8) + @_documentation(visibility: private) +#endif + public static func lift(_ buf: RustBuffer) throws -> SwiftType { + var reader = createReader(data: Data(rustBuffer: buf)) + let value = try read(from: &reader) + if hasRemaining(reader) { + throw UniffiInternalError.incompleteData + } + buf.deallocate() + return value + } + +#if swift(>=5.8) + @_documentation(visibility: private) +#endif + public static func lower(_ value: SwiftType) -> RustBuffer { + var writer = createWriter() + write(value, into: &writer) + return RustBuffer(bytes: writer) + } +} +// An error type for FFI errors. These errors occur at the UniFFI level, not +// the library level. +fileprivate enum UniffiInternalError: LocalizedError { + case bufferOverflow + case incompleteData + case unexpectedOptionalTag + case unexpectedEnumCase + case unexpectedNullPointer + case unexpectedRustCallStatusCode + case unexpectedRustCallError + case unexpectedStaleHandle + case rustPanic(_ message: String) + + public var errorDescription: String? { + switch self { + case .bufferOverflow: return "Reading the requested value would read past the end of the buffer" + case .incompleteData: return "The buffer still has data after lifting its containing value" + case .unexpectedOptionalTag: return "Unexpected optional tag; should be 0 or 1" + case .unexpectedEnumCase: return "Raw enum value doesn't match any cases" + case .unexpectedNullPointer: return "Raw pointer value was null" + case .unexpectedRustCallStatusCode: return "Unexpected RustCallStatus code" + case .unexpectedRustCallError: return "CALL_ERROR but no errorClass specified" + case .unexpectedStaleHandle: return "The object in the handle map has been dropped already" + case let .rustPanic(message): return message + } + } +} + +fileprivate extension NSLock { + func withLock(f: () throws -> T) rethrows -> T { + self.lock() + defer { self.unlock() } + return try f() + } +} + +fileprivate let CALL_SUCCESS: Int8 = 0 +fileprivate let CALL_ERROR: Int8 = 1 +fileprivate let CALL_UNEXPECTED_ERROR: Int8 = 2 +fileprivate let CALL_CANCELLED: Int8 = 3 + +fileprivate extension RustCallStatus { + init() { + self.init( + code: CALL_SUCCESS, + errorBuf: RustBuffer.init( + capacity: 0, + len: 0, + data: nil + ) + ) + } +} + +private func rustCall(_ callback: (UnsafeMutablePointer) -> T) throws -> T { + let neverThrow: ((RustBuffer) throws -> Never)? = nil + return try makeRustCall(callback, errorHandler: neverThrow) +} + +private func rustCallWithError( + _ errorHandler: @escaping (RustBuffer) throws -> E, + _ callback: (UnsafeMutablePointer) -> T) throws -> T { + try makeRustCall(callback, errorHandler: errorHandler) +} + +private func makeRustCall( + _ callback: (UnsafeMutablePointer) -> T, + errorHandler: ((RustBuffer) throws -> E)? +) throws -> T { + uniffiEnsureSharedInitialized() + var callStatus = RustCallStatus.init() + let returnedVal = callback(&callStatus) + try uniffiCheckCallStatus(callStatus: callStatus, errorHandler: errorHandler) + return returnedVal +} + +private func uniffiCheckCallStatus( + callStatus: RustCallStatus, + errorHandler: ((RustBuffer) throws -> E)? +) throws { + switch callStatus.code { + case CALL_SUCCESS: + return + + case CALL_ERROR: + if let errorHandler = errorHandler { + throw try errorHandler(callStatus.errorBuf) + } else { + callStatus.errorBuf.deallocate() + throw UniffiInternalError.unexpectedRustCallError + } + + case CALL_UNEXPECTED_ERROR: + // When the rust code sees a panic, it tries to construct a RustBuffer + // with the message. But if that code panics, then it just sends back + // an empty buffer. + if callStatus.errorBuf.len > 0 { + throw UniffiInternalError.rustPanic(try FfiConverterString.lift(callStatus.errorBuf)) + } else { + callStatus.errorBuf.deallocate() + throw UniffiInternalError.rustPanic("Rust panic") + } + + case CALL_CANCELLED: + fatalError("Cancellation not supported yet") + + default: + throw UniffiInternalError.unexpectedRustCallStatusCode + } +} + +private func uniffiTraitInterfaceCall( + callStatus: UnsafeMutablePointer, + makeCall: () throws -> T, + writeReturn: (T) -> () +) { + do { + try writeReturn(makeCall()) + } catch let error { + callStatus.pointee.code = CALL_UNEXPECTED_ERROR + callStatus.pointee.errorBuf = FfiConverterString.lower(String(describing: error)) + } +} + +private func uniffiTraitInterfaceCallWithError( + callStatus: UnsafeMutablePointer, + makeCall: () throws -> T, + writeReturn: (T) -> (), + lowerError: (E) -> RustBuffer +) { + do { + try writeReturn(makeCall()) + } catch let error as E { + callStatus.pointee.code = CALL_ERROR + callStatus.pointee.errorBuf = lowerError(error) + } catch { + callStatus.pointee.code = CALL_UNEXPECTED_ERROR + callStatus.pointee.errorBuf = FfiConverterString.lower(String(describing: error)) + } +} +fileprivate final class UniffiHandleMap: @unchecked Sendable { + // All mutation happens with this lock held, which is why we implement @unchecked Sendable. + private let lock = NSLock() + private var map: [UInt64: T] = [:] + private var currentHandle: UInt64 = 1 + + func insert(obj: T) -> UInt64 { + lock.withLock { + let handle = currentHandle + currentHandle += 1 + map[handle] = obj + return handle + } + } + + func get(handle: UInt64) throws -> T { + try lock.withLock { + guard let obj = map[handle] else { + throw UniffiInternalError.unexpectedStaleHandle + } + return obj + } + } + + @discardableResult + func remove(handle: UInt64) throws -> T { + try lock.withLock { + guard let obj = map.removeValue(forKey: handle) else { + throw UniffiInternalError.unexpectedStaleHandle + } + return obj + } + } + + var count: Int { + get { + map.count + } + } +} + + +// Public interface members begin here. + + +#if swift(>=5.8) +@_documentation(visibility: private) +#endif +fileprivate struct FfiConverterUInt32: FfiConverterPrimitive { + typealias FfiType = UInt32 + typealias SwiftType = UInt32 + + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> UInt32 { + return try lift(readInt(&buf)) + } + + public static func write(_ value: SwiftType, into buf: inout [UInt8]) { + writeInt(&buf, lower(value)) + } +} + +#if swift(>=5.8) +@_documentation(visibility: private) +#endif +fileprivate struct FfiConverterString: FfiConverter { + typealias SwiftType = String + typealias FfiType = RustBuffer + + public static func lift(_ value: RustBuffer) throws -> String { + defer { + value.deallocate() + } + if value.data == nil { + return String() + } + let bytes = UnsafeBufferPointer(start: value.data!, count: Int(value.len)) + return String(bytes: bytes, encoding: String.Encoding.utf8)! + } + + public static func lower(_ value: String) -> RustBuffer { + return value.utf8CString.withUnsafeBufferPointer { ptr in + // The swift string gives us int8_t, we want uint8_t. + ptr.withMemoryRebound(to: UInt8.self) { ptr in + // The swift string gives us a trailing null byte, we don't want it. + let buf = UnsafeBufferPointer(rebasing: ptr.prefix(upTo: ptr.count - 1)) + return RustBuffer.from(buf) + } + } + } + + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> String { + let len: Int32 = try readInt(&buf) + return String(bytes: try readBytes(&buf, count: Int(len)), encoding: String.Encoding.utf8)! + } + + public static func write(_ value: String, into buf: inout [UInt8]) { + let len = Int32(value.utf8.count) + writeInt(&buf, len) + writeBytes(&buf, value.utf8) + } +} + +#if swift(>=5.8) +@_documentation(visibility: private) +#endif +fileprivate struct FfiConverterData: FfiConverterRustBuffer { + typealias SwiftType = Data + + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Data { + let len: Int32 = try readInt(&buf) + return Data(try readBytes(&buf, count: Int(len))) + } + + public static func write(_ value: Data, into buf: inout [UInt8]) { + let len = Int32(value.count) + writeInt(&buf, len) + writeBytes(&buf, value) + } +} +public func handleResponse(_ id: UInt32, _ res: Data) -> Data { + return try! FfiConverterData.lift(try! rustCall() { + uniffi_shared_fn_func_handle_response( + FfiConverterUInt32.lower(id), + FfiConverterData.lower(res),$0 + ) +}) +} +public func processEvent(_ msg: Data) -> Data { + return try! FfiConverterData.lift(try! rustCall() { + uniffi_shared_fn_func_process_event( + FfiConverterData.lower(msg),$0 + ) +}) +} +public func view() -> Data { + return try! FfiConverterData.lift(try! rustCall() { + uniffi_shared_fn_func_view($0 + ) +}) +} + +private enum InitializationResult { + case ok + case contractVersionMismatch + case apiChecksumMismatch +} +// Use a global variable to perform the versioning checks. Swift ensures that +// the code inside is only computed once. +private let initializationResult: InitializationResult = { + // Get the bindings contract version from our ComponentInterface + let bindings_contract_version = 29 + // Get the scaffolding contract version by calling the into the dylib + let scaffolding_contract_version = ffi_shared_uniffi_contract_version() + if bindings_contract_version != scaffolding_contract_version { + return InitializationResult.contractVersionMismatch + } + if (uniffi_shared_checksum_func_handle_response() != 38599) { + return InitializationResult.apiChecksumMismatch + } + if (uniffi_shared_checksum_func_process_event() != 35444) { + return InitializationResult.apiChecksumMismatch + } + if (uniffi_shared_checksum_func_view() != 57786) { + return InitializationResult.apiChecksumMismatch + } + + return InitializationResult.ok +}() + +// Make the ensure init function public so that other modules which have external type references to +// our types can call it. +public func uniffiEnsureSharedInitialized() { + switch initializationResult { + case .ok: + break + case .contractVersionMismatch: + fatalError("UniFFI contract version mismatch: try cleaning and rebuilding your project") + case .apiChecksumMismatch: + fatalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } +} + +// swiftlint:enable all \ No newline at end of file diff --git a/macOS/generated/sharedFFI.h b/macOS/generated/sharedFFI.h new file mode 100644 index 0000000..0a9d15f --- /dev/null +++ b/macOS/generated/sharedFFI.h @@ -0,0 +1,574 @@ +// This file was autogenerated by some hot garbage in the `uniffi` crate. +// Trust me, you don't want to mess with it! + +#pragma once + +#include +#include +#include + +// The following structs are used to implement the lowest level +// of the FFI, and thus useful to multiple uniffied crates. +// We ensure they are declared exactly once, with a header guard, UNIFFI_SHARED_H. +#ifdef UNIFFI_SHARED_H + // We also try to prevent mixing versions of shared uniffi header structs. + // If you add anything to the #else block, you must increment the version suffix in UNIFFI_SHARED_HEADER_V4 + #ifndef UNIFFI_SHARED_HEADER_V4 + #error Combining helper code from multiple versions of uniffi is not supported + #endif // ndef UNIFFI_SHARED_HEADER_V4 +#else +#define UNIFFI_SHARED_H +#define UNIFFI_SHARED_HEADER_V4 +// ⚠️ Attention: If you change this #else block (ending in `#endif // def UNIFFI_SHARED_H`) you *must* ⚠️ +// ⚠️ increment the version suffix in all instances of UNIFFI_SHARED_HEADER_V4 in this file. ⚠️ + +typedef struct RustBuffer +{ + uint64_t capacity; + uint64_t len; + uint8_t *_Nullable data; +} RustBuffer; + +typedef struct ForeignBytes +{ + int32_t len; + const uint8_t *_Nullable data; +} ForeignBytes; + +// Error definitions +typedef struct RustCallStatus { + int8_t code; + RustBuffer errorBuf; +} RustCallStatus; + +// ⚠️ Attention: If you change this #else block (ending in `#endif // def UNIFFI_SHARED_H`) you *must* ⚠️ +// ⚠️ increment the version suffix in all instances of UNIFFI_SHARED_HEADER_V4 in this file. ⚠️ +#endif // def UNIFFI_SHARED_H +#ifndef UNIFFI_FFIDEF_RUST_FUTURE_CONTINUATION_CALLBACK +#define UNIFFI_FFIDEF_RUST_FUTURE_CONTINUATION_CALLBACK +typedef void (*UniffiRustFutureContinuationCallback)(uint64_t, int8_t + ); + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_FREE +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_FREE +typedef void (*UniffiForeignFutureFree)(uint64_t + ); + +#endif +#ifndef UNIFFI_FFIDEF_CALLBACK_INTERFACE_FREE +#define UNIFFI_FFIDEF_CALLBACK_INTERFACE_FREE +typedef void (*UniffiCallbackInterfaceFree)(uint64_t + ); + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE +#define UNIFFI_FFIDEF_FOREIGN_FUTURE +typedef struct UniffiForeignFuture { + uint64_t handle; + UniffiForeignFutureFree _Nonnull free; +} UniffiForeignFuture; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_U8 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_U8 +typedef struct UniffiForeignFutureStructU8 { + uint8_t returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructU8; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U8 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U8 +typedef void (*UniffiForeignFutureCompleteU8)(uint64_t, UniffiForeignFutureStructU8 + ); + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_I8 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_I8 +typedef struct UniffiForeignFutureStructI8 { + int8_t returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructI8; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I8 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I8 +typedef void (*UniffiForeignFutureCompleteI8)(uint64_t, UniffiForeignFutureStructI8 + ); + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_U16 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_U16 +typedef struct UniffiForeignFutureStructU16 { + uint16_t returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructU16; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U16 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U16 +typedef void (*UniffiForeignFutureCompleteU16)(uint64_t, UniffiForeignFutureStructU16 + ); + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_I16 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_I16 +typedef struct UniffiForeignFutureStructI16 { + int16_t returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructI16; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I16 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I16 +typedef void (*UniffiForeignFutureCompleteI16)(uint64_t, UniffiForeignFutureStructI16 + ); + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_U32 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_U32 +typedef struct UniffiForeignFutureStructU32 { + uint32_t returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructU32; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U32 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U32 +typedef void (*UniffiForeignFutureCompleteU32)(uint64_t, UniffiForeignFutureStructU32 + ); + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_I32 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_I32 +typedef struct UniffiForeignFutureStructI32 { + int32_t returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructI32; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I32 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I32 +typedef void (*UniffiForeignFutureCompleteI32)(uint64_t, UniffiForeignFutureStructI32 + ); + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_U64 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_U64 +typedef struct UniffiForeignFutureStructU64 { + uint64_t returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructU64; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U64 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U64 +typedef void (*UniffiForeignFutureCompleteU64)(uint64_t, UniffiForeignFutureStructU64 + ); + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_I64 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_I64 +typedef struct UniffiForeignFutureStructI64 { + int64_t returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructI64; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I64 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I64 +typedef void (*UniffiForeignFutureCompleteI64)(uint64_t, UniffiForeignFutureStructI64 + ); + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_F32 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_F32 +typedef struct UniffiForeignFutureStructF32 { + float returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructF32; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_F32 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_F32 +typedef void (*UniffiForeignFutureCompleteF32)(uint64_t, UniffiForeignFutureStructF32 + ); + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_F64 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_F64 +typedef struct UniffiForeignFutureStructF64 { + double returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructF64; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_F64 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_F64 +typedef void (*UniffiForeignFutureCompleteF64)(uint64_t, UniffiForeignFutureStructF64 + ); + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_POINTER +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_POINTER +typedef struct UniffiForeignFutureStructPointer { + void*_Nonnull returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructPointer; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_POINTER +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_POINTER +typedef void (*UniffiForeignFutureCompletePointer)(uint64_t, UniffiForeignFutureStructPointer + ); + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_RUST_BUFFER +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_RUST_BUFFER +typedef struct UniffiForeignFutureStructRustBuffer { + RustBuffer returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructRustBuffer; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_RUST_BUFFER +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_RUST_BUFFER +typedef void (*UniffiForeignFutureCompleteRustBuffer)(uint64_t, UniffiForeignFutureStructRustBuffer + ); + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_VOID +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_VOID +typedef struct UniffiForeignFutureStructVoid { + RustCallStatus callStatus; +} UniffiForeignFutureStructVoid; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_VOID +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_VOID +typedef void (*UniffiForeignFutureCompleteVoid)(uint64_t, UniffiForeignFutureStructVoid + ); + +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_SHARED_FN_FUNC_HANDLE_RESPONSE +#define UNIFFI_FFIDEF_UNIFFI_SHARED_FN_FUNC_HANDLE_RESPONSE +RustBuffer uniffi_shared_fn_func_handle_response(uint32_t id, RustBuffer res, RustCallStatus *_Nonnull out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_SHARED_FN_FUNC_PROCESS_EVENT +#define UNIFFI_FFIDEF_UNIFFI_SHARED_FN_FUNC_PROCESS_EVENT +RustBuffer uniffi_shared_fn_func_process_event(RustBuffer msg, RustCallStatus *_Nonnull out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_SHARED_FN_FUNC_VIEW +#define UNIFFI_FFIDEF_UNIFFI_SHARED_FN_FUNC_VIEW +RustBuffer uniffi_shared_fn_func_view(RustCallStatus *_Nonnull out_status + +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_RUSTBUFFER_ALLOC +#define UNIFFI_FFIDEF_FFI_SHARED_RUSTBUFFER_ALLOC +RustBuffer ffi_shared_rustbuffer_alloc(uint64_t size, RustCallStatus *_Nonnull out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_RUSTBUFFER_FROM_BYTES +#define UNIFFI_FFIDEF_FFI_SHARED_RUSTBUFFER_FROM_BYTES +RustBuffer ffi_shared_rustbuffer_from_bytes(ForeignBytes bytes, RustCallStatus *_Nonnull out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_RUSTBUFFER_FREE +#define UNIFFI_FFIDEF_FFI_SHARED_RUSTBUFFER_FREE +void ffi_shared_rustbuffer_free(RustBuffer buf, RustCallStatus *_Nonnull out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_RUSTBUFFER_RESERVE +#define UNIFFI_FFIDEF_FFI_SHARED_RUSTBUFFER_RESERVE +RustBuffer ffi_shared_rustbuffer_reserve(RustBuffer buf, uint64_t additional, RustCallStatus *_Nonnull out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_POLL_U8 +#define UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_POLL_U8 +void ffi_shared_rust_future_poll_u8(uint64_t handle, UniffiRustFutureContinuationCallback _Nonnull callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_CANCEL_U8 +#define UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_CANCEL_U8 +void ffi_shared_rust_future_cancel_u8(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_FREE_U8 +#define UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_FREE_U8 +void ffi_shared_rust_future_free_u8(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_COMPLETE_U8 +#define UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_COMPLETE_U8 +uint8_t ffi_shared_rust_future_complete_u8(uint64_t handle, RustCallStatus *_Nonnull out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_POLL_I8 +#define UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_POLL_I8 +void ffi_shared_rust_future_poll_i8(uint64_t handle, UniffiRustFutureContinuationCallback _Nonnull callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_CANCEL_I8 +#define UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_CANCEL_I8 +void ffi_shared_rust_future_cancel_i8(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_FREE_I8 +#define UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_FREE_I8 +void ffi_shared_rust_future_free_i8(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_COMPLETE_I8 +#define UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_COMPLETE_I8 +int8_t ffi_shared_rust_future_complete_i8(uint64_t handle, RustCallStatus *_Nonnull out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_POLL_U16 +#define UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_POLL_U16 +void ffi_shared_rust_future_poll_u16(uint64_t handle, UniffiRustFutureContinuationCallback _Nonnull callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_CANCEL_U16 +#define UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_CANCEL_U16 +void ffi_shared_rust_future_cancel_u16(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_FREE_U16 +#define UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_FREE_U16 +void ffi_shared_rust_future_free_u16(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_COMPLETE_U16 +#define UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_COMPLETE_U16 +uint16_t ffi_shared_rust_future_complete_u16(uint64_t handle, RustCallStatus *_Nonnull out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_POLL_I16 +#define UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_POLL_I16 +void ffi_shared_rust_future_poll_i16(uint64_t handle, UniffiRustFutureContinuationCallback _Nonnull callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_CANCEL_I16 +#define UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_CANCEL_I16 +void ffi_shared_rust_future_cancel_i16(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_FREE_I16 +#define UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_FREE_I16 +void ffi_shared_rust_future_free_i16(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_COMPLETE_I16 +#define UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_COMPLETE_I16 +int16_t ffi_shared_rust_future_complete_i16(uint64_t handle, RustCallStatus *_Nonnull out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_POLL_U32 +#define UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_POLL_U32 +void ffi_shared_rust_future_poll_u32(uint64_t handle, UniffiRustFutureContinuationCallback _Nonnull callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_CANCEL_U32 +#define UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_CANCEL_U32 +void ffi_shared_rust_future_cancel_u32(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_FREE_U32 +#define UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_FREE_U32 +void ffi_shared_rust_future_free_u32(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_COMPLETE_U32 +#define UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_COMPLETE_U32 +uint32_t ffi_shared_rust_future_complete_u32(uint64_t handle, RustCallStatus *_Nonnull out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_POLL_I32 +#define UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_POLL_I32 +void ffi_shared_rust_future_poll_i32(uint64_t handle, UniffiRustFutureContinuationCallback _Nonnull callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_CANCEL_I32 +#define UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_CANCEL_I32 +void ffi_shared_rust_future_cancel_i32(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_FREE_I32 +#define UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_FREE_I32 +void ffi_shared_rust_future_free_i32(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_COMPLETE_I32 +#define UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_COMPLETE_I32 +int32_t ffi_shared_rust_future_complete_i32(uint64_t handle, RustCallStatus *_Nonnull out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_POLL_U64 +#define UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_POLL_U64 +void ffi_shared_rust_future_poll_u64(uint64_t handle, UniffiRustFutureContinuationCallback _Nonnull callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_CANCEL_U64 +#define UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_CANCEL_U64 +void ffi_shared_rust_future_cancel_u64(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_FREE_U64 +#define UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_FREE_U64 +void ffi_shared_rust_future_free_u64(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_COMPLETE_U64 +#define UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_COMPLETE_U64 +uint64_t ffi_shared_rust_future_complete_u64(uint64_t handle, RustCallStatus *_Nonnull out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_POLL_I64 +#define UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_POLL_I64 +void ffi_shared_rust_future_poll_i64(uint64_t handle, UniffiRustFutureContinuationCallback _Nonnull callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_CANCEL_I64 +#define UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_CANCEL_I64 +void ffi_shared_rust_future_cancel_i64(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_FREE_I64 +#define UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_FREE_I64 +void ffi_shared_rust_future_free_i64(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_COMPLETE_I64 +#define UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_COMPLETE_I64 +int64_t ffi_shared_rust_future_complete_i64(uint64_t handle, RustCallStatus *_Nonnull out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_POLL_F32 +#define UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_POLL_F32 +void ffi_shared_rust_future_poll_f32(uint64_t handle, UniffiRustFutureContinuationCallback _Nonnull callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_CANCEL_F32 +#define UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_CANCEL_F32 +void ffi_shared_rust_future_cancel_f32(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_FREE_F32 +#define UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_FREE_F32 +void ffi_shared_rust_future_free_f32(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_COMPLETE_F32 +#define UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_COMPLETE_F32 +float ffi_shared_rust_future_complete_f32(uint64_t handle, RustCallStatus *_Nonnull out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_POLL_F64 +#define UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_POLL_F64 +void ffi_shared_rust_future_poll_f64(uint64_t handle, UniffiRustFutureContinuationCallback _Nonnull callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_CANCEL_F64 +#define UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_CANCEL_F64 +void ffi_shared_rust_future_cancel_f64(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_FREE_F64 +#define UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_FREE_F64 +void ffi_shared_rust_future_free_f64(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_COMPLETE_F64 +#define UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_COMPLETE_F64 +double ffi_shared_rust_future_complete_f64(uint64_t handle, RustCallStatus *_Nonnull out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_POLL_POINTER +#define UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_POLL_POINTER +void ffi_shared_rust_future_poll_pointer(uint64_t handle, UniffiRustFutureContinuationCallback _Nonnull callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_CANCEL_POINTER +#define UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_CANCEL_POINTER +void ffi_shared_rust_future_cancel_pointer(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_FREE_POINTER +#define UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_FREE_POINTER +void ffi_shared_rust_future_free_pointer(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_COMPLETE_POINTER +#define UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_COMPLETE_POINTER +void*_Nonnull ffi_shared_rust_future_complete_pointer(uint64_t handle, RustCallStatus *_Nonnull out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_POLL_RUST_BUFFER +#define UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_POLL_RUST_BUFFER +void ffi_shared_rust_future_poll_rust_buffer(uint64_t handle, UniffiRustFutureContinuationCallback _Nonnull callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_CANCEL_RUST_BUFFER +#define UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_CANCEL_RUST_BUFFER +void ffi_shared_rust_future_cancel_rust_buffer(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_FREE_RUST_BUFFER +#define UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_FREE_RUST_BUFFER +void ffi_shared_rust_future_free_rust_buffer(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_COMPLETE_RUST_BUFFER +#define UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_COMPLETE_RUST_BUFFER +RustBuffer ffi_shared_rust_future_complete_rust_buffer(uint64_t handle, RustCallStatus *_Nonnull out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_POLL_VOID +#define UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_POLL_VOID +void ffi_shared_rust_future_poll_void(uint64_t handle, UniffiRustFutureContinuationCallback _Nonnull callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_CANCEL_VOID +#define UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_CANCEL_VOID +void ffi_shared_rust_future_cancel_void(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_FREE_VOID +#define UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_FREE_VOID +void ffi_shared_rust_future_free_void(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_COMPLETE_VOID +#define UNIFFI_FFIDEF_FFI_SHARED_RUST_FUTURE_COMPLETE_VOID +void ffi_shared_rust_future_complete_void(uint64_t handle, RustCallStatus *_Nonnull out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_SHARED_CHECKSUM_FUNC_HANDLE_RESPONSE +#define UNIFFI_FFIDEF_UNIFFI_SHARED_CHECKSUM_FUNC_HANDLE_RESPONSE +uint16_t uniffi_shared_checksum_func_handle_response(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_SHARED_CHECKSUM_FUNC_PROCESS_EVENT +#define UNIFFI_FFIDEF_UNIFFI_SHARED_CHECKSUM_FUNC_PROCESS_EVENT +uint16_t uniffi_shared_checksum_func_process_event(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_SHARED_CHECKSUM_FUNC_VIEW +#define UNIFFI_FFIDEF_UNIFFI_SHARED_CHECKSUM_FUNC_VIEW +uint16_t uniffi_shared_checksum_func_view(void + +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_SHARED_UNIFFI_CONTRACT_VERSION +#define UNIFFI_FFIDEF_FFI_SHARED_UNIFFI_CONTRACT_VERSION +uint32_t ffi_shared_uniffi_contract_version(void + +); +#endif + diff --git a/macOS/generated/sharedFFI.modulemap b/macOS/generated/sharedFFI.modulemap new file mode 100644 index 0000000..804c5aa --- /dev/null +++ b/macOS/generated/sharedFFI.modulemap @@ -0,0 +1,7 @@ +module sharedFFI { + header "sharedFFI.h" + export * + use "Darwin" + use "_Builtin_stdbool" + use "_Builtin_stdint" +} \ No newline at end of file diff --git a/macOS/project.yml b/macOS/project.yml new file mode 100644 index 0000000..c56df76 --- /dev/null +++ b/macOS/project.yml @@ -0,0 +1,57 @@ +name: AudioAlwaysWorks +projectReferences: + Shared: + path: ../shared/shared.xcodeproj +packages: + SharedTypes: + path: ../shared_types/generated/swift/SharedTypes +options: + bundleIdPrefix: nl.pascaldevink.audio_always_works +attributes: + BuildIndependentTargetsInParallel: true +targets: + AudioAlwaysWorks: + type: application + platform: macOS + deploymentTarget: "15.5" + sources: + - AudioAlwaysWorks + - path: ../shared/src/shared.udl + buildPhase: sources + dependencies: + - target: Shared/uniffi-bindgen-bin + - target: Shared/shared-staticlib + - package: SharedTypes + info: + path: AudioAlwaysWorks/Info.plist + properties: + UILaunchScreen: {} + settings: + OTHER_LDFLAGS: [-w] + SWIFT_OBJC_BRIDGING_HEADER: generated/sharedFFI.h + ENABLE_USER_SCRIPT_SANDBOXING: NO + buildRules: + - name: Generate FFI + filePattern: "*.udl" + script: | + #!/bin/bash + set -e + + # Skip during indexing phase in XCode 13+ + if [ "$ACTION" == "indexbuild" ]; then + echo "Not building *.udl files during indexing." + exit 0 + fi + + # Skip for preview builds + if [ "$ENABLE_PREVIEWS" = "YES" ]; then + echo "Not building *.udl files during preview builds." + exit 0 + fi + + cd "${INPUT_FILE_DIR}/.." + "${BUILD_DIR}/${CONFIGURATION}/uniffi-bindgen" generate "src/${INPUT_FILE_NAME}" --language swift --out-dir "${PROJECT_DIR}/generated" + outputFiles: + - $(PROJECT_DIR)/generated/$(INPUT_FILE_BASE).swift + - $(PROJECT_DIR)/generated/$(INPUT_FILE_BASE)FFI.h + runOncePerArchitecture: false diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..acf6112 --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,5 @@ +[toolchain] +channel = "stable" +components = ["rustfmt", "rustc-dev"] +targets = ["aarch64-apple-darwin"] +profile = "minimal" diff --git a/shared/.gitignore b/shared/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/shared/.gitignore @@ -0,0 +1 @@ +/target diff --git a/shared/Cargo.toml b/shared/Cargo.toml new file mode 100644 index 0000000..160cc3b --- /dev/null +++ b/shared/Cargo.toml @@ -0,0 +1,27 @@ +[package] +name = "shared" +version = "0.1.0" +authors.workspace = true +repository.workspace = true +edition.workspace = true +license.workspace = true +rust-version.workspace = true + +[lib] +crate-type = ["lib", "staticlib", "cdylib"] +name = "shared" + +[features] +typegen = ["crux_core/typegen"] + +[dependencies] +crux_core.workspace = true +serde = { workspace = true, features = ["derive"] } +uniffi = "0.29.3" +wasm-bindgen = "0.2.100" + +[build-dependencies] +uniffi = { version = "0.29.3", features = ["build"] } + +[target.uniffi-bindgen.dependencies] +uniffi = { version = "0.29.3", features = ["cli"] } diff --git a/shared/build.rs b/shared/build.rs new file mode 100644 index 0000000..592061f --- /dev/null +++ b/shared/build.rs @@ -0,0 +1,3 @@ +fn main() { + uniffi::generate_scaffolding("./src/shared.udl").unwrap(); +} diff --git a/shared/shared.xcodeproj/project.pbxproj b/shared/shared.xcodeproj/project.pbxproj new file mode 100644 index 0000000..c811482 --- /dev/null +++ b/shared/shared.xcodeproj/project.pbxproj @@ -0,0 +1,391 @@ +// !$*UTF8*$! +{ + /* generated with cargo-xcode 1.7.0 */ + archiveVersion = 1; + classes = { + }; + objectVersion = 53; + objects = { + +/* Begin PBXBuildFile section */ + CA0075449799D346A0A05154 /* Cargo.toml in Sources */ = {isa = PBXBuildFile; fileRef = CAF972D1F1633EF4668187A5 /* Cargo.toml */; settings = {COMPILER_FLAGS = "--lib"; }; }; + CA017544979925C0556334E4 /* Cargo.toml in Sources */ = {isa = PBXBuildFile; fileRef = CAF972D1F1633EF4668187A5 /* Cargo.toml */; settings = {COMPILER_FLAGS = "--lib"; }; }; + CA02754497994296ADE0F606 /* Cargo.toml in Sources */ = {isa = PBXBuildFile; fileRef = CAF972D1F1633EF4668187A5 /* Cargo.toml */; settings = {COMPILER_FLAGS = "--bin 'uniffi-bindgen'"; }; }; + +/* End PBXBuildFile section */ + +/* Begin PBXBuildRule section */ + CAF472D1F163AC6C1400ACA8 /* PBXBuildRule */ = { + isa = PBXBuildRule; + compilerSpec = com.apple.compilers.proxy.script; + dependencyFile = "$(DERIVED_FILE_DIR)/$(CARGO_XCODE_TARGET_ARCH)-$(EXECUTABLE_NAME).d"; + filePatterns = "*/Cargo.toml"; + fileType = pattern.proxy; + inputFiles = ( + ); + isEditable = 0; + name = "Cargo project build"; + outputFiles = ( + "$(OBJECT_FILE_DIR)/$(CARGO_XCODE_TARGET_ARCH)-$(EXECUTABLE_NAME)", + ); + script = "# generated with cargo-xcode 1.7.0\nset -xeu;\nexport PATH=\"$HOME/.cargo/bin:$PATH:/usr/local/bin:/opt/homebrew/bin\";\n\nif [ \"${IS_MACCATALYST-NO}\" = YES ]; then\n CARGO_XCODE_TARGET_OS=ios-macabi\nfi\nCARGO_XCODE_TARGET_TRIPLE=\"${CARGO_XCODE_TARGET_ARCH}-apple-${CARGO_XCODE_TARGET_OS}\"\nif [ \"$CARGO_XCODE_TARGET_OS\" != darwin ]; then\n export PATH=\"${PATH/\\/Contents\\/Developer\\/Toolchains\\/XcodeDefault.xctoolchain\\/usr\\/bin:/xcode-provided-ld-cant-link-lSystem-for-the-host-build-script:}\"\nfi\nif [ \"$CARGO_XCODE_BUILD_PROFILE\" == release ]; then\n OTHER_INPUT_FILE_FLAGS=\"${OTHER_INPUT_FILE_FLAGS} --release\"\nfi\n\nif [ \"$ACTION\" = clean ]; then\n cargo clean --verbose --manifest-path=\"$SCRIPT_INPUT_FILE\" ${OTHER_INPUT_FILE_FLAGS} --target=\"${CARGO_XCODE_TARGET_TRIPLE}\";\n rm -f \"$SCRIPT_OUTPUT_FILE_0\"\n exit 0\nfi\ncargo build --verbose --manifest-path=\"$SCRIPT_INPUT_FILE\" --features=\"${CARGO_XCODE_FEATURES:-}\" ${OTHER_INPUT_FILE_FLAGS} --target=\"${CARGO_XCODE_TARGET_TRIPLE}\" || {\n if command -v rustup &> /dev/null; then\n if ! rustup target list --installed | grep -Eq \"${CARGO_XCODE_TARGET_TRIPLE}\"; then\n echo >&2 \"warning: this build requires rustup toolchain for $CARGO_XCODE_TARGET_TRIPLE, but it isn't installed (will try rustup next)\"\n rustup target add \"${CARGO_XCODE_TARGET_TRIPLE}\" || echo >&2 \"warning: can't install $CARGO_XCODE_TARGET_TRIPLE\"\n fi\n fi\n echo >&2 \"error: cargo build failed\"; exit 1; }\n\n# it's too hard to explain Cargo's actual exe path to Xcode build graph, so hardlink to a known-good path instead\nBUILT_SRC=\"${CARGO_TARGET_DIR}/${CARGO_XCODE_TARGET_TRIPLE}/${CARGO_XCODE_BUILD_PROFILE}/${CARGO_XCODE_CARGO_FILE_NAME}\"\nln -f -- \"$BUILT_SRC\" \"$SCRIPT_OUTPUT_FILE_0\" || { echo >&2 \"can't hardlink $BUILT_SRC to $SCRIPT_OUTPUT_FILE_0\"; exit 1; }\n\n# cargo generates a dep file, but for its own path, so append our rename to it\nDEP_FILE_SRC=\"${CARGO_TARGET_DIR}/${CARGO_XCODE_TARGET_TRIPLE}/${CARGO_XCODE_BUILD_PROFILE}/${CARGO_XCODE_CARGO_DEP_FILE_NAME}\"\nif [ -f \"$DEP_FILE_SRC\" ]; then\n DEP_FILE_DST=\"${DERIVED_FILE_DIR}/${CARGO_XCODE_TARGET_ARCH}-${EXECUTABLE_NAME}.d\"\n cp -f \"$DEP_FILE_SRC\" \"$DEP_FILE_DST\" || { echo >&2 \"can't copy $DEP_FILE_SRC to $DEP_FILE_DST\"; exit 1; }\n\n echo >> \"$DEP_FILE_DST\" \"${SCRIPT_OUTPUT_FILE_0/ /\\\\ /}: ${BUILT_SRC/ /\\\\ /}\"\nfi\n\n# lipo script needs to know all the platform-specific files that have been built\n# archs is in the file name, so that paths don't stay around after archs change\n# must match input for LipoScript\nFILE_LIST=\"${DERIVED_FILE_DIR}/${ARCHS}-${EXECUTABLE_NAME}.xcfilelist\"\ntouch \"$FILE_LIST\"\nif ! grep -Eq \"$SCRIPT_OUTPUT_FILE_0\" \"$FILE_LIST\" ; then\n echo >> \"$FILE_LIST\" \"$SCRIPT_OUTPUT_FILE_0\"\nfi\n\necho \"success: $ACTION of $SCRIPT_OUTPUT_FILE_0 for $CARGO_XCODE_TARGET_TRIPLE\"\n"; + }; +/* End PBXBuildRule section */ + +/* Begin PBXFileReference section */ + CA0049BF7D4FFB09138082B7 /* libshared_static.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libshared_static.a; sourceTree = BUILT_PRODUCTS_DIR; }; + CA01C51694BE10F7F7FCAC5B /* shared.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = shared.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; + CA02FA85CE9E8109328FB0D5 /* uniffi-bindgen */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "uniffi-bindgen"; sourceTree = BUILT_PRODUCTS_DIR; }; + CAF972D1F1633EF4668187A5 /* Cargo.toml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Cargo.toml; sourceTree = ""; }; + +/* End PBXFileReference section */ + +/* Begin PBXGroup section */ + CAF072D1F163D65BC3C892A8 = { + isa = PBXGroup; + children = ( + CAF972D1F1633EF4668187A5 /* Cargo.toml */, + CAF172D1F16322869D176AE5 /* Products */, + CAF272D1F16398AF0B5890DB /* Frameworks */, + ); + sourceTree = ""; + }; + CAF172D1F16322869D176AE5 /* Products */ = { + isa = PBXGroup; + children = ( + CA0049BF7D4FFB09138082B7 /* libshared_static.a */, + CA01C51694BE10F7F7FCAC5B /* shared.dylib */, + CA02FA85CE9E8109328FB0D5 /* uniffi-bindgen */, + ); + name = Products; + sourceTree = ""; + }; + CAF272D1F16398AF0B5890DB /* Frameworks */ = { + isa = PBXGroup; + children = ( + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + CA0049BF7D4FD346A0A05154 /* shared-staticlib */ = { + isa = PBXNativeTarget; + buildConfigurationList = CA009BFF234FD346A0A05154 /* Build configuration list for PBXNativeTarget "shared-staticlib" */; + buildPhases = ( + CA002DB2DC98D346A0A05154 /* Sources */, + CAF572D1F163AF6EBB7F357C /* Universal Binary lipo */, + ); + buildRules = ( + CAF472D1F163AC6C1400ACA8 /* PBXBuildRule */, + ); + dependencies = ( + ); + name = "shared-staticlib"; + productName = libshared_static.a; + productReference = CA0049BF7D4FFB09138082B7 /* libshared_static.a */; + productType = "com.apple.product-type.library.static"; + }; + CA01C51694BE25C0556334E4 /* shared-cdylib */ = { + isa = PBXNativeTarget; + buildConfigurationList = CA019BFF234F25C0556334E4 /* Build configuration list for PBXNativeTarget "shared-cdylib" */; + buildPhases = ( + CA012DB2DC9825C0556334E4 /* Sources */, + CAF572D1F163AF6EBB7F357C /* Universal Binary lipo */, + ); + buildRules = ( + CAF472D1F163AC6C1400ACA8 /* PBXBuildRule */, + ); + dependencies = ( + ); + name = "shared-cdylib"; + productName = shared.dylib; + productReference = CA01C51694BE10F7F7FCAC5B /* shared.dylib */; + productType = "com.apple.product-type.library.dynamic"; + }; + CA02FA85CE9E4296ADE0F606 /* uniffi-bindgen-bin */ = { + isa = PBXNativeTarget; + buildConfigurationList = CA029BFF234F4296ADE0F606 /* Build configuration list for PBXNativeTarget "uniffi-bindgen-bin" */; + buildPhases = ( + CA022DB2DC984296ADE0F606 /* Sources */, + CAF572D1F163AF6EBB7F357C /* Universal Binary lipo */, + ); + buildRules = ( + CAF472D1F163AC6C1400ACA8 /* PBXBuildRule */, + ); + dependencies = ( + ); + name = "uniffi-bindgen-bin"; + productName = "uniffi-bindgen"; + productReference = CA02FA85CE9E8109328FB0D5 /* uniffi-bindgen */; + productType = "com.apple.product-type.tool"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + CAF372D1F163E04653AD465F /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 1500; + TargetAttributes = { + CA0049BF7D4FD346A0A05154 = { + CreatedOnToolsVersion = 9.2; + ProvisioningStyle = Automatic; + }; + CA01C51694BE25C0556334E4 = { + CreatedOnToolsVersion = 9.2; + ProvisioningStyle = Automatic; + }; + CA02FA85CE9E4296ADE0F606 = { + CreatedOnToolsVersion = 9.2; + ProvisioningStyle = Automatic; + }; + }; + }; + buildConfigurationList = CAF672D1F16380E02D6C7F57 /* Build configuration list for PBXProject "shared" */; + compatibilityVersion = "Xcode 11.4"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = CAF072D1F163D65BC3C892A8; + productRefGroup = CAF172D1F16322869D176AE5 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + CA0049BF7D4FD346A0A05154 /* shared-staticlib */, + CA01C51694BE25C0556334E4 /* shared-cdylib */, + CA02FA85CE9E4296ADE0F606 /* uniffi-bindgen-bin */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXShellScriptBuildPhase section */ + CAF572D1F163AF6EBB7F357C /* Universal Binary lipo */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "$(DERIVED_FILE_DIR)/$(ARCHS)-$(EXECUTABLE_NAME).xcfilelist", + ); + name = "Universal Binary lipo"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(TARGET_BUILD_DIR)/$(EXECUTABLE_PATH)", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "# generated with cargo-xcode 1.7.0\nset -eux;\ntr '\\n' '\\0' < \"$DERIVED_FILE_DIR/$ARCHS-$EXECUTABLE_NAME.xcfilelist\" | xargs -0 lipo -create -output \"$TARGET_BUILD_DIR/$EXECUTABLE_PATH\"\nif [ ${LD_DYLIB_INSTALL_NAME:+1} ]; then\n install_name_tool -id \"$LD_DYLIB_INSTALL_NAME\" \"$TARGET_BUILD_DIR/$EXECUTABLE_PATH\"\nfi\n"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + CA002DB2DC98D346A0A05154 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + CA0075449799D346A0A05154 /* Cargo.toml in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + CA012DB2DC9825C0556334E4 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + CA017544979925C0556334E4 /* Cargo.toml in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + CA022DB2DC984296ADE0F606 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + CA02754497994296ADE0F606 /* Cargo.toml in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + CA00D94DC8EDD346A0A05154 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CARGO_XCODE_CARGO_DEP_FILE_NAME = libshared.d; + CARGO_XCODE_CARGO_FILE_NAME = libshared.a; + INSTALL_GROUP = ""; + INSTALL_MODE_FLAG = ""; + INSTALL_OWNER = ""; + SKIP_INSTALL = YES; + PRODUCT_NAME = shared_static; + SUPPORTED_PLATFORMS = "macosx iphonesimulator iphoneos appletvsimulator appletvos"; + + }; + name = Release; + }; + CA00F2363223D346A0A05154 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CARGO_XCODE_CARGO_DEP_FILE_NAME = libshared.d; + CARGO_XCODE_CARGO_FILE_NAME = libshared.a; + INSTALL_GROUP = ""; + INSTALL_MODE_FLAG = ""; + INSTALL_OWNER = ""; + SKIP_INSTALL = YES; + PRODUCT_NAME = shared_static; + SUPPORTED_PLATFORMS = "macosx iphonesimulator iphoneos appletvsimulator appletvos"; + + }; + name = Debug; + }; + CA01D94DC8ED25C0556334E4 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CARGO_XCODE_CARGO_DEP_FILE_NAME = libshared.d; + CARGO_XCODE_CARGO_FILE_NAME = libshared.dylib; + + PRODUCT_NAME = shared; + SUPPORTED_PLATFORMS = macosx; + DYLIB_COMPATIBILITY_VERSION = 0; + }; + name = Release; + }; + CA01F236322325C0556334E4 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CARGO_XCODE_CARGO_DEP_FILE_NAME = libshared.d; + CARGO_XCODE_CARGO_FILE_NAME = libshared.dylib; + + PRODUCT_NAME = shared; + SUPPORTED_PLATFORMS = macosx; + DYLIB_COMPATIBILITY_VERSION = 0; + }; + name = Debug; + }; + CA02D94DC8ED4296ADE0F606 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CARGO_XCODE_CARGO_DEP_FILE_NAME = "uniffi-bindgen.d"; + CARGO_XCODE_CARGO_FILE_NAME = "uniffi-bindgen"; + + PRODUCT_NAME = "uniffi-bindgen"; + SUPPORTED_PLATFORMS = macosx; + + }; + name = Release; + }; + CA02F23632234296ADE0F606 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CARGO_XCODE_CARGO_DEP_FILE_NAME = "uniffi-bindgen.d"; + CARGO_XCODE_CARGO_FILE_NAME = "uniffi-bindgen"; + + PRODUCT_NAME = "uniffi-bindgen"; + SUPPORTED_PLATFORMS = macosx; + + }; + name = Debug; + }; + + CAF73C790FAA3CC16B37690B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CARGO_TARGET_DIR = "$(PROJECT_TEMP_DIR)/cargo_target"; + CARGO_XCODE_BUILD_PROFILE = release; + CARGO_XCODE_FEATURES = ""; + "CARGO_XCODE_TARGET_ARCH[arch=arm64*]" = aarch64; + "CARGO_XCODE_TARGET_ARCH[arch=i386]" = i686; + "CARGO_XCODE_TARGET_ARCH[arch=x86_64*]" = x86_64; + "CARGO_XCODE_TARGET_OS[sdk=appletvos*]" = tvos; + "CARGO_XCODE_TARGET_OS[sdk=appletvsimulator*]" = tvos; + "CARGO_XCODE_TARGET_OS[sdk=iphoneos*]" = ios; + "CARGO_XCODE_TARGET_OS[sdk=iphonesimulator*]" = "ios-sim"; + "CARGO_XCODE_TARGET_OS[sdk=iphonesimulator*][arch=x86_64*]" = ios; + "CARGO_XCODE_TARGET_OS[sdk=macosx*]" = darwin; + CURRENT_PROJECT_VERSION = 0.1; + MARKETING_VERSION = 0.1.0; + PRODUCT_NAME = shared; + RUSTUP_TOOLCHAIN = ""; + SDKROOT = macosx; + SUPPORTS_MACCATALYST = YES; + }; + name = Release; + }; + CAF83C790FAA228BE02872F8 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CARGO_TARGET_DIR = "$(PROJECT_TEMP_DIR)/cargo_target"; + CARGO_XCODE_BUILD_PROFILE = debug; + CARGO_XCODE_FEATURES = ""; + "CARGO_XCODE_TARGET_ARCH[arch=arm64*]" = aarch64; + "CARGO_XCODE_TARGET_ARCH[arch=i386]" = i686; + "CARGO_XCODE_TARGET_ARCH[arch=x86_64*]" = x86_64; + "CARGO_XCODE_TARGET_OS[sdk=appletvos*]" = tvos; + "CARGO_XCODE_TARGET_OS[sdk=appletvsimulator*]" = tvos; + "CARGO_XCODE_TARGET_OS[sdk=iphoneos*]" = ios; + "CARGO_XCODE_TARGET_OS[sdk=iphonesimulator*]" = "ios-sim"; + "CARGO_XCODE_TARGET_OS[sdk=iphonesimulator*][arch=x86_64*]" = ios; + "CARGO_XCODE_TARGET_OS[sdk=macosx*]" = darwin; + CURRENT_PROJECT_VERSION = 0.1; + MARKETING_VERSION = 0.1.0; + ONLY_ACTIVE_ARCH = YES; + PRODUCT_NAME = shared; + RUSTUP_TOOLCHAIN = ""; + SDKROOT = macosx; + SUPPORTS_MACCATALYST = YES; + }; + name = Debug; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + CA009BFF234FD346A0A05154 /* Build configuration list for PBXNativeTarget "shared-staticlib" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + CA00D94DC8EDD346A0A05154 /* Release */, + CA00F2363223D346A0A05154 /* Debug */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + CA019BFF234F25C0556334E4 /* Build configuration list for PBXNativeTarget "shared-cdylib" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + CA01D94DC8ED25C0556334E4 /* Release */, + CA01F236322325C0556334E4 /* Debug */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + CA029BFF234F4296ADE0F606 /* Build configuration list for PBXNativeTarget "uniffi-bindgen-bin" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + CA02D94DC8ED4296ADE0F606 /* Release */, + CA02F23632234296ADE0F606 /* Debug */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + + CAF672D1F16380E02D6C7F57 /* Build configuration list for PBXProject "shared" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + CAF73C790FAA3CC16B37690B /* Release */, + CAF83C790FAA228BE02872F8 /* Debug */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = CAF372D1F163E04653AD465F /* Project object */; +} diff --git a/shared/shared.xcodeproj/xcuserdata/pascaldevink.xcuserdatad/xcschemes/xcschememanagement.plist b/shared/shared.xcodeproj/xcuserdata/pascaldevink.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..f769f19 --- /dev/null +++ b/shared/shared.xcodeproj/xcuserdata/pascaldevink.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,24 @@ + + + + + SchemeUserState + + shared-cdylib.xcscheme_^#shared#^_ + + orderHint + 2 + + shared-staticlib.xcscheme_^#shared#^_ + + orderHint + 1 + + uniffi-bindgen-bin.xcscheme_^#shared#^_ + + orderHint + 3 + + + + diff --git a/shared/src/app.rs b/shared/src/app.rs new file mode 100644 index 0000000..393c80b --- /dev/null +++ b/shared/src/app.rs @@ -0,0 +1,76 @@ +use crux_core::{ + macros::effect, + render::{render, RenderOperation}, + App, Command, +}; +use serde::{Deserialize, Serialize}; + +#[derive(Serialize, Deserialize, Clone, Debug)] +pub enum Event { + AudioDevicesChanged, + DefaultInputDeviceChanged(String), + DefaultOutputDeviceChanged(String), +} + +#[effect(typegen)] +pub enum Effect { + Render(RenderOperation), +} + +#[derive(Default)] +pub struct Model { + input_devices: Vec, + output_devices: Vec, + selected_input_device: String, + selected_output_device: String, + rules: Vec, +} + +#[derive(Serialize, Deserialize, Clone, Default)] +pub struct ViewModel { + pub input_devices: Vec, + pub output_devices: Vec, + pub selected_input_device: String, + pub selected_output_device: String, + pub rules: Vec, +} + +#[derive(Default)] +pub struct AudioAlwaysWorks; + +impl App for AudioAlwaysWorks { + type Event = Event; + type Model = Model; + type ViewModel = ViewModel; + type Capabilities = (); // will be deprecated, so use unit type for now + type Effect = Effect; + + fn update( + &self, + event: Self::Event, + model: &mut Self::Model, + _caps: &(), // will be deprecated, so prefix with underscore for now + ) -> Command { + match event { + Event::DefaultInputDeviceChanged(device) => { + model.selected_input_device = device; + } + Event::DefaultOutputDeviceChanged(device) => { + model.selected_output_device = device; + } + _ => {} + } + + render() + } + + fn view(&self, model: &Self::Model) -> Self::ViewModel { + ViewModel { + input_devices: model.input_devices.clone(), + output_devices: model.output_devices.clone(), + selected_input_device: model.selected_input_device.clone(), + selected_output_device: model.selected_output_device.clone(), + rules: model.rules.clone(), + } + } +} diff --git a/shared/src/bin/uniffi-bindgen.rs b/shared/src/bin/uniffi-bindgen.rs new file mode 100644 index 0000000..a01b547 --- /dev/null +++ b/shared/src/bin/uniffi-bindgen.rs @@ -0,0 +1,3 @@ +fn main() { + uniffi::uniffi_bindgen_main(); +} diff --git a/shared/src/lib.rs b/shared/src/lib.rs new file mode 100644 index 0000000..9792d1f --- /dev/null +++ b/shared/src/lib.rs @@ -0,0 +1,50 @@ +pub mod app; + +use std::sync::LazyLock; + +pub use crux_core::{bridge::Bridge, Core, Request}; + +pub use app::*; + +// TODO hide this plumbing + +#[cfg(not(target_family = "wasm"))] +uniffi::include_scaffolding!("shared"); + +static CORE: LazyLock> = LazyLock::new(|| Bridge::new(Core::new())); + +/// Ask the core to process an event +/// # Panics +/// If the core fails to process the event +#[cfg_attr(target_family = "wasm", wasm_bindgen::prelude::wasm_bindgen)] +#[must_use] +pub fn process_event(data: &[u8]) -> Vec { + match CORE.process_event(data) { + Ok(effects) => effects, + Err(e) => panic!("{e}"), + } +} + +/// Ask the core to handle a response +/// # Panics +/// If the core fails to handle the response +#[cfg_attr(target_family = "wasm", wasm_bindgen::prelude::wasm_bindgen)] +#[must_use] +pub fn handle_response(id: u32, data: &[u8]) -> Vec { + match CORE.handle_response(id, data) { + Ok(effects) => effects, + Err(e) => panic!("{e}"), + } +} + +/// Ask the core to render the view +/// # Panics +/// If the view cannot be serialized +#[cfg_attr(target_family = "wasm", wasm_bindgen::prelude::wasm_bindgen)] +#[must_use] +pub fn view() -> Vec { + match CORE.view() { + Ok(view) => view, + Err(e) => panic!("{e}"), + } +} diff --git a/shared/src/shared.udl b/shared/src/shared.udl new file mode 100644 index 0000000..db53521 --- /dev/null +++ b/shared/src/shared.udl @@ -0,0 +1,5 @@ +namespace shared { + bytes process_event([ByRef] bytes msg); + bytes handle_response(u32 id, [ByRef] bytes res); + bytes view(); +}; diff --git a/shared/uniffi.toml b/shared/uniffi.toml new file mode 100644 index 0000000..d28293a --- /dev/null +++ b/shared/uniffi.toml @@ -0,0 +1,7 @@ +[bindings.kotlin] +package_name = "nl.pascaldevink.audio_always_works.shared" +cdylib_name = "shared" + +[bindings.swift] +cdylib_name = "shared_ffi" +omit_argument_labels = true diff --git a/shared_types/.gitignore b/shared_types/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/shared_types/.gitignore @@ -0,0 +1 @@ +/target diff --git a/shared_types/Cargo.toml b/shared_types/Cargo.toml new file mode 100644 index 0000000..4bafead --- /dev/null +++ b/shared_types/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "shared_types" +version = "0.1.0" +authors.workspace = true +edition.workspace = true +license.workspace = true +rust-version.workspace = true + +[dependencies] + +[build-dependencies] +anyhow.workspace = true +crux_core = { workspace = true, features = ["typegen"] } +shared = { path = "../shared", features = ["typegen"] } diff --git a/shared_types/build.rs b/shared_types/build.rs new file mode 100644 index 0000000..d9c1cce --- /dev/null +++ b/shared_types/build.rs @@ -0,0 +1,23 @@ +use crux_core::typegen::TypeGen; +use shared::AudioAlwaysWorks; +use std::path::PathBuf; + +fn main() -> anyhow::Result<()> { + println!("cargo:rerun-if-changed=../shared"); + + let mut typegen = TypeGen::new(); + + typegen.register_app::()?; + + let output_root = PathBuf::from("./generated"); + + typegen.swift("SharedTypes", output_root.join("swift"))?; + + // For Android + // typegen.java("com.crux.example.simple_counter", output_root.join("java"))?; + + // For web-shell + // typegen.typescript("shared_types", output_root.join("typescript"))?; + + Ok(()) +} diff --git a/shared_types/src/lib.rs b/shared_types/src/lib.rs new file mode 100644 index 0000000..cd215e1 --- /dev/null +++ b/shared_types/src/lib.rs @@ -0,0 +1 @@ +// see build.rs