Commit Graph

187 Commits

Author SHA1 Message Date
Terry Wilson e5ed55399d
android-interop-testing: Improve errror logging (#10972) 2024-03-04 11:23:17 -08:00
Terry Wilson 516f411e02
android-interop-testing: Fix tester activity layout (#10807)
Add missing inputType and lint ignore rule.
2024-01-09 13:37:06 -08:00
Eric Anderson d6830d7f99
Change many api deps to implementation deps
These look pretty fair now, mostly only exposing grpc-api and
annotations as api dependencies.
2023-12-15 15:14:29 -08:00
Jeff Davidson 45ffb06f00 Bump compileSdkVersion and finalize setAllowActivityStarts API.
Per https://developer.android.com/about/versions/14#beta-3, Android U has reached the platform stability milestone which means that all external APIs are finalized.

We can thus bump the compileSdkVersion to 34 (U) and begin using APIs added there. We leave targetSdkVersion unchanged for now to avoid the broader evaluation of whether deeper changes may be necessary as part of the upgrade; this simply allows compile-time access to newer APIs without changing runtime behavior.

See b/274061424
2023-11-07 08:01:44 -08:00
Terry Wilson 2b4f649b0a
android: Min SDK level to 21 (#10505)
Google Play has dropped support for SDK levels 19 and 20 and so can we.
2023-08-22 10:47:31 -07:00
Eric Anderson c9864a1198 android-interop-testing: Remove usage of Netty for grpc server
We have the OkHttp server these days, so we don't need to use Netty. Use
the generic API instead of hard-coding OkHttp.

We've seen some recent interop failures. We aren't entirely sure what is
going on, but we have seen some Netty usages in logcat. Since we don't
even want Netty on Android, just get rid of it and even if it doesn't
help with the failures things are better dependency-wise.
2023-08-08 14:30:32 -07:00
Eric Anderson f3f4ed4ef3 Upgrade to Gradle 8.2.1 and upgrade plugins
Most changes are migrating from conventions to the equivalent
extensions. JMH, AppEngine, and Jib plugins trigger future compatibility
warnings with `--warning-mode all`.

The movement of configurations was to allow sourceSets to create the
configurations and then we just configure them. When configurations were
before sourceSets, we'd implicitly create the configuration.

The examples were _not_ updated to the newer Gradle, although the
non-Android examples work with the newer Gradle. The Android examples
use an older Android Gradle Plugin which will need to be upgraded first.
https://github.com/grpc/grpc-java/issues/10445
2023-08-02 13:29:44 -07:00
Eric Anderson 5a0fccfae0
Rebuild Android generated code for java.lang.String (#10327)
3808e707 fixed references of String to be java.lang.String, but failed
to update the Android build.
2023-06-29 12:47:44 -07:00
Eric Anderson d654707838
buildscripts: Build Android with main build in linux_artifacts
Note that this changes the JDK used to compile releases to Java 11. That
should only impact the appearance of the Javadoc.

This adds the Android SDK to the build container, removing the
dependency on the Android SDK being available on the CI host. This
allows running on newer Kokoro images. 'Android' and 'Android interop'
CIs still depend on the Android SDK being available on the host, but
since they aren't used as part of the release process, they can more
easily migrate off Kokoro as part of future work.

This also causes Android components to now be built with -Werror, as we
use -PfailOnWarnings=true in unix.sh but were missing it from the
Android build invocations.

Gradle will auto-download the necessary version of build-tools. We don't
want to download it ourselves because the version we specify might not
even be used. Looking at logs, we were previously downloading a version
that was unused.

We now fork javac to avoid OOM. The build fails 2/3 times before the
forking, and 0/3 after.
2023-06-28 16:24:21 -07:00
Terry Wilson f3399e3d0e
android-interop-testing: Use java.util.concurrent (#10312)
Instead of the deprecated Android AsyncTask, let's use the standard
Java concurrency library with a Callable and an ExecutorService.
2023-06-26 13:32:05 -07:00
Eric Anderson e0ac97c4fd
Upgrade dependencies (#10178)
Required bumping android compile/targetSdkVersion to 33
2023-05-17 08:32:49 -07:00
Eric Anderson 3c89aa191b android-interop-testing: Avoid JRE Guava from Protobuf 22.3 upgrade
This fixes the interop test on API levels 19-23
2023-04-20 06:40:12 -07:00
Kun Zhang 97aa279ed5
test/android: fix the import for AndroidJUnit4
Everywhere else is using
androidx.test.ext.junit.runners.AndroidJUnit4, and google internally
only has that variant.
2023-03-22 11:28:16 -07:00
Ken Katagiri 915c706dec android: Add UDSChannelBuilder
Allows using Android's LocalSocket via a Socket adapter. Such an adapter
isn't generally 100% safe, since some methods may not have any effect,
but we know what methods are called by gRPC's okhttp transport and can
update the adapter or the transport as appropriate.
2023-03-10 15:28:55 -08:00
Terry Wilson b5b7cacba9
Upgrade Android Gradle plugin to 7.4.0 (#9933)
This is the latest version of the plugin supported by the Gradle version
in use at the moment (7.6).

Note that this also upgrades the R8 optimizer to a version (4.0.48) that
now uses "full mode" optimization by default.

This also splits off Android projects to run under Java 11 (Gradle
plugin requirement) while the other projects continue to run under Java
8.
2023-03-08 11:18:27 -08:00
Benjamin Peterson 4b6853b6dd
errorprone: enable UnnecessaryAnonymousClass (#9927)
The Java 7 compatibility rationale no longer holds.
2023-03-03 15:16:17 -08:00
Larry Safran 19eab29f8d
compiler: Generate interfaces for services to implement (#9688)
Introduce an AsyncService interface in the generated code and move the methods from <service>ImplBase to default implementation of the interface.
* update pom files to allow java 1.8
* Add a bindService(<service>Async) method
* Change TestServiceImpl to use the interface and include a bind method instead of extending TestServiceImplBase.
2023-02-15 10:33:44 -08:00
Eric Anderson 0ff9f37b9e Use Gradle's task configuration avoidance APIs
This can avoid creating an additional 736 tasks (previously 502 out of
1591 were not created). That's not all that important as the build time
is essentially the same, but this lets us see the poor behavior of the
protobuf plugin in our own project and increase our understanding of how
to avoid task creation when developing the plugin. Of the tasks still
being created, protobuf is the highest contributor with 165 tasks,
followed by maven-publish with 76 and appengine with 53. The remaining
59 are from our own build, but indirectly caused by maven-publish.
2022-07-08 12:16:40 -07:00
Eric Anderson b06942d63b Use Gradle's version catalog
This moves our depedencies into a plain file that can be read and
updated by tooling. While the current tooling is not particularly better
than just using gradle-versions-plugin, it should put us on better
footing. gradle-versions-plugin is actually pretty nice, but will be
incompatible with Gradle 8, so we need to wait a bit to see what the
future holds.

Left libraries as an alias for libs to reduce the commit size and make
it easier to revert if we don't end up liking this approach.

We're using Gradle 7.3.3 where it was an incubating fetaure. But in
Gradle 7.4 is became stable.
2022-06-14 14:04:10 -07:00
yifeizhuang 01ab821a06
interop-test: add orca test case (#9079)
add interop testing `orca_per_rpc` and `orca_oob`
2022-05-24 13:34:01 -07:00
Eric Anderson 5bb721e217
interop-testing: Support syncing protos from grpc-proto
Two main incompatibilities existed in the copy of protos in grpc-proto:
no SimpleContext and an Empty method argument was replaced with a
message. "Context" is a very old word for "Metadata" back from the days
before the current gRPC protocol. We don't need that message in
particular, and well-known protos actually works in Protobuf Lite these
days, so we can swap to wrappers.proto's StringValue and don't need to
upstream a change to grpc-proto. The argument problem is fixed just by
changing the type in the Java code.

With the incompatibilities fixed, do a sync from grpc-proto and include
interop-testing.
2022-05-18 14:28:20 -07:00
ZHANG Dapeng d1e0be6919
all: fix various gradle build warnings 2022-01-18 10:18:16 -08:00
Penn (Dapeng) Zhang e279479908 android-interop-testing: update androidTest/AndroidManifest.xml for multidex 2022-01-14 13:38:29 -08:00
Penn (Dapeng) Zhang 14feae81b3 android-interop-testing: migrate AndroidJUnit4 runner 2022-01-14 13:38:29 -08:00
sanjaypujare 56e9321d8a
android-interop-testing: add the linter error message ignore annotation in the source xml file (#8821) 2022-01-11 09:12:46 -08:00
ZHANG Dapeng 5ae6f9ca25
all: Upgrade Android plugin to 4.2.0
- bump android plugin version to 4.2.0
- migrate deprecated android.support dependencies to androidx dependencies
- bump `targetSdkVersion` to 29
- temporarily ignore lint error for 'MissingClass' due to #8799
- run android CIs with `-Pandroid.useAndroidX=true -Pandroid.enableJetifier=true` flags
- android examples are still using android.support dependencies, will not be updated in this PR.
2022-01-07 09:52:26 -08:00
ZHANG Dapeng 3ad4d9bfb7
all: clean up code related to android api level less than 19 2022-01-07 08:13:32 -08:00
ZHANG Dapeng 2e84b0f20a
android: bump min Android SDK version to 19 (#8583)
As Google Play Service [discontinued updates for Jelly Bean (API levels 16, 17 & 18)](https://android-developers.googleblog.com/2021/07/google-play-services-discontinuing-jelly-bean.html).
2021-10-06 10:02:32 -07:00
markb74 f57de6bd03
Make binder instrumentation tests run on kokoro. (#8563)
The tests run as part of the existing android-interop-testing job.

We needed to modify the manifest of the apk built under android-interop-testing to declare Android Services used by the binder tests.
2021-09-29 11:28:14 +02:00
apolcyn 137bdaa868
interop-testing: add soak test cases to test service client 2021-08-27 15:30:43 -07:00
Eric Anderson 0cabf5672a compiler: Add GrpcGenerated annotation to generated class
This can be used by annotation processors to avoid processing the
gRPC-generated code. The normal Generated annotation only has SOURCE
retention, so isn't available to annotation processors.

I don't include the service name within the annotation as that assumes
we'll never have need for any other type of generated class. If there's
a request for exposing service name via an annotation in the future, we
can make an RpcService annotation or the like.

Fixes #8158
2021-07-02 22:11:40 -07:00
Eric Anderson 5642e01243
Replace failOnVersionConflict() with custom requireUpperBoundDeps
failOnVersionConflict has never been good for us. It is equivalent to
Maven dependencyConvergence which we discourage our users to use because
it is too tempermental and _creates_ version skew issues over time.
However, we had no real alternative for determining if our deps would be
misinterpeted by Maven.

failOnVersionConflict has been a constant drain and makes it really hard
to do seemingly-trivial upgrades. As evidenced by protobuf/build.gradle
in this change, it also caused _us_ to introduce a version downgrade.

This introduces our own custom requireUpperBoundDeps implementation so
that we can get back to simple dependency upgrades _and_ increase our
confidence in a consistent dependency tree.
2021-06-11 14:01:18 -07:00
Chengyuan Zhang f33658a6d7
Migrate away from Jcenter (#8111)
Replaces jcenter with mavenCentral.
2021-04-22 15:59:36 -07:00
Eric Anderson a81bf14f1f Upgrade to Guava 30.1, which warns on Java 7
This change can have large impact from two aspects:
1. It calls out a _large_ impact on the _few_ Java 7 users.
2. It may have _small_ impact on the _many_ Android users.

https://github.com/grpc/grpc-java/issues/4671 tracks gRPC's removal of
Java 7 support. We are quite eager to drop Java 7 support as that would
allow using new language features like default methods. Guava is also
dropping Java 7 support and starting in 30.1 it will warn when used on
Java 7. The purpose of the warning is to help discover users that are
negatively impacted by dropping Java 7 before it becomes a bigger
problem.

The Guava logging check was implemented in such a way that there is an
optional class that uses Java 8 bytecode. While the class is optional at
runtime, the Android build system notices when dexing and fails if
Java 8 language featutres are not enabled. We believe this will not be a
problem for most Android users, but they may need to add to their build:

```
android {
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}
```

See also https://github.com/google/guava/releases/tag/v30.1
2021-04-19 09:16:00 -07:00
Eric Anderson 2e0e238fb2 okhttp: Consume mTLS and Trust/KeyManager Credentials API 2021-02-19 09:30:24 -08:00
Chengyuan Zhang ff52893c79
android-interop-testing: fix wrong instrumented test runner (#7789) 2021-01-07 11:20:24 -08:00
Chengyuan Zhang edfc0d4d02
android-interop-testing: downgrade target SDK version to 26 and eliminate androidx dependencies (#7781)
androidx.appcompat is not ready to be used internally. This change downgrades android-interop-testing's target SDK version to 26 and use android.support's appcompat instead.
2021-01-05 17:41:08 -08:00
Chengyuan Zhang 64d2bf1256
android, cronet, android-interop-testing: bump Android versions (#7740)
Bumps target SDK version of grpc-android, grpc-cronet, grpc-android-interop-testing to API 29. Major related changes are:

- Migrated android.support to androidx, which is required for Android Q.
- android.net.NetworkInfo is deprecated in SDK 29, suppressed compiler warnings as it is needed for supporting old Android versions.
- Robolectric requires Java 9+ for Android 29, which causes unit tests in grpc-cronet fail. Added annotation to emulate Android 28 for grpc-cronet's test.
- Upgraded Android dependencies accordingly in android-interop-testing.
2020-12-29 18:05:09 -08:00
ZHANG Dapeng 7d77f64773
compiler: remove some of the static imports in codegen (#7751)
Resolves #7741 
Some of the static methods in generated code have the same method name but different package name, such `ClientCalls.asyncClientStreamingCall` and `ServerCalls.asyncClientStreamingCall`. It's less readable using static import than using full-qualified method name in-place.
2020-12-23 11:28:03 -08:00
Eric Anderson 499694e9da android-interop-testing: ErrorProne should ignore generated R class
This silences many MutablePublicArray warnings that we can't do anything
about.
2020-12-17 09:13:27 -08:00
Chengyuan Zhang 05048cf3e2
interop-testing: update proto generated service files (#7682) 2020-11-30 22:49:00 -08:00
Eric Anderson a547e23f5e Migrate users of ManagedChannelBuilder.{forTarget,forAddress} to ChannelCredentials 2020-10-07 13:58:37 -05:00
Chengyuan Zhang f444b7bcc0
android, cronet, android-interop-testing, example/drop support for android SDK versions older than 16 (#7253) 2020-07-28 12:40:55 -07:00
Eric Anderson cb5ceaaaa0 interop-testing: Add integration test for RetriableStream 2020-07-09 16:46:00 -05:00
Chengyuan Zhang e16dfa03a5
android-interop-testing: remove SDK version configurations from manifest to avoid Android Studio warnings (#7128)
Android Studio gives warning: "The minSdk version should not be declared in the android manifest file". Typically minSdkVersion should be configured in build.gradle, it was set in manifest since internally we use Blaze. cl/316513856 is created to update the internal BUILD file that configures minSdkVersion.
2020-06-15 17:03:42 -07:00
ZHANG Dapeng 0044f8ce56
all: migrate gradle build to java-library plugin
- Use gradle configuration `api` for dependencies that are part of grpc public api signatures.
- Replace deprecated gradle configurations `compile`, `testCompile`, `runtime` and `testRuntime`.
- With minimal change in dependencies: If we need dep X and Y to compile our code, and if X transitively depends on Y, then our build would still pass even if we only include X as `compile`/`implementation` dependency for our project. Ideally we should include both X and Y explicitly as `implementation` dependency for our project, but in this PR we don't add the missing Y if it is previously missing.
2020-05-04 16:44:30 -07:00
Chengyuan Zhang 6c5a7df1d4
android-interop-testing: resolve build warnings (#6870)
Suppressed compiler warnings caused by protobug-javalite and errorrprone warnings from grpc-interop-testing + "throw-in-finally".
2020-03-27 17:22:58 -07:00
jiangtaoli2016 47b6b390bb update android-interop-testing ca.pem 2020-03-24 09:06:05 -10:00
Chengyuan Zhang 8d4240f480
android-interop-testing: set minSdkVersion to 14 in manifest (#6846) 2020-03-20 15:53:45 -07:00
Chengyuan Zhang d537adedb3
android-interop-testing: include android interop testing in main build (#6829)
Proto generated code for android-interop-testing is checked in.
2020-03-19 12:37:48 -07:00