-
Notifications
You must be signed in to change notification settings - Fork 226
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Structured Android components (and some refactorings) (#111)
* Move android components to /android directory * Opportunistic update to Gradle 4.2.1 * Extract TestAndroidLifecycleScopeProvider to own module, rename This renames TestAndroidLifecycleScopeProvider to the more appropriate TestLifecycleOwner. Amongst other things, this makes the extensions/common dependencies only part of that artifact and not a part of the mainline artifact * Opportunistic update kotlin plugin name to newer qualified one * Switch to static creators for TestLifecycleOwner * Add autodispose-android-kotlin artifact * Add autodispose-android-archcomponents-kotlin artifact * Add autodispose-android-archcomponents-test-kotlin artifact * arch components rc1 * Build tools 26.0.2 * Add consumer proguard rules for javaxextras Resolves #112 * Common 1.0.3 + include in archcomponents This is apparently necessary for generated code * Make the test use something other than .test for name to avoid conflicts * Remove manifest, set in defaultConfig instead * Ignore restricted API warning in generated adapter code * Add generated adapter to proguard rules in case * Add convenience Function<Lifecycle.Event, Lifecycle.Event> resolver API This also simplifies the multiple constructors we had going on * Update stop check to match slinky behavior Due to a behavior change, stop events just mean it falls back to "created", which presumably could restart. To match this, I've changed the test to measure this such that if the last even was pause, we don't assume destroy, and actually just stop in onStop like normal * Remove backfilling from TestLifecycleOwner, as registry handles it now
- Loading branch information
Showing
47 changed files
with
617 additions
and
82 deletions.
There are no files selected for viewing
56 changes: 56 additions & 0 deletions
56
android/autodispose-android-archcomponents-kotlin/build.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Copyright (c) 2017. Uber Technologies | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
buildscript { | ||
repositories { | ||
jcenter() | ||
} | ||
|
||
dependencies { | ||
classpath deps.build.gradlePlugins.android | ||
classpath deps.build.gradlePlugins.kotlin | ||
} | ||
} | ||
|
||
apply plugin: 'com.android.library' | ||
apply plugin: 'org.jetbrains.kotlin.android' | ||
|
||
android { | ||
compileSdkVersion deps.build.compileSdkVersion | ||
buildToolsVersion deps.build.buildToolsVersion | ||
|
||
defaultConfig { | ||
minSdkVersion deps.build.minSdkVersion | ||
targetSdkVersion deps.build.targetSdkVersion | ||
consumerProguardFiles 'consumer-proguard-rules.txt' | ||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" | ||
} | ||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_7 | ||
targetCompatibility JavaVersion.VERSION_1_7 | ||
} | ||
sourceSets { | ||
main.java.srcDirs += 'src/main/kotlin' | ||
} | ||
} | ||
|
||
dependencies { | ||
compile deps.kotlin.stdlib | ||
compile project(':android:autodispose-android-archcomponents') | ||
androidTestCompile project(':test-utils') | ||
} | ||
|
||
apply from: rootProject.file('gradle/gradle-mvn-push.gradle') |
1 change: 1 addition & 0 deletions
1
android/autodispose-android-archcomponents-kotlin/consumer-proguard-rules.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
-dontwarn com.uber.javaxextras.** |
19 changes: 19 additions & 0 deletions
19
android/autodispose-android-archcomponents-kotlin/gradle.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# | ||
# Copyright (c) 2017. Uber Technologies | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
POM_NAME=AutoDispose (Android Architecture Components Kotlin Extensions) | ||
POM_ARTIFACT_ID=autodispose-android-archcomponents-kotlin | ||
POM_PACKAGING=aar |
17 changes: 17 additions & 0 deletions
17
android/autodispose-android-archcomponents-kotlin/src/main/AndroidManifest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!-- | ||
~ Copyright (c) 2017. Uber Technologies | ||
~ | ||
~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
~ you may not use this file except in compliance with the License. | ||
~ You may obtain a copy of the License at | ||
~ | ||
~ http://www.apache.org/licenses/LICENSE-2.0 | ||
~ | ||
~ Unless required by applicable law or agreed to in writing, software | ||
~ distributed under the License is distributed on an "AS IS" BASIS, | ||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
~ See the License for the specific language governing permissions and | ||
~ limitations under the License. | ||
--> | ||
|
||
<manifest package="com.uber.autodispose.android.lifecycle.kotlin"/> |
54 changes: 54 additions & 0 deletions
54
...lin/src/main/kotlin/com/uber/autodispose/android/lifecycle/autodisposeAndroidLifecycle.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Copyright (c) 2017. Uber Technologies | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
@file:Suppress("NOTHING_TO_INLINE") | ||
|
||
package com.uber.autodispose.android.lifecycle | ||
|
||
import android.arch.lifecycle.Lifecycle | ||
import android.arch.lifecycle.LifecycleOwner | ||
import com.uber.autodispose.LifecycleScopeProvider | ||
import io.reactivex.annotations.CheckReturnValue | ||
|
||
/** | ||
* Extension that returns a [LifecycleScopeProvider] for this [LifecycleOwner]. | ||
*/ | ||
@CheckReturnValue | ||
inline fun LifecycleOwner.scope(): LifecycleScopeProvider<*> = AndroidLifecycleScopeProvider.from(this) | ||
|
||
/** | ||
* Extension that returns a [LifecycleScopeProvider] for this [LifecycleOwner]. | ||
* | ||
* @param untilEvent the event until the scope is valid. | ||
*/ | ||
@CheckReturnValue | ||
inline fun LifecycleOwner.scope(untilEvent: Lifecycle.Event): LifecycleScopeProvider<*> | ||
= AndroidLifecycleScopeProvider.from(this, untilEvent) | ||
|
||
/** | ||
* Extension that returns a [LifecycleScopeProvider] for this [Lifecycle]. | ||
*/ | ||
@CheckReturnValue | ||
inline fun Lifecycle.scope(): LifecycleScopeProvider<*> = AndroidLifecycleScopeProvider.from(this) | ||
|
||
/** | ||
* Extension that returns a [LifecycleScopeProvider] for this [Lifecycle]. | ||
* | ||
* @param untilEvent the event until the scope is valid. | ||
*/ | ||
@CheckReturnValue | ||
inline fun Lifecycle.scope(untilEvent: Lifecycle.Event): LifecycleScopeProvider<*> | ||
= AndroidLifecycleScopeProvider.from(this, untilEvent) |
56 changes: 56 additions & 0 deletions
56
android/autodispose-android-archcomponents-test-kotlin/build.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Copyright (c) 2017. Uber Technologies | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
buildscript { | ||
repositories { | ||
jcenter() | ||
} | ||
|
||
dependencies { | ||
classpath deps.build.gradlePlugins.android | ||
classpath deps.build.gradlePlugins.kotlin | ||
} | ||
} | ||
|
||
apply plugin: 'com.android.library' | ||
apply plugin: 'org.jetbrains.kotlin.android' | ||
|
||
android { | ||
compileSdkVersion deps.build.compileSdkVersion | ||
buildToolsVersion deps.build.buildToolsVersion | ||
|
||
defaultConfig { | ||
minSdkVersion deps.build.minSdkVersion | ||
targetSdkVersion deps.build.targetSdkVersion | ||
consumerProguardFiles 'consumer-proguard-rules.txt' | ||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" | ||
} | ||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_7 | ||
targetCompatibility JavaVersion.VERSION_1_7 | ||
} | ||
sourceSets { | ||
main.java.srcDirs += 'src/main/kotlin' | ||
} | ||
} | ||
|
||
dependencies { | ||
compile deps.kotlin.stdlib | ||
compile project(':android:autodispose-android-archcomponents-test') | ||
androidTestCompile project(':test-utils') | ||
} | ||
|
||
apply from: rootProject.file('gradle/gradle-mvn-push.gradle') |
1 change: 1 addition & 0 deletions
1
android/autodispose-android-archcomponents-test-kotlin/consumer-proguard-rules.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
-dontwarn com.uber.javaxextras.** |
19 changes: 19 additions & 0 deletions
19
android/autodispose-android-archcomponents-test-kotlin/gradle.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# | ||
# Copyright (c) 2017. Uber Technologies | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
POM_NAME=AutoDispose (Android Architecture Components Test Kotlin Extensions) | ||
POM_ARTIFACT_ID=autodispose-android-archcomponents-test-kotlin | ||
POM_PACKAGING=aar |
17 changes: 17 additions & 0 deletions
17
android/autodispose-android-archcomponents-test-kotlin/src/main/AndroidManifest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!-- | ||
~ Copyright (c) 2017. Uber Technologies | ||
~ | ||
~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
~ you may not use this file except in compliance with the License. | ||
~ You may obtain a copy of the License at | ||
~ | ||
~ http://www.apache.org/licenses/LICENSE-2.0 | ||
~ | ||
~ Unless required by applicable law or agreed to in writing, software | ||
~ distributed under the License is distributed on an "AS IS" BASIS, | ||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
~ See the License for the specific language governing permissions and | ||
~ limitations under the License. | ||
--> | ||
|
||
<manifest package="com.uber.autodispose.android.lifecycle.test.kotlin"/> |
28 changes: 28 additions & 0 deletions
28
...ain/kotlin/com/uber/autodispose/android/lifecycle/test/autodisposeAndroidLifecycleTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* Copyright (c) 2017. Uber Technologies | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
@file:Suppress("NOTHING_TO_INLINE") | ||
|
||
package com.uber.autodispose.android.lifecycle.test | ||
|
||
import android.arch.lifecycle.LifecycleRegistry | ||
import io.reactivex.annotations.CheckReturnValue | ||
|
||
/** | ||
* Extension that returns a [TestLifecycleOwner] for this [LifecycleRegistry]. | ||
*/ | ||
@CheckReturnValue | ||
inline fun LifecycleRegistry.test(): TestLifecycleOwner = TestLifecycleOwner.create(this) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
android/autodispose-android-archcomponents-test/consumer-proguard-rules.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
-dontwarn com.uber.javaxextras.** |
19 changes: 19 additions & 0 deletions
19
android/autodispose-android-archcomponents-test/gradle.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# | ||
# Copyright (c) 2017. Uber Technologies | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
POM_NAME=AutoDispose (Android Architecture Components Test Extensions) | ||
POM_ARTIFACT_ID=autodispose-android-archcomponents-test | ||
POM_PACKAGING=aar |
17 changes: 17 additions & 0 deletions
17
android/autodispose-android-archcomponents-test/src/main/AndroidManifest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!-- | ||
~ Copyright (c) 2017. Uber Technologies | ||
~ | ||
~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
~ you may not use this file except in compliance with the License. | ||
~ You may obtain a copy of the License at | ||
~ | ||
~ http://www.apache.org/licenses/LICENSE-2.0 | ||
~ | ||
~ Unless required by applicable law or agreed to in writing, software | ||
~ distributed under the License is distributed on an "AS IS" BASIS, | ||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
~ See the License for the specific language governing permissions and | ||
~ limitations under the License. | ||
--> | ||
|
||
<manifest package="com.uber.autodispose.android.lifecycle.test"/> |
Oops, something went wrong.