From 0e24de2d9a4a482bec7e70d0d5dc9d058c7a761f Mon Sep 17 00:00:00 2001 From: Stefan Oehme Date: Thu, 17 Jun 2021 15:58:38 +0200 Subject: [PATCH] Make IDEA support work out of the box Instead of requiring users to apply the `idea` plugin, which is normally not necessary when using IDEA's importer. Fixes #474 --- src/main/groovy/com/google/protobuf/gradle/Utils.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/groovy/com/google/protobuf/gradle/Utils.groovy b/src/main/groovy/com/google/protobuf/gradle/Utils.groovy index 4dd26bbe..80c84681 100644 --- a/src/main/groovy/com/google/protobuf/gradle/Utils.groovy +++ b/src/main/groovy/com/google/protobuf/gradle/Utils.groovy @@ -126,8 +126,8 @@ class Utils { * not exist, it will be created before the IDE task is run. */ static void addToIdeSources(Project project, boolean isTest, File f, boolean isGenerated) { - IdeaModel model = project.getExtensions().findByType(IdeaModel) - if (model != null) { + project.plugins.withId("idea") { + IdeaModel model = project.getExtensions().findByType(IdeaModel) if (isTest) { model.module.testSourceDirs += f } else {