Address Gradle warning about Task.project (#3118)
Apparently, this is all that's needed to replace the forbidden `Task.project` accessor, which would be an error in Gradle v10 (it's been deprecated for a while) This will also allow us to use the Configuration Cache if we wanted to.
This commit is contained in:
@@ -2,19 +2,24 @@ package mihon.gradle.tasks
|
||||
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.file.DirectoryProperty
|
||||
import org.gradle.api.model.ObjectFactory
|
||||
import org.gradle.api.tasks.OutputDirectory
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
import javax.inject.Inject
|
||||
|
||||
abstract class GenerateLocalesConfigTask : DefaultTask() {
|
||||
|
||||
@get:Inject
|
||||
abstract val objectFactory: ObjectFactory
|
||||
|
||||
@get:OutputDirectory
|
||||
abstract val outputDir: DirectoryProperty
|
||||
|
||||
@TaskAction
|
||||
fun action() {
|
||||
val locales = project.fileTree("src/commonMain/moko-resources") {
|
||||
matching { include("**/strings.xml") }
|
||||
}
|
||||
val locales = objectFactory.fileTree()
|
||||
.from("src/commonMain/moko-resources")
|
||||
.matching { include("**/strings.xml") }
|
||||
.asSequence()
|
||||
.filterNot { it.readText().contains(emptyResourcesElement) }
|
||||
.map {
|
||||
|
||||
Reference in New Issue
Block a user