diff --git a/src/main/groovy/com/eriwen/gradle/css/source/internal/DefaultCssSourceSet.groovy b/src/main/groovy/com/eriwen/gradle/css/source/internal/DefaultCssSourceSet.groovy index cede97b..60da3ce 100644 --- a/src/main/groovy/com/eriwen/gradle/css/source/internal/DefaultCssSourceSet.groovy +++ b/src/main/groovy/com/eriwen/gradle/css/source/internal/DefaultCssSourceSet.groovy @@ -24,7 +24,9 @@ class DefaultCssSourceSet implements CssSourceSet { DefaultCssSourceSet(String name, Project project, Instantiator instantiator, FileResolver fileResolver) { this.name = name this.displayName = GUtil.toWords(name) - if (GradleVersion.current().compareTo(GradleVersion.version("2.12")) >= 0) { + if (GradleVersion.current().compareTo(GradleVersion.version("5.0")) >= 0) { + this.css = project.objects.sourceDirectorySet(name, String.format("%s CSS source", displayName)) + } else if (GradleVersion.current().compareTo(GradleVersion.version("2.12")) >= 0) { Class fileTreeFactory = Class.forName("org.gradle.api.internal.file.collections.DefaultDirectoryFileTreeFactory") def directoryFileTreeFactory = fileTreeFactory.getConstructor().newInstance() this.css = new DefaultSourceDirectorySet(name, String.format("%s CSS source", displayName), fileResolver, directoryFileTreeFactory)