Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify Android release support by including a jar directly #115

Open
jrose-signal opened this issue Jul 17, 2024 · 2 comments
Open

Simplify Android release support by including a jar directly #115

jrose-signal opened this issue Jul 17, 2024 · 2 comments
Labels
O-Android Work related to the Android verifier implementation

Comments

@jrose-signal
Copy link

jrose-signal commented Jul 17, 2024

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")
}
@djc
Copy link
Member

djc commented Jul 18, 2024

Cool to see that Signal is starting to use rustls-platform-verifier!

I don't have all the context here, but you might like to read through the discussion in #32.

@complexspaces complexspaces added the O-Android Work related to the Android verifier implementation label Aug 24, 2024
@Hinton
Copy link

Hinton commented Sep 12, 2024

We're also running into this issue as we distribute an android library and the consumers have understandably difficulties resolving rustls:rustls-platform-verifier:latest.release. Most likely we'll follow a similar path to above and ship the library bundled.

Hinton added a commit to bitwarden/sdk-sm that referenced this issue Sep 20, 2024
We've run into some issues related to rustls-platform-verifier
distributing an android library through their crate, which works great
if you use platform-verifier within an application. However since we
distribute an sdk, the application have difficulties locating the
android specific platform-verifier library.

To resolve this we follow the method established in
rustls/rustls-platform-verifier#115 and bundle
the classes with the library.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-Android Work related to the Android verifier implementation
Projects
None yet
Development

No branches or pull requests

4 participants