Skip to content

Commit 853f1c1

Browse files
wojtek-kalicinskiSpace Team
authored andcommitted
[BTA] Deprecate old BTA API
^KT-81321 Fixed
1 parent c9e7ff0 commit 853f1c1

File tree

10 files changed

+27
-7
lines changed

10 files changed

+27
-7
lines changed

compiler/build-tools/kotlin-build-tools-api-tests/src/main/kotlin/compilation/model/DefaultStrategyAgnosticCompilationTestArgumentProvider.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
44
*/
55

6+
@file:Suppress("DEPRECATION")
7+
68
package org.jetbrains.kotlin.buildtools.api.tests.compilation.model
79

810
import org.jetbrains.kotlin.buildtools.api.CompilationService

compiler/build-tools/kotlin-build-tools-api/src/main/kotlin/org/jetbrains/kotlin/buildtools/api/CompilationService.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
44
*/
55

6+
@file:Suppress("DEPRECATION")
7+
68
package org.jetbrains.kotlin.buildtools.api
79

810
import org.jetbrains.kotlin.buildtools.api.CompilationService.Companion.loadImplementation
@@ -26,6 +28,7 @@ import java.io.File
2628
*
2729
* This interface is not intended to be implemented by the API consumers. An instance of [CompilationService] is expected to be obtained from [loadImplementation].
2830
*/
31+
@Deprecated("Use the new BTA API with entry points in KotlinToolchain instead")
2932
@ExperimentalBuildToolsApi
3033
public interface CompilationService {
3134
/**

compiler/build-tools/kotlin-build-tools-api/src/main/kotlin/org/jetbrains/kotlin/buildtools/api/CompilerExecutionStrategyConfiguration.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
44
*/
55

6+
@file:Suppress("DEPRECATION")
7+
68
package org.jetbrains.kotlin.buildtools.api
79

810
import java.time.Duration
@@ -12,6 +14,7 @@ import java.time.Duration
1214
*
1315
* This interface is not intended to be implemented by the API consumers.
1416
*/
17+
@Deprecated("Use the new BTA API with entry points in KotlinToolchain instead")
1518
@ExperimentalBuildToolsApi
1619
public interface CompilerExecutionStrategyConfiguration {
1720
/**

compiler/build-tools/kotlin-build-tools-api/src/main/kotlin/org/jetbrains/kotlin/buildtools/api/KotlinToolchains.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ public interface KotlinToolchains {
140140
try {
141141
loadImplementation(KotlinToolchains::class, classLoader)
142142
} catch (_: NoImplementationFoundException) {
143+
@Suppress("DEPRECATION")
143144
classLoader.loadClass("org.jetbrains.kotlin.buildtools.internal.compat.KotlinToolchainsV1Adapter").constructors.first()
144145
.newInstance(CompilationService.loadImplementation(classLoader)) as KotlinToolchains
145146
}

compiler/build-tools/kotlin-build-tools-api/src/main/kotlin/org/jetbrains/kotlin/buildtools/api/internal/wrappers/PreKotlin220Wrapper.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import org.jetbrains.kotlin.buildtools.api.*
1010
import org.jetbrains.kotlin.buildtools.api.jvm.*
1111
import java.io.File
1212

13+
@Suppress("DEPRECATION")
1314
internal class PreKotlin220Wrapper(
1415
private val base: CompilationService
1516
) : CompilationService by base {

compiler/build-tools/kotlin-build-tools-api/src/test/kotlin/SharedApiClassesClassLoaderTest.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
@file:Suppress("DEPRECATION")
2+
13
import org.jetbrains.kotlin.buildtools.api.CompilationService
24
import org.jetbrains.kotlin.buildtools.api.SharedApiClassesClassLoader
35
import org.junit.jupiter.api.DisplayName

compiler/build-tools/kotlin-build-tools-compat/src/main/kotlin/org/jetbrains/kotlin/buildtools/internal/compat/KotlinToolchainsV1Adapter.kt

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import kotlin.time.Duration
3131
import kotlin.time.toJavaDuration
3232

3333
public class KotlinToolchainsV1Adapter(
34-
private val compilationService: CompilationService,
34+
@Suppress("DEPRECATION") private val compilationService: CompilationService,
3535
) : KotlinToolchains {
3636
private val jvm: JvmPlatformToolchain by lazy {
3737
object : JvmPlatformToolchain {
@@ -74,7 +74,7 @@ public class KotlinToolchainsV1Adapter(
7474
}
7575

7676
private class JvmClasspathSnapshottingOperationV1Adapter(
77-
val compilationService: CompilationService,
77+
@Suppress("DEPRECATION") val compilationService: CompilationService,
7878
val classpathEntry: Path,
7979
) :
8080
BuildOperationImpl<ClasspathEntrySnapshot>(), JvmClasspathSnapshottingOperation {
@@ -116,7 +116,7 @@ private class JvmClasspathSnapshottingOperationV1Adapter(
116116
}
117117

118118
private class JvmCompilationOperationV1Adapter(
119-
val compilationService: CompilationService,
119+
@Suppress("DEPRECATION") val compilationService: CompilationService,
120120
val kotlinSources: List<Path>,
121121
val destinationDirectory: Path,
122122
override val compilerArguments: JvmCompilerArgumentsImpl,
@@ -202,6 +202,7 @@ private class JvmCompilationOperationV1Adapter(
202202
/**
203203
* It's better to avoid arguments duplication for the versions that contain the fix
204204
*/
205+
@Suppress("DEPRECATION")
205206
private fun CompilationService.treatsJavaSourcesProperly(): Boolean = try {
206207
val kotlinCompilerVersion = KotlinToolingVersion(getCompilerVersion())
207208
kotlinCompilerVersion >= KotlinToolingVersion(2, 2, 21, null)
@@ -282,15 +283,17 @@ internal fun List<String>.fixForFirCheck(): List<String> {
282283
}
283284

284285
private interface ExecutionPolicyV1Adapter {
286+
@Suppress("DEPRECATION")
285287
val strategyConfiguration: CompilerExecutionStrategyConfiguration
286288

287-
class InProcess(override val strategyConfiguration: CompilerExecutionStrategyConfiguration) :
289+
class InProcess(@Suppress("DEPRECATION") override val strategyConfiguration: CompilerExecutionStrategyConfiguration) :
288290
ExecutionPolicyV1Adapter,
289291
ExecutionPolicy.InProcess
290292

291-
class WithDaemon(private val compilationService: CompilationService) : ExecutionPolicyV1Adapter,
293+
class WithDaemon(@Suppress("DEPRECATION") private val compilationService: CompilationService) : ExecutionPolicyV1Adapter,
292294
ExecutionPolicy.WithDaemon {
293295

296+
@Suppress("DEPRECATION")
294297
override val strategyConfiguration: CompilerExecutionStrategyConfiguration
295298
get() {
296299
val jvmArguments = get(JVM_ARGUMENTS) ?: emptyList()
@@ -339,7 +342,7 @@ private interface ExecutionPolicyV1Adapter {
339342
private class BuildSessionV1Adapter(
340343
override val kotlinToolchains: KotlinToolchains,
341344
override val projectId: ProjectId,
342-
private val compilationService: CompilationService,
345+
@Suppress("DEPRECATION") private val compilationService: CompilationService,
343346
) : KotlinToolchains.BuildSession {
344347
override fun <R> executeOperation(operation: BuildOperation<R>): R {
345348
return executeOperation(operation, logger = null)
@@ -367,6 +370,7 @@ private class BuildSessionV1Adapter(
367370
}
368371
}
369372

373+
@Suppress("DEPRECATION")
370374
public fun CompilationService.asKotlinToolchains(): KotlinToolchains = KotlinToolchainsV1Adapter(this)
371375

372376
private abstract class BuildOperationImpl<R> : BuildOperation<R> {

compiler/build-tools/kotlin-build-tools-impl/src/main/kotlin/org/jetbrains/kotlin/buildtools/internal/CompilationServiceImpl.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
44
*/
55

6+
@file:Suppress("DEPRECATION")
7+
68
package org.jetbrains.kotlin.buildtools.internal
79

810
import com.intellij.openapi.vfs.impl.ZipHandler

compiler/build-tools/kotlin-build-tools-impl/src/main/kotlin/org/jetbrains/kotlin/buildtools/internal/CompilerExecutionStrategyConfigurationImpl.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
44
*/
55

6+
@file:Suppress("DEPRECATION")
7+
68
package org.jetbrains.kotlin.buildtools.internal
79

810
import org.jetbrains.kotlin.buildtools.api.CompilerExecutionStrategyConfiguration

libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/scripting/internal/ScriptingGradleSubplugin.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
44
*/
55

6-
@file:Suppress("UnstableApiUsage")
6+
@file:Suppress("UnstableApiUsage", "DEPRECATION")
77

88
package org.jetbrains.kotlin.gradle.scripting.internal
99

0 commit comments

Comments
 (0)