Bug 1860654 - Support Rust for Thunderbird development. r=rjl
Adds a new `comm/rust` directory used to build the upstream `gkrust-shared` library within the newly provided `gkrust` Rust library. Expose a new dedicated workspace and vendoring system, allowing for Thunderbird-only dependencies within the tree, and solve the issue of having drift in Cargo.lock between Thunderbird and Firefox. New mach commands for managing the workflow around Rust with Thunderbird: ./mach tb-rust sync ./mach tb-rust vendor Differential Revision: https://phabricator.services.mozilla.com/D193543 --HG-- extra : amend_source : ca6dc59ef386f4c62f53e79dac8cdb6caef8104e
This commit is contained in:
Родитель
2deb321659
Коммит
e906c84d0d
|
@ -48,3 +48,4 @@ third_party/asn1js/node_modules/
|
|||
# Built documentation
|
||||
docs/_build
|
||||
docs/_venv
|
||||
^rust/target/
|
|
@ -68,6 +68,7 @@ def initialize(topsrcdir, args=()):
|
|||
"tb-l10n-quarantine-to-strings": MachCommandReference("comm/python/l10n/mach_commands.py"),
|
||||
"tb-l10n-x-channel": MachCommandReference("comm/python/l10n/mach_commands.py"),
|
||||
"tb-esmify": MachCommandReference("comm/tools/esmify/mach_commands.py"),
|
||||
"tb-rust": MachCommandReference("comm/rust/mach_commands.py"),
|
||||
"tb-storybook": MachCommandReference("comm/mail/components/storybook/mach_commands.py"),
|
||||
}
|
||||
MACH_COMMANDS.update(COMM_MACH_COMMANDS)
|
||||
|
|
|
@ -14,6 +14,8 @@ Thunderbird Source Tree Documentation
|
|||
|
||||
l10n/index
|
||||
|
||||
rust/index
|
||||
|
||||
storybook/index
|
||||
|
||||
telemetry/index
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
# Rust in Thunderbird
|
||||
|
||||
Thunderbird now builds `gkrust` as its own library, using `gkrust-shared`
|
||||
from upstream (Gecko) allowing for Thunderbird-only Rust crates and components.
|
||||
|
||||
Note, however, this is a slightly odd arrangement as Cargo doesn't support using
|
||||
workspaces within the parent directory. As a result, we must keep track of the
|
||||
first-level dependencies of our crates (ie shallow transitive).
|
||||
|
||||
## Updating dependencies
|
||||
|
||||
./mach tb-rust sync
|
||||
|
||||
## Sync the vendored dependencies
|
||||
|
||||
When crate dependencies change, we need to synchronise the dependencies. This is done
|
||||
to support use from the root of mozilla-central and account for *all* crate dependencies.
|
||||
|
||||
./mach tb-rust vendor
|
||||
|
||||
Do **not** directly modify `comm/rust/.cargo/*` !
|
|
@ -31,6 +31,11 @@ DIRS += [
|
|||
"../third_party",
|
||||
]
|
||||
|
||||
if CONFIG["MOZ_OVERRIDE_GKRUST"]:
|
||||
DIRS += [
|
||||
"../rust",
|
||||
]
|
||||
|
||||
TEST_DIRS += [
|
||||
"test/browser",
|
||||
"test/marionette",
|
||||
|
|
|
@ -99,5 +99,11 @@ def thunderbird_official_branding(milestone, update_channel):
|
|||
set_config("THUNDERBIRD_OFFICIAL_BRANDING", thunderbird_official_branding)
|
||||
add_old_configure_assignment("THUNDERBIRD_OFFICIAL_BRANDING", thunderbird_official_branding)
|
||||
|
||||
# Enable Rust overrides
|
||||
option("--enable-thunderbird-rust", help="Enable Rust support within Thunderbird")
|
||||
set_config("MOZ_OVERRIDE_GKRUST", True, when="--enable-thunderbird-rust")
|
||||
set_config(
|
||||
"MOZ_OVERRIDE_CARGO_CONFIG", "comm/rust/.cargo/config.in", when="--enable-thunderbird-rust"
|
||||
)
|
||||
|
||||
include("../../toolkit/moz.configure")
|
||||
|
|
|
@ -0,0 +1,309 @@
|
|||
# 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/.
|
||||
|
||||
import os.path
|
||||
import subprocess
|
||||
|
||||
import tomlkit
|
||||
from tomlkit.toml_file import TOMLFile
|
||||
|
||||
config_footer = """
|
||||
# Take advantage of the fact that cargo will treat lines starting with #
|
||||
# as comments to add preprocessing directives. This file can thus by copied
|
||||
# as-is to $topsrcdir/.cargo/config with no preprocessing to be used there
|
||||
# (for e.g. independent tasks building rust code), or be preprocessed by
|
||||
# the build system to produce a .cargo/config with the right content.
|
||||
#define REPLACE_NAME vendored-sources
|
||||
#define VENDORED_DIRECTORY comm/third_party/rust
|
||||
# We explicitly exclude the following section when preprocessing because
|
||||
# it would overlap with the preprocessed [source."@REPLACE_NAME@"], and
|
||||
# cargo would fail.
|
||||
#ifndef REPLACE_NAME
|
||||
[source.vendored-sources]
|
||||
directory = "../third_party/rust"
|
||||
#endif
|
||||
|
||||
# Thankfully, @REPLACE_NAME@ is unlikely to be a legitimate source, so
|
||||
# cargo will ignore it when it's here verbatim.
|
||||
#filter substitution
|
||||
[source."@REPLACE_NAME@"]
|
||||
directory = "@top_srcdir@/@VENDORED_DIRECTORY@"
|
||||
"""
|
||||
|
||||
gkrust_template = """
|
||||
[package]
|
||||
name = "gkrust"
|
||||
version = "0.1.0"
|
||||
|
||||
[lib]
|
||||
path = "src/lib.rs"
|
||||
crate-type = ["staticlib"]
|
||||
test = false
|
||||
doctest = false
|
||||
bench = false
|
||||
doc = false
|
||||
plugin = false
|
||||
harness = false
|
||||
|
||||
{dependencies}
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
normal = ["mozilla-central-workspace-hack"]
|
||||
"""
|
||||
|
||||
workspace_template = """
|
||||
[package]
|
||||
name = "mozilla-central-workspace-hack"
|
||||
version = "0.1.0"
|
||||
license = "MPL-2.0"
|
||||
description = "Thunderbird extensions to mozilla-central-workspace-hack"
|
||||
|
||||
[features]
|
||||
{features}
|
||||
|
||||
[workspace]
|
||||
members = {members}
|
||||
|
||||
[workspace.dependencies]
|
||||
{dependencies}
|
||||
|
||||
{patches}
|
||||
"""
|
||||
|
||||
|
||||
class CargoFile:
|
||||
"""
|
||||
Simple abstraction of a Cargo.toml file
|
||||
"""
|
||||
|
||||
# Direct dependencies
|
||||
dependencies = None
|
||||
|
||||
name = None
|
||||
|
||||
# Identity -> Patch
|
||||
patches = None
|
||||
|
||||
# Full filename of this cargo file
|
||||
filename = None
|
||||
features = None
|
||||
|
||||
workspace_members = None
|
||||
workspace_deps = None
|
||||
our_directory = None
|
||||
|
||||
def __init__(self, filename):
|
||||
self.our_directory = os.path.dirname(filename)
|
||||
self.dependencies = dict()
|
||||
self.patches = dict()
|
||||
self.filename = filename
|
||||
self.workspace_members = list()
|
||||
self.workspace_deps = dict()
|
||||
self.features = dict()
|
||||
|
||||
data = TOMLFile(filename).read()
|
||||
|
||||
for section in data:
|
||||
if section == "package":
|
||||
if "name" in data[section]:
|
||||
self.name = data[section]["name"]
|
||||
if section == "patch":
|
||||
for block in data[section]:
|
||||
self._handle_patches(block, data[section][block])
|
||||
elif section == "dependencies":
|
||||
self.dependencies.update(self._handle_dependencies(data[section]))
|
||||
pass
|
||||
elif section == "workspace":
|
||||
self._handle_workspace(data[section])
|
||||
elif section == "features":
|
||||
self.features = data["features"]
|
||||
|
||||
def _handle_dependencies(self, data):
|
||||
"""Store each dependnency"""
|
||||
deps = dict()
|
||||
|
||||
for id in data:
|
||||
dep = data[id]
|
||||
# Direct version field
|
||||
if isinstance(dep, str):
|
||||
dep = {"version": dep}
|
||||
if "path" in dep:
|
||||
path = os.path.abspath(os.path.join(self.our_directory, dep["path"]))
|
||||
dep["path"] = path
|
||||
deps[id] = dep
|
||||
|
||||
return deps
|
||||
|
||||
def _handle_patches(self, identity, data):
|
||||
"""identity = crates-io, etc."""
|
||||
patches = dict()
|
||||
|
||||
for id in data:
|
||||
patch = data[id]
|
||||
if "path" in patch:
|
||||
path = os.path.abspath(os.path.join(self.our_directory, patch["path"]))
|
||||
patch["path"] = path
|
||||
patches[id] = patch
|
||||
|
||||
if identity in self.patches:
|
||||
self.patches[identity].update(patches)
|
||||
else:
|
||||
self.patches[identity] = patches
|
||||
|
||||
def _handle_workspace(self, data):
|
||||
if "dependencies" in data:
|
||||
self.workspace_deps.update(self._handle_dependencies(data["dependencies"]))
|
||||
|
||||
if "members" in data:
|
||||
self.workspace_members = data["members"]
|
||||
|
||||
|
||||
def regen_toml_files(command_context, workspace):
|
||||
"""
|
||||
Regenerate the TOML files within the gkrust workspace
|
||||
"""
|
||||
mc_workspace_toml = os.path.join(command_context.topsrcdir, "Cargo.toml")
|
||||
mc_gkrust_toml = os.path.join(
|
||||
command_context.topsrcdir, "toolkit", "library", "rust", "shared", "Cargo.toml"
|
||||
)
|
||||
|
||||
mc_workspace = CargoFile(mc_workspace_toml)
|
||||
mc_gkrust = CargoFile(mc_gkrust_toml)
|
||||
|
||||
comm_gkrust_toml = os.path.join(workspace, "gkrust", "Cargo.toml")
|
||||
comm_gkrust_dir = os.path.dirname(comm_gkrust_toml)
|
||||
comm_workspace_toml = os.path.join(workspace, "Cargo.toml")
|
||||
|
||||
# Grab existing features/members
|
||||
comm_workspace = CargoFile(comm_workspace_toml)
|
||||
features = comm_workspace.features
|
||||
members = comm_workspace.workspace_members
|
||||
|
||||
# Preserve original deps to gkrust (path = relative)
|
||||
comm_gkrust = CargoFile(comm_gkrust_toml)
|
||||
local_deps = dict()
|
||||
for dep_id in comm_gkrust.dependencies:
|
||||
dep = comm_gkrust.dependencies[dep_id]
|
||||
if "path" not in dep:
|
||||
continue
|
||||
path = os.path.abspath(os.path.join(workspace, dep["path"]))
|
||||
if os.path.dirname(path) == workspace:
|
||||
local_deps[dep_id] = dep
|
||||
|
||||
# Deps copied from gkrust-shared
|
||||
global_deps = mc_gkrust.dependencies
|
||||
keys = [
|
||||
x
|
||||
for x in global_deps.keys()
|
||||
if x != "mozilla-central-workspace-hack" and x != "gkrust-shared"
|
||||
]
|
||||
keys.sort()
|
||||
global_deps.update(local_deps)
|
||||
|
||||
patches = mc_workspace.patches
|
||||
del patches["crates-io"]["mozilla-central-workspace-hack"]
|
||||
|
||||
global_deps["mozilla-central-workspace-hack"] = {
|
||||
"version": "0.1",
|
||||
"features": ["gkrust"],
|
||||
"optional": True,
|
||||
}
|
||||
global_deps["gkrust-shared"] = {
|
||||
"version": "0.1.0",
|
||||
"path": os.path.join(command_context.topsrcdir, "toolkit", "library", "rust", "shared"),
|
||||
}
|
||||
for i in local_deps.keys():
|
||||
keys.insert(0, i)
|
||||
|
||||
keys.insert(0, "gkrust-shared")
|
||||
keys.insert(0, "mozilla-central-workspace-hack")
|
||||
|
||||
dependencies = "[dependencies]\n"
|
||||
for key in keys:
|
||||
data = global_deps[key]
|
||||
# Rewrite paths relative to us.
|
||||
if "path" in data:
|
||||
data["path"] = os.path.relpath(data["path"], comm_gkrust_dir)
|
||||
if "default_features" in data:
|
||||
del data["default_features"]
|
||||
elif "default-features" in data:
|
||||
del data["default-features"]
|
||||
dependencies += inline_encoded_toml(key, data) + "\n"
|
||||
|
||||
with open(comm_gkrust_toml, "w") as cargo:
|
||||
cargo.write(gkrust_template.format(dependencies=dependencies.strip()))
|
||||
|
||||
workspace_members = members
|
||||
workspace_patches = ""
|
||||
workspace_dependencies = ""
|
||||
|
||||
for dep in mc_workspace.workspace_deps:
|
||||
workspace_dependencies += inline_encoded_toml(dep, mc_workspace.workspace_deps[dep])
|
||||
|
||||
# Patch emission
|
||||
for section in patches:
|
||||
data = patches[section]
|
||||
if ":/" in section:
|
||||
section = f'"{section}"'
|
||||
workspace_patches += f"[patch.{section}]\n"
|
||||
if section == "crates-io":
|
||||
workspace_patches += (
|
||||
inline_encoded_toml("mozilla-central-workspace-hack", {"path": "."}) + "\n"
|
||||
)
|
||||
for id in data:
|
||||
patch = data[id]
|
||||
if "path" in patch:
|
||||
patch["path"] = os.path.relpath(patch["path"], workspace)
|
||||
workspace_patches += inline_encoded_toml(id, patch) + "\n"
|
||||
workspace_patches += "\n"
|
||||
|
||||
with open(comm_workspace_toml, "w") as cargo:
|
||||
cargo_toml = (
|
||||
workspace_template.format(
|
||||
dependencies=workspace_dependencies,
|
||||
members=workspace_members,
|
||||
features=tomlkit.dumps(features),
|
||||
patches=workspace_patches,
|
||||
).strip()
|
||||
+ "\n"
|
||||
)
|
||||
cargo.write(cargo_toml)
|
||||
|
||||
|
||||
def run_cargo_update(workspace):
|
||||
"""
|
||||
Run cargo to regenerate the lockfile
|
||||
"""
|
||||
subprocess.run(
|
||||
[
|
||||
"cargo",
|
||||
"update",
|
||||
"-p",
|
||||
"gkrust",
|
||||
],
|
||||
cwd=workspace,
|
||||
check=True,
|
||||
)
|
||||
|
||||
|
||||
def inline_encoded_toml(id, data):
|
||||
"""
|
||||
Write nice looking TOML keys automatically for easier to review changes
|
||||
"""
|
||||
if isinstance(data, str):
|
||||
return f'{id} = "{data}"'
|
||||
ret = f"{id} = {{"
|
||||
for idx, key in enumerate(data):
|
||||
if isinstance(data[key], bool):
|
||||
value = (str(data[key])).lower()
|
||||
elif isinstance(data[key], list):
|
||||
value = str(data[key])
|
||||
else:
|
||||
value = '"' + data[key] + '"'
|
||||
if idx > 0:
|
||||
ret += ", "
|
||||
else:
|
||||
ret += " "
|
||||
ret += f"{key} = {value}"
|
||||
return ret + " }"
|
|
@ -0,0 +1,124 @@
|
|||
[source.crates-io]
|
||||
replace-with = "vendored-sources"
|
||||
|
||||
[source."git+https://github.com/FirefoxGraphics/aa-stroke?rev=ed4206ea11703580cd1d4fc63371a527b29d8252"]
|
||||
git = "https://github.com/FirefoxGraphics/aa-stroke"
|
||||
rev = "ed4206ea11703580cd1d4fc63371a527b29d8252"
|
||||
replace-with = "vendored-sources"
|
||||
|
||||
[source."git+https://github.com/FirefoxGraphics/wpf-gpu-raster?rev=99979da091fd58fba8477e7fcdf5ec0727102916"]
|
||||
git = "https://github.com/FirefoxGraphics/wpf-gpu-raster"
|
||||
rev = "99979da091fd58fba8477e7fcdf5ec0727102916"
|
||||
replace-with = "vendored-sources"
|
||||
|
||||
[source."git+https://github.com/chris-zen/coremidi.git?rev=fc68464b5445caf111e41f643a2e69ccce0b4f83"]
|
||||
git = "https://github.com/chris-zen/coremidi.git"
|
||||
rev = "fc68464b5445caf111e41f643a2e69ccce0b4f83"
|
||||
replace-with = "vendored-sources"
|
||||
|
||||
[source."git+https://github.com/franziskuskiefer/cose-rust?rev=43c22248d136c8b38fe42ea709d08da6355cf04b"]
|
||||
git = "https://github.com/franziskuskiefer/cose-rust"
|
||||
rev = "43c22248d136c8b38fe42ea709d08da6355cf04b"
|
||||
replace-with = "vendored-sources"
|
||||
|
||||
[source."git+https://github.com/gfx-rs/wgpu?rev=ff7b2c399301cca9bcbc5b19a869feb3c29ef785"]
|
||||
git = "https://github.com/gfx-rs/wgpu"
|
||||
rev = "ff7b2c399301cca9bcbc5b19a869feb3c29ef785"
|
||||
replace-with = "vendored-sources"
|
||||
|
||||
[source."git+https://github.com/hsivonen/chardetng?rev=3484d3e3ebdc8931493aa5df4d7ee9360a90e76b"]
|
||||
git = "https://github.com/hsivonen/chardetng"
|
||||
rev = "3484d3e3ebdc8931493aa5df4d7ee9360a90e76b"
|
||||
replace-with = "vendored-sources"
|
||||
|
||||
[source."git+https://github.com/hsivonen/chardetng_c?rev=ed8a4c6f900a90d4dbc1d64b856e61490a1c3570"]
|
||||
git = "https://github.com/hsivonen/chardetng_c"
|
||||
rev = "ed8a4c6f900a90d4dbc1d64b856e61490a1c3570"
|
||||
replace-with = "vendored-sources"
|
||||
|
||||
[source."git+https://github.com/jfkthame/mapped_hyph.git?rev=c7651a0cffff41996ad13c44f689bd9cd2192c01"]
|
||||
git = "https://github.com/jfkthame/mapped_hyph.git"
|
||||
rev = "c7651a0cffff41996ad13c44f689bd9cd2192c01"
|
||||
replace-with = "vendored-sources"
|
||||
|
||||
[source."git+https://github.com/mozilla-spidermonkey/jsparagus?rev=64ba08e24749616de2344112f226d1ef4ba893ae"]
|
||||
git = "https://github.com/mozilla-spidermonkey/jsparagus"
|
||||
rev = "64ba08e24749616de2344112f226d1ef4ba893ae"
|
||||
replace-with = "vendored-sources"
|
||||
|
||||
[source."git+https://github.com/mozilla/application-services?rev=c82bccfa500813f273f4db0ead64fc73bfa2b34c"]
|
||||
git = "https://github.com/mozilla/application-services"
|
||||
rev = "c82bccfa500813f273f4db0ead64fc73bfa2b34c"
|
||||
replace-with = "vendored-sources"
|
||||
|
||||
[source."git+https://github.com/mozilla/audioipc?rev=6be424d75f1367e70f2f5ddcacd6d0237e81a6a9"]
|
||||
git = "https://github.com/mozilla/audioipc"
|
||||
rev = "6be424d75f1367e70f2f5ddcacd6d0237e81a6a9"
|
||||
replace-with = "vendored-sources"
|
||||
|
||||
[source."git+https://github.com/mozilla/cubeb-coreaudio-rs?rev=5d779af33219625a510df6bbc48a641b8a70bbc5"]
|
||||
git = "https://github.com/mozilla/cubeb-coreaudio-rs"
|
||||
rev = "5d779af33219625a510df6bbc48a641b8a70bbc5"
|
||||
replace-with = "vendored-sources"
|
||||
|
||||
[source."git+https://github.com/mozilla/cubeb-pulse-rs?rev=c04c4d2c7f2291cb81a1c48f5a8c425748f18cd8"]
|
||||
git = "https://github.com/mozilla/cubeb-pulse-rs"
|
||||
rev = "c04c4d2c7f2291cb81a1c48f5a8c425748f18cd8"
|
||||
replace-with = "vendored-sources"
|
||||
|
||||
[source."git+https://github.com/mozilla/midir.git?rev=519e651241e867af3391db08f9ae6400bc023e18"]
|
||||
git = "https://github.com/mozilla/midir.git"
|
||||
rev = "519e651241e867af3391db08f9ae6400bc023e18"
|
||||
replace-with = "vendored-sources"
|
||||
|
||||
[source."git+https://github.com/mozilla/mp4parse-rust?rev=d262e40e7b80f949dcdb4db21caa6dbf1a8b2043"]
|
||||
git = "https://github.com/mozilla/mp4parse-rust"
|
||||
rev = "d262e40e7b80f949dcdb4db21caa6dbf1a8b2043"
|
||||
replace-with = "vendored-sources"
|
||||
|
||||
[source."git+https://github.com/mozilla/neqo?tag=v0.6.8"]
|
||||
git = "https://github.com/mozilla/neqo"
|
||||
tag = "v0.6.8"
|
||||
replace-with = "vendored-sources"
|
||||
|
||||
[source."git+https://github.com/mozilla/uniffi-rs.git?rev=c0e64b839018728d8153ce1758d391b7782e2e21"]
|
||||
git = "https://github.com/mozilla/uniffi-rs.git"
|
||||
rev = "c0e64b839018728d8153ce1758d391b7782e2e21"
|
||||
replace-with = "vendored-sources"
|
||||
|
||||
[source."git+https://github.com/rust-lang/rust-bindgen?rev=86f3dbe846020e2ba573d6eb38d1434d0cbcbb40"]
|
||||
git = "https://github.com/rust-lang/rust-bindgen"
|
||||
rev = "86f3dbe846020e2ba573d6eb38d1434d0cbcbb40"
|
||||
replace-with = "vendored-sources"
|
||||
|
||||
[source."git+https://github.com/seanmonstar/warp?rev=9d081461ae1167eb321585ce424f4fef6cf0092b"]
|
||||
git = "https://github.com/seanmonstar/warp"
|
||||
rev = "9d081461ae1167eb321585ce424f4fef6cf0092b"
|
||||
replace-with = "vendored-sources"
|
||||
|
||||
[source."git+https://github.com/servo/rust-cssparser?rev=aaa966d9d6ae70c4b8a62bb5e3a14c068bb7dff0"]
|
||||
git = "https://github.com/servo/rust-cssparser"
|
||||
rev = "aaa966d9d6ae70c4b8a62bb5e3a14c068bb7dff0"
|
||||
replace-with = "vendored-sources"
|
||||
|
||||
|
||||
# Take advantage of the fact that cargo will treat lines starting with #
|
||||
# as comments to add preprocessing directives. This file can thus by copied
|
||||
# as-is to $topsrcdir/.cargo/config with no preprocessing to be used there
|
||||
# (for e.g. independent tasks building rust code), or be preprocessed by
|
||||
# the build system to produce a .cargo/config with the right content.
|
||||
#define REPLACE_NAME vendored-sources
|
||||
#define VENDORED_DIRECTORY comm/third_party/rust
|
||||
# We explicitly exclude the following section when preprocessing because
|
||||
# it would overlap with the preprocessed [source."@REPLACE_NAME@"], and
|
||||
# cargo would fail.
|
||||
#ifndef REPLACE_NAME
|
||||
[source.vendored-sources]
|
||||
directory = "../third_party/rust"
|
||||
#endif
|
||||
|
||||
# Thankfully, @REPLACE_NAME@ is unlikely to be a legitimate source, so
|
||||
# cargo will ignore it when it's here verbatim.
|
||||
#filter substitution
|
||||
[source."@REPLACE_NAME@"]
|
||||
directory = "@top_srcdir@/@VENDORED_DIRECTORY@"
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,77 @@
|
|||
[package]
|
||||
name = "mozilla-central-workspace-hack"
|
||||
version = "0.1.0"
|
||||
license = "MPL-2.0"
|
||||
description = "Thunderbird extensions to mozilla-central-workspace-hack"
|
||||
|
||||
[features]
|
||||
gkrust = []
|
||||
|
||||
|
||||
[workspace]
|
||||
members = ['gkrust']
|
||||
|
||||
[workspace.dependencies]
|
||||
uniffi = { version = "0.24.3" }
|
||||
|
||||
[patch.crates-io]
|
||||
mozilla-central-workspace-hack = { path = "." }
|
||||
cmake = { path = "../../build/rust/cmake" }
|
||||
vcpkg = { path = "../../build/rust/vcpkg" }
|
||||
mozbuild = { path = "../../build/rust/mozbuild" }
|
||||
windows-targets = { path = "../../build/rust/windows-targets" }
|
||||
oslog = { path = "../../build/rust/oslog" }
|
||||
terminal_size = { path = "../../build/rust/terminal_size" }
|
||||
bitflags = { path = "../../build/rust/bitflags" }
|
||||
memmap2 = { path = "../../build/rust/memmap2" }
|
||||
cfg-if = { path = "../../build/rust/cfg-if" }
|
||||
serde_with = { path = "../../build/rust/serde_with" }
|
||||
redox_users = { path = "../../build/rust/redox_users" }
|
||||
redox_syscall = { path = "../../build/rust/redox_syscall" }
|
||||
tinyvec = { path = "../../build/rust/tinyvec" }
|
||||
base64 = { path = "../../build/rust/base64" }
|
||||
wasi = { path = "../../build/rust/wasi" }
|
||||
backtrace = { path = "../../build/rust/backtrace" }
|
||||
bindgen_0_63 = { package = "bindgen", path = "../../build/rust/bindgen-0.63" }
|
||||
bindgen_0_64 = { package = "bindgen", path = "../../build/rust/bindgen-0.64" }
|
||||
bindgen = { path = "../../build/rust/bindgen" }
|
||||
bindgen_0_69 = { package = "bindgen", git = "https://github.com/rust-lang/rust-bindgen", rev = "86f3dbe846020e2ba573d6eb38d1434d0cbcbb40" }
|
||||
nix = { path = "../../build/rust/nix" }
|
||||
indexmap = { path = "../../build/rust/indexmap" }
|
||||
derive_more = { path = "../../build/rust/derive_more" }
|
||||
autocfg = { path = "../../third_party/rust/autocfg" }
|
||||
goblin = { path = "../../build/rust/goblin" }
|
||||
memoffset = { path = "../../build/rust/memoffset" }
|
||||
js-sys = { path = "../../build/rust/dummy-web/js-sys" }
|
||||
wasm-bindgen = { path = "../../build/rust/dummy-web/wasm-bindgen" }
|
||||
web-sys = { path = "../../build/rust/dummy-web/web-sys" }
|
||||
moz_asserts = { path = "../../mozglue/static/rust/moz_asserts" }
|
||||
rure = { path = "../../third_party/rust/rure" }
|
||||
cssparser = { git = "https://github.com/servo/rust-cssparser", rev = "aaa966d9d6ae70c4b8a62bb5e3a14c068bb7dff0" }
|
||||
cssparser-macros = { git = "https://github.com/servo/rust-cssparser", rev = "aaa966d9d6ae70c4b8a62bb5e3a14c068bb7dff0" }
|
||||
chardetng = { git = "https://github.com/hsivonen/chardetng", rev = "3484d3e3ebdc8931493aa5df4d7ee9360a90e76b" }
|
||||
chardetng_c = { git = "https://github.com/hsivonen/chardetng_c", rev = "ed8a4c6f900a90d4dbc1d64b856e61490a1c3570" }
|
||||
coremidi = { git = "https://github.com/chris-zen/coremidi.git", rev = "fc68464b5445caf111e41f643a2e69ccce0b4f83" }
|
||||
cose = { git = "https://github.com/franziskuskiefer/cose-rust", rev = "43c22248d136c8b38fe42ea709d08da6355cf04b" }
|
||||
firefox-on-glean = { path = "../../toolkit/components/glean/api" }
|
||||
icu_capi = { path = "../../intl/icu_capi" }
|
||||
icu_segmenter_data = { path = "../../intl/icu_segmenter_data" }
|
||||
libudev-sys = { path = "../../dom/webauthn/libudev-sys" }
|
||||
midir = { git = "https://github.com/mozilla/midir.git", rev = "519e651241e867af3391db08f9ae6400bc023e18" }
|
||||
warp = { git = "https://github.com/seanmonstar/warp", rev = "9d081461ae1167eb321585ce424f4fef6cf0092b" }
|
||||
malloc_size_of_derive = { path = "../../xpcom/rust/malloc_size_of_derive" }
|
||||
interrupt-support = { git = "https://github.com/mozilla/application-services", rev = "c82bccfa500813f273f4db0ead64fc73bfa2b34c" }
|
||||
sql-support = { git = "https://github.com/mozilla/application-services", rev = "c82bccfa500813f273f4db0ead64fc73bfa2b34c" }
|
||||
suggest = { git = "https://github.com/mozilla/application-services", rev = "c82bccfa500813f273f4db0ead64fc73bfa2b34c" }
|
||||
sync15 = { git = "https://github.com/mozilla/application-services", rev = "c82bccfa500813f273f4db0ead64fc73bfa2b34c" }
|
||||
tabs = { git = "https://github.com/mozilla/application-services", rev = "c82bccfa500813f273f4db0ead64fc73bfa2b34c" }
|
||||
viaduct = { git = "https://github.com/mozilla/application-services", rev = "c82bccfa500813f273f4db0ead64fc73bfa2b34c" }
|
||||
webext-storage = { git = "https://github.com/mozilla/application-services", rev = "c82bccfa500813f273f4db0ead64fc73bfa2b34c" }
|
||||
mio = { path = "../../third_party/rust/mio-0.6.23" }
|
||||
|
||||
[patch."https://github.com/mozilla/uniffi-rs.git"]
|
||||
uniffi = "=0.24.3"
|
||||
uniffi_bindgen = "=0.24.3"
|
||||
uniffi_build = "=0.24.3"
|
||||
uniffi_macros = "=0.24.3"
|
||||
weedle2 = "=4.0.0"
|
|
@ -0,0 +1,106 @@
|
|||
|
||||
[package]
|
||||
name = "gkrust"
|
||||
version = "0.1.0"
|
||||
|
||||
[lib]
|
||||
path = "src/lib.rs"
|
||||
crate-type = ["staticlib"]
|
||||
test = false
|
||||
doctest = false
|
||||
bench = false
|
||||
doc = false
|
||||
plugin = false
|
||||
harness = false
|
||||
|
||||
[dependencies]
|
||||
mozilla-central-workspace-hack = { version = "0.1", features = ['gkrust'], optional = true }
|
||||
gkrust-shared = { version = "0.1.0", path = "../../../toolkit/library/rust/shared" }
|
||||
aa-stroke = { git = "https://github.com/FirefoxGraphics/aa-stroke", rev = "ed4206ea11703580cd1d4fc63371a527b29d8252" }
|
||||
app_services_logger = { path = "../../../services/common/app_services_logger" }
|
||||
audio_thread_priority = { version = "0.30" }
|
||||
audioipc2-client = { git = "https://github.com/mozilla/audioipc", rev = "6be424d75f1367e70f2f5ddcacd6d0237e81a6a9", optional = true }
|
||||
audioipc2-server = { git = "https://github.com/mozilla/audioipc", rev = "6be424d75f1367e70f2f5ddcacd6d0237e81a6a9", optional = true }
|
||||
authrs_bridge = { path = "../../../dom/webauthn/authrs_bridge" }
|
||||
binary_http = { path = "../../../netwerk/protocol/http/binary_http" }
|
||||
bitsdownload = { path = "../../../toolkit/components/bitsdownload", optional = true }
|
||||
bookmark_sync = { path = "../../../toolkit/components/places/bookmark_sync", optional = true }
|
||||
cascade_bloom_filter = { path = "../../../toolkit/components/cascade_bloom_filter" }
|
||||
cert_storage = { path = "../../../security/manager/ssl/cert_storage" }
|
||||
chardetng_c = { version = "0.1.1" }
|
||||
cose-c = { version = "0.1.5" }
|
||||
crypto_hash = { path = "../../../security/manager/ssl/crypto_hash" }
|
||||
cubeb-coreaudio = { git = "https://github.com/mozilla/cubeb-coreaudio-rs", rev = "5d779af33219625a510df6bbc48a641b8a70bbc5", optional = true }
|
||||
cubeb-pulse = { git = "https://github.com/mozilla/cubeb-pulse-rs", rev = "c04c4d2c7f2291cb81a1c48f5a8c425748f18cd8", optional = true, features = ['pulse-dlopen'] }
|
||||
cubeb-sys = { version = "0.10.3", optional = true, features = ['gecko-in-tree'] }
|
||||
dap_ffi = { path = "../../../toolkit/components/telemetry/dap/ffi" }
|
||||
data-encoding-ffi = { path = "../../../dom/fs/parent/rust/data-encoding-ffi" }
|
||||
data_storage = { path = "../../../security/manager/ssl/data_storage" }
|
||||
dom = { path = "../../../dom/base/rust" }
|
||||
encoding_glue = { path = "../../../intl/encoding_glue" }
|
||||
fallible_collections = { version = "0.4", features = ['rust_1_57'] }
|
||||
fluent = { version = "0.16.0", features = ['fluent-pseudo'] }
|
||||
fluent-fallback = { version = "0.7.0" }
|
||||
fluent-ffi = { path = "../../../intl/l10n/rust/fluent-ffi" }
|
||||
fluent-langneg = { version = "0.13", features = ['cldr'] }
|
||||
fluent-langneg-ffi = { path = "../../../intl/locale/rust/fluent-langneg-ffi" }
|
||||
fog_control = { path = "../../../toolkit/components/glean" }
|
||||
gecko-profiler = { path = "../../../tools/profiler/rust-api" }
|
||||
gecko_logger = { path = "../../../xpcom/rust/gecko_logger" }
|
||||
geckoservo = { path = "../../../servo/ports/geckolib" }
|
||||
gkrust_utils = { path = "../../../xpcom/rust/gkrust_utils" }
|
||||
http_sfv = { path = "../../../netwerk/base/http-sfv" }
|
||||
jog = { path = "../../../toolkit/components/glean/bindings/jog" }
|
||||
jsrust_shared = { path = "../../../js/src/rust/shared" }
|
||||
kvstore = { path = "../../../toolkit/components/kvstore" }
|
||||
l10nregistry = { path = "../../../intl/l10n/rust/l10nregistry-rs" }
|
||||
l10nregistry-ffi = { path = "../../../intl/l10n/rust/l10nregistry-ffi" }
|
||||
lmdb-rkv-sys = { version = "0.11", features = ['mdb_idl_logn_9'] }
|
||||
localization-ffi = { path = "../../../intl/l10n/rust/localization-ffi" }
|
||||
log = { version = "0.4", features = ['release_max_level_info'] }
|
||||
mapped_hyph = { git = "https://github.com/jfkthame/mapped_hyph.git", rev = "c7651a0cffff41996ad13c44f689bd9cd2192c01" }
|
||||
mdns_service = { path = "../../../dom/media/webrtc/transport/mdns_service", optional = true }
|
||||
midir_impl = { path = "../../../dom/midi/midir_impl", optional = true }
|
||||
mime-guess-ffi = { path = "../../../dom/fs/parent/rust/mime-guess-ffi" }
|
||||
moz_asserts = { version = "0.1" }
|
||||
mozannotation_client = { path = "../../../toolkit/crashreporter/mozannotation_client", optional = true }
|
||||
mozannotation_server = { path = "../../../toolkit/crashreporter/mozannotation_server", optional = true }
|
||||
mozglue-static = { path = "../../../mozglue/static/rust" }
|
||||
mozurl = { path = "../../../netwerk/base/mozurl" }
|
||||
mp4parse_capi = { git = "https://github.com/mozilla/mp4parse-rust", rev = "d262e40e7b80f949dcdb4db21caa6dbf1a8b2043", features = ['missing-pixi-permitted'] }
|
||||
neqo_glue = { path = "../../../netwerk/socket/neqo_glue" }
|
||||
netwerk_helper = { path = "../../../netwerk/base/rust-helper" }
|
||||
nserror = { path = "../../../xpcom/rust/nserror" }
|
||||
nsstring = { path = "../../../xpcom/rust/nsstring" }
|
||||
oblivious_http = { path = "../../../netwerk/protocol/http/oblivious_http" }
|
||||
origin-trials-ffi = { path = "../../../dom/origin-trials/ffi" }
|
||||
oxilangtag = { version = "0.1.3" }
|
||||
oxilangtag-ffi = { path = "../../../intl/locale/rust/oxilangtag-ffi" }
|
||||
prefs_parser = { path = "../../../modules/libpref/parser" }
|
||||
processtools = { path = "../../../toolkit/components/processtools" }
|
||||
profiler_helper = { path = "../../../tools/profiler/rust-helper", optional = true }
|
||||
qcms = { path = "../../../gfx/qcms", features = ['c_bindings', 'neon'] }
|
||||
rsdparsa_capi = { path = "../../../dom/media/webrtc/sdp/rsdparsa_capi" }
|
||||
rure = { version = "0.2.2" }
|
||||
rusqlite = { version = "0.29.0", features = ['modern_sqlite', 'in_gecko'] }
|
||||
rust_minidump_writer_linux = { path = "../../../toolkit/crashreporter/rust_minidump_writer_linux", optional = true }
|
||||
static_prefs = { path = "../../../modules/libpref/init/static_prefs" }
|
||||
storage = { path = "../../../storage/rust" }
|
||||
unic-langid = { version = "0.9", features = ['likelysubtags'] }
|
||||
unic-langid-ffi = { path = "../../../intl/locale/rust/unic-langid-ffi" }
|
||||
uniffi-example-arithmetic = { git = "https://github.com/mozilla/uniffi-rs.git", rev = "c0e64b839018728d8153ce1758d391b7782e2e21", optional = true }
|
||||
uniffi-example-custom-types = { path = "../../../toolkit/components/uniffi-example-custom-types", optional = true }
|
||||
uniffi-example-geometry = { git = "https://github.com/mozilla/uniffi-rs.git", rev = "c0e64b839018728d8153ce1758d391b7782e2e21", optional = true }
|
||||
uniffi-example-rondpoint = { git = "https://github.com/mozilla/uniffi-rs.git", rev = "c0e64b839018728d8153ce1758d391b7782e2e21", optional = true }
|
||||
uniffi-example-sprites = { git = "https://github.com/mozilla/uniffi-rs.git", rev = "c0e64b839018728d8153ce1758d391b7782e2e21", optional = true }
|
||||
uniffi-example-todolist = { git = "https://github.com/mozilla/uniffi-rs.git", rev = "c0e64b839018728d8153ce1758d391b7782e2e21", optional = true }
|
||||
uniffi-fixture-callbacks = { path = "../../../toolkit/components/uniffi-fixture-callbacks", optional = true }
|
||||
uniffi-fixture-external-types = { path = "../../../toolkit/components/uniffi-fixture-external-types", optional = true }
|
||||
url = { version = "2.5.0" }
|
||||
webrender_bindings = { path = "../../../gfx/webrender_bindings" }
|
||||
wgpu_bindings = { path = "../../../gfx/wgpu_bindings" }
|
||||
wpf-gpu-raster = { git = "https://github.com/FirefoxGraphics/wpf-gpu-raster", rev = "99979da091fd58fba8477e7fcdf5ec0727102916" }
|
||||
xpcom = { path = "../../../xpcom/rust/xpcom" }
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
normal = ["mozilla-central-workspace-hack"]
|
|
@ -0,0 +1,7 @@
|
|||
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# 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/.
|
||||
|
||||
include("/toolkit/library/rust/moz.build")
|
|
@ -0,0 +1,6 @@
|
|||
/* 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/. */
|
||||
|
||||
// Add new crates to Cargo.toml and build them here to get into gkrust/libxul
|
||||
extern crate gkrust_shared;
|
|
@ -0,0 +1,94 @@
|
|||
# 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 https://mozilla.org/MPL/2.0/.
|
||||
|
||||
# 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/.
|
||||
|
||||
import logging
|
||||
import os.path
|
||||
import shutil
|
||||
import subprocess
|
||||
|
||||
from mach.decorators import Command, SubCommand
|
||||
|
||||
|
||||
@Command(
|
||||
"tb-rust",
|
||||
category="thunderbird",
|
||||
description="Manage Thunderbird Rust components",
|
||||
virtualenv_name="tb_common",
|
||||
)
|
||||
def tb_rust(command_context):
|
||||
"""
|
||||
Commands for keeping the Thunderbird Rust workspace in sync with
|
||||
the mozilla-central Rust workspace.
|
||||
|
||||
Do not rely on `cargo update` as it will bust builds.
|
||||
"""
|
||||
|
||||
|
||||
@SubCommand("tb-rust", "sync", description="Sync gkrust with mozilla-central gkrust")
|
||||
def tb_cargo_sync(command_context):
|
||||
"""
|
||||
Sync the comm/rust workspace with mozilla-central
|
||||
"""
|
||||
from rocbuild.rust import regen_toml_files, run_cargo_update
|
||||
|
||||
mc_lock = os.path.join(command_context.topsrcdir, "Cargo.lock")
|
||||
workspace = os.path.join(command_context.topsrcdir, "comm", "rust")
|
||||
our_lock = os.path.join(workspace, "Cargo.lock")
|
||||
|
||||
regen_toml_files(command_context, workspace)
|
||||
command_context.log(logging.INFO, "tb-rust", {}, f"[INFO] Syncing {mc_lock} with {our_lock}")
|
||||
shutil.copyfile(mc_lock, our_lock)
|
||||
command_context.log(logging.INFO, "tb-rust", {}, "[INFO] Updating gkrust in our workspace")
|
||||
run_cargo_update(workspace)
|
||||
|
||||
|
||||
@SubCommand("tb-rust", "vendor", description="Refresh comm/third_party/rust")
|
||||
def tb_cargo_vendor(command_context):
|
||||
"""
|
||||
Remove and refresh the vendored rust dependencies within the
|
||||
comm/third_party/rust directory.
|
||||
|
||||
Existing directories will be removed and the vendor process will
|
||||
be performed according to the lockfile.
|
||||
|
||||
Do note that the lockfile and Cargo.toml files will be synced as
|
||||
part of the process.
|
||||
"""
|
||||
from rocbuild.rust import config_footer
|
||||
|
||||
tb_cargo_sync(command_context)
|
||||
workspace = os.path.join(command_context.topsrcdir, "comm", "rust")
|
||||
config = os.path.join(workspace, ".cargo", "config.in")
|
||||
third_party = os.path.join(command_context.topsrcdir, "comm", "third_party", "rust")
|
||||
|
||||
if os.path.exists(third_party):
|
||||
command_context.log(logging.INFO, "tb-rust", {}, "[INFO] Removing comm/third_party/rust")
|
||||
shutil.rmtree(third_party)
|
||||
else:
|
||||
command_context.log(
|
||||
logging.WARNING,
|
||||
"tb-rust",
|
||||
{},
|
||||
"[WARNING] Cannot find comm/third_party/rust",
|
||||
)
|
||||
|
||||
cmd = [
|
||||
"cargo",
|
||||
"vendor",
|
||||
"-s",
|
||||
"comm/rust/Cargo.toml",
|
||||
"comm/third_party/rust",
|
||||
]
|
||||
|
||||
command_context.log(logging.INFO, "tb-rust", {}, "[INFO] Running cargo vendor")
|
||||
proc = subprocess.run(
|
||||
cmd, cwd=command_context.topsrcdir, check=True, stdout=subprocess.PIPE, encoding="utf-8"
|
||||
)
|
||||
with open(config, "w") as config_file:
|
||||
config_file.writelines([f"{x}\n" for x in proc.stdout.splitlines()[0:-2]])
|
||||
config_file.write(config_footer)
|
|
@ -0,0 +1,8 @@
|
|||
# vim: set filetype=python:
|
||||
# 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/.
|
||||
|
||||
DIRS += [
|
||||
"gkrust",
|
||||
]
|
|
@ -0,0 +1,6 @@
|
|||
/* 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/. */
|
||||
|
||||
/* This file exists to force our mozilla-central-workspace-hack override
|
||||
to work properly as a named package-workspace. Nothing needs adding to it */
|
Загрузка…
Ссылка в новой задаче