Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use commandline argument file for all options, but -J, for case javac… #98

Merged
merged 3 commits into from Jun 15, 2019
Merged

Use commandline argument file for all options, but -J, for case javac… #98

merged 3 commits into from Jun 15, 2019

Conversation

slobokot
Copy link

Currently only java files are passed using commandline argument file for javac.
There are times when classpath is longer than 8000 characters. on unix that works, but on windows it doesn't, see https://support.microsoft.com/en-us/help/830473/command-prompt-cmd-exe-command-line-string-limitation. That leads to exception like

at org.apache.tools.ant.taskdefs.compilers.DefaultCompilerAdapter.executeExternalCompile(DefaultCompilerAdapter.java:601)
        at org.apache.tools.ant.taskdefs.compilers.JavacExternal.execute(JavacExternal.java:62)
        at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:1395)
        at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:1121)
        ...
Caused by: java.io.IOException: Cannot run program "c:\...\javac.exe" (in directory "..."): CreateProcess error=206, The filename or extension is too long
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
        at java.lang.Runtime.exec(Runtime.java:620)
        at org.apache.tools.ant.taskdefs.launcher.Java13CommandLauncher.exec(Java13CommandLauncher.java:58)
        at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:426)
        at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:440)
        at org.apache.tools.ant.taskdefs.compilers.DefaultCompilerAdapter.executeExternalCompile(DefaultCompilerAdapter.java:598)
        ... 33 more
Caused by: java.io.IOException: CreateProcess error=206, The filename or extension is too long
        at java.lang.ProcessImpl.create(Native Method)
        at java.lang.ProcessImpl.<init>(ProcessImpl.java:386)
        at java.lang.ProcessImpl.start(ProcessImpl.java:137)
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
        ... 38 more

This pull requests puts all but -J options into commandline argument file. -J options can't be specified in commandline argument file as per documentation: https://docs.oracle.com/en/java/javase/11/tools/javac.html

@asfgit
Copy link

asfgit commented Jun 14, 2019

Can one of the admins verify this patch?

5 similar comments
@asfgit
Copy link

asfgit commented Jun 14, 2019

Can one of the admins verify this patch?

@asfgit
Copy link

asfgit commented Jun 14, 2019

Can one of the admins verify this patch?

@asfgit
Copy link

asfgit commented Jun 14, 2019

Can one of the admins verify this patch?

@asfgit
Copy link

asfgit commented Jun 14, 2019

Can one of the admins verify this patch?

@asfgit
Copy link

asfgit commented Jun 14, 2019

Can one of the admins verify this patch?

@bodewig
Copy link
Member

bodewig commented Jun 15, 2019

this is OK to test

@asfgit
Copy link

asfgit commented Jun 15, 2019

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/Ant%20Github-PR-Linux/127/

@asfgit
Copy link

asfgit commented Jun 15, 2019

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/Ant%20Github-PR-Windows/133/

@jmkf jmkf merged commit b527dca into apache:master Jun 15, 2019
@jmkf
Copy link
Contributor

jmkf commented Jun 15, 2019

I was wondering why the java 11 checks would not apply to java 12 as the first ones, howerver these are indeed referring to javac 1.1 and 1.2

asfgit pushed a commit that referenced this pull request Jun 15, 2019
Use commandline argument file for all options, but -J, for case javac…
@lipnitsk
Copy link

This change likely broke the usage of command-line argument files, see https://bz.apache.org/bugzilla/show_bug.cgi?id=63874.

@slobokot
Copy link
Author

Reproduced issue using following build.xml

<project name="MyProject" default="dist" basedir=".">
    <property name="class_path" value="4000 characters long"/>
    <target name="compile">        
        <javac srcdir="src" destdir="build" classpath="${class_path}" fork="true">
            <compilerarg value="@c:\tmp\test-ant\args-file"/>
        </javac>
      </target>
</project>

produces

    [javac] File to be compiled:
    [javac]     C:\tmp\test-ant\src\com\Program.java
    [javac] javac: invalid flag: @c:\tmp\test-ant\args-file
    [javac] Usage: javac <options> <source files>
    [javac] use -help for a list of possible options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants