Rename 'classpath' input into 'libraries'
'classpath' makes sense only in case of Kotlin/Jvm, but not for Kotlin/Js or Kotlin/Native. 'libraries' is common ground for a name. For 'KotlinCompile' task 'getClasspath' and 'setClasspath' methods are left with deprecation note. ^KT-32805 Fixed
This commit is contained in:
committed by
teamcity
parent
f4078b0940
commit
c7e594fc7f
+1
-1
@@ -560,7 +560,7 @@ class KotlinSpecificDependenciesIT : KGPBaseTest() {
|
|||||||
} else {
|
} else {
|
||||||
"org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompileTool<?>"
|
"org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompileTool<?>"
|
||||||
}
|
}
|
||||||
val expression = """(tasks.getByName("$taskName") as $taskClass).${if (isNative) "libraries" else "classpath"}.toList()"""
|
val expression = """(tasks.getByName("$taskName") as $taskClass).libraries.toList()"""
|
||||||
checkPrintedItems(subproject, expression, checkModulesInClasspath, checkModulesNotInClasspath, isBuildGradleKts)
|
checkPrintedItems(subproject, expression, checkModulesInClasspath, checkModulesNotInClasspath, isBuildGradleKts)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -516,7 +516,7 @@ class Kapt3GradleSubplugin @Inject internal constructor(private val registry: To
|
|||||||
// the configuration is not extended (via extendsFrom, which normally happens when one configuration is _added_ into another)
|
// the configuration is not extended (via extendsFrom, which normally happens when one configuration is _added_ into another)
|
||||||
// but is instead included as the (lazily) resolved files. This is needed because the class structure configuration doesn't have
|
// but is instead included as the (lazily) resolved files. This is needed because the class structure configuration doesn't have
|
||||||
// the attributes that are potentially needed to resolve dependencies on MPP modules, and the classpath configuration does.
|
// the attributes that are potentially needed to resolve dependencies on MPP modules, and the classpath configuration does.
|
||||||
project.dependencies.add(classStructureIfIncremental.name, project.files(project.provider { kotlinCompile.get().classpath }))
|
project.dependencies.add(classStructureIfIncremental.name, project.files(project.provider { kotlinCompile.get().libraries }))
|
||||||
}
|
}
|
||||||
|
|
||||||
val kaptClasspathConfiguration = project.configurations.create("kaptClasspath_$taskName")
|
val kaptClasspathConfiguration = project.configurations.create("kaptClasspath_$taskName")
|
||||||
|
|||||||
+2
-2
@@ -61,7 +61,7 @@ abstract class KaptGenerateStubsTask @Inject constructor(
|
|||||||
val providerFactory = kotlinCompileTask.project.providers
|
val providerFactory = kotlinCompileTask.project.providers
|
||||||
task.useModuleDetection.value(kotlinCompileTask.useModuleDetection).disallowChanges()
|
task.useModuleDetection.value(kotlinCompileTask.useModuleDetection).disallowChanges()
|
||||||
task.moduleName.value(kotlinCompileTask.moduleName).disallowChanges()
|
task.moduleName.value(kotlinCompileTask.moduleName).disallowChanges()
|
||||||
task.classpath.from(kotlinCompileTask.classpath)
|
task.libraries.from(kotlinCompileTask.libraries)
|
||||||
task.kotlinTaskPluginClasspath.from(
|
task.kotlinTaskPluginClasspath.from(
|
||||||
providerFactory.provider { kotlinCompileTask.pluginClasspath }
|
providerFactory.provider { kotlinCompileTask.pluginClasspath }
|
||||||
)
|
)
|
||||||
@@ -163,7 +163,7 @@ abstract class KaptGenerateStubsTask @Inject constructor(
|
|||||||
args.pluginOptions = (pluginOptionsWithKapt.arguments + args.pluginOptions!!).toTypedArray()
|
args.pluginOptions = (pluginOptionsWithKapt.arguments + args.pluginOptions!!).toTypedArray()
|
||||||
|
|
||||||
args.verbose = verbose.get()
|
args.verbose = verbose.get()
|
||||||
args.classpathAsList = this.classpath.filter { it.exists() }.toList()
|
args.classpathAsList = this.libraries.filter { it.exists() }.toList()
|
||||||
args.destinationAsFile = this.destinationDirectory.get().asFile
|
args.destinationAsFile = this.destinationDirectory.get().asFile
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -40,7 +40,7 @@ abstract class KaptTask @Inject constructor(
|
|||||||
val objectFactory = task.project.objects
|
val objectFactory = task.project.objects
|
||||||
|
|
||||||
task.compilerClasspath.from({ kotlinCompileTask.defaultCompilerClasspath })
|
task.compilerClasspath.from({ kotlinCompileTask.defaultCompilerClasspath })
|
||||||
task.classpath.from(kotlinCompileTask.classpath)
|
task.classpath.from(kotlinCompileTask.libraries)
|
||||||
task.compiledSources.from(
|
task.compiledSources.from(
|
||||||
kotlinCompileTask.destinationDirectory,
|
kotlinCompileTask.destinationDirectory,
|
||||||
Callable { kotlinCompileTask.javaOutputDir.takeIf { it.isPresent } }
|
Callable { kotlinCompileTask.javaOutputDir.takeIf { it.isPresent } }
|
||||||
|
|||||||
+1
-1
@@ -126,7 +126,7 @@ class KotlinModelBuilder(private val kotlinPluginVersion: String, private val an
|
|||||||
return CompilerArgumentsImpl(
|
return CompilerArgumentsImpl(
|
||||||
serializedCompilerArguments,
|
serializedCompilerArguments,
|
||||||
defaultSerializedCompilerArguments,
|
defaultSerializedCompilerArguments,
|
||||||
classpath.toList()
|
libraries.toList()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -122,7 +122,7 @@ internal abstract class KotlinSourceSetProcessor<T : AbstractKotlinCompile<*>>(
|
|||||||
return register(project, name) {
|
return register(project, name) {
|
||||||
it.description = taskDescription
|
it.description = taskDescription
|
||||||
it.destinationDirectory.set(defaultKotlinDestinationDir)
|
it.destinationDirectory.set(defaultKotlinDestinationDir)
|
||||||
it.classpath.from({ kotlinCompilation.compileDependencyFiles })
|
it.libraries.from({ kotlinCompilation.compileDependencyFiles })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -59,7 +59,7 @@ class Android25ProjectHandler(
|
|||||||
|
|
||||||
val preJavaClasspathKey = variantData.registerPreJavacGeneratedBytecode(preJavaKotlinOutput)
|
val preJavaClasspathKey = variantData.registerPreJavacGeneratedBytecode(preJavaKotlinOutput)
|
||||||
kotlinTask.configure { kotlinTaskInstance ->
|
kotlinTask.configure { kotlinTaskInstance ->
|
||||||
kotlinTaskInstance.classpath
|
kotlinTaskInstance.libraries
|
||||||
.from(variantData.getCompileClasspath(preJavaClasspathKey))
|
.from(variantData.getCompileClasspath(preJavaClasspathKey))
|
||||||
.from(Callable { AndroidGradleWrapper.getRuntimeJars(androidPlugin, androidExt) })
|
.from(Callable { AndroidGradleWrapper.getRuntimeJars(androidPlugin, androidExt) })
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -76,7 +76,7 @@ class KotlinJsDcePlugin : Plugin<Project> {
|
|||||||
val configuration = project.configurations.getByName(kotlinCompilation.compileDependencyConfigurationName)
|
val configuration = project.configurations.getByName(kotlinCompilation.compileDependencyConfigurationName)
|
||||||
|
|
||||||
dceTask.configure {
|
dceTask.configure {
|
||||||
it.classpath.from(configuration)
|
it.libraries.from(configuration)
|
||||||
it.destinationDirectory.set(it.dceOptions.outputDirectory?.let { File(it) } ?: outputDir)
|
it.destinationDirectory.set(it.dceOptions.outputDirectory?.let { File(it) } ?: outputDir)
|
||||||
it.setSource(kotlinTask.map { task -> (task as Kotlin2JsCompile).outputFileProperty })
|
it.setSource(kotlinTask.map { task -> (task as Kotlin2JsCompile).outputFileProperty })
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -308,7 +308,7 @@ open class KotlinBrowserJs @Inject constructor(target: KotlinJsTarget) :
|
|||||||
|
|
||||||
it.kotlinFilesOnly = true
|
it.kotlinFilesOnly = true
|
||||||
|
|
||||||
it.classpath.from(project.configurations.getByName(compilation.runtimeDependencyConfigurationName))
|
it.libraries.from(project.configurations.getByName(compilation.runtimeDependencyConfigurationName))
|
||||||
it.destinationDirectory.set(
|
it.destinationDirectory.set(
|
||||||
it.dceOptions.outputDirectory?.let { File(it) }
|
it.dceOptions.outputDirectory?.let { File(it) }
|
||||||
?: compilation.npmProject.dir.resolve(if (dev) DCE_DEV_DIR else DCE_DIR)
|
?: compilation.npmProject.dir.resolve(if (dev) DCE_DEV_DIR else DCE_DIR)
|
||||||
|
|||||||
+4
-6
@@ -159,10 +159,12 @@ abstract class AbstractKotlinNativeCompile<
|
|||||||
}
|
}
|
||||||
|
|
||||||
@get:Classpath
|
@get:Classpath
|
||||||
val libraries: FileCollection by project.provider {
|
override val libraries: ConfigurableFileCollection by project.provider {
|
||||||
// Avoid resolving these dependencies during task graph construction when we can't build the target:
|
// Avoid resolving these dependencies during task graph construction when we can't build the target:
|
||||||
if (konanTarget.enabledOnCurrentHost)
|
if (konanTarget.enabledOnCurrentHost)
|
||||||
compilation.compileDependencyFiles.filterOutPublishableInteropLibs(project)
|
objectFactory.fileCollection().from(
|
||||||
|
compilation.compileDependencyFiles.filterOutPublishableInteropLibs(project)
|
||||||
|
)
|
||||||
else objectFactory.fileCollection()
|
else objectFactory.fileCollection()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,10 +173,6 @@ abstract class AbstractKotlinNativeCompile<
|
|||||||
project.files(compilation.friendPaths)
|
project.files(compilation.friendPaths)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated("For native tasks use 'libraries' instead", ReplaceWith("libraries"))
|
|
||||||
override val classpath: ConfigurableFileCollection
|
|
||||||
get() = objectFactory.fileCollection().from(libraries)
|
|
||||||
|
|
||||||
@get:Input
|
@get:Input
|
||||||
val target: String by project.provider { compilation.konanTarget.name }
|
val target: String by project.provider { compilation.konanTarget.name }
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -116,7 +116,7 @@ abstract class KotlinCompileCommon @Inject constructor(
|
|||||||
|
|
||||||
if (defaultsOnly) return
|
if (defaultsOnly) return
|
||||||
|
|
||||||
val classpathList = classpath.files.filter { it.exists() }.toMutableList()
|
val classpathList = libraries.files.filter { it.exists() }.toMutableList()
|
||||||
|
|
||||||
with(args) {
|
with(args) {
|
||||||
classpath = classpathList.joinToString(File.pathSeparator)
|
classpath = classpathList.joinToString(File.pathSeparator)
|
||||||
|
|||||||
+3
-3
@@ -84,7 +84,7 @@ abstract class KotlinJsDce @Inject constructor(
|
|||||||
|
|
||||||
@get:Incremental
|
@get:Incremental
|
||||||
@get:InputFiles
|
@get:InputFiles
|
||||||
abstract override val classpath: ConfigurableFileCollection
|
abstract override val libraries: ConfigurableFileCollection
|
||||||
|
|
||||||
private val buildDir = project.layout.buildDirectory
|
private val buildDir = project.layout.buildDirectory
|
||||||
|
|
||||||
@@ -103,11 +103,11 @@ abstract class KotlinJsDce @Inject constructor(
|
|||||||
val shouldPerformIncrementalCopy = isDevMode && !isExplicitDevModeAllStrategy
|
val shouldPerformIncrementalCopy = isDevMode && !isExplicitDevModeAllStrategy
|
||||||
|
|
||||||
val classpathFiles = if (shouldPerformIncrementalCopy) {
|
val classpathFiles = if (shouldPerformIncrementalCopy) {
|
||||||
inputChanges.getFileChanges(classpath)
|
inputChanges.getFileChanges(libraries)
|
||||||
.filter { it.changeType == ChangeType.MODIFIED || it.changeType == ChangeType.ADDED }
|
.filter { it.changeType == ChangeType.MODIFIED || it.changeType == ChangeType.ADDED }
|
||||||
.map { it.file }
|
.map { it.file }
|
||||||
} else {
|
} else {
|
||||||
classpath.asFileTree.files
|
libraries.asFileTree.files
|
||||||
}
|
}
|
||||||
|
|
||||||
val inputFiles = sources.asFileTree.files.plus(classpathFiles)
|
val inputFiles = sources.asFileTree.files.plus(classpathFiles)
|
||||||
|
|||||||
+22
-7
@@ -172,7 +172,7 @@ abstract class AbstractKotlinCompileTool<T : CommonToolArguments> @Inject constr
|
|||||||
|
|
||||||
@get:Classpath
|
@get:Classpath
|
||||||
@get:Incremental
|
@get:Incremental
|
||||||
abstract val classpath: ConfigurableFileCollection
|
abstract val libraries: ConfigurableFileCollection
|
||||||
|
|
||||||
@get:OutputDirectory
|
@get:OutputDirectory
|
||||||
abstract val destinationDirectory: DirectoryProperty
|
abstract val destinationDirectory: DirectoryProperty
|
||||||
@@ -480,7 +480,7 @@ abstract class AbstractKotlinCompile<T : CommonCompilerArguments> @Inject constr
|
|||||||
protected open val incrementalProps: List<FileCollection>
|
protected open val incrementalProps: List<FileCollection>
|
||||||
get() = listOfNotNull(
|
get() = listOfNotNull(
|
||||||
sources,
|
sources,
|
||||||
classpath,
|
libraries,
|
||||||
commonSourceSet
|
commonSourceSet
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -578,7 +578,7 @@ class KotlinJvmCompilerArgumentsProvider
|
|||||||
(taskProvider: KotlinCompile) : KotlinCompileArgumentsProvider<KotlinCompile>(taskProvider) {
|
(taskProvider: KotlinCompile) : KotlinCompileArgumentsProvider<KotlinCompile>(taskProvider) {
|
||||||
val moduleName: String = taskProvider.moduleName.get()
|
val moduleName: String = taskProvider.moduleName.get()
|
||||||
val friendPaths: FileCollection = taskProvider.friendPaths
|
val friendPaths: FileCollection = taskProvider.friendPaths
|
||||||
val compileClasspath: Iterable<File> = taskProvider.classpath
|
val compileClasspath: Iterable<File> = taskProvider.libraries
|
||||||
val destinationDir: File = taskProvider.destinationDirectory.get().asFile
|
val destinationDir: File = taskProvider.destinationDirectory.get().asFile
|
||||||
internal val kotlinOptions: List<KotlinJvmOptionsImpl> = listOfNotNull(
|
internal val kotlinOptions: List<KotlinJvmOptionsImpl> = listOfNotNull(
|
||||||
taskProvider.parentKotlinOptionsImpl.orNull as? KotlinJvmOptionsImpl,
|
taskProvider.parentKotlinOptionsImpl.orNull as? KotlinJvmOptionsImpl,
|
||||||
@@ -621,7 +621,7 @@ abstract class KotlinCompile @Inject constructor(
|
|||||||
if (properties.useClasspathSnapshot) {
|
if (properties.useClasspathSnapshot) {
|
||||||
registerTransformsOnce(project)
|
registerTransformsOnce(project)
|
||||||
project.configurations.create(classpathSnapshotConfigurationName(taskProvider.name)).apply {
|
project.configurations.create(classpathSnapshotConfigurationName(taskProvider.name)).apply {
|
||||||
project.dependencies.add(name, project.files(project.provider { taskProvider.get().classpath }))
|
project.dependencies.add(name, project.files(project.provider { taskProvider.get().libraries }))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -686,7 +686,7 @@ abstract class KotlinCompile @Inject constructor(
|
|||||||
val classpathSnapshotDir = getClasspathSnapshotDir(task)
|
val classpathSnapshotDir = getClasspathSnapshotDir(task)
|
||||||
task.classpathSnapshotProperties.classpathSnapshotDir.value(classpathSnapshotDir).disallowChanges()
|
task.classpathSnapshotProperties.classpathSnapshotDir.value(classpathSnapshotDir).disallowChanges()
|
||||||
} else {
|
} else {
|
||||||
task.classpathSnapshotProperties.classpath.from(task.project.provider { task.classpath })
|
task.classpathSnapshotProperties.classpath.from(task.project.provider { task.libraries })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -710,7 +710,22 @@ abstract class KotlinCompile @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
@get:Internal // To support compile avoidance (ClasspathSnapshotProperties.classpathSnapshot will be used as input instead)
|
@get:Internal // To support compile avoidance (ClasspathSnapshotProperties.classpathSnapshot will be used as input instead)
|
||||||
override abstract val classpath: ConfigurableFileCollection
|
abstract override val libraries: ConfigurableFileCollection
|
||||||
|
|
||||||
|
@Deprecated(
|
||||||
|
"Replaced with 'libraries' input",
|
||||||
|
replaceWith = ReplaceWith("libraries")
|
||||||
|
)
|
||||||
|
@Internal
|
||||||
|
fun getClasspath(): FileCollection = libraries
|
||||||
|
|
||||||
|
@Deprecated(
|
||||||
|
"Replaced with 'libraries' input",
|
||||||
|
replaceWith = ReplaceWith("libraries")
|
||||||
|
)
|
||||||
|
fun setClasspath(configuration: FileCollection) {
|
||||||
|
libraries.setFrom(configuration)
|
||||||
|
}
|
||||||
|
|
||||||
@get:Input
|
@get:Input
|
||||||
abstract val useKotlinAbiSnapshot: Property<Boolean>
|
abstract val useKotlinAbiSnapshot: Property<Boolean>
|
||||||
@@ -1265,7 +1280,7 @@ abstract class Kotlin2JsCompile @Inject constructor(
|
|||||||
logger.info(USING_JS_IR_BACKEND_MESSAGE)
|
logger.info(USING_JS_IR_BACKEND_MESSAGE)
|
||||||
}
|
}
|
||||||
|
|
||||||
val dependencies = classpath
|
val dependencies = libraries
|
||||||
.filter { it.exists() && libraryFilter(it) }
|
.filter { it.exists() && libraryFilter(it) }
|
||||||
.map { it.canonicalPath }
|
.map { it.canonicalPath }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user