Wanted to give an update on this for what I found.
It is definetly an issue related to the length of the command that is passed to Runtime.exec.
To experiment, I changed the path that my class are build from long path
to something very short:
Worked great! Same number of classes being compiled.
So, I played further and tried to find the breaking point of the directory length, for my instance, and I found that while:
works. this doesn't:
The extra letter on every path of every class causes it to pass that magical threshold -- which after looking at the the lengths of the two strings that are generated, is somewhere around 2^15.
Any hope of getting a fix before the 1.0 release to the AopC ant task so the compiler will handle a directory passed in, and pass that directly to the standalone compiler? I would assume that I am not the only one who is going to have this issue.
The usual fix for this is to allow a
to be passed in to the compiler.
If the length of the file names is too large it can write them to a temp file
and pass --SOURCEFILES [tmp-file-name]
The other fix is to not use Windows :-)
I wonder if the javac target in Ant has the same problem as I based aopc on this code.
I will try and resolve your request...We need to release 1.0 this week as other JBoss Inc. projects are waiting on it so I can't promise anything.
But, this is a serious usability bug, so I'll put cycles into it.
You bring up a good point. I saw your comment about using javac as the basis for the code.
In my same ant task, I also compile the same set of code using javac with no issues. Weird.
I understand about getting 1.0 out --- I can look tonight at the differences and why javac would work and aopc would not.
Looking at the source of the javac task -- it appears that Adrian's solution is exactly what they do. When the user wants to fork the process, and the command line is >4096, it outputs it to a temp file, and passes that to the compiler.
When you don't fork via with javac, there is no problem what so ever? Would it be simplier to just not fork the AopC compiler and run it in the same process, like javac?
This will be in the release. If the files portion of the java command is longer than a given number of chars, it creates a temp file as outlined.
I don't know what the limits are, so I have added a maxsrc parameter to the ant task. The default is 1000
Thanks....I really do appreciate it.
Personally, I think following Ant's lead and hardcoding it 4096 as the threshold is fine -- that is the number that POSIX defines as the limit.
Windows is only notionally POSIX compliant.
It defines a POSIX compliant interface, but it does not use it internally (e.g from
the command line/shell) and most WIN32 apis ignore it as well.