-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
167 additions
and
153 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
...-time.library/src/commonMain/kotlin/com/github/kitakkun/backintime/annotations/Capture.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
32 changes: 0 additions & 32 deletions
32
gradle-plugin/src/main/kotlin/com/github/kitakkun/backintime/BackInTimeExtension.kt
This file was deleted.
Oops, something went wrong.
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
15 changes: 15 additions & 0 deletions
15
...le-plugin/src/main/kotlin/com/github/kitakkun/backintime/extension/BackInTimeExtension.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,15 @@ | ||
package com.github.kitakkun.backintime.extension | ||
|
||
import com.github.kitakkun.backintime.plugin.extension.ValueContainerConfig | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
open class BackInTimeExtension( | ||
var enabled: Boolean = true, | ||
val valueContainers: MutableList<ValueContainerConfig> = mutableListOf(), | ||
) { | ||
fun valueContainers(configuration: ValueContainersScope.() -> Unit) { | ||
val scope = ValueContainersScope().apply(configuration) | ||
valueContainers.addAll(scope.containers) | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...e-plugin/src/main/kotlin/com/github/kitakkun/backintime/extension/ValueContainersScope.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,35 @@ | ||
package com.github.kitakkun.backintime.extension | ||
|
||
import com.github.kitakkun.backintime.plugin.extension.ValueContainerConfig | ||
|
||
class ValueContainersScope { | ||
var containers: MutableList<ValueContainerConfig> = mutableListOf() | ||
private set | ||
|
||
fun container(configuration: ValueContainerConfig.() -> Unit) { | ||
val config = ValueContainerConfig().apply(configuration) | ||
this.containers.add(config) | ||
} | ||
|
||
fun androidValueContainers() { | ||
container { | ||
className = "androidx.lifecycle.MutableLiveData" | ||
captures = listOf("postValue", "setValue") | ||
getter = "getValue" | ||
setter = "postValue" | ||
} | ||
container { | ||
className = "androidx.compose.runtime.MutableState" | ||
captures = listOf("<set-value>") | ||
getter = "<get-value>" | ||
setter = "<set-value>" | ||
} | ||
container { | ||
className = "kotlinx.coroutines.flow.MutableStateFlow" | ||
captures = listOf("<set-value>", "update", "updateAndGet", "getAndUpdate", "emit", "tryEmit") | ||
getter = "<get-value>" | ||
setter = "<set-value>" | ||
} | ||
} | ||
} | ||
|
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
6 changes: 2 additions & 4 deletions
6
...rc/main/kotlin/com/github/kitakkun/backintime/compiler/BackInTimeCompilerConfiguration.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,10 +1,8 @@ | ||
package com.github.kitakkun.backintime.compiler | ||
|
||
import org.jetbrains.kotlin.name.CallableId | ||
import com.github.kitakkun.backintime.compiler.backend.ValueContainerClassInfo | ||
|
||
data class BackInTimeCompilerConfiguration( | ||
val enabled: Boolean, | ||
val capturedCallableIds: Set<CallableId>, | ||
val valueGetterCallableIds: Set<CallableId>, | ||
val valueSetterCallableIds: Set<CallableId>, | ||
val valueContainers: List<ValueContainerClassInfo>, | ||
) |
5 changes: 2 additions & 3 deletions
5
...main/kotlin/com/github/kitakkun/backintime/compiler/BackInTimeCompilerConfigurationKey.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,11 +1,10 @@ | ||
package com.github.kitakkun.backintime.compiler | ||
|
||
import com.github.kitakkun.backintime.plugin.BackInTimeCompilerOptionKey | ||
import com.github.kitakkun.backintime.plugin.extension.ValueContainerConfig | ||
import org.jetbrains.kotlin.config.CompilerConfigurationKey | ||
|
||
object BackInTimeCompilerConfigurationKey { | ||
val ENABLED = CompilerConfigurationKey.create<Boolean>(BackInTimeCompilerOptionKey.ENABLED) | ||
val CAPTURED_CALLS = CompilerConfigurationKey.create<List<String>>(BackInTimeCompilerOptionKey.CAPTURED_CALLS) | ||
val VALUE_GETTERS = CompilerConfigurationKey.create<List<String>>(BackInTimeCompilerOptionKey.VALUE_GETTERS) | ||
val VALUE_SETTERS = CompilerConfigurationKey.create<List<String>>(BackInTimeCompilerOptionKey.VALUE_SETTERS) | ||
val VALUE_CONTAINER = CompilerConfigurationKey.create<List<ValueContainerConfig>>(BackInTimeCompilerOptionKey.VALUE_CONTAINER) | ||
} |
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.