Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility with Gradle 8 #86

Closed
ljacomet opened this issue Feb 2, 2023 · 0 comments · Fixed by #87
Closed

Compatibility with Gradle 8 #86

ljacomet opened this issue Feb 2, 2023 · 0 comments · Fixed by #87

Comments

@ljacomet
Copy link
Contributor

ljacomet commented Feb 2, 2023

The following code is an issue with upcoming Gradle 8:

class WartremoverPlugin implements Plugin<Project> {
@Override
void apply(Project project) {
def extension = project.extensions.create('wartremover', WartremoverExtension)
project.afterEvaluate {
project.dependencies { scalaCompilerPlugins "org.wartremover:wartremover_${getWartremoverArtifactSuffix(project)}" }
project.tasks.withType(ScalaCompile).configureEach { scalaTask ->
if (scalaTask.scalaCompileOptions.additionalParameters == null) {
scalaTask.scalaCompileOptions.additionalParameters = new ArrayList<String>()
}
WartremoverSettings settings = scalaTask.name.toLowerCase().contains('test') ? extension.getTest() : extension
scalaTask.scalaCompileOptions.additionalParameters.addAll(settings.errorWarts.collect { getErrorWartDirective(it) })
scalaTask.scalaCompileOptions.additionalParameters.addAll(settings.warningWarts.collect { getWarningWartDirective(it) })
scalaTask.scalaCompileOptions.additionalParameters.addAll(settings.excludedFiles.collect { getExludedFileDirective(project.file(it).canonicalPath) })
scalaTask.scalaCompileOptions.additionalParameters.addAll(settings.classPaths.collect { getClasspathDirective(it) })
}
}
}

Gradle made the additionalParameters list immutable, so you have to copy, add and then set it to make changes to it.

I'll open a PR that does just that.

ljacomet added a commit to ljacomet/gradle-wartremover that referenced this issue Feb 2, 2023
This makes the plugin compatible with upcoming Gradle 8

Fixes augi#86
@augi augi closed this as completed in #87 Feb 2, 2023
augi pushed a commit that referenced this issue Feb 2, 2023
This makes the plugin compatible with upcoming Gradle 8

Fixes #86
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants