[Gradle] Move some of the DSL to the API module
DSL exposed in the build scripts in effectively an API, so this change moves it to the kotlin-gradle-plugin-api subproject. ^KT-50869 In Progress
This commit is contained in:
committed by
teamcity
parent
bb4f996467
commit
c93594331b
+121
@@ -0,0 +1,121 @@
|
||||
/*
|
||||
* Copyright 2010-2021 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.dsl
|
||||
|
||||
/**
|
||||
* DSL extension used to configure KAPT stub generation and KAPT annotation processing.
|
||||
*/
|
||||
interface KaptExtensionConfig {
|
||||
|
||||
/**
|
||||
* If `true`, compile classpath should be used to search for annotation processors.
|
||||
*/
|
||||
var includeCompileClasspath: Boolean?
|
||||
|
||||
/**
|
||||
* If `true`, skip body analysis if possible.
|
||||
*/
|
||||
var useLightAnalysis: Boolean
|
||||
|
||||
/**
|
||||
* If `true`, replace generated or error types with ones from the generated sources.
|
||||
*/
|
||||
var correctErrorTypes: Boolean
|
||||
|
||||
/**
|
||||
* If `true`, put initializers on fields when corresponding primary constructor parameters have a default value specified.
|
||||
*/
|
||||
var dumpDefaultParameterValues: Boolean
|
||||
|
||||
/**
|
||||
* If `true`, map diagnostic reported on kapt stubs to original locations in Kotlin sources.
|
||||
*/
|
||||
var mapDiagnosticLocations: Boolean
|
||||
|
||||
/**
|
||||
* If `true`, show errors on incompatibilities during stub generation.
|
||||
*/
|
||||
var strictMode: Boolean
|
||||
|
||||
/**
|
||||
* If `true`, strip @Metadata annotations from stubs.
|
||||
*/
|
||||
var stripMetadata: Boolean
|
||||
|
||||
/**
|
||||
* If `true`, show annotation processor timings.
|
||||
*/
|
||||
var showProcessorTimings: Boolean
|
||||
|
||||
/**
|
||||
* If `true`, detect memory leaks in annotation processors.
|
||||
*/
|
||||
var detectMemoryLeaks: String
|
||||
|
||||
/**
|
||||
* Opt-out switch for Kapt caching. Should be used when annotation processors used by this project are suspected of
|
||||
* using anything aside from the task inputs in their logic and are not guaranteed to produce the same
|
||||
* output on subsequent runs without input changes.
|
||||
*/
|
||||
var useBuildCache: Boolean
|
||||
|
||||
/**
|
||||
* If true keeps annotation processors added via `annotationProcessor(..)` configuration for javac java-files compilation
|
||||
*/
|
||||
var keepJavacAnnotationProcessors: Boolean
|
||||
|
||||
/**
|
||||
* Adds annotation processor with the specified [fqName] to the list of processors to run.
|
||||
*/
|
||||
fun annotationProcessor(fqName: String)
|
||||
|
||||
/**
|
||||
* Adds annotation processors with the specified [fqName] to the list of processors to run.
|
||||
*/
|
||||
fun annotationProcessors(vararg fqName: String)
|
||||
|
||||
/**
|
||||
* Configure [KaptArguments] used for annotation processing.
|
||||
*/
|
||||
fun arguments(action: KaptArguments.() -> Unit)
|
||||
|
||||
/**
|
||||
* Configure [KaptJavacOption] used for annotation processing.
|
||||
*/
|
||||
fun javacOptions(action: KaptJavacOption.() -> Unit)
|
||||
|
||||
/**
|
||||
* Gets all javac options used for KAPT.
|
||||
*/
|
||||
fun getJavacOptions(): Map<String, String>
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface used to specify arguments that are used during KAPT processing.
|
||||
*/
|
||||
interface KaptArguments {
|
||||
|
||||
/**
|
||||
* Adds argument with the specified name and values.
|
||||
*/
|
||||
fun arg(name: Any, vararg values: Any)
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface used to specify javac options that are used during KAPT processing.
|
||||
*/
|
||||
interface KaptJavacOption {
|
||||
|
||||
/**
|
||||
* Adds an option with name and value.
|
||||
*/
|
||||
fun option(name: Any, value: Any)
|
||||
|
||||
/**
|
||||
* Adds an option with name only (no value associated).
|
||||
*/
|
||||
fun option(name: Any)
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
// DO NOT EDIT MANUALLY!
|
||||
// Generated by org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt
|
||||
package org.jetbrains.kotlin.gradle.dsl
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
interface KotlinJsDceOptions : org.jetbrains.kotlin.gradle.dsl.KotlinCommonToolOptions {
|
||||
|
||||
/**
|
||||
* Development mode: don't strip out any code, just copy dependencies
|
||||
* Default value: false
|
||||
*/
|
||||
var devMode: kotlin.Boolean
|
||||
|
||||
/**
|
||||
* Output directory
|
||||
* Default value: null
|
||||
*/
|
||||
var outputDirectory: kotlin.String?
|
||||
}
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
// DO NOT EDIT MANUALLY!
|
||||
// Generated by org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt
|
||||
package org.jetbrains.kotlin.gradle.dsl
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
interface KotlinJsOptions : org.jetbrains.kotlin.gradle.dsl.KotlinCommonOptions {
|
||||
|
||||
/**
|
||||
* Disable internal declaration export
|
||||
* Default value: false
|
||||
*/
|
||||
var friendModulesDisabled: kotlin.Boolean
|
||||
|
||||
/**
|
||||
* Define whether the `main` function should be called upon execution
|
||||
* Possible values: "call", "noCall"
|
||||
* Default value: "call"
|
||||
*/
|
||||
var main: kotlin.String
|
||||
|
||||
/**
|
||||
* Generate .meta.js and .kjsm files with metadata. Use to create a library
|
||||
* Default value: true
|
||||
*/
|
||||
var metaInfo: kotlin.Boolean
|
||||
|
||||
/**
|
||||
* Kind of the JS module generated by the compiler
|
||||
* Possible values: "plain", "amd", "commonjs", "umd"
|
||||
* Default value: "plain"
|
||||
*/
|
||||
var moduleKind: kotlin.String
|
||||
|
||||
/**
|
||||
* Don't automatically include the default Kotlin/JS stdlib into compilation dependencies
|
||||
* Default value: true
|
||||
*/
|
||||
var noStdlib: kotlin.Boolean
|
||||
|
||||
/**
|
||||
* Destination *.js file for the compilation result
|
||||
* Default value: null
|
||||
*/
|
||||
var outputFile: kotlin.String?
|
||||
|
||||
/**
|
||||
* Generate source map
|
||||
* Default value: false
|
||||
*/
|
||||
var sourceMap: kotlin.Boolean
|
||||
|
||||
/**
|
||||
* Embed source files into source map
|
||||
* Possible values: "never", "always", "inlining"
|
||||
* Default value: null
|
||||
*/
|
||||
var sourceMapEmbedSources: kotlin.String?
|
||||
|
||||
/**
|
||||
* Add the specified prefix to paths in the source map
|
||||
* Default value: null
|
||||
*/
|
||||
var sourceMapPrefix: kotlin.String?
|
||||
|
||||
/**
|
||||
* Generate JS files for specific ECMA version
|
||||
* Possible values: "v5"
|
||||
* Default value: "v5"
|
||||
*/
|
||||
var target: kotlin.String
|
||||
|
||||
/**
|
||||
* Translate primitive arrays to JS typed arrays
|
||||
* Default value: true
|
||||
*/
|
||||
var typedArrays: kotlin.Boolean
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
// DO NOT EDIT MANUALLY!
|
||||
// Generated by org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt
|
||||
package org.jetbrains.kotlin.gradle.dsl
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
interface KotlinJvmOptions : org.jetbrains.kotlin.gradle.dsl.KotlinCommonOptions {
|
||||
|
||||
/**
|
||||
* Generate metadata for Java 1.8 reflection on method parameters
|
||||
* Default value: false
|
||||
*/
|
||||
var javaParameters: kotlin.Boolean
|
||||
|
||||
/**
|
||||
* Include a custom JDK from the specified location into the classpath instead of the default JAVA_HOME
|
||||
* Default value: null
|
||||
*/
|
||||
@Deprecated(message = "This option is not working well with Gradle caching and will be removed in the future.", level = DeprecationLevel.WARNING)
|
||||
var jdkHome: kotlin.String?
|
||||
|
||||
/**
|
||||
* Target version of the generated JVM bytecode (1.6 (DEPRECATED), 1.8, 9, 10, 11, 12, 13, 14, 15, 16 or 17), default is 1.8
|
||||
* Possible values: "1.6", "1.8", "9", "10", "11", "12", "13", "14", "15", "16", "17"
|
||||
* Default value: null
|
||||
*/
|
||||
var jvmTarget: kotlin.String?
|
||||
|
||||
/**
|
||||
* Name of the generated .kotlin_module file
|
||||
* Default value: null
|
||||
*/
|
||||
var moduleName: kotlin.String?
|
||||
|
||||
/**
|
||||
* Don't automatically include the Java runtime into the classpath
|
||||
* Default value: false
|
||||
*/
|
||||
var noJdk: kotlin.Boolean
|
||||
|
||||
/**
|
||||
* Don't automatically include the Kotlin/JVM stdlib and Kotlin reflection into the classpath
|
||||
* Default value: true
|
||||
*/
|
||||
@Deprecated(message = "This option has no effect and will be removed in a future release.", level = DeprecationLevel.ERROR)
|
||||
var noStdlib: kotlin.Boolean
|
||||
|
||||
/**
|
||||
* Use the IR backend. This option has no effect unless the language version less than 1.5 is used
|
||||
* Default value: false
|
||||
*/
|
||||
@Deprecated(message = "This option has no effect and will be removed in a future release.", level = DeprecationLevel.HIDDEN)
|
||||
var useIR: kotlin.Boolean
|
||||
|
||||
/**
|
||||
* Use the old JVM backend
|
||||
* Default value: false
|
||||
*/
|
||||
var useOldBackend: kotlin.Boolean
|
||||
}
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright 2010-2021 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.dsl
|
||||
|
||||
/**
|
||||
* DSL extension that is used to configure Kotlin options for the entire project.
|
||||
*/
|
||||
interface KotlinTopLevelExtensionConfig {
|
||||
val experimental: ExperimentalExtensionConfig
|
||||
|
||||
/**
|
||||
* Version of the core Kotlin libraries that are added to Kotlin compile classpath, unless there is already a dependency added to this
|
||||
* project. By default, this version is the same as the version of the used Kotlin Gradle plugin.
|
||||
*/
|
||||
var coreLibrariesVersion: String
|
||||
|
||||
/**
|
||||
* Option that tells the compiler if and how to report issues on all public API declarations without explicit visibility or return type.
|
||||
*/
|
||||
var explicitApi: ExplicitApiMode?
|
||||
|
||||
/**
|
||||
* Sets [explicitApi] option to report issues as errors.
|
||||
*/
|
||||
fun explicitApi()
|
||||
|
||||
/**
|
||||
* Sets [explicitApi] option to report issues as warnings.
|
||||
*/
|
||||
fun explicitApiWarning()
|
||||
}
|
||||
|
||||
interface ExperimentalExtensionConfig {
|
||||
var coroutines: Coroutines?
|
||||
}
|
||||
|
||||
/**
|
||||
* Different modes that can be used to set the level of issue reporting for [KotlinTopLevelExtensionConfig.explicitApi] option.
|
||||
*/
|
||||
enum class ExplicitApiMode(private val cliOption: String) {
|
||||
/** Report issues as errors. */
|
||||
Strict("strict"),
|
||||
|
||||
/** Report issues as warnings. */
|
||||
Warning("warning"),
|
||||
|
||||
/** Disable issues reporting. */
|
||||
Disabled("disable");
|
||||
|
||||
fun toCompilerArg() = "-Xexplicit-api=$cliOption"
|
||||
}
|
||||
|
||||
enum class Coroutines {
|
||||
ENABLE,
|
||||
WARN,
|
||||
ERROR,
|
||||
DEFAULT;
|
||||
|
||||
companion object {
|
||||
fun byCompilerArgument(argument: String): Coroutines? =
|
||||
values().firstOrNull { it.name.equals(argument, ignoreCase = true) }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user