Method in build.gradle not available in imported scripts


(Thierry Guérin) #1

Guess I came too late to the 1.12-rc2 party (12 minutes before the 1.12 announcement). Just in case my message in the 1.12-rc2 announcement went unnoticed, I stumbled upon a regression:

when a method is defined in build.gradle, it’s no longer available to the scripts that build.gradle includes.
Example:
--build.gradle--
void echo(String string) {
logger.quiet string
}
apply from: file(‘include.gradle’)

--include.gradle--
task myTask {
echo(‘this used to work’)
}

This used to work with version 1.11 (and since at least 1.1, which is the oldest Gradle version that I still had handy).

Hope this helps (should I open a bug report?),

Thierry Note: This topic was created from a reply on the Gradle 1.12 released topic.


(René Groeschke) #2

Hello Thierry, sorry for the late reply. I can reproduce this issue with gradle 1.12 and its indeed working with 1.11. Indeed it came a bit to late for us to be noticed before releasing 1.12. So there is indeed a regression.

I’ve created a bug in our issue tracker at http://issues.gradle.org/browse/GRADLE-3079

cheers, René


(Thierry Guérin) #3

Ok, thanks.

Do you think that this can potentially change the plans (1.12 is the last release before 2.0) and open the possibility of a fix in a 1.13? Just curious, I do not need the features introduced in 1.12 and can wait until the 2.0 release for a fix.

Regards,

Thierry


(Carlo Luib-Finetti) #4

for me this is a very crucial isssue, because I have to (re)write the generated Eclipse “.classpath” files of all subprojects in a manner that they apply to what Eclipse PDE wants to have (“Plugin-dependencies”).

Execution failed for task ':de.uvdms.root:eclipseClasspath'.
> No signature of method: org.gradle.plugins.ide.eclipse.model.Classpath.replaceWithRelativePath() is applicable for argument types ....

(Peter Niederwieser) #5

It will be fixed in 2.0, which is expected to hit the streets in about 6 weeks.