[Gradle] Add fileProperty(initialValue: File) utility function

^KT-61359 Verification Pending
This commit is contained in:
Anton Lakotka
2023-10-16 14:04:01 +02:00
committed by Space Team
parent 6ee4cbb6ec
commit 251f52586e
2 changed files with 10 additions and 9 deletions
@@ -35,6 +35,7 @@ import org.jetbrains.kotlin.gradle.plugin.getKotlinPluginVersion
import org.jetbrains.kotlin.gradle.report.GradleBuildMetricsReporter
import org.jetbrains.kotlin.gradle.report.UsesBuildMetricsService
import org.jetbrains.kotlin.gradle.utils.chainedFinalizeValueOnRead
import org.jetbrains.kotlin.gradle.utils.fileProperty
import org.jetbrains.kotlin.gradle.utils.listProperty
import org.jetbrains.kotlin.gradle.utils.property
import org.jetbrains.kotlin.konan.library.KONAN_DISTRIBUTION_COMMONIZED_LIBS_DIR
@@ -89,15 +90,12 @@ internal abstract class NativeDistributionCommonizerTask
@get:OutputDirectory
internal val rootOutputDirectoryProperty: RegularFileProperty = objectFactory
.fileProperty()
.apply {
set(
project.file(project.konanHome)
.resolve(KONAN_DISTRIBUTION_KLIB_DIR)
.resolve(KONAN_DISTRIBUTION_COMMONIZED_LIBS_DIR)
.resolve(URLEncoder.encode(project.getKotlinPluginVersion(), Charsets.UTF_8.name()))
)
}
.fileProperty(
project.file(project.konanHome)
.resolve(KONAN_DISTRIBUTION_KLIB_DIR)
.resolve(KONAN_DISTRIBUTION_COMMONIZED_LIBS_DIR)
.resolve(URLEncoder.encode(project.getKotlinPluginVersion(), Charsets.UTF_8.name()))
)
private val isCachingEnabled = project.kotlinPropertiesProvider.enableNativeDistributionCommonizationCache
@@ -108,6 +108,9 @@ internal fun Project.newFileProperty(initialize: (() -> File)? = null): RegularF
}
}
internal fun ObjectFactory.fileProperty(initialValue: File): RegularFileProperty = fileProperty()
.apply { set(initialValue) }
internal fun Project.filesProvider(
vararg buildDependencies: Any,
provider: () -> Any?