Should we have an org.gradle.api.tasks.compile.JavaCompile task type for the 1.0 API?


(matted-34813) #1

Should we have an org.gradle.api.tasks.compile.JavaCompile task type for the 1.0 API?

When folks code withType(JavaCompile) it would be clearer than withType(Compile)? One has to know from experience that Compile is Java related.

I see that [compileJava].options.encoding via NamedDomainObjectCollection corresponds to tasks.withType(Compile) { it.options.encoding }, while [compileGroovy].options.encoding corresponds to tasks.withType(GroovyCompiile) { it.options.encoding } which is good. (I know about [compileGroovy].groovyOptions.encoding as well )

This would involve: 1) Copying the org.gradle.api.tasks.compile.Compile and org.gradle.api.tasks.compile.JavaCompile 2) Making org.gradle.api.tasks.compile.Compile extend from org.gradle.api.tasks.compile.JavaCompile 3) Refactor org.gradle.api.tasks.compile.Compile in codebase to use org.gradle.api.tasks.compile.JavaCompile instead (since folks will copy plugins) 3) Possibly deprecating org.gradle.api.tasks.compile.Compile, so but hopefully now generating deprecation warnings in the build. 4) Updating documentation and example code to use and promote the use of org.gradle.api.tasks.compile.JavaCompile.

It will save many converstations on ambiguity in the future with multiple languages being supported.


(René Groeschke) #2

Hello, I understand your concerns here and this topic is worth to be discussed. But I don’t think this will make it into the 1.0 API, as 1.0-RC1 is just around the corner which is considered to be “feature complete” and API compliant to 1.0.

regards, René


(matted-34813) #3

You are right in delaying such a change so close to the release.


(Lucas Neiva) #4

I just spent a good 30 minutes trying to understand why “tasks.withType(CompileJava)” wasn’t working… Maybe it’s time to do the change now?


(Peter Niederwieser) #5

A ‘JavaCompile’ task type was already added a while ago. What made it so difficult to understand that there is no task type called ‘CompileJava’?