Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ members = [
"examples/*/",
"testing/separated/*/",
"testing/sync-test",

"monorepo-hacks/workspace-hack",
"monorepo-hacks/mozbuild",
]

exclude = [
Expand Down Expand Up @@ -159,3 +162,8 @@ lto = "thin"
uniffi = { git = "https://github.com/mozilla/uniffi-rs.git", rev = "59b035078322fbc0a605cc3c784cc38214113450" }
uniffi_bindgen = { git = "https://github.com/mozilla/uniffi-rs.git", rev = "59b035078322fbc0a605cc3c784cc38214113450" }
uniffi_pipeline = { git = "https://github.com/mozilla/uniffi-rs.git", rev = "59b035078322fbc0a605cc3c784cc38214113450" }
# dummy crates for m-c integration hacks.
mozilla-central-workspace-hack = { path = "monorepo-hacks/workspace-hack" }
mozbuild = { path = "monorepo-hacks/mozbuild" }
# temporary ohttp override enabling the above hacks while we wait for a new version.
ohttp = { git = "https://github.com/martinthomson/ohttp", revision = "324f876e79394c9b815dcacda3fd4f48f105fdf2" }
1 change: 1 addition & 0 deletions components/support/nimbus-fml/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,4 @@ itertools = "0"
regex = "1.9"
viaduct = { path = "../../viaduct/" }
termcolor = "1.4.1"
mozilla-central-workspace-hack = { version = "0.1", features = ["nimbus-fml"], optional = true }
1 change: 1 addition & 0 deletions megazords/full/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ init_rust_components = { path = "../../components/init_rust_components" }
merino = { path = "../../components/merino" }
relay = { path = "../../components/relay" }
ads-client = { path = "../../components/ads-client" }
mozilla-central-workspace-hack = { version = "0.1", features = ["megazord"], optional = true }
15 changes: 15 additions & 0 deletions monorepo-hacks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
This directory holds a couple of crates which are hacks to help us on the
path to moving this repo into mozilla-central.

They exist only to keep Cargo and/or the Rust compiler happy, so the
same code/config can be used in both repos. They serve no actual purpose
and are never actually called in this repo.

They are:

* workspace-hack/* contains a dummy `mozilla-central-workspace-hack` crate, which
is referenced from a few "top-level" crates built in m-c.

* mozbuild/* contains a dummy `mozbuild` crate, which is referenced by the ohttp
crate when the "app-svc" feature is enabled. That feature auto-detects whether
it is in this repo or in mozilla-central.
6 changes: 6 additions & 0 deletions monorepo-hacks/mozbuild/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[package]
name = "mozbuild"
version = "0.1.0"
edition = "2024"

[dependencies]
27 changes: 27 additions & 0 deletions monorepo-hacks/mozbuild/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

// A dummy mozbuild which exists purely so ohttp can be built in this repo.
// This implementation is never actually called, it just needs to exist
// to keep the compiler happy.

use std::path::Path;

// from https://searchfox.org/firefox-main/source/build/rust/mozbuild/lib.rs

// Path::new is not const at the moment. This is a non-generic version
// of Path::new, similar to libstd's implementation of Path::new.
#[inline(always)]
const fn const_path(s: &'static str) -> &'static std::path::Path {
unsafe { &*(s as *const str as *const std::path::Path) }
}

pub const TOPOBJDIR: &Path = const_path("");

pub mod config {
pub const MOZ_FOLD_LIBS: bool = true;
pub const BINDGEN_SYSTEM_FLAGS: [&str; 0] = [];
pub const NSS_CFLAGS: [&str; 0] = [];
pub const NSPR_CFLAGS: [&str; 0] = [];
}
17 changes: 17 additions & 0 deletions monorepo-hacks/workspace-hack/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[package]
name = "mozilla-central-workspace-hack"
version = "0.1.0"
license = "MPL-2.0"
description = "Workspace hack for mozilla-central"
edition = "2024"

# This is a copy of the workspace hack in mozilla-central - https://searchfox.org/firefox-main/source/build/workspace-hack
# It exists only so that the crates in this repo which need the "workspace hack" once in mozilla-central
# automagically get it.
# It serves no purpose in application-services other than to allow our
# crates to be build in mozilla-central without modification.

[features]
megazord = []
embedded-uniffi-bindgen = []
nimbus-fml = []
11 changes: 11 additions & 0 deletions monorepo-hacks/workspace-hack/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#[cfg(test)]
mod tests {
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
}
1 change: 1 addition & 0 deletions tools/embedded-uniffi-bindgen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ clap = {version = "4.2", default-features = false, features = ["std", "derive"]}
serde = { version = "1", features = ["derive"] }
uniffi_bindgen = { version = "0.31" }
uniffi_pipeline = { version = "0.31" }
mozilla-central-workspace-hack = { version = "0.1", features = ["embedded-uniffi-bindgen"], optional = true }
Loading