Skip to content

Commit

Permalink
Restore removed 'kotlinPluginVersion' property.
Browse files Browse the repository at this point in the history
And marked it as '@deprecated'.

^KT-47317 Fixed
  • Loading branch information
Tapchicoma authored and Space committed Jun 21, 2021
1 parent eec6efb commit 4ac3753
Showing 1 changed file with 24 additions and 1 deletion.
Expand Up @@ -54,6 +54,15 @@ abstract class KotlinBasePluginWrapper : Plugin<Project> {

private val log = Logging.getLogger(this.javaClass)

@Deprecated(
message = "Scheduled to be removed in 1.7 release",
replaceWith = ReplaceWith(
"project.getKotlinPluginVersion()",
"org.jetbrains.kotlin.gradle.plugin.getKotlinPluginVersion"
)
)
val kotlinPluginVersion by lazy { loadKotlinVersionFromResource(log) }

open val projectExtensionClass: KClass<out KotlinTopLevelExtension> get() = KotlinProjectExtension::class

internal open fun kotlinSourceSetFactory(project: Project): NamedDomainObjectFactory<KotlinSourceSet> =
Expand Down Expand Up @@ -252,6 +261,20 @@ open class KotlinPm20PluginWrapper @Inject constructor(private val objectFactory
get() = KotlinPm20ProjectExtension::class
}

@Deprecated(
message = "Scheduled to be removed in 1.7 release",
replaceWith = ReplaceWith(
"project.getKotlinPluginVersion()",
"org.jetbrains.kotlin.gradle.plugin.getKotlinPluginVersion"
)
)
fun Plugin<*>.loadKotlinVersionFromResource(log: Logger): String {
log.kotlinDebug("Loading version information")
val projectVersion = loadPropertyFromResources("project.properties", "project.version")
log.kotlinDebug("Found project version [$projectVersion]")
return projectVersion
}

fun Project.getKotlinPluginVersion(): String {
if (!kotlinPluginVersionFromResources.isInitialized()) {
project.logger.kotlinDebug("Loading version information")
Expand All @@ -265,4 +288,4 @@ private fun loadKotlinPluginVersionFromResourcesOf(any: Any) =

private val kotlinPluginVersionFromResources = lazy {
loadKotlinPluginVersionFromResourcesOf(object {})
}
}

0 comments on commit 4ac3753

Please sign in to comment.