Skip to content

Commit 6b9044e

Browse files
committed
Add support for Kotlin v2.2.0 (#995)
1 parent 011be92 commit 6b9044e

3 files changed

Lines changed: 4 additions & 53 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
* Bug fix to handle export dependencies file path correctly.
88

99
### Version 0.53.3
10-
* Add configuration cleanCacheDir to conditionally delete the cache directory or
11-
just the existing dependency rules files
10+
* Add configuration cleanCacheDir to conditionally delete the cache directory or just the existing dependency rules files
1211

1312
### Version 0.54.0
1413
* Stop using /tmp for Android Lint gen-rule and use buck-out tmp instead
@@ -40,3 +39,4 @@
4039
- Updated `actions/setup-java` to v4 with temurin distribution
4140
- Removed rxPermissions and XLog dependencies
4241
- Updated to Python 3.8
42+
* Added support for Kotlin 2.2.0

buildSrc/src/main/java/com/uber/okbuck/core/model/jvm/JvmTarget.java

Lines changed: 2 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,10 @@
5656
import org.gradle.api.tasks.compile.JavaCompile;
5757
import org.gradle.api.tasks.testing.Test;
5858
import org.gradle.jvm.tasks.Jar;
59-
import org.jetbrains.kotlin.allopen.gradle.AllOpenGradleSubplugin;
6059
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptions;
6160
import org.jetbrains.kotlin.gradle.dsl.KotlinSingleTargetExtension;
6261
import org.jetbrains.kotlin.gradle.plugin.KotlinBasePluginWrapper;
6362
import org.jetbrains.kotlin.gradle.plugin.KotlinCompilation;
64-
import org.jetbrains.kotlin.gradle.plugin.SubpluginOption;
6563
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinCommonCompilation;
6664
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile;
6765

@@ -470,30 +468,15 @@ public Map<String, List<String>> getKotlinFriendPaths(boolean isTest) {
470468
}
471469

472470
protected List<String> getKotlinCompilerPlugins() {
473-
List<SubpluginOption> subpluginOptions = getAllOpenSubpluginOptions();
474-
475-
if (subpluginOptions.size() > 0) {
476-
return ImmutableList.of(KotlinManager.KOTLIN_AO_PLUGIN_TARGET);
477-
} else {
478-
return ImmutableList.of();
479-
}
471+
return ImmutableList.of();
480472
}
481473

482474
protected List<String> getKotlinCompilerOptions() {
483475
if (!isKotlin) {
484476
return ImmutableList.of();
485477
}
486478

487-
ImmutableList.Builder<String> optionBuilder = ImmutableList.builder();
488-
optionBuilder.addAll(readKotlinCompilerArguments());
489-
490-
for (SubpluginOption option : getAllOpenSubpluginOptions()) {
491-
optionBuilder.add("-P");
492-
optionBuilder.add(
493-
"plugin:org.jetbrains.kotlin.allopen:" + option.getKey() + "=" + option.getValue());
494-
}
495-
496-
return optionBuilder.build();
479+
return ImmutableList.copyOf(readKotlinCompilerArguments());
497480
}
498481

499482
private List<String> readKotlinCompilerArguments() {
@@ -571,27 +554,6 @@ private List<String> readKotlinCompilerArguments() {
571554
}
572555
}
573556

574-
private ImmutableList<SubpluginOption> getAllOpenSubpluginOptions() {
575-
if (!getProject().getPlugins().hasPlugin(KotlinManager.KOTLIN_ALLOPEN_MODULE)) {
576-
return ImmutableList.of();
577-
}
578-
579-
KotlinSingleTargetExtension extension =
580-
getProject().getExtensions().findByType(KotlinSingleTargetExtension.class);
581-
if (extension == null) {
582-
return ImmutableList.of();
583-
}
584-
585-
AllOpenGradleSubplugin subPlugin =
586-
(AllOpenGradleSubplugin)
587-
getProject().getPlugins().getPlugin(KotlinManager.KOTLIN_ALLOPEN_MODULE);
588-
KotlinCompilation fakeCompilation =
589-
new KotlinCommonCompilation(extension.getTarget(), "fakeCompilation");
590-
return new ImmutableList.Builder<SubpluginOption>()
591-
.addAll(subPlugin.applyToCompilation(fakeCompilation).get())
592-
.build();
593-
}
594-
595557
@SuppressWarnings("NoFunctionalReturnType")
596558
private static <T> Predicate<T> distinctByKey(Function<? super T, ?> keyExtractor) {
597559
Set<Object> seen = ConcurrentHashMap.newKeySet();

libraries/kotlinlibrary/src/test/java/demo/AllOpenTest.kt

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)