[CLI] reduce memory usage for compiler settings
make write protection directly in properties it creates no additional wrapper with the link to the containing class for ij project, this reduces memory usage for ~15 mb ^KT-56351
This commit is contained in:
+350
-70
@@ -29,7 +29,11 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
|
||||
}
|
||||
|
||||
@get:Transient
|
||||
var autoAdvanceLanguageVersion: Boolean by FreezableVar(true)
|
||||
var autoAdvanceLanguageVersion = true
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@GradleOption(
|
||||
value = DefaultValue.LANGUAGE_VERSIONS,
|
||||
@@ -41,10 +45,18 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
|
||||
valueDescription = "<version>",
|
||||
description = "Provide source compatibility with the specified version of Kotlin"
|
||||
)
|
||||
var languageVersion: String? by NullableStringFreezableVar(null)
|
||||
var languageVersion: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = if (value.isNullOrEmpty()) null else value
|
||||
}
|
||||
|
||||
@get:Transient
|
||||
var autoAdvanceApiVersion: Boolean by FreezableVar(true)
|
||||
var autoAdvanceApiVersion = true
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@GradleOption(
|
||||
value = DefaultValue.API_VERSIONS,
|
||||
@@ -56,14 +68,22 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
|
||||
valueDescription = "<version>",
|
||||
description = "Allow using declarations only from the specified version of bundled libraries"
|
||||
)
|
||||
var apiVersion: String? by NullableStringFreezableVar(null)
|
||||
var apiVersion: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = if (value.isNullOrEmpty()) null else value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-kotlin-home",
|
||||
valueDescription = "<path>",
|
||||
description = "Path to the home directory of Kotlin compiler used for discovery of runtime libraries"
|
||||
)
|
||||
var kotlinHome: String? by NullableStringFreezableVar(null)
|
||||
var kotlinHome: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = if (value.isNullOrEmpty()) null else value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-progressive",
|
||||
@@ -74,10 +94,18 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
|
||||
"Code written in the progressive mode is backward compatible; however, code written in\n" +
|
||||
"non-progressive mode may cause compilation errors in the progressive mode."
|
||||
)
|
||||
var progressiveMode by FreezableVar(false)
|
||||
var progressiveMode = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(value = "-script", description = "Evaluate the given Kotlin script (*.kts) file")
|
||||
var script: Boolean by FreezableVar(false)
|
||||
var script = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-opt-in",
|
||||
@@ -85,82 +113,155 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
|
||||
valueDescription = "<fq.name>",
|
||||
description = "Enable usages of API that requires opt-in with an opt-in requirement marker with the given fully qualified name"
|
||||
)
|
||||
var optIn: Array<String>? by FreezableVar(null)
|
||||
var optIn: Array<String>? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
// Advanced options
|
||||
|
||||
@Argument(value = "-Xno-inline", description = "Disable method inlining")
|
||||
var noInline: Boolean by FreezableVar(false)
|
||||
var noInline = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xskip-metadata-version-check",
|
||||
description = "Allow to load classes with bad metadata version and pre-release classes"
|
||||
)
|
||||
var skipMetadataVersionCheck: Boolean by FreezableVar(false)
|
||||
var skipMetadataVersionCheck = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(value = "-Xskip-prerelease-check", description = "Allow to load pre-release classes")
|
||||
var skipPrereleaseCheck: Boolean by FreezableVar(false)
|
||||
var skipPrereleaseCheck = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xallow-kotlin-package",
|
||||
description = "Allow compiling code in package 'kotlin' and allow not requiring kotlin.stdlib in module-info"
|
||||
)
|
||||
var allowKotlinPackage: Boolean by FreezableVar(false)
|
||||
var allowKotlinPackage = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(value = "-Xreport-output-files", description = "Report source to output files mapping")
|
||||
var reportOutputFiles: Boolean by FreezableVar(false)
|
||||
var reportOutputFiles = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(value = "-Xplugin", valueDescription = "<path>", description = "Load plugins from the given classpath")
|
||||
var pluginClasspaths: Array<String>? by FreezableVar(null)
|
||||
var pluginClasspaths: Array<String>? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(value = "-P", valueDescription = PLUGIN_OPTION_FORMAT, description = "Pass an option to a plugin")
|
||||
var pluginOptions: Array<String>? by FreezableVar(null)
|
||||
var pluginOptions: Array<String>? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(value = "-Xcompiler-plugin", valueDescription = "<path1>,<path2>:<optionName>=<value>,<optionName>=<value>", description = "Register compiler plugin", delimiter = "")
|
||||
var pluginConfigurations: Array<String>? by FreezableVar(null)
|
||||
@Argument(
|
||||
value = "-Xcompiler-plugin",
|
||||
valueDescription = "<path1>,<path2>:<optionName>=<value>,<optionName>=<value>",
|
||||
description = "Register compiler plugin",
|
||||
delimiter = ""
|
||||
)
|
||||
var pluginConfigurations: Array<String>? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(value = "-Xmulti-platform", description = "Enable experimental language support for multi-platform projects")
|
||||
var multiPlatform: Boolean by FreezableVar(false)
|
||||
var multiPlatform = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(value = "-Xno-check-actual", description = "Do not check presence of 'actual' modifier in multi-platform projects")
|
||||
var noCheckActual: Boolean by FreezableVar(false)
|
||||
var noCheckActual = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xintellij-plugin-root",
|
||||
valueDescription = "<path>",
|
||||
description = "Path to the kotlin-compiler.jar or directory where IntelliJ configuration files can be found"
|
||||
)
|
||||
var intellijPluginRoot: String? by NullableStringFreezableVar(null)
|
||||
var intellijPluginRoot: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = if (value.isNullOrEmpty()) null else value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xnew-inference",
|
||||
description = "Enable new experimental generic type inference algorithm"
|
||||
)
|
||||
var newInference: Boolean by FreezableVar(false)
|
||||
var newInference = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xinline-classes",
|
||||
description = "Enable experimental inline classes"
|
||||
)
|
||||
var inlineClasses: Boolean by FreezableVar(false)
|
||||
var inlineClasses = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xlegacy-smart-cast-after-try",
|
||||
description = "Allow var smart casts despite assignment in try block"
|
||||
)
|
||||
var legacySmartCastAfterTry: Boolean by FreezableVar(false)
|
||||
var legacySmartCastAfterTry = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xeffect-system",
|
||||
description = "Enable experimental language feature: effect system"
|
||||
)
|
||||
var effectSystem: Boolean by FreezableVar(false)
|
||||
var effectSystem = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xread-deserialized-contracts",
|
||||
description = "Enable reading of contracts from metadata"
|
||||
)
|
||||
var readDeserializedContracts: Boolean by FreezableVar(false)
|
||||
var readDeserializedContracts = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@IDEAPluginsCompatibilityAPI(
|
||||
IDEAPlatforms._212, // maybe 211 AS used it too
|
||||
@@ -176,29 +277,49 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
|
||||
message = "Please migrate to -opt-in",
|
||||
plugins = "Android"
|
||||
)
|
||||
var useExperimental: Array<String>? by FreezableVar(null)
|
||||
var useExperimental: Array<String>? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xproper-ieee754-comparisons",
|
||||
description = "Generate proper IEEE 754 comparisons in all cases if values are statically known to be of primitive numeric types"
|
||||
)
|
||||
var properIeee754Comparisons by FreezableVar(false)
|
||||
var properIeee754Comparisons = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(value = "-Xreport-perf", description = "Report detailed performance statistics")
|
||||
var reportPerf: Boolean by FreezableVar(false)
|
||||
var reportPerf = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xdump-perf",
|
||||
valueDescription = "<path>",
|
||||
description = "Dump detailed performance statistics to the specified file"
|
||||
)
|
||||
var dumpPerf: String? by NullableStringFreezableVar(null)
|
||||
var dumpPerf: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = if (value.isNullOrEmpty()) null else value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xmetadata-version",
|
||||
description = "Change metadata version of the generated binary files"
|
||||
)
|
||||
var metadataVersion: String? by FreezableVar(null)
|
||||
var metadataVersion: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xcommon-sources",
|
||||
@@ -206,97 +327,161 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
|
||||
description = "Sources of the common module that need to be compiled together with this module in the multi-platform mode.\n" +
|
||||
"Should be a subset of sources passed as free arguments"
|
||||
)
|
||||
var commonSources: Array<String>? by FreezableVar(null)
|
||||
var commonSources: Array<String>? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xallow-result-return-type",
|
||||
description = "Allow compiling code when `kotlin.Result` is used as a return type"
|
||||
)
|
||||
var allowResultReturnType: Boolean by FreezableVar(false)
|
||||
var allowResultReturnType = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xlist-phases",
|
||||
description = "List backend phases"
|
||||
)
|
||||
var listPhases: Boolean by FreezableVar(false)
|
||||
var listPhases = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xdisable-phases",
|
||||
description = "Disable backend phases"
|
||||
)
|
||||
var disablePhases: Array<String>? by FreezableVar(null)
|
||||
var disablePhases: Array<String>? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xverbose-phases",
|
||||
description = "Be verbose while performing these backend phases"
|
||||
)
|
||||
var verbosePhases: Array<String>? by FreezableVar(null)
|
||||
var verbosePhases: Array<String>? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xphases-to-dump-before",
|
||||
description = "Dump backend state before these phases"
|
||||
)
|
||||
var phasesToDumpBefore: Array<String>? by FreezableVar(null)
|
||||
var phasesToDumpBefore: Array<String>? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xphases-to-dump-after",
|
||||
description = "Dump backend state after these phases"
|
||||
)
|
||||
var phasesToDumpAfter: Array<String>? by FreezableVar(null)
|
||||
var phasesToDumpAfter: Array<String>? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xphases-to-dump",
|
||||
description = "Dump backend state both before and after these phases"
|
||||
)
|
||||
var phasesToDump: Array<String>? by FreezableVar(null)
|
||||
var phasesToDump: Array<String>? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xdump-directory",
|
||||
description = "Dump backend state into directory"
|
||||
)
|
||||
var dumpDirectory: String? by FreezableVar(null)
|
||||
var dumpDirectory: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xdump-fqname",
|
||||
description = "FqName of declaration that should be dumped"
|
||||
)
|
||||
var dumpOnlyFqName: String? by FreezableVar(null)
|
||||
var dumpOnlyFqName: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xphases-to-validate-before",
|
||||
description = "Validate backend state before these phases"
|
||||
)
|
||||
var phasesToValidateBefore: Array<String>? by FreezableVar(null)
|
||||
var phasesToValidateBefore: Array<String>? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xphases-to-validate-after",
|
||||
description = "Validate backend state after these phases"
|
||||
)
|
||||
var phasesToValidateAfter: Array<String>? by FreezableVar(null)
|
||||
var phasesToValidateAfter: Array<String>? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xphases-to-validate",
|
||||
description = "Validate backend state both before and after these phases"
|
||||
)
|
||||
var phasesToValidate: Array<String>? by FreezableVar(null)
|
||||
var phasesToValidate: Array<String>? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xprofile-phases",
|
||||
description = "Profile backend phases"
|
||||
)
|
||||
var profilePhases: Boolean by FreezableVar(false)
|
||||
var profilePhases = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xcheck-phase-conditions",
|
||||
description = "Check pre- and postconditions on phases"
|
||||
)
|
||||
var checkPhaseConditions: Boolean by FreezableVar(false)
|
||||
var checkPhaseConditions = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xcheck-sticky-phase-conditions",
|
||||
description = "Run sticky condition checks on subsequent phases as well. Implies -Xcheck-phase-conditions"
|
||||
)
|
||||
var checkStickyPhaseConditions: Boolean by FreezableVar(false)
|
||||
var checkStickyPhaseConditions = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@GradleDeprecatedOption(
|
||||
message = "Compiler flag -Xuse-k2 is deprecated; please use language version 2.0 instead",
|
||||
@@ -313,46 +498,78 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
|
||||
deprecatedName = "-Xuse-fir",
|
||||
description = "Compile using experimental K2. K2 is a new compiler pipeline, no compatibility guarantees are yet provided"
|
||||
)
|
||||
var useK2: Boolean by FreezableVar(false)
|
||||
var useK2 = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xuse-fir-extended-checkers",
|
||||
description = "Use extended analysis mode based on Front-end IR. Warning: this feature is far from being production-ready"
|
||||
)
|
||||
var useFirExtendedCheckers: Boolean by FreezableVar(false)
|
||||
var useFirExtendedCheckers = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xuse-fir-ic",
|
||||
description = "Compile using Front-end IR internal incremental compilation cycle. Warning: this feature is far from being production-ready"
|
||||
)
|
||||
var useFirIC: Boolean by FreezableVar(false)
|
||||
var useFirIC = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xuse-fir-lt",
|
||||
description = "Compile using LightTree parser with Front-end IR. Warning: this feature is far from being production-ready"
|
||||
)
|
||||
var useFirLT: Boolean by FreezableVar(true)
|
||||
var useFirLT = true
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xdisable-ultra-light-classes",
|
||||
description = "Do not use the ultra light classes implementation"
|
||||
)
|
||||
var disableUltraLightClasses: Boolean by FreezableVar(false)
|
||||
var disableUltraLightClasses = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xuse-mixed-named-arguments",
|
||||
description = "Enable Support named arguments in their own position even if the result appears as mixed"
|
||||
)
|
||||
var useMixedNamedArguments: Boolean by FreezableVar(false)
|
||||
var useMixedNamedArguments = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xexpect-actual-linker",
|
||||
description = "Enable experimental expect/actual linker"
|
||||
)
|
||||
var expectActualLinker: Boolean by FreezableVar(false)
|
||||
var expectActualLinker = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(value = "-Xdisable-default-scripting-plugin", description = "Do not enable scripting plugin by default")
|
||||
var disableDefaultScriptingPlugin: Boolean by FreezableVar(false)
|
||||
var disableDefaultScriptingPlugin = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xexplicit-api",
|
||||
@@ -360,84 +577,144 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
|
||||
description = "Force compiler to report errors on all public API declarations without explicit visibility or return type.\n" +
|
||||
"Use 'warning' level to issue warnings instead of errors."
|
||||
)
|
||||
var explicitApi: String by FreezableVar(ExplicitApiMode.DISABLED.state)
|
||||
var explicitApi: String = ExplicitApiMode.DISABLED.state
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xinference-compatibility",
|
||||
description = "Enable compatibility changes for generic type inference algorithm"
|
||||
)
|
||||
var inferenceCompatibility: Boolean by FreezableVar(false)
|
||||
var inferenceCompatibility = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xsuppress-version-warnings",
|
||||
description = "Suppress warnings about outdated, inconsistent or experimental language or API versions"
|
||||
)
|
||||
var suppressVersionWarnings: Boolean by FreezableVar(false)
|
||||
var suppressVersionWarnings = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xextended-compiler-checks",
|
||||
description = "Enable additional compiler checks that might provide verbose diagnostic information for certain errors.\n" +
|
||||
"Warning: this mode is not backward-compatible and might cause compilation errors in previously compiled code."
|
||||
)
|
||||
var extendedCompilerChecks: Boolean by FreezableVar(false)
|
||||
var extendedCompilerChecks = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xbuiltins-from-sources",
|
||||
description = "Compile builtIns from sources"
|
||||
)
|
||||
var builtInsFromSources: Boolean by FreezableVar(false)
|
||||
var builtInsFromSources = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xunrestricted-builder-inference",
|
||||
description = "Eliminate builder inference restrictions like allowance of returning type variables of a builder inference call"
|
||||
)
|
||||
var unrestrictedBuilderInference: Boolean by FreezableVar(false)
|
||||
var unrestrictedBuilderInference = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xenable-builder-inference",
|
||||
description = "Use the builder inference by default, for all calls with lambdas which can't be resolved without it.\n" +
|
||||
"The corresponding calls' declarations may not be marked with @BuilderInference."
|
||||
)
|
||||
var enableBuilderInference: Boolean by FreezableVar(false)
|
||||
var enableBuilderInference = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xself-upper-bound-inference",
|
||||
description = "Support inferring type arguments based on only self upper bounds of the corresponding type parameters"
|
||||
)
|
||||
var selfUpperBoundInference: Boolean by FreezableVar(false)
|
||||
var selfUpperBoundInference = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xcontext-receivers",
|
||||
description = "Enable experimental context receivers"
|
||||
)
|
||||
var contextReceivers: Boolean by FreezableVar(false)
|
||||
var contextReceivers = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xklib-relative-path-base",
|
||||
description = "Provide a base paths to compute source's relative paths in klib (default is empty)"
|
||||
)
|
||||
var relativePathBases: Array<String>? by FreezableVar(null)
|
||||
var relativePathBases: Array<String>? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xklib-normalize-absolute-path",
|
||||
description = "Normalize absolute paths in klibs"
|
||||
)
|
||||
var normalizeAbsolutePath: Boolean by FreezableVar(false)
|
||||
var normalizeAbsolutePath = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xklib-enable-signature-clash-checks",
|
||||
description = "Enable the checks on uniqueness of signatures"
|
||||
)
|
||||
var enableSignatureClashChecks: Boolean by FreezableVar(true)
|
||||
var enableSignatureClashChecks = true
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(value = "-Xenable-incremental-compilation", description = "Enable incremental compilation")
|
||||
var incrementalCompilation: Boolean? by FreezableVar(null)
|
||||
var incrementalCompilation: Boolean? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(value = "-Xrender-internal-diagnostic-names", description = "Render internal names of warnings and errors")
|
||||
var renderInternalDiagnosticNames: Boolean by FreezableVar(false)
|
||||
var renderInternalDiagnosticNames = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(value = "-Xallow-any-scripts-in-source-roots", description = "Allow to compile any scripts along with regular Kotlin sources")
|
||||
var allowAnyScriptsInSourceRoots: Boolean by FreezableVar(false)
|
||||
var allowAnyScriptsInSourceRoots = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@OptIn(IDEAPluginsCompatibilityAPI::class)
|
||||
open fun configureAnalysisFlags(collector: MessageCollector, languageVersion: LanguageVersion): MutableMap<AnalysisFlag<*>, Any> {
|
||||
@@ -675,7 +952,10 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun findOutdatedVersion(language: LanguageVersion, api: ApiVersion): Triple<LanguageOrApiVersion, LanguageOrApiVersion?, VersionKind>? {
|
||||
private fun findOutdatedVersion(
|
||||
language: LanguageVersion,
|
||||
api: ApiVersion
|
||||
): Triple<LanguageOrApiVersion, LanguageOrApiVersion?, VersionKind>? {
|
||||
return when {
|
||||
language.isUnsupported -> Triple(language, LanguageVersion.FIRST_SUPPORTED, VersionKind.LANGUAGE)
|
||||
api.isUnsupported -> Triple(api, ApiVersion.FIRST_SUPPORTED, VersionKind.API)
|
||||
|
||||
+40
-8
@@ -24,19 +24,35 @@ abstract class CommonToolArguments : Freezable(), Serializable {
|
||||
private val serialVersionUID = 0L
|
||||
}
|
||||
|
||||
var freeArgs: List<String> by FreezableVar(emptyList())
|
||||
var freeArgs: List<String> = emptyList()
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Transient
|
||||
var errors: ArgumentParseErrors? = null
|
||||
|
||||
@Argument(value = "-help", shortName = "-h", description = "Print a synopsis of standard options")
|
||||
var help: Boolean by FreezableVar(false)
|
||||
var help = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(value = "-X", description = "Print a synopsis of advanced options")
|
||||
var extraHelp: Boolean by FreezableVar(false)
|
||||
var extraHelp = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(value = "-version", description = "Display compiler version")
|
||||
var version: Boolean by FreezableVar(false)
|
||||
var version = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@GradleOption(
|
||||
value = DefaultValue.BOOLEAN_FALSE_DEFAULT,
|
||||
@@ -44,7 +60,11 @@ abstract class CommonToolArguments : Freezable(), Serializable {
|
||||
shouldGenerateDeprecatedKotlinOptions = true,
|
||||
)
|
||||
@Argument(value = "-verbose", description = "Enable verbose logging output")
|
||||
var verbose: Boolean by FreezableVar(false)
|
||||
var verbose = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@GradleOption(
|
||||
value = DefaultValue.BOOLEAN_FALSE_DEFAULT,
|
||||
@@ -52,7 +72,11 @@ abstract class CommonToolArguments : Freezable(), Serializable {
|
||||
shouldGenerateDeprecatedKotlinOptions = true,
|
||||
)
|
||||
@Argument(value = "-nowarn", description = "Generate no warnings")
|
||||
var suppressWarnings: Boolean by FreezableVar(false)
|
||||
var suppressWarnings = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@GradleOption(
|
||||
value = DefaultValue.BOOLEAN_FALSE_DEFAULT,
|
||||
@@ -60,7 +84,15 @@ abstract class CommonToolArguments : Freezable(), Serializable {
|
||||
shouldGenerateDeprecatedKotlinOptions = true,
|
||||
)
|
||||
@Argument(value = "-Werror", description = "Report an error if there are any warnings")
|
||||
var allWarningsAsErrors: Boolean by FreezableVar(false)
|
||||
var allWarningsAsErrors = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
var internalArguments: List<InternalArgument> by FreezableVar(emptyList())
|
||||
var internalArguments: List<InternalArgument> = emptyList()
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,26 +16,9 @@
|
||||
|
||||
package org.jetbrains.kotlin.cli.common.arguments
|
||||
|
||||
import java.io.Serializable
|
||||
import kotlin.properties.ReadWriteProperty
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
abstract class Freezable {
|
||||
protected open inner class FreezableVar<T>(private var value: T) : ReadWriteProperty<Any, T>, Serializable {
|
||||
override fun getValue(thisRef: Any, property: KProperty<*>) = value
|
||||
|
||||
override fun setValue(thisRef: Any, property: KProperty<*>, value: T) {
|
||||
if (frozen) throw IllegalStateException("Instance of ${this::class} is frozen")
|
||||
this.value = value
|
||||
}
|
||||
}
|
||||
|
||||
protected inner class NullableStringFreezableVar(value: String?) : FreezableVar<String?>(value) {
|
||||
private val defaultValue = value
|
||||
|
||||
override fun setValue(thisRef: Any, property: KProperty<*>, value: String?) {
|
||||
super.setValue(thisRef, property, if (value.isNullOrEmpty()) defaultValue else value)
|
||||
}
|
||||
protected fun checkFrozen() {
|
||||
if (frozen) throw IllegalStateException("Instance of ${this::class} is frozen")
|
||||
}
|
||||
|
||||
private var frozen: Boolean = false
|
||||
@@ -51,7 +34,8 @@ abstract class Freezable {
|
||||
|
||||
@Suppress(
|
||||
"UNCHECKED_CAST",
|
||||
"EXTENSION_SHADOWED_BY_MEMBER" // It's false positive shadowed warning KT-21598
|
||||
"EXTENSION_SHADOWED_BY_MEMBER", // It's false positive shadowed warning KT-21598
|
||||
"unused" //used from kotlin plugin
|
||||
)
|
||||
fun <T : Freezable> T.frozen(): T = getInstanceWithFreezeStatus(true) as T
|
||||
@Suppress(
|
||||
|
||||
+301
-61
@@ -28,10 +28,18 @@ class K2JSCompilerArguments : CommonCompilerArguments() {
|
||||
removeAfter = "1.9.0"
|
||||
)
|
||||
@Argument(value = "-output", valueDescription = "<filepath>", description = "Destination *.js file for the compilation result")
|
||||
var outputFile: String? by NullableStringFreezableVar(null)
|
||||
var outputFile: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = if (value.isNullOrEmpty()) null else value
|
||||
}
|
||||
|
||||
@Argument(value = "-ir-output-dir", valueDescription = "<directory>", description = "Destination for generated files")
|
||||
var outputDir: String? by NullableStringFreezableVar(null)
|
||||
var outputDir: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = if (value.isNullOrEmpty()) null else value
|
||||
}
|
||||
|
||||
@GradleOption(
|
||||
value = DefaultValue.STRING_NULL_DEFAULT,
|
||||
@@ -39,7 +47,11 @@ class K2JSCompilerArguments : CommonCompilerArguments() {
|
||||
shouldGenerateDeprecatedKotlinOptions = true,
|
||||
)
|
||||
@Argument(value = "-ir-output-name", description = "Base name of generated files")
|
||||
var moduleName: String? by NullableStringFreezableVar(null)
|
||||
var moduleName: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = if (value.isNullOrEmpty()) null else value
|
||||
}
|
||||
|
||||
@GradleOption(
|
||||
value = DefaultValue.BOOLEAN_TRUE_DEFAULT,
|
||||
@@ -47,14 +59,22 @@ class K2JSCompilerArguments : CommonCompilerArguments() {
|
||||
shouldGenerateDeprecatedKotlinOptions = true,
|
||||
)
|
||||
@Argument(value = "-no-stdlib", description = "Don't automatically include the default Kotlin/JS stdlib into compilation dependencies")
|
||||
var noStdlib: Boolean by FreezableVar(false)
|
||||
var noStdlib = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-libraries",
|
||||
valueDescription = "<path>",
|
||||
description = "Paths to Kotlin libraries with .meta.js and .kjsm files, separated by system path separator"
|
||||
)
|
||||
var libraries: String? by NullableStringFreezableVar(null)
|
||||
var libraries: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = if (value.isNullOrEmpty()) null else value
|
||||
}
|
||||
|
||||
@GradleOption(
|
||||
value = DefaultValue.BOOLEAN_FALSE_DEFAULT,
|
||||
@@ -62,7 +82,11 @@ class K2JSCompilerArguments : CommonCompilerArguments() {
|
||||
shouldGenerateDeprecatedKotlinOptions = true,
|
||||
)
|
||||
@Argument(value = "-source-map", description = "Generate source map")
|
||||
var sourceMap: Boolean by FreezableVar(false)
|
||||
var sourceMap = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@GradleOption(
|
||||
value = DefaultValue.STRING_NULL_DEFAULT,
|
||||
@@ -70,7 +94,11 @@ class K2JSCompilerArguments : CommonCompilerArguments() {
|
||||
shouldGenerateDeprecatedKotlinOptions = true,
|
||||
)
|
||||
@Argument(value = "-source-map-prefix", description = "Add the specified prefix to paths in the source map")
|
||||
var sourceMapPrefix: String? by NullableStringFreezableVar(null)
|
||||
var sourceMapPrefix: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = if (value.isNullOrEmpty()) null else value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-source-map-base-dirs",
|
||||
@@ -78,7 +106,11 @@ class K2JSCompilerArguments : CommonCompilerArguments() {
|
||||
valueDescription = "<path>",
|
||||
description = "Base directories for calculating relative paths to source files in source map"
|
||||
)
|
||||
var sourceMapBaseDirs: String? by NullableStringFreezableVar(null)
|
||||
var sourceMapBaseDirs: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = if (value.isNullOrEmpty()) null else value
|
||||
}
|
||||
|
||||
/**
|
||||
* SourceMapEmbedSources should be null by default, since it has effect only when source maps are enabled.
|
||||
@@ -94,7 +126,11 @@ class K2JSCompilerArguments : CommonCompilerArguments() {
|
||||
valueDescription = "{always|never|inlining}",
|
||||
description = "Embed source files into source map"
|
||||
)
|
||||
var sourceMapEmbedSources: String? by NullableStringFreezableVar(null)
|
||||
var sourceMapEmbedSources: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = if (value.isNullOrEmpty()) null else value
|
||||
}
|
||||
|
||||
@GradleOption(
|
||||
value = DefaultValue.JS_SOURCE_MAP_NAMES_POLICY,
|
||||
@@ -106,7 +142,11 @@ class K2JSCompilerArguments : CommonCompilerArguments() {
|
||||
valueDescription = "{no|simple-names|fully-qualified-names}",
|
||||
description = "How to map generated names to original names (IR backend only)"
|
||||
)
|
||||
var sourceMapNamesPolicy: String? by NullableStringFreezableVar(null)
|
||||
var sourceMapNamesPolicy: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = if (value.isNullOrEmpty()) null else value
|
||||
}
|
||||
|
||||
@GradleOption(
|
||||
value = DefaultValue.BOOLEAN_TRUE_DEFAULT,
|
||||
@@ -114,7 +154,11 @@ class K2JSCompilerArguments : CommonCompilerArguments() {
|
||||
shouldGenerateDeprecatedKotlinOptions = true,
|
||||
)
|
||||
@Argument(value = "-meta-info", description = "Generate .meta.js and .kjsm files with metadata. Use to create a library")
|
||||
var metaInfo: Boolean by FreezableVar(false)
|
||||
var metaInfo = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@GradleOption(
|
||||
value = DefaultValue.JS_ECMA_VERSIONS,
|
||||
@@ -122,14 +166,22 @@ class K2JSCompilerArguments : CommonCompilerArguments() {
|
||||
shouldGenerateDeprecatedKotlinOptions = true,
|
||||
)
|
||||
@Argument(value = "-target", valueDescription = "{ v5 }", description = "Generate JS files for specific ECMA version")
|
||||
var target: String? by NullableStringFreezableVar(null)
|
||||
var target: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = if (value.isNullOrEmpty()) null else value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xir-keep",
|
||||
description = "Comma-separated list of fully-qualified names to not be eliminated by DCE (if it can be reached), " +
|
||||
"and for which to keep non-minified names."
|
||||
)
|
||||
var irKeep: String? by NullableStringFreezableVar(null)
|
||||
var irKeep: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = if (value.isNullOrEmpty()) null else value
|
||||
}
|
||||
|
||||
@GradleOption(
|
||||
value = DefaultValue.JS_MODULE_KINDS,
|
||||
@@ -141,7 +193,11 @@ class K2JSCompilerArguments : CommonCompilerArguments() {
|
||||
valueDescription = "{plain|amd|commonjs|umd|es}",
|
||||
description = "Kind of the JS module generated by the compiler"
|
||||
)
|
||||
var moduleKind: String? by NullableStringFreezableVar(K2JsArgumentConstants.MODULE_PLAIN)
|
||||
var moduleKind: String? = MODULE_PLAIN
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = if (value.isNullOrEmpty()) MODULE_PLAIN else value
|
||||
}
|
||||
|
||||
@GradleOption(
|
||||
value = DefaultValue.JS_MAIN,
|
||||
@@ -151,22 +207,35 @@ class K2JSCompilerArguments : CommonCompilerArguments() {
|
||||
@Argument(
|
||||
value = "-main",
|
||||
valueDescription = "{$CALL|$NO_CALL}",
|
||||
description = "Define whether the `main` function should be called upon execution")
|
||||
var main: String? by NullableStringFreezableVar(null)
|
||||
description = "Define whether the `main` function should be called upon execution"
|
||||
)
|
||||
var main: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = if (value.isNullOrEmpty()) null else value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-output-prefix",
|
||||
valueDescription = "<path>",
|
||||
description = "Add the content of the specified file to the beginning of output file"
|
||||
)
|
||||
var outputPrefix: String? by NullableStringFreezableVar(null)
|
||||
var outputPrefix: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = if (value.isNullOrEmpty()) null else value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-output-postfix",
|
||||
valueDescription = "<path>",
|
||||
description = "Add the content of the specified file to the end of output file"
|
||||
)
|
||||
var outputPostfix: String? by NullableStringFreezableVar(null)
|
||||
var outputPostfix: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = if (value.isNullOrEmpty()) null else value
|
||||
}
|
||||
|
||||
// Advanced options
|
||||
|
||||
@@ -175,114 +244,213 @@ class K2JSCompilerArguments : CommonCompilerArguments() {
|
||||
description = "Generate unpacked KLIB into parent directory of output JS file.\n" +
|
||||
"In combination with -meta-info generates both IR and pre-IR versions of library."
|
||||
)
|
||||
var irProduceKlibDir: Boolean by FreezableVar(false)
|
||||
var irProduceKlibDir = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xir-produce-klib-file",
|
||||
description = "Generate packed klib into file specified by -output. Disables pre-IR backend"
|
||||
)
|
||||
var irProduceKlibFile: Boolean by FreezableVar(false)
|
||||
var irProduceKlibFile = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(value = "-Xir-produce-js", description = "Generates JS file using IR backend. Also disables pre-IR backend")
|
||||
var irProduceJs: Boolean by FreezableVar(false)
|
||||
var irProduceJs = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(value = "-Xir-dce", description = "Perform experimental dead code elimination")
|
||||
var irDce: Boolean by FreezableVar(false)
|
||||
var irDce = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xir-dce-runtime-diagnostic",
|
||||
valueDescription = "{$RUNTIME_DIAGNOSTIC_LOG|$RUNTIME_DIAGNOSTIC_EXCEPTION}",
|
||||
description = "Enable runtime diagnostics when performing DCE instead of removing declarations"
|
||||
)
|
||||
var irDceRuntimeDiagnostic: String? by NullableStringFreezableVar(null)
|
||||
var irDceRuntimeDiagnostic: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = if (value.isNullOrEmpty()) null else value
|
||||
}
|
||||
|
||||
@Argument(value = "-Xir-dce-print-reachability-info", description = "Print declarations' reachability info to stdout during performing DCE")
|
||||
var irDcePrintReachabilityInfo: Boolean by FreezableVar(false)
|
||||
@Argument(
|
||||
value = "-Xir-dce-print-reachability-info",
|
||||
description = "Print declarations' reachability info to stdout during performing DCE"
|
||||
)
|
||||
var irDcePrintReachabilityInfo = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(value = "-Xir-property-lazy-initialization", description = "Perform lazy initialization for properties")
|
||||
var irPropertyLazyInitialization: Boolean by FreezableVar(true)
|
||||
var irPropertyLazyInitialization = true
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(value = "-Xir-minimized-member-names", description = "Perform minimization for names of members")
|
||||
var irMinimizedMemberNames: Boolean by FreezableVar(false)
|
||||
var irMinimizedMemberNames = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(value = "-Xir-only", description = "Disables pre-IR backend")
|
||||
var irOnly: Boolean by FreezableVar(false)
|
||||
var irOnly = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xir-module-name",
|
||||
valueDescription = "<name>",
|
||||
description = "Specify a compilation module name for IR backend"
|
||||
)
|
||||
var irModuleName: String? by NullableStringFreezableVar(null)
|
||||
var irModuleName: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = if (value.isNullOrEmpty()) null else value
|
||||
}
|
||||
|
||||
@Argument(value = "-Xir-base-class-in-metadata", description = "Write base class into metadata")
|
||||
var irBaseClassInMetadata: Boolean by FreezableVar(false)
|
||||
var irBaseClassInMetadata = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xir-safe-external-boolean",
|
||||
description = "Safe access via Boolean() to Boolean properties in externals to safely cast falsy values."
|
||||
)
|
||||
var irSafeExternalBoolean: Boolean by FreezableVar(false)
|
||||
var irSafeExternalBoolean = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xir-safe-external-boolean-diagnostic",
|
||||
valueDescription = "{$RUNTIME_DIAGNOSTIC_LOG|$RUNTIME_DIAGNOSTIC_EXCEPTION}",
|
||||
description = "Enable runtime diagnostics when access safely to boolean in external declarations"
|
||||
)
|
||||
var irSafeExternalBooleanDiagnostic: String? by NullableStringFreezableVar(null)
|
||||
var irSafeExternalBooleanDiagnostic: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = if (value.isNullOrEmpty()) null else value
|
||||
}
|
||||
|
||||
@Argument(value = "-Xir-per-module", description = "Splits generated .js per-module")
|
||||
var irPerModule: Boolean by FreezableVar(false)
|
||||
var irPerModule = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(value = "-Xir-per-module-output-name", description = "Adds a custom output name to the splitted js files")
|
||||
var irPerModuleOutputName: String? by NullableStringFreezableVar(null)
|
||||
var irPerModuleOutputName: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = if (value.isNullOrEmpty()) null else value
|
||||
}
|
||||
|
||||
@Argument(value = "-Xir-per-file", description = "Splits generated .js per-file")
|
||||
var irPerFile: Boolean by FreezableVar(false)
|
||||
var irPerFile = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(value = "-Xir-new-ir2js", description = "New fragment-based ir2js")
|
||||
var irNewIr2Js: Boolean by FreezableVar(true)
|
||||
var irNewIr2Js = true
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xir-generate-inline-anonymous-functions",
|
||||
description = "Lambda expressions that capture values are translated into in-line anonymous JavaScript functions"
|
||||
)
|
||||
var irGenerateInlineAnonymousFunctions: Boolean by FreezableVar(false)
|
||||
var irGenerateInlineAnonymousFunctions = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xinclude",
|
||||
valueDescription = "<path>",
|
||||
description = "A path to an intermediate library that should be processed in the same manner as source files."
|
||||
)
|
||||
var includes: String? by NullableStringFreezableVar(null)
|
||||
var includes: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = if (value.isNullOrEmpty()) null else value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xcache-directory",
|
||||
valueDescription = "<path>",
|
||||
description = "A path to cache directory"
|
||||
)
|
||||
var cacheDirectory: String? by NullableStringFreezableVar(null)
|
||||
var cacheDirectory: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = if (value.isNullOrEmpty()) null else value
|
||||
}
|
||||
|
||||
@Argument(value = "-Xir-build-cache", description = "Use compiler to build cache")
|
||||
var irBuildCache: Boolean by FreezableVar(false)
|
||||
var irBuildCache = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xgenerate-dts",
|
||||
description = "Generate TypeScript declarations .d.ts file alongside JS file. Available in IR backend only."
|
||||
)
|
||||
var generateDts: Boolean by FreezableVar(false)
|
||||
var generateDts = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xgenerate-polyfills",
|
||||
description = "Generate polyfills for features from the ES6+ standards."
|
||||
)
|
||||
var generatePolyfills: Boolean by FreezableVar(true)
|
||||
var generatePolyfills = true
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xstrict-implicit-export-types",
|
||||
description = "Generate strict types for implicitly exported entities inside d.ts files. Available in IR backend only."
|
||||
)
|
||||
var strictImplicitExportType: Boolean by FreezableVar(false)
|
||||
var strictImplicitExportType = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@GradleOption(
|
||||
value = DefaultValue.BOOLEAN_FALSE_DEFAULT,
|
||||
@@ -293,7 +461,11 @@ class K2JSCompilerArguments : CommonCompilerArguments() {
|
||||
value = "-Xes-classes",
|
||||
description = "Generated JavaScript will use ES2015 classes."
|
||||
)
|
||||
var useEsClasses: Boolean by FreezableVar(false)
|
||||
var useEsClasses = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@GradleOption(
|
||||
value = DefaultValue.BOOLEAN_TRUE_DEFAULT,
|
||||
@@ -301,7 +473,11 @@ class K2JSCompilerArguments : CommonCompilerArguments() {
|
||||
shouldGenerateDeprecatedKotlinOptions = true,
|
||||
)
|
||||
@Argument(value = "-Xtyped-arrays", description = "Translate primitive arrays to JS typed arrays")
|
||||
var typedArrays: Boolean by FreezableVar(true)
|
||||
var typedArrays = true
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@GradleOption(
|
||||
value = DefaultValue.BOOLEAN_FALSE_DEFAULT,
|
||||
@@ -309,65 +485,129 @@ class K2JSCompilerArguments : CommonCompilerArguments() {
|
||||
shouldGenerateDeprecatedKotlinOptions = true,
|
||||
)
|
||||
@Argument(value = "-Xfriend-modules-disabled", description = "Disable internal declaration export")
|
||||
var friendModulesDisabled: Boolean by FreezableVar(false)
|
||||
var friendModulesDisabled = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xfriend-modules",
|
||||
valueDescription = "<path>",
|
||||
description = "Paths to friend modules"
|
||||
)
|
||||
var friendModules: String? by NullableStringFreezableVar(null)
|
||||
var friendModules: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = if (value.isNullOrEmpty()) null else value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xenable-extension-functions-in-externals",
|
||||
description = "Enable extensions functions members in external interfaces"
|
||||
)
|
||||
var extensionFunctionsInExternals: Boolean by FreezableVar(false)
|
||||
var extensionFunctionsInExternals = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(value = "-Xmetadata-only", description = "Generate *.meta.js and *.kjsm files only")
|
||||
var metadataOnly: Boolean by FreezableVar(false)
|
||||
var metadataOnly = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(value = "-Xenable-js-scripting", description = "Enable experimental support of .kts files using K/JS (with -Xir only)")
|
||||
var enableJsScripting: Boolean by FreezableVar(false)
|
||||
var enableJsScripting = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(value = "-Xfake-override-validator", description = "Enable IR fake override validator")
|
||||
var fakeOverrideValidator: Boolean by FreezableVar(false)
|
||||
var fakeOverrideValidator = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(value = "-Xerror-tolerance-policy", description = "Set up error tolerance policy (NONE, SEMANTIC, SYNTAX, ALL)")
|
||||
var errorTolerancePolicy: String? by NullableStringFreezableVar(null)
|
||||
var errorTolerancePolicy: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = if (value.isNullOrEmpty()) null else value
|
||||
}
|
||||
|
||||
@Argument(value = "-Xpartial-linkage", description = "Allow unlinked symbols")
|
||||
var partialLinkage: Boolean by FreezableVar(false)
|
||||
var partialLinkage = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(value = "-Xwasm", description = "Use experimental WebAssembly compiler backend")
|
||||
var wasm: Boolean by FreezableVar(false)
|
||||
var wasm = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(value = "-Xwasm-debug-info", description = "Add debug info to WebAssembly compiled module")
|
||||
var wasmDebug: Boolean by FreezableVar(true)
|
||||
var wasmDebug = true
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(value = "-Xwasm-kclass-fqn", description = "Enable support for FQ names in KClass")
|
||||
var wasmKClassFqn: Boolean by FreezableVar(false)
|
||||
var wasmKClassFqn = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(value = "-Xwasm-enable-array-range-checks", description = "Turn on range checks for the array access functions")
|
||||
var wasmEnableArrayRangeChecks: Boolean by FreezableVar(false)
|
||||
var wasmEnableArrayRangeChecks = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(value = "-Xwasm-enable-asserts", description = "Turn on asserts")
|
||||
var wasmEnableAsserts: Boolean by FreezableVar(false)
|
||||
var wasmEnableAsserts = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(value = "-Xwasm-generate-wat", description = "Generate wat file")
|
||||
var wasmGenerateWat: Boolean by FreezableVar(false)
|
||||
var wasmGenerateWat = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xuse-deprecated-legacy-compiler",
|
||||
description = "Use deprecated legacy compiler without error"
|
||||
)
|
||||
var useDeprecatedLegacyCompiler: Boolean by FreezableVar(false)
|
||||
var useDeprecatedLegacyCompiler = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xlegacy-deprecated-no-warn",
|
||||
description = "Disable warnings of deprecation of legacy compiler"
|
||||
)
|
||||
var legacyDeprecatedNoWarn: Boolean by FreezableVar(false)
|
||||
var legacyDeprecatedNoWarn = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
private fun MessageCollector.deprecationWarn(value: Boolean, defaultValue: Boolean, name: String) {
|
||||
if (value != defaultValue) {
|
||||
|
||||
+25
-5
@@ -28,20 +28,32 @@ class K2JSDceArguments : CommonToolArguments() {
|
||||
valueDescription = "<path>",
|
||||
description = "Output directory"
|
||||
)
|
||||
var outputDirectory: String? by NullableStringFreezableVar(null)
|
||||
var outputDirectory: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = if (value.isNullOrEmpty()) null else value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-keep",
|
||||
valueDescription = "<fully.qualified.name[,]>",
|
||||
description = "List of fully-qualified names of declarations that shouldn't be eliminated"
|
||||
)
|
||||
var declarationsToKeep: Array<String>? by FreezableVar(null)
|
||||
var declarationsToKeep: Array<String>? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xprint-reachability-info",
|
||||
description = "Print declarations marked as reachable"
|
||||
)
|
||||
var printReachabilityInfo: Boolean by FreezableVar(false)
|
||||
var printReachabilityInfo = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@GradleOption(
|
||||
value = DefaultValue.BOOLEAN_FALSE_DEFAULT,
|
||||
@@ -52,14 +64,22 @@ class K2JSDceArguments : CommonToolArguments() {
|
||||
value = "-dev-mode",
|
||||
description = "Development mode: don't strip out any code, just copy dependencies"
|
||||
)
|
||||
var devMode: Boolean by FreezableVar(false)
|
||||
var devMode = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xdev-mode-overwriting-strategy",
|
||||
valueDescription = "{$OLDER|$ALL}",
|
||||
description = "Overwriting strategy during copy dependencies in development mode"
|
||||
)
|
||||
var devModeOverwritingStrategy: String? by NullableStringFreezableVar(null)
|
||||
var devModeOverwritingStrategy: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = if (value.isNullOrEmpty()) null else value
|
||||
}
|
||||
}
|
||||
|
||||
object DevModeOverwritingStrategies {
|
||||
|
||||
+380
-76
@@ -16,7 +16,11 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
|
||||
}
|
||||
|
||||
@Argument(value = "-d", valueDescription = "<directory|jar>", description = "Destination for generated class files")
|
||||
var destination: String? by NullableStringFreezableVar(null)
|
||||
var destination: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = if (value.isNullOrEmpty()) null else value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-classpath",
|
||||
@@ -24,17 +28,29 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
|
||||
valueDescription = "<path>",
|
||||
description = "List of directories and JAR/ZIP archives to search for user class files"
|
||||
)
|
||||
var classpath: String? by NullableStringFreezableVar(null)
|
||||
var classpath: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = if (value.isNullOrEmpty()) null else value
|
||||
}
|
||||
|
||||
@Argument(value = "-include-runtime", description = "Include Kotlin runtime into the resulting JAR")
|
||||
var includeRuntime: Boolean by FreezableVar(false)
|
||||
var includeRuntime = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-jdk-home",
|
||||
valueDescription = "<path>",
|
||||
description = "Include a custom JDK from the specified location into the classpath instead of the default JAVA_HOME"
|
||||
)
|
||||
var jdkHome: String? by NullableStringFreezableVar(null)
|
||||
var jdkHome: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = if (value.isNullOrEmpty()) null else value
|
||||
}
|
||||
|
||||
@GradleOption(
|
||||
value = DefaultValue.BOOLEAN_FALSE_DEFAULT,
|
||||
@@ -42,30 +58,50 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
|
||||
shouldGenerateDeprecatedKotlinOptions = true,
|
||||
)
|
||||
@Argument(value = "-no-jdk", description = "Don't automatically include the Java runtime into the classpath")
|
||||
var noJdk: Boolean by FreezableVar(false)
|
||||
var noJdk = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-no-stdlib",
|
||||
description = "Don't automatically include the Kotlin/JVM stdlib and Kotlin reflection into the classpath"
|
||||
)
|
||||
var noStdlib: Boolean by FreezableVar(false)
|
||||
var noStdlib = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(value = "-no-reflect", description = "Don't automatically include Kotlin reflection into the classpath")
|
||||
var noReflect: Boolean by FreezableVar(false)
|
||||
var noReflect = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-expression",
|
||||
shortName = "-e",
|
||||
description = "Evaluate the given string as a Kotlin script"
|
||||
)
|
||||
var expression: String? by FreezableVar(null)
|
||||
var expression: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-script-templates",
|
||||
valueDescription = "<fully qualified class name[,]>",
|
||||
description = "Script definition template classes"
|
||||
)
|
||||
var scriptTemplates: Array<String>? by FreezableVar(null)
|
||||
var scriptTemplates: Array<String>? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@GradleOption(
|
||||
value = DefaultValue.STRING_NULL_DEFAULT,
|
||||
@@ -73,7 +109,11 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
|
||||
shouldGenerateDeprecatedKotlinOptions = true,
|
||||
)
|
||||
@Argument(value = "-module-name", valueDescription = "<name>", description = "Name of the generated .kotlin_module file")
|
||||
var moduleName: String? by NullableStringFreezableVar(null)
|
||||
var moduleName: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = if (value.isNullOrEmpty()) null else value
|
||||
}
|
||||
|
||||
@GradleOption(
|
||||
value = DefaultValue.JVM_TARGET_VERSIONS,
|
||||
@@ -85,7 +125,11 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
|
||||
valueDescription = "<version>",
|
||||
description = "Target version of the generated JVM bytecode (${JvmTarget.SUPPORTED_VERSIONS_DESCRIPTION}), default is 1.8"
|
||||
)
|
||||
var jvmTarget: String? by NullableStringFreezableVar(null)
|
||||
var jvmTarget: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = if (value.isNullOrEmpty()) null else value
|
||||
}
|
||||
|
||||
@GradleOption(
|
||||
value = DefaultValue.BOOLEAN_FALSE_DEFAULT,
|
||||
@@ -93,7 +137,11 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
|
||||
shouldGenerateDeprecatedKotlinOptions = true,
|
||||
)
|
||||
@Argument(value = "-java-parameters", description = "Generate metadata for Java 1.8 reflection on method parameters")
|
||||
var javaParameters: Boolean by FreezableVar(false)
|
||||
var javaParameters = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
// Advanced options
|
||||
|
||||
@@ -101,16 +149,28 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
|
||||
value = "-Xuse-ir",
|
||||
description = "Use the IR backend. This option has no effect unless the language version less than 1.5 is used"
|
||||
)
|
||||
var useIR: Boolean by FreezableVar(false)
|
||||
var useIR = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(value = "-Xuse-old-backend", description = "Use the old JVM backend")
|
||||
var useOldBackend: Boolean by FreezableVar(false)
|
||||
var useOldBackend = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xallow-unstable-dependencies",
|
||||
description = "Do not report errors on classes in dependencies, which were compiled by an unstable version of the Kotlin compiler"
|
||||
)
|
||||
var allowUnstableDependencies: Boolean by FreezableVar(false)
|
||||
var allowUnstableDependencies = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xabi-stability",
|
||||
@@ -120,13 +180,21 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
|
||||
"When using the JVM IR backend, conversely, use 'unstable' to mark generated class files as unstable\n" +
|
||||
"to force diagnostics to be reported."
|
||||
)
|
||||
var abiStability: String? by FreezableVar(null)
|
||||
var abiStability: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xir-do-not-clear-binding-context",
|
||||
description = "When using the IR backend, do not clear BindingContext between psi2ir and lowerings"
|
||||
)
|
||||
var doNotClearBindingContext: Boolean by FreezableVar(false)
|
||||
var doNotClearBindingContext = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xbackend-threads",
|
||||
@@ -135,10 +203,18 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
|
||||
"0 means use a thread per processor core.\n" +
|
||||
"Default value is 1"
|
||||
)
|
||||
var backendThreads: String by FreezableVar("1")
|
||||
var backendThreads: String = "1"
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(value = "-Xmodule-path", valueDescription = "<path>", description = "Paths where to find Java 9+ modules")
|
||||
var javaModulePath: String? by NullableStringFreezableVar(null)
|
||||
var javaModulePath: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = if (value.isNullOrEmpty()) null else value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xadd-modules",
|
||||
@@ -146,25 +222,45 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
|
||||
description = "Root modules to resolve in addition to the initial modules,\n" +
|
||||
"or all modules on the module path if <module> is ALL-MODULE-PATH"
|
||||
)
|
||||
var additionalJavaModules: Array<String>? by FreezableVar(null)
|
||||
var additionalJavaModules: Array<String>? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(value = "-Xno-call-assertions", description = "Don't generate not-null assertions for arguments of platform types")
|
||||
var noCallAssertions: Boolean by FreezableVar(false)
|
||||
var noCallAssertions = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xno-receiver-assertions",
|
||||
description = "Don't generate not-null assertion for extension receiver arguments of platform types"
|
||||
)
|
||||
var noReceiverAssertions: Boolean by FreezableVar(false)
|
||||
var noReceiverAssertions = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xno-param-assertions",
|
||||
description = "Don't generate not-null assertions on parameters of methods accessible from Java"
|
||||
)
|
||||
var noParamAssertions: Boolean by FreezableVar(false)
|
||||
var noParamAssertions = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(value = "-Xno-optimize", description = "Disable optimizations")
|
||||
var noOptimize: Boolean by FreezableVar(false)
|
||||
var noOptimize = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xassertions", valueDescription = "{always-enable|always-disable|jvm|legacy}",
|
||||
@@ -175,7 +271,11 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
|
||||
"-Xassertions=legacy: calculate condition on each call, check depends on jvm assertion settings in the kotlin package;\n" +
|
||||
"default: legacy"
|
||||
)
|
||||
var assertionsMode: String? by NullableStringFreezableVar(JVMAssertionsMode.DEFAULT.description)
|
||||
var assertionsMode: String? = JVMAssertionsMode.DEFAULT.description
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = if (value.isNullOrEmpty()) JVMAssertionsMode.DEFAULT.description else value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xbuild-file",
|
||||
@@ -183,60 +283,104 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
|
||||
valueDescription = "<path>",
|
||||
description = "Path to the .xml build file to compile"
|
||||
)
|
||||
var buildFile: String? by NullableStringFreezableVar(null)
|
||||
var buildFile: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = if (value.isNullOrEmpty()) null else value
|
||||
}
|
||||
|
||||
@Argument(value = "-Xmultifile-parts-inherit", description = "Compile multifile classes as a hierarchy of parts and facade")
|
||||
var inheritMultifileParts: Boolean by FreezableVar(false)
|
||||
var inheritMultifileParts = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(value = "-Xuse-type-table", description = "Use type table in metadata serialization")
|
||||
var useTypeTable: Boolean by FreezableVar(false)
|
||||
var useTypeTable = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xuse-old-class-files-reading",
|
||||
description = "Use old class files reading implementation. This may slow down the build and cause problems with Groovy interop.\n" +
|
||||
"Should be used in case of problems with the new implementation"
|
||||
)
|
||||
var useOldClassFilesReading: Boolean by FreezableVar(false)
|
||||
var useOldClassFilesReading = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xuse-fast-jar-file-system",
|
||||
description = "Use fast implementation on Jar FS. This may speed up compilation time, but currently it's an experimental mode"
|
||||
)
|
||||
var useFastJarFileSystem: Boolean by FreezableVar(false)
|
||||
var useFastJarFileSystem = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xdump-declarations-to",
|
||||
valueDescription = "<path>",
|
||||
description = "Path to JSON file to dump Java to Kotlin declaration mappings"
|
||||
)
|
||||
var declarationsOutputPath: String? by NullableStringFreezableVar(null)
|
||||
var declarationsOutputPath: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = if (value.isNullOrEmpty()) null else value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xsuppress-missing-builtins-error",
|
||||
description = "Suppress the \"cannot access built-in declaration\" error (useful with -no-stdlib)"
|
||||
)
|
||||
var suppressMissingBuiltinsError: Boolean by FreezableVar(false)
|
||||
var suppressMissingBuiltinsError = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xscript-resolver-environment",
|
||||
valueDescription = "<key=value[,]>",
|
||||
description = "Script resolver environment in key-value pairs (the value could be quoted and escaped)"
|
||||
)
|
||||
var scriptResolverEnvironment: Array<String>? by FreezableVar(null)
|
||||
var scriptResolverEnvironment: Array<String>? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
// Javac options
|
||||
@Argument(value = "-Xuse-javac", description = "Use javac for Java source and class files analysis")
|
||||
var useJavac: Boolean by FreezableVar(false)
|
||||
var useJavac = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(value = "-Xcompile-java", description = "Reuse javac analysis and compile Java source files")
|
||||
var compileJava by FreezableVar(false)
|
||||
var compileJava = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xjavac-arguments",
|
||||
valueDescription = "<option[,]>",
|
||||
description = "Java compiler arguments"
|
||||
)
|
||||
var javacArguments: Array<String>? by FreezableVar(null)
|
||||
var javacArguments: Array<String>? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
|
||||
@Argument(
|
||||
@@ -244,13 +388,21 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
|
||||
valueDescription = "<path>",
|
||||
description = "Paths to directories with Java source files"
|
||||
)
|
||||
var javaSourceRoots: Array<String>? by FreezableVar(null)
|
||||
var javaSourceRoots: Array<String>? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xjava-package-prefix",
|
||||
description = "Package prefix for Java files"
|
||||
)
|
||||
var javaPackagePrefix: String? by FreezableVar(null)
|
||||
var javaPackagePrefix: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xjsr305",
|
||||
@@ -267,7 +419,11 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
|
||||
" * strict (experimental; treat as other supported nullability annotations)\n" +
|
||||
" * warn (report a warning)"
|
||||
)
|
||||
var jsr305: Array<String>? by FreezableVar(null)
|
||||
var jsr305: Array<String>? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xnullability-annotations",
|
||||
@@ -278,7 +434,11 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
|
||||
" * strict\n" +
|
||||
" * warn (report a warning)"
|
||||
)
|
||||
var nullabilityAnnotations: Array<String>? by FreezableVar(null)
|
||||
var nullabilityAnnotations: Array<String>? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xsupport-compatqual-checker-framework-annotations",
|
||||
@@ -286,7 +446,11 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
|
||||
description = "Specify behavior for Checker Framework compatqual annotations (NullableDecl/NonNullDecl).\n" +
|
||||
"Default value is 'enable'"
|
||||
)
|
||||
var supportCompatqualCheckerFrameworkAnnotations: String? by NullableStringFreezableVar(null)
|
||||
var supportCompatqualCheckerFrameworkAnnotations: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = if (value.isNullOrEmpty()) null else value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xjspecify-annotations",
|
||||
@@ -294,7 +458,11 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
|
||||
description = "Specify behavior for jspecify annotations.\n" +
|
||||
"Default value is 'warn'"
|
||||
)
|
||||
var jspecifyAnnotations: String? by FreezableVar(null)
|
||||
var jspecifyAnnotations: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xjvm-default",
|
||||
@@ -325,23 +493,39 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
|
||||
-Xjvm-default=compatibility Deprecated. Allow usages of @JvmDefault; generate a compatibility accessor
|
||||
in the DefaultImpls class in addition to the default interface method."""
|
||||
)
|
||||
var jvmDefault: String by FreezableVar(JvmDefaultMode.DEFAULT.description)
|
||||
var jvmDefault: String = JvmDefaultMode.DEFAULT.description
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xdefault-script-extension",
|
||||
valueDescription = "<script filename extension>",
|
||||
description = "Compile expressions and unrecognized scripts passed with the -script argument as scripts with given filename extension"
|
||||
)
|
||||
var defaultScriptExtension: String? by FreezableVar(null)
|
||||
var defaultScriptExtension: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(value = "-Xdisable-standard-script", description = "Disable standard kotlin script support")
|
||||
var disableStandardScript: Boolean by FreezableVar(false)
|
||||
var disableStandardScript = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xgenerate-strict-metadata-version",
|
||||
description = "Generate metadata with strict version semantics (see kdoc on Metadata.extraInt)"
|
||||
)
|
||||
var strictMetadataVersionSemantics: Boolean by FreezableVar(false)
|
||||
var strictMetadataVersionSemantics = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xsanitize-parentheses",
|
||||
@@ -349,26 +533,42 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
|
||||
"This mode can BREAK BINARY COMPATIBILITY and is only supposed to be used to workaround\n" +
|
||||
"problems with parentheses in identifiers on certain platforms"
|
||||
)
|
||||
var sanitizeParentheses: Boolean by FreezableVar(false)
|
||||
var sanitizeParentheses = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xfriend-paths",
|
||||
valueDescription = "<path>",
|
||||
description = "Paths to output directories for friend modules (whose internals should be visible)"
|
||||
)
|
||||
var friendPaths: Array<String>? by FreezableVar(null)
|
||||
var friendPaths: Array<String>? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xallow-no-source-files",
|
||||
description = "Allow no source files"
|
||||
)
|
||||
var allowNoSourceFiles: Boolean by FreezableVar(false)
|
||||
var allowNoSourceFiles = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xemit-jvm-type-annotations",
|
||||
description = "Emit JVM type annotations in bytecode"
|
||||
)
|
||||
var emitJvmTypeAnnotations: Boolean by FreezableVar(false)
|
||||
var emitJvmTypeAnnotations = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xstring-concat",
|
||||
@@ -380,7 +580,11 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
|
||||
default: `indy-with-constants` for JVM target 9 or greater, `inline` otherwise"""
|
||||
|
||||
)
|
||||
var stringConcat: String? by NullableStringFreezableVar(null)
|
||||
var stringConcat: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = if (value.isNullOrEmpty()) null else value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xjdk-release",
|
||||
@@ -389,7 +593,11 @@ default: `indy-with-constants` for JVM target 9 or greater, `inline` otherwise""
|
||||
Supported versions depend on the used JDK; for JDK 17+ supported versions are ${JvmTarget.SUPPORTED_VERSIONS_DESCRIPTION}.
|
||||
Also sets `-jvm-target` value equal to the selected JDK version"""
|
||||
)
|
||||
var jdkRelease: String? by NullableStringFreezableVar(null)
|
||||
var jdkRelease: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = if (value.isNullOrEmpty()) null else value
|
||||
}
|
||||
|
||||
|
||||
@Argument(
|
||||
@@ -399,7 +607,11 @@ Also sets `-jvm-target` value equal to the selected JDK version"""
|
||||
-Xsam-conversions=indy Generate SAM conversions using `invokedynamic` with `LambdaMetafactory.metafactory`. Requires `-jvm-target 1.8` or greater.
|
||||
-Xsam-conversions=class Generate SAM conversions as explicit classes"""
|
||||
)
|
||||
var samConversions: String? by NullableStringFreezableVar(null)
|
||||
var samConversions: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = if (value.isNullOrEmpty()) null else value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xlambdas",
|
||||
@@ -409,44 +621,72 @@ Also sets `-jvm-target` value equal to the selected JDK version"""
|
||||
Lambda objects created using `LambdaMetafactory.metafactory` will have different `toString()`.
|
||||
-Xlambdas=class Generate lambdas as explicit classes"""
|
||||
)
|
||||
var lambdas: String? by NullableStringFreezableVar(null)
|
||||
var lambdas: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = if (value.isNullOrEmpty()) null else value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xklib",
|
||||
valueDescription = "<path>",
|
||||
description = "Paths to cross-platform libraries in .klib format"
|
||||
)
|
||||
var klibLibraries: String? by NullableStringFreezableVar(null)
|
||||
var klibLibraries: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = if (value.isNullOrEmpty()) null else value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xno-optimized-callable-references",
|
||||
description = "Do not use optimized callable reference superclasses available from 1.4"
|
||||
)
|
||||
var noOptimizedCallableReferences: Boolean by FreezableVar(false)
|
||||
var noOptimizedCallableReferences = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xno-kotlin-nothing-value-exception",
|
||||
description = "Do not use KotlinNothingValueException available since 1.4"
|
||||
)
|
||||
var noKotlinNothingValueException: Boolean by FreezableVar(false)
|
||||
var noKotlinNothingValueException = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xno-reset-jar-timestamps",
|
||||
description = "Do not reset jar entry timestamps to a fixed date"
|
||||
)
|
||||
var noResetJarTimestamps: Boolean by FreezableVar(false)
|
||||
var noResetJarTimestamps = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xno-unified-null-checks",
|
||||
description = "Use pre-1.4 exception types in null checks instead of java.lang.NPE. See KT-22275 for more details"
|
||||
)
|
||||
var noUnifiedNullChecks: Boolean by FreezableVar(false)
|
||||
var noUnifiedNullChecks = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xno-source-debug-extension",
|
||||
description = "Do not generate @kotlin.jvm.internal.SourceDebugExtension annotation on a class with the copy of SMAP"
|
||||
)
|
||||
var noSourceDebugExtension: Boolean by FreezableVar(false)
|
||||
var noSourceDebugExtension = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xprofile",
|
||||
@@ -456,34 +696,54 @@ Also sets `-jvm-target` value equal to the selected JDK version"""
|
||||
"If it's not on the classpath, the compiler will attempt to load async-profiler.jar from the containing directory of profilerPath.\n" +
|
||||
"Example: -Xprofile=<PATH_TO_ASYNC_PROFILER>/async-profiler/build/libasyncProfiler.so:event=cpu,interval=1ms,threads,start:<SNAPSHOT_DIR_PATH>"
|
||||
)
|
||||
var profileCompilerCommand: String? by NullableStringFreezableVar(null)
|
||||
var profileCompilerCommand: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = if (value.isNullOrEmpty()) null else value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xrepeat",
|
||||
valueDescription = "<number>",
|
||||
description = "Debug option: Repeats modules compilation <number> times"
|
||||
)
|
||||
var repeatCompileModules: String? by NullableStringFreezableVar(null)
|
||||
var repeatCompileModules: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = if (value.isNullOrEmpty()) null else value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xuse-14-inline-classes-mangling-scheme",
|
||||
description = "Use 1.4 inline classes mangling scheme instead of 1.4.30 one"
|
||||
)
|
||||
var useOldInlineClassesManglingScheme: Boolean by FreezableVar(false)
|
||||
var useOldInlineClassesManglingScheme = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xjvm-enable-preview",
|
||||
description = "Allow using features from Java language that are in preview phase.\n" +
|
||||
"Works as `--enable-preview` in Java. All class files are marked as preview-generated thus it won't be possible to use them in release environment"
|
||||
)
|
||||
var enableJvmPreview: Boolean by FreezableVar(false)
|
||||
var enableJvmPreview = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xsuppress-deprecated-jvm-target-warning",
|
||||
description = "Suppress deprecation warning about deprecated JVM target versions.\n" +
|
||||
"This option has no effect and will be deleted in a future version."
|
||||
)
|
||||
var suppressDeprecatedJvmTargetWarning: Boolean by FreezableVar(false)
|
||||
var suppressDeprecatedJvmTargetWarning = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xtype-enhancement-improvements-strict-mode",
|
||||
@@ -491,70 +751,114 @@ Also sets `-jvm-target` value equal to the selected JDK version"""
|
||||
"including freshly supported reading of the type use annotations from class files.\n" +
|
||||
"See KT-45671 for more details"
|
||||
)
|
||||
var typeEnhancementImprovementsInStrictMode: Boolean by FreezableVar(false)
|
||||
var typeEnhancementImprovementsInStrictMode = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xserialize-ir",
|
||||
valueDescription = "{none|inline|all}",
|
||||
description = "Save IR to metadata (EXPERIMENTAL)"
|
||||
)
|
||||
var serializeIr: String by FreezableVar("none")
|
||||
var serializeIr: String = "none"
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xvalidate-ir",
|
||||
description = "Validate IR before and after lowering"
|
||||
)
|
||||
var validateIr: Boolean by FreezableVar(false)
|
||||
var validateIr = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xvalidate-bytecode",
|
||||
description = "Validate generated JVM bytecode before and after optimizations"
|
||||
)
|
||||
var validateBytecode: Boolean by FreezableVar(false)
|
||||
var validateBytecode = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xenhance-type-parameter-types-to-def-not-null",
|
||||
description = "Enhance not null annotated type parameter's types to definitely not null types (@NotNull T => T & Any)"
|
||||
)
|
||||
var enhanceTypeParameterTypesToDefNotNull: Boolean by FreezableVar(false)
|
||||
var enhanceTypeParameterTypesToDefNotNull = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xlink-via-signatures",
|
||||
description = "Link JVM IR symbols via signatures, instead of descriptors.\n" +
|
||||
"This mode is slower, but can be useful in troubleshooting problems with the JVM IR backend"
|
||||
)
|
||||
var linkViaSignatures: Boolean by FreezableVar(false)
|
||||
var linkViaSignatures = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xdebug",
|
||||
description = "Enable debug mode for compilation.\n" +
|
||||
"Currently this includes spilling all variables in a suspending context regardless their liveness."
|
||||
)
|
||||
var enableDebugMode: Boolean by FreezableVar(false)
|
||||
var enableDebugMode = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xignore-const-optimization-errors",
|
||||
description = "Ignore all compilation exceptions while optimizing some constant expressions."
|
||||
)
|
||||
var ignoreConstOptimizationErrors: Boolean by FreezableVar(false)
|
||||
var ignoreConstOptimizationErrors = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xno-new-java-annotation-targets",
|
||||
description = "Do not generate Java 1.8+ targets for Kotlin annotation classes"
|
||||
)
|
||||
var noNewJavaAnnotationTargets: Boolean by FreezableVar(false)
|
||||
var noNewJavaAnnotationTargets = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xuse-old-innerclasses-logic",
|
||||
description = "Use old logic for generation of InnerClasses attributes"
|
||||
)
|
||||
var oldInnerClassesLogic: Boolean by FreezableVar(false)
|
||||
var oldInnerClassesLogic = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xvalue-classes",
|
||||
description = "Enable experimental value classes"
|
||||
)
|
||||
var valueClasses: Boolean by FreezableVar(false)
|
||||
var valueClasses = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
override fun configureAnalysisFlags(collector: MessageCollector, languageVersion: LanguageVersion): MutableMap<AnalysisFlag<*>, Any> {
|
||||
val result = super.configureAnalysisFlags(collector, languageVersion)
|
||||
|
||||
+30
-6
@@ -22,7 +22,11 @@ class K2MetadataCompilerArguments : CommonCompilerArguments() {
|
||||
}
|
||||
|
||||
@Argument(value = "-d", valueDescription = "<directory|jar>", description = "Destination for generated .kotlin_metadata files")
|
||||
var destination: String? by NullableStringFreezableVar(null)
|
||||
var destination: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = if (value.isNullOrEmpty()) null else value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-classpath",
|
||||
@@ -30,28 +34,48 @@ class K2MetadataCompilerArguments : CommonCompilerArguments() {
|
||||
valueDescription = "<path>",
|
||||
description = "Paths where to find library .kotlin_metadata files"
|
||||
)
|
||||
var classpath: String? by NullableStringFreezableVar(null)
|
||||
var classpath: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = if (value.isNullOrEmpty()) null else value
|
||||
}
|
||||
|
||||
@Argument(value = "-module-name", valueDescription = "<name>", description = "Name of the generated .kotlin_module file")
|
||||
var moduleName: String? by NullableStringFreezableVar(null)
|
||||
var moduleName: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = if (value.isNullOrEmpty()) null else value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xjps",
|
||||
description = "Enable in JPS"
|
||||
)
|
||||
var enabledInJps: Boolean by FreezableVar(false)
|
||||
var enabledInJps = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xfriend-paths",
|
||||
valueDescription = "<path>",
|
||||
description = "Paths to output directories for friend modules (whose internals should be visible)"
|
||||
)
|
||||
var friendPaths: Array<String>? by FreezableVar(null)
|
||||
var friendPaths: Array<String>? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xrefines-paths",
|
||||
valueDescription = "<path>",
|
||||
description = "Paths to output directories for refined modules (whose expects this module can actualize)"
|
||||
)
|
||||
var refinesPaths: Array<String>? by FreezableVar(null)
|
||||
var refinesPaths: Array<String>? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,11 +20,31 @@ import com.intellij.openapi.util.text.StringUtil
|
||||
import org.jetbrains.kotlin.cli.common.arguments.Freezable
|
||||
|
||||
class CompilerSettings : Freezable() {
|
||||
var additionalArguments: String by FreezableVar(DEFAULT_ADDITIONAL_ARGUMENTS)
|
||||
var scriptTemplates: String by FreezableVar("")
|
||||
var scriptTemplatesClasspath: String by FreezableVar("")
|
||||
var copyJsLibraryFiles: Boolean by FreezableVar(true)
|
||||
var outputDirectoryForJsLibraryFiles: String by FreezableVar(DEFAULT_OUTPUT_DIRECTORY)
|
||||
var additionalArguments: String = DEFAULT_ADDITIONAL_ARGUMENTS
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
var scriptTemplates: String = ""
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
var scriptTemplatesClasspath: String = ""
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
var copyJsLibraryFiles = true
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
var outputDirectoryForJsLibraryFiles: String = DEFAULT_OUTPUT_DIRECTORY
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
companion object {
|
||||
val DEFAULT_ADDITIONAL_ARGUMENTS = ""
|
||||
|
||||
@@ -9,5 +9,9 @@ import org.jetbrains.kotlin.cli.common.arguments.Freezable
|
||||
|
||||
class JpsPluginSettings : Freezable() {
|
||||
@Suppress("unused") // Used in Kotlin plugin
|
||||
var version: String by FreezableVar("") // KTIJ-20555 Fix default value?
|
||||
var version: String = "" // KTIJ-20555 Fix default value?
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user