Commit Graph

77 Commits

Author SHA1 Message Date
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
Eric Anderson 3ca3b9975e
android: Remove unneeded proguard rule
The methods other than forTarget() were no longer used after 493af030.
forTarget() was no longer used after cda0e9d9.
2023-11-08 14:33:48 -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
Sergii Tkachenko a294b27d52
core: Deprecate ForwardingChannelBuilder (#10587)
Deprecate `ForwardingChannelBuilder` in favor of `ForwardingChannelBuilder2`.
2023-11-02 10:58:20 -07: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 f46793e82d Remove unneeded dependency excludes
Since 44847bf4e, when we upgraded our JUnit version, the JUnit
exclusions have probably not been necessary. e0ac97c4f upgraded
Robolectric to a version that had the auto.service problem fixed.
2023-06-23 11:18:10 -07:00
Eric Anderson e0ac97c4fd
Upgrade dependencies (#10178)
Required bumping android compile/targetSdkVersion to 33
2023-05-17 08:32:49 -07:00
Terry Wilson 0005029328
android,binder,cronet: .aar file when publishing (#10138) 2023-05-05 15:21:26 -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
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
Eric Anderson 40c929e39f android: Use InternalManagedChannelProvider instead of reflection
This fixes up cda0e9d to be compatible with Proguard without
configuration. Since the methods are now accessed directly there is no
need for manual -keep configuration.
2022-03-31 11:52:57 -07:00
Eric Anderson cda0e9d996 android: Use Provider to construct OkHttpChannelBuilder
Doing any reflection on OkHttpChannelBuilder requires that all methods
can have their arguments resolved. We'd like to make okhttp an optional
dependency (to support okhttp 2 and 3/4 simultaneously). But making
okhttp optional means we can no longer construct OkHttpChannelBuilder
reflectively. We swap to the Provider that doesn't have this problem.
See #8971.

Note that ManagedChannelProvider itself only exposes its methods as
protected, so they wouldn't be accessible. However OkHttpChannelProvider
has its methods public. It is an open question of whether
ManagedChannelProvider's methods should become public, but in any case
we can hide a public OkHttpChannelProvider inside a package-private
class so it is only accessable via reflection. So this code assuming
public methods doesn't prevent future implementation hiding.
2022-03-24 14:51:57 -07:00
Eric Anderson 7a35e3bbde android: fix code style of onBlockedStatusChanged() 2022-02-09 10:28:32 -08:00
litclimbing ca4a1d8ca3
android: fix for app coming to foreground
When an app goes to the background, onBlockedStatusChanged is called with true and then called with false when it comes back to the foreground. The function onAvailable isn't called in this case and the connection wasn't being reset. Closes #8850

I noticed the comment that this is used for API versions 24+ but onBlockedStatusChanged was added in 29. I'm not sure if some kind of guard needs to be added or not.
https://developer.android.com/reference/android/net/ConnectivityManager.NetworkCallback#onBlockedStatusChanged(android.net.Network,%20boolean)
2022-02-03 15:56:43 -08:00
ZHANG Dapeng d1e0be6919
all: fix various gradle build warnings 2022-01-18 10:18:16 -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
Sumit Bhagwani 2b4a474759
Fix javadoc (#8570) 2021-09-29 13:41:32 -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
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
Chengyuan Zhang b3429ec2d9
android: make Channel always enterIdle upon network recover (#7611)
On Android, there is a race between making new RPCs and reconnecting after network comes back. If the former happens first, RPCs fail immediately. This is because resetConnectBackoff() does not update the picker before trying to reconnect and new RPCs are sent with the old picker, which fails RPCs immediately.

In this change, we move to use enterIdle(), which updates the channel picker to cause new RPCs being buffered (while subchannels are in reconnecting), at the moment network recovers. Hopefully, this can avoid RPCs being dropped prematurely in network recovery.
2020-11-17 15:27:25 -08: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
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 b06f888615
android: suppress warnings for deprecated constants in ConnectivityManager (#6835)
For Android version 28, some constants in ConnectivityManager have been deprecated such as ConnectivityManager. CONNECTIVITY_ACTION, ConnectivityManager. TYPE_WIFI, ConnectivityManager. TYPE_MOBILE, etc. In grpc-android, they are used for supporting legacy SDK connectivity state monitoring (and its unit tests). They work as intended for legacy SDK versions. So we suppress those warnings for the target SDK version 28.
2020-03-18 10:31:56 -07:00
Chengyuan Zhang 5ba663bcf6
android: add grpc-android into main build (#6793)
Add grpc-android into main build. grpc-android will be built if Gradle option skipAndroid is false. This change also migrates deprecated Robolectric methods to androidx.test methods.
2020-03-04 15:40:39 -08:00
Ran 3cd59c0b02
android: Annotate tests to use Robolectric's LEGACY LooperMode. bump roboletric to 4.3.1, truth to 1.0.1 and sdk to 28. (#6773) 2020-02-27 17:00:15 -08:00
Jihun Cho 3e9f3964c4 Start 1.29.0 development cycle 2020-02-26 09:37:27 -08:00
Eric Anderson ca56aa30d4 Start 1.28.0 development cycle 2020-01-14 15:10:05 -08:00
Tomo Suzuki 75f6fd8f10 Upgrade error_prone_annotations to 2.3.4 2020-01-03 14:50:34 -08:00
Eric Gribkoff bfa085a1cf
Start 1.27.0 development cycle (#6480) 2019-12-03 17:27:55 -08:00
Kun Zhang 47d798bbec
Start 1.26.0 development cycle (#6329) 2019-10-23 15:27:22 -07:00
Elliotte Rusty Harold e99672e03d all: Update to truth 1.0
* Update to truth 1.0
2019-09-11 08:53:18 -07:00
Chengyuan Zhang fa8f89a1a6
Start 1.25.0 development cycle (#6141) 2019-09-10 17:41:37 -07:00
Chengyuan Zhang 5fbe2ed8e8
android: final stabilization of AndroidChannelBuilder (#6097)
* Removed ExperimentalApi annotation for AndroidChannelBuilder

* Put ExperimentalApi annotation back to deprecated method.
2019-08-28 09:52:08 -07:00
Chengyuan Zhang 1e475be64d
android: deleted unused code leftover in AndroidChannelBuilder test. (#6098) 2019-08-28 09:51:44 -07:00
Chengyuan Zhang 493af030ab
android: delete deprecated API methods (#6088) 2019-08-21 16:31:36 -07:00
Chengyuan Zhang 3a9616fc25
android: clean up AndroidChannelBuilder APIs (#6083)
* Added missing Javadoc for public methods, deprecate fromBuilder and replace with usingBuilder.

* Removed unnecessary final keyword for static methods.

* call usingBuilder in deprecated fromBuilder

* Changed Javadoc description for usingBuilder method.
2019-08-19 17:21:43 -07:00
Chengyuan Zhang c521a31886
android: fix Javadoc symbol/class not found errors (#6063)
* android: fix Javadoc symbol/class not found errors

* Removed redundant join, files API can already handle list.

* Replace usage of javaCompile with javaCompileProvider

* Avoid afterEvaluate by filling javadocs.classpath in android configuration.

* Construct FileCollection via files(Closure), which delays the file resolution.
2019-08-15 12:47:14 -07:00
Eric Anderson 6c7258b05e Upgrade gradle-errorprone-plugin to 0.8.1
This fixes the following warning when building grpc-android:
WARNING: API 'variant.getJavaCompiler()' is obsolete and has been replaced with 'variant.getJavaCompileProvider()'.
It will be removed at the end of 2019.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
To determine what is calling variant.getJavaCompiler(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace.
2019-08-14 16:22:59 -05:00
ZHANG Dapeng e14f8de4ab
Start 1.24.0 development cycle 2019-07-31 11:03:13 -07:00
Jihun Cho e57d4c5a8e
Start 1.23.0 development cycle (#5899) 2019-06-18 15:54:16 -07:00
Eric Anderson be819fa3fd
android: Convert to maven-publish
com.github.dcendents:android-maven-gradle-plugin is incompatible with
Gradle 5 and the project hasn't seen any activity in over a year, so it
seems unlikely to get fixed.

We want to use maven-publish anyway, since that's what we use elsewhere.
2019-06-06 14:53:27 -07:00
Carl Mastrangelo 7657523b28
all: update to error prone 2.3.3 2019-06-05 15:28:43 -07:00
Carl Mastrangelo 409afe5867
all: update to truth 0.45 2019-06-04 21:12:21 -07:00
Eric Anderson 3aa3218fb2 Start 1.22.0 development cycle 2019-05-09 13:53:12 -07:00
Carl Mastrangelo 04e07034f3
all: update to truth 0.44 2019-04-23 10:50:49 -07:00
ZHANG Dapeng 755a22790b
android/android-interop-testing/examples: upgrade android plugin
This resolves #5523

While bumping `com.android.tools.build:gradle:3.1.2` to `3.3.0`, some other plugins/artifacts/maven repo/buildscripts have to be updated:

- gradle (wrapper) need to upgrade to 4.10.x
- protobuf gradle plugin need to bump a version compatible with gradle version.
- need add `google()` and `jcenter()` repos for android (otherwise `com.android.tools.build:aapt2:3.3.0x` and `trove4j` will not be found resp.)
- need to accept license for Android "build-tools;28.0.3" in kokoro env.
2019-04-02 14:52:27 -07:00