Skip to content

Commit

Permalink
Suppress Kotlin 1.5.20 deprecation warning
Browse files Browse the repository at this point in the history
  • Loading branch information
philwebb committed Jun 24, 2021
1 parent 8f9652c commit d442071
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,17 @@ class KotlinPluginAction implements PluginApplicationAction {
public void execute(Project project) {
ExtraPropertiesExtension extraProperties = project.getExtensions().getExtraProperties();
if (!extraProperties.has("kotlin.version")) {
String kotlinVersion = project.getPlugins().getPlugin(KotlinPluginWrapper.class).getKotlinPluginVersion();
String kotlinVersion = getKotlinVersion(project);
extraProperties.set("kotlin.version", kotlinVersion);
}
enableJavaParametersOption(project);
}

@SuppressWarnings("deprecation")
private String getKotlinVersion(Project project) {
return project.getPlugins().getPlugin(KotlinPluginWrapper.class).getKotlinPluginVersion();
}

private void enableJavaParametersOption(Project project) {
project.getTasks().withType(KotlinCompile.class,
(compile) -> compile.getKotlinOptions().setJavaParameters(true));
Expand Down

0 comments on commit d442071

Please sign in to comment.