Skip to content

Commit

Permalink
Use SpiderMonkey's encoding_c instead of our own crate (bytecodeallia…
Browse files Browse the repository at this point in the history
…nce#55)

SpiderMonkey uses the `encoding_c` Rust crate and comes bundled with it. This lead to either duplication or linking errors when using our own crate re-exporting `encoding_c`.

Instead, with this PR we just bundle a C header file for interacting with the crate's functionality, and rely on SpiderMonkey's version.
  • Loading branch information
tschneidereit authored May 29, 2024
1 parent 8fcd257 commit aa9ff14
Show file tree
Hide file tree
Showing 8 changed files with 4 additions and 111 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ include("host_api")
include("build-crates")

add_library(extension_api INTERFACE include/extension-api.h runtime/encode.h)
target_link_libraries(extension_api INTERFACE rust-url rust-encoding spidermonkey)
target_link_libraries(extension_api INTERFACE rust-url spidermonkey)
target_include_directories(extension_api INTERFACE include deps/include runtime)

include("builtins")
Expand Down
3 changes: 0 additions & 3 deletions cmake/build-crates.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
corrosion_import_crate(MANIFEST_PATH ${CMAKE_CURRENT_SOURCE_DIR}/crates/rust-url/Cargo.toml NO_LINKER_OVERRIDE)
set_property(TARGET rust-url PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/crates/rust-url/)

corrosion_import_crate(MANIFEST_PATH ${CMAKE_CURRENT_SOURCE_DIR}/crates/rust-encoding/Cargo.toml NO_LINKER_OVERRIDE)
set_property(TARGET rust-encoding PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/crates/rust-encoding/)
1 change: 0 additions & 1 deletion crates/rust-encoding/.gitignore

This file was deleted.

34 changes: 0 additions & 34 deletions crates/rust-encoding/Cargo.lock

This file was deleted.

17 changes: 0 additions & 17 deletions crates/rust-encoding/Cargo.toml

This file was deleted.

54 changes: 0 additions & 54 deletions crates/rust-encoding/cbindgen.toml

This file was deleted.

1 change: 0 additions & 1 deletion crates/rust-encoding/src/lib.rs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// NOTE: This file was generated by cbindgen for the encoding_c crate.
// Since that crate is included in SpiderMonkey, we just include the header file here.
// TODO: look into whether we can bundle the header file with SpiderMonkey's includes.
// The constructor created by cbindgen's `derive_constructor` causes this warning.
// Gecko's various uses of cbindgen silence it, so we do, too.
#ifdef __clang__
Expand Down

0 comments on commit aa9ff14

Please sign in to comment.