diff --git a/build.gradle.kts b/build.gradle.kts
index 0c729e44971..1e4cb14a2b8 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -380,6 +380,7 @@ val projectsWithEnabledContextReceivers by extra {
val gradlePluginProjects = listOf(
":kotlin-gradle-plugin",
":kotlin-gradle-plugin-api",
+ ":kotlin-gradle-plugin-annotations",
":kotlin-gradle-plugin-idea",
":kotlin-gradle-plugin-idea-proto",
":kotlin-gradle-plugin-kpm-android",
diff --git a/buildSrc/src/main/kotlin/tasks.kt b/buildSrc/src/main/kotlin/tasks.kt
index 66d197fcf63..a4a2d04da5b 100644
--- a/buildSrc/src/main/kotlin/tasks.kt
+++ b/buildSrc/src/main/kotlin/tasks.kt
@@ -44,6 +44,7 @@ val kotlinGradlePluginAndItsRequired = arrayOf(
":kotlin-daemon-client",
":kotlin-project-model",
":kotlin-gradle-plugin-api",
+ ":kotlin-gradle-plugin-annotations",
":kotlin-gradle-plugin-idea",
":kotlin-gradle-plugin-idea-proto",
":kotlin-gradle-plugin",
diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml
index 2e021aa2d8e..e91a2e0a1ae 100644
--- a/gradle/verification-metadata.xml
+++ b/gradle/verification-metadata.xml
@@ -18,6 +18,7 @@
+
diff --git a/libraries/tools/kotlin-gradle-plugin-annotations/build.gradle.kts b/libraries/tools/kotlin-gradle-plugin-annotations/build.gradle.kts
new file mode 100644
index 00000000000..22e3fb1e71d
--- /dev/null
+++ b/libraries/tools/kotlin-gradle-plugin-annotations/build.gradle.kts
@@ -0,0 +1,12 @@
+plugins {
+ kotlin("jvm")
+}
+
+configureKotlinCompileTasksGradleCompatibility()
+
+publish()
+standardPublicJars()
+
+dependencies {
+ compileOnly(kotlinStdlib())
+}
\ No newline at end of file
diff --git a/libraries/tools/kotlin-gradle-plugin-annotations/src/main/kotlin/org/jetbrains/kotlin/gradle/ExperimentalKotlinGradlePluginApi.kt b/libraries/tools/kotlin-gradle-plugin-annotations/src/main/kotlin/org/jetbrains/kotlin/gradle/ExperimentalKotlinGradlePluginApi.kt
new file mode 100644
index 00000000000..1a079463ba7
--- /dev/null
+++ b/libraries/tools/kotlin-gradle-plugin-annotations/src/main/kotlin/org/jetbrains/kotlin/gradle/ExperimentalKotlinGradlePluginApi.kt
@@ -0,0 +1,13 @@
+/*
+ * Copyright 2010-2022 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.
+ */
+
+package org.jetbrains.kotlin.gradle
+
+@RequiresOptIn(
+ message = "Experimental API in the Kotlin Gradle Plugin: No stability guarantees can be provided. " +
+ "The API could get removed in the future without replacement",
+ level = RequiresOptIn.Level.WARNING
+)
+annotation class ExperimentalKotlinGradlePluginApi
diff --git a/libraries/tools/kotlin-gradle-plugin-annotations/src/main/kotlin/org/jetbrains/kotlin/gradle/InternalKotlinGradlePluginApi.kt b/libraries/tools/kotlin-gradle-plugin-annotations/src/main/kotlin/org/jetbrains/kotlin/gradle/InternalKotlinGradlePluginApi.kt
new file mode 100644
index 00000000000..39efaf5ef45
--- /dev/null
+++ b/libraries/tools/kotlin-gradle-plugin-annotations/src/main/kotlin/org/jetbrains/kotlin/gradle/InternalKotlinGradlePluginApi.kt
@@ -0,0 +1,12 @@
+/*
+ * Copyright 2010-2022 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.
+ */
+
+package org.jetbrains.kotlin.gradle
+
+@RequiresOptIn(
+ message = "This API is not intended to be used outside of JetBrains / outside the Kotlin Gradle Plugin",
+ level = RequiresOptIn.Level.ERROR
+)
+annotation class InternalKotlinGradlePluginApi
diff --git a/libraries/tools/kotlin-gradle-plugin-api/build.gradle.kts b/libraries/tools/kotlin-gradle-plugin-api/build.gradle.kts
index 17ee5d9c588..7dd278ec9b1 100644
--- a/libraries/tools/kotlin-gradle-plugin-api/build.gradle.kts
+++ b/libraries/tools/kotlin-gradle-plugin-api/build.gradle.kts
@@ -4,6 +4,7 @@ plugins {
}
dependencies {
+ commonApi(project(":kotlin-gradle-plugin-annotations"))
commonApi(project(":native:kotlin-native-utils"))
commonApi(project(":kotlin-project-model"))
commonImplementation(project(":kotlin-tooling-core"))
diff --git a/settings.gradle b/settings.gradle
index d0cfbf04acb..2d9d24e017d 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -251,6 +251,7 @@ include ":kotlin-imports-dumper-compiler-plugin",
":kotlin-project-model-tests-generator",
":kotlin-gradle-compiler-types",
":kotlin-gradle-plugin-api",
+ ":kotlin-gradle-plugin-annotations",
":kotlin-gradle-plugin-idea",
":kotlin-gradle-plugin-idea-proto",
":kotlin-gradle-plugin-idea-for-compatibility-tests",
@@ -756,6 +757,7 @@ project(':kotlin-project-model').projectDir = "$rootDir/libraries/tools/kotlin-p
project(':kotlin-project-model-tests-generator').projectDir = "$rootDir/libraries/tools/kotlin-project-model-tests-generator" as File
project(':kotlin-gradle-compiler-types').projectDir = "$rootDir/libraries/tools/kotlin-gradle-compiler-types" as File
project(':kotlin-gradle-plugin-api').projectDir = "$rootDir/libraries/tools/kotlin-gradle-plugin-api" as File
+project(':kotlin-gradle-plugin-annotations').projectDir = "$rootDir/libraries/tools/kotlin-gradle-plugin-annotations" as File
project(':kotlin-gradle-plugin-idea').projectDir = "$rootDir/libraries/tools/kotlin-gradle-plugin-idea" as File
project(':kotlin-gradle-plugin-idea-proto').projectDir = "$rootDir/libraries/tools/kotlin-gradle-plugin-idea-proto" as File
project(':kotlin-gradle-plugin-idea-for-compatibility-tests').projectDir = "$rootDir/libraries/tools/kotlin-gradle-plugin-idea-for-compatibility-tests" as File