org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmAndroidCompilation.kt Maven / Gradle / Ivy
/*
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@file:Suppress("PackageDirectoryMismatch") // Old package for compatibility
package org.jetbrains.kotlin.gradle.plugin.mpp
import org.gradle.api.file.FileCollection
import org.gradle.api.provider.Property
import org.gradle.api.tasks.TaskProvider
import org.gradle.api.tasks.compile.JavaCompile
import org.jetbrains.kotlin.gradle.dsl.*
import org.jetbrains.kotlin.gradle.plugin.*
import org.jetbrains.kotlin.gradle.plugin.mpp.compilationImpl.KotlinCompilationImpl
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask
import org.jetbrains.kotlin.gradle.utils.*
import javax.inject.Inject
@Suppress("TYPEALIAS_EXPANSION_DEPRECATION", "DEPRECATION")
open class KotlinJvmAndroidCompilation @Inject internal constructor(
compilation: KotlinCompilationImpl,
val androidVariant: DeprecatedAndroidBaseVariant
) : DeprecatedAbstractKotlinCompilationToRunnableFiles(compilation) {
override val target: KotlinAndroidTarget = compilation.target as KotlinAndroidTarget
@Suppress("DEPRECATION")
@Deprecated(
"To configure compilation compiler options use 'compileTaskProvider':\ncompilation.compileTaskProvider.configure{\n" +
" compilerOptions {}\n}"
)
override val compilerOptions: DeprecatedHasCompilerOptions =
compilation.compilerOptions.castCompilerOptionsType()
internal val testedVariantArtifacts: Property =
compilation.project.objects.property(FileCollection::class.java)
@Suppress("DEPRECATION")
@Deprecated("Accessing task instance directly is deprecated", replaceWith = ReplaceWith("compileTaskProvider"))
override val compileKotlinTask: org.jetbrains.kotlin.gradle.tasks.KotlinCompile
get() = compilation.compileKotlinTask as org.jetbrains.kotlin.gradle.tasks.KotlinCompile
@Suppress("UNCHECKED_CAST", "DEPRECATION")
@Deprecated("Replaced with compileTaskProvider", replaceWith = ReplaceWith("compileTaskProvider"))
override val compileKotlinTaskProvider: TaskProvider
get() = compilation.compileKotlinTaskProvider as TaskProvider
@Suppress("UNCHECKED_CAST")
override val compileTaskProvider: TaskProvider>
get() = compilation.compileTaskProvider as TaskProvider>
val compileJavaTaskProvider: TaskProvider
get() = androidVariant.javaCompileProvider
}