-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Review whetstone packaging structure (#48)
* Restructure whetstone packaging to favor independent use-cases rather than whetstone layers * Rename InternalInjectApi to InternalWhetstoneApi and remove explicit targets * Merge all app modules into a single ApplicationModule * Change component functions to properties where it makes sense * Improve documentation of Whetstone methods
- Loading branch information
1 parent
062cc05
commit cb72932
Showing
35 changed files
with
174 additions
and
196 deletions.
There are no files selected for viewing
4 changes: 2 additions & 2 deletions
4
sample/src/main/java/com/deliveryhero/whetstone/sample/GeneratedComponents.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
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
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
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
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
8 changes: 1 addition & 7 deletions
8
...liveryhero/whetstone/InternalInjectApi.kt → ...eryhero/whetstone/InternalWhetstoneApi.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 |
---|---|---|
@@ -1,16 +1,10 @@ | ||
package com.deliveryhero.whetstone | ||
|
||
@Retention(value = AnnotationRetention.BINARY) | ||
@Target( | ||
AnnotationTarget.CLASS, | ||
AnnotationTarget.FUNCTION, | ||
AnnotationTarget.TYPEALIAS, | ||
AnnotationTarget.PROPERTY | ||
) | ||
@RequiresOptIn( | ||
level = RequiresOptIn.Level.ERROR, | ||
message = "This is an internal API that should not be used directly. No compatibility guarantees " + | ||
"are provided. It is recommended to report your use-case of internal API so stable API" + | ||
" could be provided instead." | ||
) | ||
public annotation class InternalInjectApi | ||
public annotation class InternalWhetstoneApi |
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
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
14 changes: 14 additions & 0 deletions
14
whetstone/src/main/java/com/deliveryhero/whetstone/activity/ActivityModule.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,14 @@ | ||
package com.deliveryhero.whetstone.activity | ||
|
||
import com.deliveryhero.whetstone.injector.MembersInjectorMap | ||
import com.squareup.anvil.annotations.ContributesTo | ||
import dagger.Module | ||
import dagger.multibindings.Multibinds | ||
|
||
@Module | ||
@ContributesTo(ActivityScope::class) | ||
public interface ActivityModule { | ||
|
||
@Multibinds | ||
public fun membersInjectors(): MembersInjectorMap | ||
} |
2 changes: 1 addition & 1 deletion
2
...veryhero/whetstone/scope/ActivityScope.kt → ...yhero/whetstone/activity/ActivityScope.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
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
2 changes: 1 addition & 1 deletion
2
...ne/component/ApplicationComponentOwner.kt → ...hetstone/app/ApplicationComponentOwner.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
39 changes: 39 additions & 0 deletions
39
whetstone/src/main/java/com/deliveryhero/whetstone/app/ApplicationModule.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,39 @@ | ||
package com.deliveryhero.whetstone.app | ||
|
||
import android.app.Application | ||
import android.content.Context | ||
import androidx.lifecycle.LifecycleOwner | ||
import androidx.lifecycle.ProcessLifecycleOwner | ||
import androidx.lifecycle.lifecycleScope | ||
import com.deliveryhero.whetstone.ForScope | ||
import com.squareup.anvil.annotations.ContributesTo | ||
import dagger.Binds | ||
import dagger.Module | ||
import dagger.Provides | ||
import kotlinx.coroutines.CoroutineScope | ||
|
||
@Module | ||
@ContributesTo(ApplicationScope::class) | ||
public interface ApplicationModule { | ||
|
||
@Binds | ||
@ForScope(ApplicationScope::class) | ||
public fun Application.bindContext(): Context | ||
|
||
public companion object { | ||
|
||
@Provides | ||
@ForScope(ApplicationScope::class) | ||
public fun provideLifecycleOwner(): LifecycleOwner { | ||
return ProcessLifecycleOwner.get() | ||
} | ||
|
||
@Provides | ||
@ForScope(ApplicationScope::class) | ||
public fun provideCoroutineScope( | ||
@ForScope(ApplicationScope::class) lifecycleOwner: LifecycleOwner | ||
): CoroutineScope { | ||
return lifecycleOwner.lifecycleScope | ||
} | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...yhero/whetstone/scope/ApplicationScope.kt → ...eryhero/whetstone/app/ApplicationScope.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
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
Oops, something went wrong.