use of org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments in project intellij by bazelbuild.
the class BlazeKotlinSyncPlugin method maybeUpdateCompilerConfig.
/**
* Update the compiler settings of the project if needed. The language setting applies to both the
* api version and the language version. Blanket setting this project wide is fine. The rules
* should catch incorrect usage.
*/
private static void maybeUpdateCompilerConfig(Project project, ProjectViewSet projectViewSet) {
LanguageVersion languageLevel = BlazeKotlinLanguageVersionSection.getLanguageLevel(projectViewSet);
String languageLevelVersionString = languageLevel.getVersionString();
CommonCompilerArguments settings = CommonCompilerArgumentsCompatUtils.getUnfrozenSettings(project);
boolean updated = false;
String apiVersion = CommonCompilerArgumentsCompatUtils.getApiVersion(settings);
String languageVersion = CommonCompilerArgumentsCompatUtils.getLanguageVersion(settings);
if (apiVersion == null || !apiVersion.equals(languageLevelVersionString)) {
updated = true;
CommonCompilerArgumentsCompatUtils.setApiVersion(settings, languageLevelVersionString);
}
if (languageVersion == null || !languageVersion.equals(languageLevelVersionString)) {
updated = true;
CommonCompilerArgumentsCompatUtils.setLanguageVersion(settings, languageLevelVersionString);
}
if (updated) {
KotlinCommonCompilerArgumentsHolder.Companion.getInstance(project).setSettings(settings);
}
}
use of org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments in project intellij by bazelbuild.
the class KotlinSyncTest method assertViewConfigState.
private void assertViewConfigState(LanguageVersion languageVersion) {
runBlazeSync(new BlazeSyncParams.Builder("Sync", BlazeSyncParams.SyncMode.INCREMENTAL).addProjectViewTargets(true).build());
ProjectViewSet projectViewSet = ProjectViewManager.getInstance(getProject()).getProjectViewSet();
assert projectViewSet != null;
assertThat(BlazeKotlinLanguageVersionSection.getLanguageLevel(projectViewSet)).isEqualTo(languageVersion);
// test the compiler reflect the project view.
CommonCompilerArguments settings = KotlinCommonCompilerArgumentsHolder.Companion.getInstance(getProject()).getSettings();
assertThat(CommonCompilerArgumentsCompatUtils.getApiVersion(settings)).isEqualTo(languageVersion.getVersionString());
assertThat(CommonCompilerArgumentsCompatUtils.getLanguageVersion(settings)).isEqualTo(languageVersion.getVersionString());
}
Aggregations