jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • groovy
  • GROOVY-5024

Reduce groovyc command line length

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 2.0-beta-3, 1.8.7
  • Component/s: Ant integration
  • Labels:
    None
  • Environment:
    Windows

Description

On Windows, the command line length is restricted to 32Kb or somesuch.

FileSystemCompiler builds a command line that includes the classpath twice, which makes it prone to failure on Windows. See http://issues.gradle.org/browse/GRADLE-1420

The attatched patch reduces the problem by passing one of the classpath strings via the CLASSPATH environment variable instead of the -cp argument.

A further improvement would be to add @-handling to FileSystemCompiler's --classpath argument parser.

  • Options
    • Sort By Name
    • Sort By Date
    • Ascending
    • Descending
    • Download All

Attachments

  1. File
    groovyc-use-env-classpath.diff
    15/Sep/11 2:21 AM
    2 kB
    Jesper Skov

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Guillaume Laforge added a comment - 22/Sep/11 9:29 AM

Just had a look at the patch, and it seems to still need a bit of work, as it's failing the Groovy build!

Have you tried running the Groovy build with your patch?

-stagedcompile-groovy:
  [groovyc] Compiling 183 source files to /Users/glaforge/Projects/groovy/groovy-git/target/classes
  [groovyc] Exception in thread "main" java.lang.NoClassDefFoundError: org/codehaus/groovy/tools/FileSystemCompiler
  [groovyc] Caused by: java.lang.ClassNotFoundException: org.codehaus.groovy.tools.FileSystemCompiler
  [groovyc] 	at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
  [groovyc] 	at java.security.AccessController.doPrivileged(Native Method)
  [groovyc] 	at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
  [groovyc] 	at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
  [groovyc] 	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
  [groovyc] 	at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

BUILD FAILED
/Users/glaforge/Projects/groovy/groovy-git/build.xml:176: The following error occurred while executing this line:
/Users/glaforge/Projects/groovy/groovy-git/build.xml:183: Forked groovyc returned error code: 1
Show
Guillaume Laforge added a comment - 22/Sep/11 9:29 AM Just had a look at the patch, and it seems to still need a bit of work, as it's failing the Groovy build! Have you tried running the Groovy build with your patch?
-stagedcompile-groovy:
  [groovyc] Compiling 183 source files to /Users/glaforge/Projects/groovy/groovy-git/target/classes
  [groovyc] Exception in thread "main" java.lang.NoClassDefFoundError: org/codehaus/groovy/tools/FileSystemCompiler
  [groovyc] Caused by: java.lang.ClassNotFoundException: org.codehaus.groovy.tools.FileSystemCompiler
  [groovyc] 	at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
  [groovyc] 	at java.security.AccessController.doPrivileged(Native Method)
  [groovyc] 	at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
  [groovyc] 	at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
  [groovyc] 	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
  [groovyc] 	at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

BUILD FAILED
/Users/glaforge/Projects/groovy/groovy-git/build.xml:176: The following error occurred while executing this line:
/Users/glaforge/Projects/groovy/groovy-git/build.xml:183: Forked groovyc returned error code: 1
Hide
Permalink
Jesper Skov added a comment - 22/Sep/11 9:38 AM

No, sorry. As I said, I wrote it blind.

The change compiled in Eclipse, and I inserted the resulting .class file into my groovy-all jar. Gross hack. But working.

I won't contest that the patch may break things for you. But It's strange that the error cause should be FileSystemCompiler, which is not mentioned in my patch!?!?

Anyway, I'll be happy to set up a properly building Groovy environment locally, and see if I can fix the problem.
Unfortunately, I cannot commit to a deadline for this...

Show
Jesper Skov added a comment - 22/Sep/11 9:38 AM No, sorry. As I said, I wrote it blind. The change compiled in Eclipse, and I inserted the resulting .class file into my groovy-all jar. Gross hack. But working. I won't contest that the patch may break things for you. But It's strange that the error cause should be FileSystemCompiler, which is not mentioned in my patch!?!? Anyway, I'll be happy to set up a properly building Groovy environment locally, and see if I can fix the problem. Unfortunately, I cannot commit to a deadline for this...
Hide
Permalink
Jesper Skov added a comment - 25/Jan/12 5:32 AM

I now have access to a Linux box at work, and on that I get the exact same output as you when using groovyc.

So I'll give it another look.

Show
Jesper Skov added a comment - 25/Jan/12 5:32 AM I now have access to a Linux box at work, and on that I get the exact same output as you when using groovyc. So I'll give it another look.
Hide
Permalink
Jesper Skov added a comment - 25/Jan/12 11:35 AM

