Add immutable LanguageSettings interface and apply it to compilation

LanguageSettingsBuilder extends LanguageSettings
This commit is contained in:
Anton Lakotka
2021-03-25 09:48:29 +01:00
committed by Sergey Igushkin
parent 54c6ae2cce
commit de4221afd8
11 changed files with 47 additions and 25 deletions
@@ -14,6 +14,8 @@ interface KotlinModuleFragment {
val fragmentName: String
val directRefinesDependencies: Iterable<KotlinModuleFragment>
val languageSettings: LanguageSettings
// TODO: scopes
val declaredModuleDependencies: Iterable<KotlinModuleDependency>
@@ -46,7 +48,8 @@ val KotlinModuleFragment.refinesClosure: Set<KotlinModuleFragment>
open class BasicKotlinModuleFragment(
override val containingModule: KotlinModule,
override val fragmentName: String
override val fragmentName: String,
override val languageSettings: LanguageSettings
) : KotlinModuleFragment {
override val directRefinesDependencies: MutableSet<BasicKotlinModuleFragment> = mutableSetOf()
@@ -59,10 +62,12 @@ open class BasicKotlinModuleFragment(
class BasicKotlinModuleVariant(
containingModule: KotlinModule,
fragmentName: String
fragmentName: String,
languageSettings: LanguageSettings
) : BasicKotlinModuleFragment (
containingModule,
fragmentName
fragmentName,
languageSettings
), KotlinModuleVariant {
override val variantAttributes: MutableMap<KotlinAttributeKey, String> = mutableMapOf()
override fun toString(): String = "variant $fragmentName"
@@ -0,0 +1,14 @@
/*
* 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.project.model
interface LanguageSettings {
val languageVersion: String?
val apiVersion: String?
val progressiveMode: Boolean
val enabledLanguageFeatures: Set<String>
val experimentalAnnotationsInUse: Set<String>
}