mirror of
https://github.com/InsanusMokrassar/krontab.git
synced 2024-11-22 16:23:55 +00:00
commit
2b06033c75
4
.github/workflows/publishing_packages.yml
vendored
4
.github/workflows/publishing_packages.yml
vendored
@ -8,9 +8,9 @@ jobs:
|
|||||||
- uses: actions/setup-java@v1
|
- uses: actions/setup-java@v1
|
||||||
with:
|
with:
|
||||||
java-version: 1.8
|
java-version: 1.8
|
||||||
- name: Fix android 31.0.0 dx
|
- name: Fix android 32.0.0 dx
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
run: cd /usr/local/lib/android/sdk/build-tools/31.0.0/ && mv d8 dx && cd lib && mv d8.jar dx.jar
|
run: cd /usr/local/lib/android/sdk/build-tools/32.0.0/ && mv d8 dx && cd lib && mv d8.jar dx.jar
|
||||||
- name: Update version
|
- name: Update version
|
||||||
run: |
|
run: |
|
||||||
branch="`echo "${{ github.ref }}" | grep -o "[^/]*$"`"
|
branch="`echo "${{ github.ref }}" | grep -o "[^/]*$"`"
|
||||||
|
10
CHANGELOG.md
10
CHANGELOG.md
@ -1,5 +1,15 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 0.7.0
|
||||||
|
|
||||||
|
**ALL DEPRECATIONS HAVE BEEN REMOVED**
|
||||||
|
|
||||||
|
* Versions
|
||||||
|
* `Kotlin`: `1.6.10`
|
||||||
|
* `Klock`: `2.4.10`
|
||||||
|
* `Coroutines`: `1.6.0`
|
||||||
|
* `Androidx Work`: `2.7.1`
|
||||||
|
|
||||||
## 0.6.6
|
## 0.6.6
|
||||||
|
|
||||||
* Versions
|
* Versions
|
||||||
|
@ -134,7 +134,6 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
java {
|
java {
|
||||||
toolchain {
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||||
languageVersion = JavaLanguageVersion.of(8)
|
targetCompatibility = JavaVersion.VERSION_1_8
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -8,12 +8,12 @@ android.useAndroidX=true
|
|||||||
android.enableJetifier=false
|
android.enableJetifier=false
|
||||||
|
|
||||||
|
|
||||||
kotlin_version=1.5.31
|
kotlin_version=1.6.10
|
||||||
kotlin_coroutines_version=1.5.2
|
kotlin_coroutines_version=1.6.0
|
||||||
|
|
||||||
dokka_version=1.5.31
|
dokka_version=1.6.0
|
||||||
|
|
||||||
klockVersion=2.4.8
|
klockVersion=2.4.10
|
||||||
|
|
||||||
## Github reease
|
## Github reease
|
||||||
|
|
||||||
@ -22,16 +22,16 @@ github_release_plugin_version=2.2.12
|
|||||||
## Android
|
## Android
|
||||||
|
|
||||||
android_minSdkVersion=19
|
android_minSdkVersion=19
|
||||||
android_compileSdkVersion=31
|
android_compileSdkVersion=32
|
||||||
android_buildToolsVersion=31.0.0
|
android_buildToolsVersion=32.0.0
|
||||||
dexcount_version=3.0.0
|
dexcount_version=3.0.0
|
||||||
junit_version=4.12
|
junit_version=4.12
|
||||||
test_ext_junit_version=1.1.2
|
test_ext_junit_version=1.1.2
|
||||||
espresso_core=3.3.0
|
espresso_core=3.3.0
|
||||||
|
|
||||||
androidx_work_version=2.7.0
|
androidx_work_version=2.7.1
|
||||||
|
|
||||||
## Common
|
## Common
|
||||||
|
|
||||||
version=0.6.6
|
version=0.7.0
|
||||||
android_code_version=10
|
android_code_version=11
|
||||||
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
|||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
|
||||||
|
@ -2,7 +2,6 @@ package dev.inmo.krontab.internal
|
|||||||
|
|
||||||
import com.soywiz.klock.DateTime
|
import com.soywiz.klock.DateTime
|
||||||
import dev.inmo.krontab.KronScheduler
|
import dev.inmo.krontab.KronScheduler
|
||||||
import dev.inmo.krontab.collection.plus
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cron-oriented realisation of [KronScheduler]
|
* Cron-oriented realisation of [KronScheduler]
|
||||||
@ -36,23 +35,3 @@ internal fun mergeCronDateTimeSchedulers(
|
|||||||
): CronDateTimeScheduler = CronDateTimeScheduler(
|
): CronDateTimeScheduler = CronDateTimeScheduler(
|
||||||
schedulers.map { it.cronDateTime }.merge()
|
schedulers.map { it.cronDateTime }.merge()
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
|
||||||
* @return New instance of [CronDateTimeScheduler] with all unique [CronDateTimeScheduler.cronDateTimes] of
|
|
||||||
* [kronSchedulers] included
|
|
||||||
*/
|
|
||||||
@Deprecated("Will be removed in next major release", ReplaceWith("merge", "dev.inmo.krontab"))
|
|
||||||
fun merge(kronSchedulers: List<KronScheduler>) = kronSchedulers.apply { dev.inmo.krontab.merge() }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Vararg shortcut for [dev.inmo.krontab.merge]
|
|
||||||
*/
|
|
||||||
@Suppress("NOTHING_TO_INLINE")
|
|
||||||
@Deprecated("Will be removed in next major release", ReplaceWith("merge", "dev.inmo.krontab"))
|
|
||||||
inline fun merge(vararg kronDateTimeSchedulers: KronScheduler) = kronDateTimeSchedulers.apply { dev.inmo.krontab.merge() }
|
|
||||||
/**
|
|
||||||
* @return Vararg shortcut for [dev.inmo.krontab.merge]
|
|
||||||
*/
|
|
||||||
@Suppress("NOTHING_TO_INLINE")
|
|
||||||
@Deprecated("Will be removed in next major release", ReplaceWith("merge", "dev.inmo.krontab"))
|
|
||||||
inline fun KronScheduler.plus(other: KronScheduler) = this + other
|
|
||||||
|
@ -4,8 +4,8 @@ import com.soywiz.klock.DateTime
|
|||||||
import com.soywiz.klock.DateTimeTz
|
import com.soywiz.klock.DateTimeTz
|
||||||
import dev.inmo.krontab.*
|
import dev.inmo.krontab.*
|
||||||
import kotlinx.coroutines.FlowPreview
|
import kotlinx.coroutines.FlowPreview
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.flow.Flow
|
||||||
import kotlinx.coroutines.flow.*
|
import kotlinx.coroutines.flow.channelFlow
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This [Flow] will trigger emitting each near time which will be returned from [this] [KronScheduler] with attention to
|
* This [Flow] will trigger emitting each near time which will be returned from [this] [KronScheduler] with attention to
|
||||||
@ -33,23 +33,3 @@ fun KronScheduler.asFlow(): Flow<DateTime> = channelFlow {
|
|||||||
send(it)
|
send(it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated(
|
|
||||||
"It is not recommended to use this class in future. This functionality will be removed soon",
|
|
||||||
ReplaceWith("asFlow", "dev.inmo.krontab.utils.asFlow")
|
|
||||||
)
|
|
||||||
@FlowPreview
|
|
||||||
class SchedulerFlow(
|
|
||||||
private val scheduler: KronScheduler
|
|
||||||
) : AbstractFlow<DateTime>() {
|
|
||||||
@FlowPreview
|
|
||||||
override suspend fun collectSafely(collector: FlowCollector<DateTime>) {
|
|
||||||
while (true) {
|
|
||||||
val now = DateTime.now()
|
|
||||||
val nextTime = scheduler.next(now) ?: break
|
|
||||||
val sleepDelay = (nextTime - now).millisecondsLong
|
|
||||||
delay(sleepDelay)
|
|
||||||
collector.emit(nextTime)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user