Skip to content

Commit 0c5b35e

Browse files
authored
Fix build (#550)
1 parent 73e62fc commit 0c5b35e

51 files changed

Lines changed: 348 additions & 317 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 23 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -18,58 +18,46 @@ concurrency:
1818

1919
jobs:
2020
build:
21-
runs-on: macOS-latest
22-
env:
23-
api-level: "18"
21+
runs-on: ubuntu-latest
2422
steps:
2523
- name: Checkout
26-
uses: actions/checkout@v1
27-
28-
- name: Gradle Wrapper Validation
29-
uses: gradle/wrapper-validation-action@v1
24+
uses: actions/checkout@v6
3025

3126
- name: Install JDK
32-
uses: actions/setup-java@v2
27+
uses: actions/setup-java@v5
3328
with:
3429
distribution: 'zulu'
35-
java-version: '17'
30+
java-version: '21'
3631

37-
- name: Gradle cache
38-
uses: gradle/gradle-build-action@v2
32+
- name: Setup Gradle
33+
uses: gradle/actions/setup-gradle@v6
3934

4035
# TODO split test and instrumentation into parallel builds
4136
- name: Build and run unit tests
42-
id: gradle
43-
uses: gradle/gradle-build-action@v2
44-
with:
45-
arguments: check
37+
run: ./gradlew check
4638

47-
- name: AVD cache
48-
uses: actions/cache@v3
49-
id: avd-cache
50-
with:
51-
path: |
52-
~/.android/avd/*
53-
~/.android/adb*
54-
key: avd-${{ env.api-level }}
39+
- name: Enable KVM group perms
40+
run: |
41+
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
42+
sudo udevadm control --reload-rules
43+
sudo udevadm trigger --name-match=kvm
5544
56-
- name: Create AVD and generate snapshot for caching
57-
if: steps.avd-cache.outputs.cache-hit != 'true'
58-
uses: reactivecircus/android-emulator-runner@v2
59-
with:
60-
api-level: ${{ env.api-level }}
61-
force-avd-creation: false
62-
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
63-
disable-animations: false
64-
script: echo "Generated AVD snapshot for caching."
45+
- name: Free up disk space for the emulator
46+
run: |
47+
# Remove Haskell stuff to free up space for the emulator
48+
sudo rm -rf /usr/local/.ghcup
49+
# Remove dotnet stuff as well
50+
sudo rm -rf /usr/share/dotnet
51+
df -h
6552
6653
- name: Run instrumentation tests
6754
uses: reactivecircus/android-emulator-runner@v2
6855
with:
69-
api-level: ${{ env.api-level }}
70-
force-avd-creation: false
71-
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
56+
api-level: 35
57+
arch: x86_64
7258
disable-animations: true
59+
disk-size: 6000M
60+
heap-size: 600M
7361
script: ./gradlew connectedCheck
7462

7563
- name: (Fail-only) Upload build reports

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
Changelog
22
=========
33

4+
Unreleased
5+
----------
6+
7+
- **Fix**: Handle empty lambdas in lint checks.
8+
- **Fix**: Use `javax.inject.Inject` for newer versions of ErrorProne.
9+
- **Fix**: Properly propagate nullabiltiy in type params (i.e., `T extends @NonNull Object` vs `@NonNull T`).
10+
- Raise lint target Kotlin language version to `2.0`.
11+
- Update to RxJava `3.1.12`.
12+
- Update minSdk to `23` to match upstream AndroidX deps.
13+
- Update to Lint `32.2.1`.
14+
- Update to ErrorProne `2.49.0`.
15+
416
Version 2.2.1
517
-------------
618

android/autodispose-androidx-lifecycle/src/main/java/autodispose2/androidx/lifecycle/KotlinExtensions.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public inline fun Lifecycle.scope(
9393
@CheckReturnValue
9494
public inline fun <T : Any> Flowable<T>.autoDispose(
9595
lifecycleOwner: LifecycleOwner,
96-
untilEvent: Event? = null
96+
untilEvent: Event? = null,
9797
): FlowableSubscribeProxy<T> {
9898
return if (untilEvent == null) {
9999
this.to(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(lifecycleOwner)))
@@ -114,7 +114,7 @@ public inline fun <T : Any> Flowable<T>.autoDispose(
114114
@CheckReturnValue
115115
public inline fun <T : Any> Observable<T>.autoDispose(
116116
lifecycleOwner: LifecycleOwner,
117-
untilEvent: Event? = null
117+
untilEvent: Event? = null,
118118
): ObservableSubscribeProxy<T> {
119119
return if (untilEvent == null) {
120120
this.to(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(lifecycleOwner)))
@@ -135,7 +135,7 @@ public inline fun <T : Any> Observable<T>.autoDispose(
135135
@CheckReturnValue
136136
public inline fun <T : Any> Single<T>.autoDispose(
137137
lifecycleOwner: LifecycleOwner,
138-
untilEvent: Event? = null
138+
untilEvent: Event? = null,
139139
): SingleSubscribeProxy<T> {
140140
return if (untilEvent == null) {
141141
this.to(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(lifecycleOwner)))
@@ -156,7 +156,7 @@ public inline fun <T : Any> Single<T>.autoDispose(
156156
@CheckReturnValue
157157
public inline fun <T : Any> Maybe<T>.autoDispose(
158158
lifecycleOwner: LifecycleOwner,
159-
untilEvent: Event? = null
159+
untilEvent: Event? = null,
160160
): MaybeSubscribeProxy<T> {
161161
return if (untilEvent == null) {
162162
this.to(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(lifecycleOwner)))
@@ -177,7 +177,7 @@ public inline fun <T : Any> Maybe<T>.autoDispose(
177177
@CheckReturnValue
178178
public inline fun Completable.autoDispose(
179179
lifecycleOwner: LifecycleOwner,
180-
untilEvent: Event? = null
180+
untilEvent: Event? = null,
181181
): CompletableSubscribeProxy {
182182
return if (untilEvent == null) {
183183
this.to(AutoDispose.autoDisposable<Any>(AndroidLifecycleScopeProvider.from(lifecycleOwner)))
@@ -200,7 +200,7 @@ public inline fun Completable.autoDispose(
200200
@CheckReturnValue
201201
public inline fun <T : Any> ParallelFlowable<T>.autoDispose(
202202
lifecycleOwner: LifecycleOwner,
203-
untilEvent: Event? = null
203+
untilEvent: Event? = null,
204204
): ParallelFlowableSubscribeProxy<T> {
205205
return if (untilEvent == null) {
206206
this.to(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(lifecycleOwner)))

autodispose-interop/coroutines/src/main/kotlin/autodispose2/interop/coroutines/AutoDisposeCoroutinesInterop.kt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,13 @@ private fun CoroutineScope.asUndeferredCompletable(): Completable {
8989
?: error(
9090
"Scope cannot be created because it does not have a job: ${this@asUndeferredCompletable}"
9191
)
92-
val handle =
93-
job.invokeOnCompletion {
94-
when (it) {
95-
null,
96-
is CancellationException -> emitter.onComplete()
97-
else -> emitter.onError(it)
98-
}
92+
val handle = job.invokeOnCompletion {
93+
when (it) {
94+
null,
95+
is CancellationException -> emitter.onComplete()
96+
else -> emitter.onError(it)
9997
}
98+
}
10099
emitter.setCancellable(handle::dispose)
101100
}
102101
}

autodispose-lifecycle/src/main/java/autodispose2/lifecycle/CorrespondingEventsFunction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
*
2626
* @param <E> the event type.
2727
*/
28-
public interface CorrespondingEventsFunction<@NonNull E> extends Function<E, E> {
28+
public interface CorrespondingEventsFunction<E extends @NonNull Object> extends Function<E, E> {
2929

3030
/**
3131
* Given an event {@code event}, returns the next corresponding event that this lifecycle should

autodispose-lifecycle/src/main/java/autodispose2/lifecycle/LifecycleScopeProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
* @see LifecycleScopes
3636
*/
3737
@DoNotMock(value = "Use TestLifecycleScopeProvider instead")
38-
public interface LifecycleScopeProvider<@NonNull E> extends ScopeProvider {
38+
public interface LifecycleScopeProvider<E extends @NonNull Object> extends ScopeProvider {
3939

4040
/**
4141
* Returns a sequence of lifecycle events. Note that completion of this lifecycle will also

autodispose-lifecycle/src/main/java/autodispose2/lifecycle/LifecycleScopes.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ private LifecycleScopes() {
5252
* @throws OutsideScopeException if the {@link LifecycleScopeProvider#correspondingEvents()}
5353
* throws an {@link OutsideScopeException} during resolution.
5454
*/
55-
public static <@NonNull E> CompletableSource resolveScopeFromLifecycle(
55+
public static <E extends @NonNull Object> CompletableSource resolveScopeFromLifecycle(
5656
final LifecycleScopeProvider<E> provider) throws OutsideScopeException {
5757
return resolveScopeFromLifecycle(provider, true);
5858
}
@@ -75,7 +75,7 @@ private LifecycleScopes() {
7575
* @throws OutsideScopeException if the {@link LifecycleScopeProvider#correspondingEvents()}
7676
* throws an {@link OutsideScopeException} during resolution.
7777
*/
78-
public static <@NonNull E> CompletableSource resolveScopeFromLifecycle(
78+
public static <E extends @NonNull Object> CompletableSource resolveScopeFromLifecycle(
7979
final LifecycleScopeProvider<E> provider, final boolean checkEndBoundary)
8080
throws OutsideScopeException {
8181
E lastEvent = provider.peekLifecycle();
@@ -115,7 +115,7 @@ private LifecycleScopes() {
115115
* @param endEvent the target end event
116116
* @param <E> the lifecycle event type
117117
*/
118-
public static <@NonNull E> CompletableSource resolveScopeFromLifecycle(
118+
public static <E extends @NonNull Object> CompletableSource resolveScopeFromLifecycle(
119119
Observable<E> lifecycle, final E endEvent) {
120120
@Nullable Comparator<E> comparator = null;
121121
if (endEvent instanceof Comparable) {
@@ -134,7 +134,7 @@ private LifecycleScopes() {
134134
* @param comparator an optional comparator for checking event equality.
135135
* @param <E> the lifecycle event type
136136
*/
137-
public static <@NonNull E> CompletableSource resolveScopeFromLifecycle(
137+
public static <E extends @NonNull Object> CompletableSource resolveScopeFromLifecycle(
138138
Observable<E> lifecycle, final E endEvent, @Nullable final Comparator<E> comparator) {
139139
Predicate<E> equalityPredicate;
140140
if (comparator != null) {

autodispose/src/main/java/autodispose2/AutoDispose.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ public final class AutoDispose {
7878
* @return an {@link AutoDisposeConverter} to transform with operators like {@link
7979
* Observable#to(ObservableConverter)}
8080
*/
81-
public static <@NonNull T> AutoDisposeConverter<T> autoDisposable(final ScopeProvider provider) {
81+
public static <T extends @NonNull Object> AutoDisposeConverter<T> autoDisposable(
82+
final ScopeProvider provider) {
8283
checkNotNull(provider, "provider == null");
8384
return autoDisposable(completableOf(provider));
8485
}
@@ -99,7 +100,8 @@ public final class AutoDispose {
99100
* @return an {@link AutoDisposeConverter} to transform with operators like {@link
100101
* Observable#to(ObservableConverter)}
101102
*/
102-
public static <@NonNull T> AutoDisposeConverter<T> autoDisposable(final CompletableSource scope) {
103+
public static <T extends @NonNull Object> AutoDisposeConverter<T> autoDisposable(
104+
final CompletableSource scope) {
103105
checkNotNull(scope, "scope == null");
104106
return new AutoDisposeConverter<T>() {
105107
@Override
@@ -138,7 +140,7 @@ public void subscribe(CompletableObserver observer) {
138140
}
139141

140142
@Override
141-
public <@NonNull E extends CompletableObserver> E subscribeWith(E observer) {
143+
public <E extends @NonNull CompletableObserver> E subscribeWith(E observer) {
142144
return new AutoDisposeCompletable(upstream, scope).subscribeWith(observer);
143145
}
144146

@@ -196,7 +198,7 @@ public void subscribe(Subscriber<? super T> observer) {
196198
}
197199

198200
@Override
199-
public <@NonNull E extends Subscriber<? super T>> E subscribeWith(E observer) {
201+
public <E extends @NonNull Subscriber<? super T>> E subscribeWith(E observer) {
200202
return new AutoDisposeFlowable<>(upstream, scope).subscribeWith(observer);
201203
}
202204

@@ -263,7 +265,7 @@ public void subscribe(MaybeObserver<? super T> observer) {
263265
}
264266

265267
@Override
266-
public <@NonNull E extends MaybeObserver<? super T>> E subscribeWith(E observer) {
268+
public <E extends @NonNull MaybeObserver<? super T>> E subscribeWith(E observer) {
267269
return new AutoDisposeMaybe<>(upstream, scope).subscribeWith(observer);
268270
}
269271

@@ -321,7 +323,7 @@ public void subscribe(Observer<? super T> observer) {
321323
}
322324

323325
@Override
324-
public <@NonNull E extends Observer<? super T>> E subscribeWith(E observer) {
326+
public <E extends @NonNull Observer<? super T>> E subscribeWith(E observer) {
325327
return new AutoDisposeObservable<>(upstream, scope).subscribeWith(observer);
326328
}
327329

@@ -363,7 +365,7 @@ public Disposable subscribe(Consumer<? super T> onSuccess) {
363365
@SuppressWarnings("NullAway") // False positive
364366
@Override
365367
public Disposable subscribe(
366-
BiConsumer<@Nullable ? super T, @Nullable ? super Throwable> biConsumer) {
368+
BiConsumer<? super @Nullable T, ? super @Nullable Throwable> biConsumer) {
367369
return new AutoDisposeSingle<>(upstream, scope).subscribe(biConsumer);
368370
}
369371

@@ -379,7 +381,7 @@ public void subscribe(SingleObserver<? super T> observer) {
379381
}
380382

381383
@Override
382-
public <@NonNull E extends SingleObserver<? super T>> E subscribeWith(E observer) {
384+
public <E extends @NonNull SingleObserver<? super T>> E subscribeWith(E observer) {
383385
return new AutoDisposeSingle<>(upstream, scope).subscribeWith(observer);
384386
}
385387

autodispose/src/main/java/autodispose2/AutoDisposeConverter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
*
3030
* @param <T> the type.
3131
*/
32-
public interface AutoDisposeConverter<@NonNull T>
32+
public interface AutoDisposeConverter<T extends @NonNull Object>
3333
extends FlowableConverter<T, FlowableSubscribeProxy<T>>,
3434
ParallelFlowableConverter<T, ParallelFlowableSubscribeProxy<T>>,
3535
ObservableConverter<T, ObservableSubscribeProxy<T>>,

autodispose/src/main/java/autodispose2/AutoDisposeFlowable.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import org.reactivestreams.Publisher;
2222
import org.reactivestreams.Subscriber;
2323

24-
final class AutoDisposeFlowable<@NonNull T> extends Flowable<T>
24+
final class AutoDisposeFlowable<T extends @NonNull Object> extends Flowable<T>
2525
implements FlowableSubscribeProxy<T> {
2626
private final Publisher<T> source;
2727
private final CompletableSource scope;

0 commit comments

Comments
 (0)