Skip to content

Commit bc31a51

Browse files
committed
chore: make ide-plugin compatible with Gradle 9
1 parent 61429cd commit bc31a51

File tree

1 file changed

+6
-2
lines changed
  • plugins/ide-plugin/src/main/kotlin/com/github/vlsi/gradle/ide

1 file changed

+6
-2
lines changed

plugins/ide-plugin/src/main/kotlin/com/github/vlsi/gradle/ide/IdeExtension.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import org.gradle.kotlin.dsl.apply
2828
import org.gradle.kotlin.dsl.configure
2929
import org.gradle.plugins.ide.eclipse.model.EclipseModel
3030
import org.gradle.plugins.ide.idea.model.IdeaModel
31+
import org.gradle.plugins.ide.idea.model.IdeaModule
3132
import org.gradle.util.GradleVersion
3233
import org.jetbrains.gradle.ext.ProjectSettings
3334
import java.io.File
@@ -111,8 +112,11 @@ open class IdeExtension(private val project: Project) {
111112
if (GradleVersion.current() >= GradleVersion.version("7.4")) {
112113
module.testSources.from(generationOutput)
113114
} else {
114-
@Suppress("DEPRECATION")
115-
module.testSourceDirs.add(generationOutput)
115+
val getTestSourceDirs =
116+
IdeaModule::class.java.getDeclaredMethod("getTestSourceDirs")
117+
@Suppress("UNCHECKED_CAST")
118+
val testSourceDirs = getTestSourceDirs.invoke(module) as MutableSet<File>
119+
testSourceDirs.add(generationOutput)
116120
}
117121
}
118122
}

0 commit comments

Comments
 (0)