Closed Bug 1860654 Opened 2 years ago Closed 2 years ago

Support Rust for Thunderbird development

Categories

(Thunderbird :: Build Config, enhancement)

enhancement

Tracking

(thunderbird_esr115 wontfix)

RESOLVED FIXED
122 Branch
Tracking Status
thunderbird_esr115 --- wontfix

People

(Reporter: ikey, Assigned: ikey)

References

(Blocks 1 open bug)

Details

Attachments

(3 files, 1 obsolete file)

In order to facilitate more modern development practices within Thunderbird, we should enable Rust for development of both libraries and xpcom crates. In order to land this work, we require upstream support by way of elimination of RustLibrary() limits (Bug 1860246).

At minimum, we must provide:

  • A custom cargo workspace within comm-central that obeys the mozilla-central-workspace-hack requirements, to eliminate unnecessary rebuilds and ensure proper dependency management
  • Support for Rust xpcom components in Thunderbird
  • Build integrations to trivially extend our own equivalent of gkrust with new crates + xpcom components
  • Simple management of the Cargo.toml - such that we can safely reuse mozilla-central crates / xpcom without requiring upstream changes to the lock file
  • Easy rebase of the toml file (python script)
  • Ease of development experience with Thunderbird+Rust to lower the complexity and cost of feature delivery while leveraging memory safety + other desirable oxide traits

Add the necessary scaffolding to Thunderbird to support the build
of Rust crates + xpcom components under a dedicated workspace that
follows mozilla-central vendorered dependencies for a sane build
approach.

The included example_xpcom tree can be built to verify the machinery
but exists purely for documentation purposes, and is excluded in all
build configurations.

The new rustbird library is built and merged with gkrust by
allowing duplicate symbol definitions (ie don't error out, and use
the gkrust-defined symbols) into the final libxul, allowing us to
implement our own downstream oxidisation efforts.

Note that this work is dependent on upstream support landing for more
than one RustLibrary within the (derived) tree:

Assignee: nobody → ikey
Status: NEW → ASSIGNED
Attachment #9359907 - Attachment is obsolete: true
Depends on: 1864624
No longer depends on: 1860246

This (admittedly extensive) modification adds a new comm/rust directory
used to build the upstream gkrust-shared library within our newly provided
gkrust Rust library.

We also expose a new dedicated workspace and vendoring system, allowing us
to add our own dependencies within the tree, and solve the issue of having
drift in Cargo.lock from mozilla-central and comm-central.

This is a vital change to unlock Rust for Thunderbird development.
Unfortunately phab will not let us push the vendored deps as they're simply
too massive. They will need vendoring (per rust/README.md) on landing this
patch.

Blocks: 1869059
Blocks: 1869063
Attachment #9363484 - Attachment description: Bug 1860654: Support Rust for Thunderbird development. r=rjl → Bug 1860654 - Support Rust for Thunderbird development. r=rjl
Depends on: 1869405

Heads up landing this patch should include (or be immediately followed by) committing the Rust vendored tree (which is too large for Phab so must be built and pushed locally). The process for this is:

  • run mach tb-rust vendor
  • add changes and new files in comm/rust, as well as comm/third_party/rust to a commit
  • push that alongside the two patches mentioned above (or immediately following the push that contains them)

Edit: try run as example: https://treeherder.mozilla.org/jobs?repo=try-comm-central&revision=3bc716e690d93b001ba8598c3eaa36cdb66e09b0

Pushed by thunderbird@calypsoblue.org:
https://hg.mozilla.org/comm-central/rev/8a0750b85f6d
Support Rust for Thunderbird development. r=rjl
https://hg.mozilla.org/comm-central/rev/71f0b3cd1905
Add vendored Rust deps. rs=me

Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Blocks: 1869653

The final patch is missing some files unfortunately. Follow-ups coming in shortly.

Status: RESOLVED → REOPENED
Resolution: FIXED → ---

Pushed by daniel@thunderbird.net:
https://hg.mozilla.org/comm-central/rev/41090156b609
Update .hgignore to allow for JetBrains .idea directories outside of root directory. r=thunderbird-build-system-reviewers,rjl
https://hg.mozilla.org/comm-central/rev/a3228aa361eb
Vendor in new application-services / Glean / UniFFI. r=thunderbird-build-system-reviewers,rjl

Status: REOPENED → RESOLVED
Closed: 2 years ago2 years ago
Resolution: --- → FIXED
Blocks: 1869860
Target Milestone: --- → 122 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: