This follows Node in splitting out a base protocol for "disconnected"
events that the existing ChatListener protocol extends. It's a bit
more involved because of the helper class that keeps track of both the
listener and the ChatService, which can't be made generic because
Swift generics aren't monomorphized (and thus won't work as C function
pointers).
This is a breaking change in practice because the name of the callback
has changed (from chatServiceConnectionWasInterrupted to just
connectionWasInterrupted).
0453438d added the capability to prefer arch-specific versions of
libsignal_jni, but it turns out that some Java implementations use
"x86_64" rather than the "amd64" we expected. Rather than doing
something clever and general, just handle this one special case. If
this happens again with "arm64" vs "aarch64", we can spend more time
on it then.
Previously we tried to be Fast by allocating a big local frame, enough
references for all the recipients we parsed. However, that backfired
if there were so many recipients that we couldn't allocate the local
frame. Switch to using AutoLocal references, so we have a fixed
overhead.
One interesting consequence of this is that we can't build the array
of excluded recipients in one go; instead, we now use a helper
java.util.ArrayList that we push into. Fortunately, we only exposed a
List in the public interface anyway.
Normally we'd add these back as dev-dependencies, but in this case the
doctests are all purely syntactic -- they have
`#[cfg(ignore_even_when_running_all_tests)]` in their bodies.
Follow-up to 0453438d. Previously, setting CARGO_BUILD_TARGET before
manually calling build_jni.sh merely did a Cargo build with the same
settings as the host build. However, adding support for cross-compiles
for the server build broke this "ad hoc" cross-compilation.
Fortunately, it was used only in one place: providing both flavors of
Mac library in a built libsignal-client and libsignal-server. We can
use the *new* cross-compilation support for this instead, reducing
special cases.
This also limits the conditions where build_jni.sh will automatically
set CC and other environment variables, and allows that behavior to be
overridden by manually setting them.