
phraseapp.ClearTranslationsTask.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of phrase-gradle-plugin Show documentation
Show all versions of phrase-gradle-plugin Show documentation
A Gradle plugin to upload your mobile translations to Phrase and download all locales.
The newest version!
package phraseapp
import kotlinx.coroutines.runBlocking
import org.gradle.api.DefaultTask
import org.gradle.api.GradleException
import org.gradle.api.provider.MapProperty
import org.gradle.api.provider.Property
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.TaskAction
import phraseapp.internal.platforms.Platform
import phraseapp.internal.printers.FileOperationImpl
import phraseapp.repositories.operations.Cleaner
abstract class ClearTranslationsTask : DefaultTask() {
@get:Input
abstract val platform: Property
@get:Input
abstract val resFolders: MapProperty>
@TaskAction
fun clear() = runBlocking {
try {
Cleaner(platform.get(), FileOperationImpl())
.clean(resFolders.get())
logger.info("All resources have been deleted!")
} catch (error: Throwable) {
throw GradleException("Something wrong happened during the cleaning...", error)
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy