Jochen,

The background here is that if I issue ./gradlew commands from a
top-level login shell then compilation of the Gradle code succeeds.  If
I issue the same command from a ( . . . ) sub-shell of a shell script
then I get an error due to the use of covariant return types.  As far as
I can tell the environment variables are all identical.  As far as I can
tell the java command line initiating the FileSystemCompiler is
identical.  So the question is where can the variability be.  It is as
though in one case the -source 1.5 is being obeyed and in the other
something like -source 1.4 is being used (but I am guessing).

If there is any input you have that can help here I would much
appreciate it as I am going insane on this one -- which probably means
it is something really trivial I should have spotted ages ago.


-------- Forwarded Message --------
> From: Russel Winder <[email protected]>
> Reply-to: [email protected]
> To: [email protected]
> Cc: Jochen Theodorou <[email protected]>
> Subject: Re: [gradle-dev] Build broken :-(
> Date: Tue, 18 Aug 2009 07:02:32 +0100
> 
> On Mon, 2009-08-17 at 22:05 +0200, Jacob Grydholt Jensen wrote:
> > 2009/8/17 Russel Winder <[email protected]>:
> > > I am beginning to think something very weird is happening deep in the
> > > bowels of Gradle/Groovy/Java/Bash.
> > >
> > > If I issue the gradlew command from the command line, the Gradle build
> > > works fine.  If I put the gradlew command in a shell script or subshell,
> > > then I get the
> > >
> > >> > :compile
> > >> > org.codehaus.groovy.control.MultipleCompilationErrorsException: 
> > >> > startup failed, 
> > >> > /home/users/russel/Repositories/Bazaar/Subversion/GradleCore/Trunk/src/main/groovy/org/gradle/api/internal/file/CopySpecImpl.groovy:
> > >> >  62: The return type of org.gradle.api.file.CopySpec 
> > >> > from([Ljava.lang.Object;) in org.gradle.api.internal.file.CopySpecImpl 
> > >> > is incompatible with org.gradle.api.file.CopySourceSpec 
> > >> > from([Ljava.lang.Object;) in org.gradle.api.file.CopySourceSpec.
> > >> > Node: org.codehaus.groovy.ast.MethodNode. At [62:5]  @ line 62, column 
> > >> > 5.
> > >> >        CopySpec from(Object... sourcePaths) {
> > >> >        ^
> > >
> > > error.  I checked the java command issued to do the compilation and it
> > > appears to be identical.  This is where the weirdness happens:  if the
> > > java command issued is the same how can the resulting groovyc execution
> > > do the right thing from a shell and the wrong thing from a subshell?
> > 
> > Could it be that your environment variables are different in the shell
> > and the subshell? I know that in bash login shells are treated
> > differently. If you are using bash you could try starting the subshell
> > with the '-l' switch to make it act as a login shell.
> 
> I don't think so.  A sub-shell should inherit all the environment of the
> parent shell unless special action is taken.  Using the --login option
> is just such an action.
> 
> My script actually invokes a sub-sub-shell by using ( . . . ), but I
> checked and the environment is exactly the one expected -- i.e. it looks
> the same as the top-level login shell environment.
> 
> The problem here is that the java command issued in the two cases is
> identical:
> 
>         06:49:39.761 [main] DEBUG org.gradle.api.logging.LogLevel - 
> Execute:Java13CommandLauncher: Executing 
> '/usr/lib/jvm/java-6-openjdk/jre/bin/java' with arguments:
>         '-classpath'
>         
> '/home/users/russel/.gradle/cache/org.codehaus.groovy/groovy-all/jars/groovy-all-1.6.3.jar:/home/users/russel/.gradle/cache/commons-httpclient/commons-httpclient/jars/commons-httpclient-3.0.jar:/home/users/russel/.gradle/cache/dom4j/dom4j/jars/dom4j-1.6.1.jar:/home/users/russel/.gradle/cache/org.mortbay.jetty/jetty-plus/jars/jetty-plus-6.1.14.jar:/home/users/russel/.gradle/cache/org.mortbay.jetty/jetty-util/jars/jetty-util-6.1.14.jar:/home/users/russel/.gradle/cache/javax.servlet/servlet-api/jars/servlet-api-2.5.jar:/home/users/russel/.gradle/cache/org.mortbay.jetty/jetty/jars/jetty-6.1.14.jar:/home/users/russel/.gradle/cache/org.apache.ivy/ivy/jars/ivy-2.1.0-rc2.jar:/home/users/russel/.gradle/cache/net.sf.jopt-simple/jopt-simple/jars/jopt-simple-2.4.1.jar:/home/users/russel/.gradle/cache/org.apache.ant/ant/jars/ant-1.7.0.jar:/home/users/russel/.gradle/cache/ch.qos.logback/logback-classic/jars/logback-classic-0.9.9.jar:/home/users/russel/.gradle/cache/org.slf4j/slf4j-api/jars/slf4j-api-1.5.3.jar:/home/users/russel/.gradle/cache/org.slf4j/jul-to-slf4j/jars/jul-to-slf4j-1.5.3.jar:/home/users/russel/.gradle/cache/ch.qos.logback/logback-core/jars/logback-core-0.9.9.jar:/home/users/russel/.gradle/cache/commons-io/commons-io/jars/commons-io-1.4.jar:/home/users/russel/.gradle/cache/commons-lang/commons-lang/jars/commons-lang-2.3.jar:/home/users/russel/.gradle/cache/commons-codec/commons-codec/jars/commons-codec-1.2.jar:/home/users/russel/.gradle/cache/slide/webdavlib/jars/webdavlib-2.0.jar:/home/users/russel/.gradle/cache/biz.aQute/bndlib/jars/bndlib-0.0.255.jar:/home/users/russel/.gradle/cache/org.apache.maven/maven-ant-tasks/jars/maven-ant-tasks-2.0.9.jar:/home/users/russel/.gradle/cache/asm/asm-all/jars/asm-all-2.2.3.jar:/home/users/russel/.gradle/cache/org.codenarc/CodeNarc/jars/CodeNarc-0.6.jar:/home/users/russel/.gradle/wrapper/dists/gradle-0.8-20090728100643+1000/lib/ant-launcher-1.7.0.jar:/home/users/russel/.gradle/wrapper/dists/gradle-0.8-20090728100643+1000/lib/ant-1.7.0.jar'
>         '-Xms128M'
>         '-Xmx1G'
>         'org.codehaus.groovy.tools.FileSystemCompiler'
>         '--classpath'
>         
> '/home/users/russel/.gradle/cache/org.codehaus.groovy/groovy-all/jars/groovy-all-1.6.3.jar:/home/users/russel/.gradle/cache/commons-httpclient/commons-httpclient/jars/commons-httpclient-3.0.jar:/home/users/russel/.gradle/cache/dom4j/dom4j/jars/dom4j-1.6.1.jar:/home/users/russel/.gradle/cache/org.mortbay.jetty/jetty-plus/jars/jetty-plus-6.1.14.jar:/home/users/russel/.gradle/cache/org.mortbay.jetty/jetty-util/jars/jetty-util-6.1.14.jar:/home/users/russel/.gradle/cache/javax.servlet/servlet-api/jars/servlet-api-2.5.jar:/home/users/russel/.gradle/cache/org.mortbay.jetty/jetty/jars/jetty-6.1.14.jar:/home/users/russel/.gradle/cache/org.apache.ivy/ivy/jars/ivy-2.1.0-rc2.jar:/home/users/russel/.gradle/cache/net.sf.jopt-simple/jopt-simple/jars/jopt-simple-2.4.1.jar:/home/users/russel/.gradle/cache/org.apache.ant/ant/jars/ant-1.7.0.jar:/home/users/russel/.gradle/cache/ch.qos.logback/logback-classic/jars/logback-classic-0.9.9.jar:/home/users/russel/.gradle/cache/org.slf4j/slf4j-api/jars/slf4j-api-1.5.3.jar:/home/users/russel/.gradle/cache/org.slf4j/jul-to-slf4j/jars/jul-to-slf4j-1.5.3.jar:/home/users/russel/.gradle/cache/ch.qos.logback/logback-core/jars/logback-core-0.9.9.jar:/home/users/russel/.gradle/cache/commons-io/commons-io/jars/commons-io-1.4.jar:/home/users/russel/.gradle/cache/commons-lang/commons-lang/jars/commons-lang-2.3.jar:/home/users/russel/.gradle/cache/commons-codec/commons-codec/jars/commons-codec-1.2.jar:/home/users/russel/.gradle/cache/slide/webdavlib/jars/webdavlib-2.0.jar:/home/users/russel/.gradle/cache/biz.aQute/bndlib/jars/bndlib-0.0.255.jar:/home/users/russel/.gradle/cache/org.apache.maven/maven-ant-tasks/jars/maven-ant-tasks-2.0.9.jar:/home/users/russel/.gradle/cache/asm/asm-all/jars/asm-all-2.2.3.jar:/home/users/russel/.gradle/cache/org.codenarc/CodeNarc/jars/CodeNarc-0.6.jar:/home/users/russel/.gradle/wrapper/dists/gradle-0.8-20090728100643+1000/lib/ant-launcher-1.7.0.jar:/home/users/russel/.gradle/wrapper/dists/gradle-0.8-20090728100643+1000/lib/ant-1.7.0.jar'
>         '-j'
>         '-Fg'
>         '-Jsource=1.5'
>         '-Jtarget=1.5'
>         '-d'
>         
> '/home/users/russel/Repositories/Bazaar/Subversion/GradleCore/Trunk/build/classes'
>         '@/tmp/groovyc-files-6310068733395055564.txt'
>         
>         The ' characters around the executable and arguments are
>         not part of the command.
> 
> So the question is how can the
> org.codehaus.groovy.tools.FileSystemCompiler end up with two different
> behaviours, one compiling correctly and the other not.
> 
-- 
Russel.
=============================================================================
Dr Russel Winder      Partner
                                            xmpp: [email protected]
Concertant LLP        t: +44 20 7585 2200, +44 20 7193 9203
41 Buckmaster Road,   f: +44 8700 516 084   voip: sip:[email protected]
London SW11 1EN, UK   m: +44 7770 465 077   skype: russel_winder

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to