Commit Graph

36 Commits

Author SHA1 Message Date
GitHub Actions
e7dfe4142c Update artifacts branch 2024-10-08 18:11:09 +00:00
Michael
c4bbaa25f8 Fix Typos In Docs & Code Comments (#37170)
There are several typos in files within the ./examples/* directory, so just a PR to fix them

Closes #37170

PiperOrigin-RevId: 650818587
2024-07-09 18:25:39 -07:00
John Cormie
e409ca652f [build] rename android platforms to match CPU arch (#36715)
Work around for https://github.com/bazelbuild/bazel/issues/15837#issuecomment-2127758141

Fixes a problem where the example client and server APKs would build but could not be installed (`INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries`)

Closes #36715

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36715 from jdcormie:android-platforms f71e994b14b94153536f9776a3dc8a3d537180a4
PiperOrigin-RevId: 640938680
2024-06-06 10:20:05 -07:00
Ming-Chuan
d6bb391449 [Build] Migrate Android NDK, android rules and platforms (#36116)
This commit does the following 3 things for Android bazel rules, which depends on each other

1. Update NDK to 26.2.11394342 (and a few other Android things)
2. Use rules_android_ndk instead of builtin `native.android_ndk_repository`
    * `third_party/android/android_configure.bzl` was a workaround for users who don't set `$ANDROID_NDK_HOME` env var. Now with rules_android_ndk, we can declare repo without registering the toolchain. Instead users who need NDK toolchain should use `--extra_toolchains` to manually register the toolchain, as shown in README.md.
3. Migrate to platforms. See https://bazel.build/concepts/platforms
    * Currently we declares android platforms that is needed for binder transport APK. Later gRPC repo can gradually migrate to platforms for other platforms.
    * The value of `crosstool_top` will still be `//external:android/crosstool` (which is the default value), so existings android `config_settings` will still work. We should migrate them to match with `@platforms//os:android` constraint later.

The platforms migration needs Bazel 7.0 to work so we also override bazel version in testing scripts.

Closes #36116

PiperOrigin-RevId: 617244655
2024-03-19 11:46:15 -07:00
Esun Kim
5c0f349761 [Build] Bump the required CMake version to 3.13 (#35572)
We've been trying to upgrade Cmake to 3.13 or later as OSS policy bumped it. But we couldn't as Android has a weird linker error with Cmake 3.18 (you can see the error from https://github.com/grpc/grpc/pull/34331) This PR instead upgrades it to use 3.22 for Android test.

Closes #35572

PiperOrigin-RevId: 599317285
2024-01-17 16:08:53 -08:00
Jan Tattermusch
0f1afec5a8 [protobuf] Upgrade third_party/protobuf to 22.x (#32606)
The very non-trivial upgrade of third_party/protobuf to 22.x
This PR strives to be as small as possible and many changes that were
compatible with protobuf 21.x and didn't have to be merged atomically
with the upgrade were already merged.
Due to the complexity of the upgrade, this PR wasn't created
automatically by a tool, but manually. Subsequent upgraded of
third_party/protobuf with our OSS release script should work again once
this change is merged.

This is best reviewed commit-by-commit, I tried to group changes in
logical areas.

Notable changes:
- the upgrade of third_party/protobuf submodule, the bazel protobuf
dependency itself
- upgrade of UPB dependency to 22.x (in the past, we used to always
upgrade upb to "main", but upb now has release branch as well). UPB
needs to be upgraded atomically with protobuf since there's a de-facto
circular dependency (new protobuf depends on new upb, which depends on
new protobuf for codegen).
- some protobuf and upb bazel rules are now aliases, so `
extract_metadata_from_bazel_xml.py` and `gen_upb_api_from_bazel_xml.py`
had to be modified to be able to follow aliases and reach the actual
aliased targets.
- some protobuf public headers were renamed, so especially
`src/compiler` needed to be updated to use the new headers.
- protobuf and upb now both depend on utf8_range project, so since we
bundle upb with grpc in some languages, we now have to bundle utf8_range
as well (hence changes in build for python, PHP, objC, cmake etc).
- protoc now depends on absl and utf8_range (previously protobuf had
absl dependency, but not for the codegen part), so python's
make_grpcio_tools.py required partial rewrite to be able to handle those
dependencies in the grpcio_tools build.
- many updates and fixes required for C++ distribtests (currently they
all pass, but we'll probably need to follow up, make protobuf's and
grpc's handling of dependencies more aligned and revisit the
distribtests)
- bunch of other changes mostly due to overhaul of protobuf's and upb's
internal build layout.

TODOs:
- [DONE] make sure IWYU and clang_tidy_code pass
- create a list of followups (e.g. work to reenable the few tests I had
to disable and to remove workaround I had to use)
- [DONE in cl/523706129] figure out problem(s) with internal import

---------

Co-authored-by: Craig Tiller <ctiller@google.com>
2023-04-12 18:43:58 +02:00
Esun Kim
b64d623f24 CMake's better handling c++14 requirement (#31916)
* Bumped the cmake version version to 3.8

* Switch to target_compile_features for cxx_std_14

* Regen
2023-01-27 09:51:31 -08:00
Esun Kim
564a46291b Update all Debian:9 to Debian:10 (#31917) 2023-01-23 10:50:41 -08:00
Esun Kim
03e9ac6f1f Requiring C++14 (#29589) 2022-05-12 21:17:32 -07:00
Ming-Chuan
08181286e3 Add a ChannelArguments option for sepcify custom binder intent (#28723)
User can use
`grpc::ChannelArguments::SetString("grpc.binder.custom_android_intent_action_name", "...")`
to set custom binder intent.
2022-02-09 13:54:27 +08:00
Ming-Chuan
93733de253 Add SameSignatureSecurityPolicy for binder transport (#27816)
Tested signing example server and example client APKs with different
debug key, worked as intended.
2022-01-18 15:01:01 +08:00
AJ Heller
83868b695e Assert Android API >= v21 (#27943)
* Assert Android API >= v21

This precedes a change that would otherwise break on older Android APIs,
but in a more obvious way.

* error if __ANDROID_API__ is not defined

* update all Andriod minSdkVersions to 21

* csharp experimental: android-19 to 21
2021-11-05 19:04:05 -07:00
Ming-Chuan
1777ddf3c3 Add an experimental binder transport API for pre-finding Java class (#27939)
Due to limitation of JVM, when user want to create binder channel in
threads created in unmanaged native code, they will need to call this
new API first to make sure Java helper classes can correctly be found.

Unused code in jni_utils.cc are also cleaned up in this commit
2021-11-05 16:01:02 +08:00
Ming-Chuan
5c0df85ea8 [BinderTransport] Avoid depending on NdkBinder at compile time (#27912)
* [BinderTransport] Avoid depending on NdkBinder at compile time

We would like to make it possible to use BinderTransport in a APK that
has min sdk version lower than 29 (NdkBinder was introduced at 29)

We copies constants and type definitions from Ndk headers, creates a
same name wrapper for every NdkBinder API we use in
grpc_binder::ndk_util namespace.

We will try to load libbinder_ndk.so and resolve the symbol when the
NdkBinder API wrappers are invoked.

* regenerate projects

* Add GRPC_NO_BINDER guard
2021-11-05 01:40:49 +08:00
Ming-Chuan
d92baa99d6 Expose grpc++_binder through grpc++ (#27891)
A config option is provided so user can pass --define=grpc_no_binder=true to bazel, or passing `-DGRPC_NO_BINDER` to compiler to disable the dependency.
2021-11-03 23:30:17 +08:00
Ming-Chuan
e0f793b3d3 Expose experimental binder transport API (#27632)
* Expose experimental binder transport API

New headers are added
`grpcpp/create_channel_binder.h `: interfaces for creating client
channel
`grpcpp/security/binder_credentials.h`: interfaces for binder server
credentials
`grpcpp/security/binder_security_policy.h`: interfaces for binder
security policy, which is used by both server and client. Individual
security policies are merged into this single header.

Users can now depend on the `grpc++_binder` target to use the headers
listed above.

* Regenerate projects
2021-11-01 20:25:22 +08:00
Ming-Chuan
dcabe420cc [BinderTransport] Create client channel instead of direct channel (#27790)
* [BinderTransport] Create client channel instead of direct channel

In this commit we create a client channel instead of direct channel.

BinderConnector is added to connect subchannel when the user actually
make RPC call using the channel.

BindToOnDeviceServerService() is not required anymore since now the
actual connection is delay until the channel is used.

* Regenerate projects.
2021-10-28 15:52:21 +08:00
Ming-Chuan
66d4e0ccb1 Consolidate binder targets into a single target in top-level BUILD file (#27719)
* Move binder targets into a single target in top-level BUILD file

* Regenerate projects
2021-10-18 17:29:27 +08:00
Ming-Chuan
f58f903a4f Add helper function for getting endpoint binder in Java (#27598)
Also update the server side URI scheme to use path instead of authority

See gRFC L85-core-binder-transport.md for more details
2021-10-08 10:54:22 +08:00
Ming-Chuan
332713a35a Implement BinderTransport SecurityPolicies that requires no JNI (#27573)
This commit

1. Implements the security policies that does not require JNI. This
includes a security policy that always allow connection and a security
policy that allows connection when remote UID is the same us local UID.
2. Add security policy as an argument in our interfaces. Old interfaces
are temporarily preserved so compilation will not suddenly break when we
import the code to internal repo.
3. Pumping the security policy from the public interfaces to the code
that handles SETUP_TRANSPORT transaction.
4. Abort the transport setup when the security policy is not satisfied.

Since meaningful tests will require to be run in real Android
environment, we will implement it later. For now, this change is
manually tested with example APKs.

For security policies that need to invoke Java to check authorization,
we will implement them in later.
2021-10-07 00:21:51 +08:00
Ming-Chuan
4cb907457b Rename binder transport example client app (#27344)
Rename the app to exampleclient

Also moved and updated README.md
2021-09-15 13:29:29 +08:00
Craig Tiller
ea389c00c2 Adjust include order per style guide (#27175)
Introduce clang-format configuration to sort includes closer to our rules.
2021-09-08 12:14:44 -07:00
Ta-Wei Tu
3a5e844b38 [binder] Implicitly initialize the binder pool (#27261) 2021-09-07 19:27:46 -07:00
Ming-Chuan
2dfa59e898 Enable server side implementation in example binder server app (#27259) 2021-09-07 12:11:51 +08:00
Ming-Chuan
73003f8527 Add BinderTransport example server app (#27067)
Some code are commented out because the server interface has not been
merged yet.

After this, user should be able to install both apps on Android device
and test if basic unary call works or not
2021-08-30 18:26:49 +08:00
Ming-Chuan
9da755a61e Import binder transport channel create interface (#27007)
Also try use the API in example apk to make sure the binder transport
code and the rest of gRPC compiles with the Android toolchain

We will properly expose our interface later.
2021-08-20 13:03:21 +08:00
Nicolas Noble
a325d7f77a Pointing the protobuf submodule to the new URL (#26811)
* Pointing the protobuf submodule to the new URL

* Also changing WORKSPACE dependencies

* More references to the old URL...
2021-07-29 10:19:16 -07:00
Ming-Chuan
746eaf6c48 Add BinderTransport example app (#26747)
This commit adds an app that will be served as BinderTransport example
later.

Currently the app simply calls C++ function when button is pressed. In
the future the C++ function will run BinderTransport gRPC example
instead.

Tests not included in this commit, later we will add a build test to
CI to make sure this apk is always build-able. (This app will also be
used to make sure our BinderTransport implementation is compile-able
with Android toolchain, on GitHub) For now we exclude this target in
bazel build test.

Changes are made to WORKSPACE file in order to support android builds.

Build instructions are documented at
examples/android/binder/java/io/grpc/binder/cpp/example/README.md
2021-07-27 11:18:59 +08:00
Esun Kim
fc4556a92d Add ABSL_NO_XRAY_ATTRIBUTES 2020-08-28 10:59:36 -07:00
Esun Kim
32ea9af3b0 Bump Android SDK 2020-08-27 19:54:35 -07:00
Esun Kim
10d7e2fef7 Upgrade gradlewrapper to 6.5.1 2020-08-27 14:16:09 -07:00
Eric Gribkoff
10ad26f917 refer to libprotobuf directly 2018-04-03 13:32:20 -07:00
Eric Gribkoff
ffa10caf94 simplify CMake build 2018-03-30 11:10:44 -07:00
Eric Gribkoff
2d3d918db5 Fix Android build 2018-03-27 12:01:35 -07:00
Eric Gribkoff
f54e4a35fa build protoc and grpc_cpp_plugin for android kokoro job 2018-03-23 17:04:25 -07:00
Eric Gribkoff
a32a4c51f8 C++ on Android example client and server 2018-03-02 08:42:46 -08:00