The problem turned out to simply be "classpath" that should be upper-cased.

Then it works for me on both Windows and Linux.

I tried to build 1.7.10, but it failed with some missing dependencies. So I still did not test it with an actual Groovy build. Sorry.

Show
Jesper Skov added a comment - 25/Jan/12 11:35 AM The problem turned out to simply be "classpath" that should be upper-cased. Then it works for me on both Windows and Linux. I tried to build 1.7.10, but it failed with some missing dependencies. So I still did not test it with an actual Groovy build. Sorry.
Hide
Permalink
Steven Dick added a comment - 02/Feb/12 3:28 AM

I've applied the patch to a locally built Groovy 1.8.5 and it solves the problem where the combination of Windows + Gradle + Groovy + Spock fails on my multi-project build with the command line length problem - http://forums.gradle.org/gradle/topics/gradle_groovy_spock_windows_argh

Is a Windows environment such a rarity that this problem is not a bigger issue?

Show
Steven Dick added a comment - 02/Feb/12 3:28 AM I've applied the patch to a locally built Groovy 1.8.5 and it solves the problem where the combination of Windows + Gradle + Groovy + Spock fails on my multi-project build with the command line length problem - http://forums.gradle.org/gradle/topics/gradle_groovy_spock_windows_argh Is a Windows environment such a rarity that this problem is not a bigger issue?
Hide
Permalink
Paul King added a comment - 02/Feb/12 3:36 AM

@Steven: you applied the patch as is or with the "upper-casing" amendment as well?

Show
Paul King added a comment - 02/Feb/12 3:36 AM @Steven: you applied the patch as is or with the "upper-casing" amendment as well?
Hide
Permalink
Steven Dick added a comment - 02/Feb/12 6:30 AM - edited

Double checking the code, I've added the patch as-is with the lowercase 'classpath' which seems to work on XP at least. I assume this is a *nix/Windows issue with the case of 'classpath' being significant. I manually applied the changes as the patch doesn't match up with the 1.8.5 version of the class. I used the Gradle build to generate the JAR files (though the docs.gradle file is corrupted with diff markers).

I'm only using this custom version as part of the build, so I'm not too concerned about the fitness of the solution, but I would appreciate an official version in the not too distant future.

Show
Steven Dick added a comment - 02/Feb/12 6:30 AM - edited Double checking the code, I've added the patch as-is with the lowercase 'classpath' which seems to work on XP at least. I assume this is a *nix/Windows issue with the case of 'classpath' being significant. I manually applied the changes as the patch doesn't match up with the 1.8.5 version of the class. I used the Gradle build to generate the JAR files (though the docs.gradle file is corrupted with diff markers). I'm only using this custom version as part of the build, so I'm not too concerned about the fitness of the solution, but I would appreciate an official version in the not too distant future.
Hide
Permalink
Paul King added a comment - 07/Feb/12 8:22 AM

The patch has been applied with the lowercase "classpath" variation. Leaving open for a brief time while some more testing takes place.

Show
Paul King added a comment - 07/Feb/12 8:22 AM The patch has been applied with the lowercase "classpath" variation. Leaving open for a brief time while some more testing takes place.
Hide
Permalink
Steven Dick added a comment - 13/Feb/12 4:00 AM

Groovy 1.8.6 still fails for me on the groovyc Ant task. Looking at the source code, it appears that the patch was partially applied as I don't see the removal of lines 782 & 783 from groovyc.java in the Github history.

Show
Steven Dick added a comment - 13/Feb/12 4:00 AM Groovy 1.8.6 still fails for me on the groovyc Ant task. Looking at the source code, it appears that the patch was partially applied as I don't see the removal of lines 782 & 783 from groovyc.java in the Github history.
Hide
Permalink
Paul King added a comment - 13/Feb/12 4:43 AM

My apologies, the auto-patch didn't work for me and I applied it manually and somehow I missed those two lines. That's what I get for skimping out on some kind of integration test. Will fix it now.

Show
Paul King added a comment - 13/Feb/12 4:43 AM My apologies, the auto-patch didn't work for me and I applied it manually and somehow I missed those two lines. That's what I get for skimping out on some kind of integration test. Will fix it now.
Hide
Permalink
Paul King added a comment - 13/Feb/12 5:07 AM

ok, hopefully this time!

Show
Paul King added a comment - 13/Feb/12 5:07 AM ok, hopefully this time!

People

  • Assignee:
    Paul King
    Reporter:
    Jesper Skov
Vote (4)
Watch (4)

Dates

  • Created:
    15/Sep/11 2:21 AM
    Updated:
    13/May/12 3:30 AM
    Resolved:
    13/Feb/12 5:07 AM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.