rustls / rustls/rustls-platform-verifier

Simplify Android release support by including a jar directly

Open
#115 10 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

O-Android
Dominant language
Rust
Stars
158
Forks
60
Avg merge
5d 10h
Merged PRs (30d)
3

Description

The crate-local Maven repository didn't work for Signal because we use rustls-platform-verifier in a library, and our main app doesn't know about Rust at all. We determined that as long as no other library is using rustls-platform-verifier, and as long as rustls-platform-verifier's Java/Kotlin side doesn't need anything but its classes, we can slurp those classes into our library directly and everything will be fine. (And indeed, it is working for us.)

This may have some downsides for general use (the main one being that files(…) dependencies can't have metadata), but given how minimal the crate-local Maven repository is, I'm not sure they'll come up in practice. So maybe this is a simpler approach for future versions of the crate?

dependencies {
    implementation files(findRustlsPlatformVerifierClasses())
}

File findRustlsPlatformVerifierClasses() {
    def dependencyText = providers.exec {
        it.workingDir = new File("../")
        commandLine("cargo", "metadata", "--format-version", "1")
    }.standardOutput.asText.get()

    def dependencyJson = new JsonSlurper().parseText(dependencyText)
    def manifestFile = file(dependencyJson.packages.find { it.name == "rustls-platform-verifier-android" }.manifest_path)
    return new File(manifestFile.parentFile, "classes.jar")
}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with java/android/build.gradle, especially the dependency setup at lines 84-113, and compare it with the current crate-local Maven repository approach. Inspect the cargo metadata output and the rustls-platform-verifier-android classes.jar layout; done means Android release support can use the bundled classes without relying on the crate-local Maven repository.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, rust
Domain
build-system, mobile, release
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.