You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by GitBox <gi...@apache.org> on 2019/11/11 21:24:47 UTC

[GitHub] [groovy] eric-milles opened a new pull request #1080: GROOVY-9197: Ant: separate compiler classpath from compilation classpath

eric-milles opened a new pull request #1080: GROOVY-9197: Ant: separate compiler classpath from compilation classpath
URL: https://github.com/apache/groovy/pull/1080
 
 
   [GROOVY-9197](https://issues.apache.org/jira/browse/GROOVY-9197): Java 11 compatibility of groovyc ant task
   
   The design of this change is to pass separately the paths necessary for groovyc to run and the classpath of the compiled artifacts.  The `-classpath` argument was previously populated with groovy-all, etc.  Now this stuff is passed via the `--classpath` argument to `FileSystemCompilerFacade`.  Thus, no special `URLClassLoader` interaction is required (which fails under Java 11).
   ```
     [compile] Compilation arguments:
     [compile] C:\Program Files\Java\jdk\11.0.5\bin\java
     [compile] -classpath
     [compile] <enough to execute FileSystemCompilerFacade>
     [compile] -Dfile.encoding=UTF-8
     [compile] org.codehaus.groovy.ant.FileSystemCompilerFacade
     [compile] --classpath
     [compile] <compilation classpath>
     [compile] -j
     [compile] -Fg
     [compile] -Jsource=1.8
     [compile] -Jtarget=1.8
     [compile] -d
     [compile] <output directory>
     [compile] --configscript
     [compile] config.groovy
     [compile] <source files to compile>
   ```
   
   The trick to doing all of this is determining what the bootstrap classpath for `FileSystemCompilerFacade` should be.  At the moment, I am getting the Ant runtime from `AntClassLoader`.  But this should be reduced to just `groovy` and `groovy-ant`.
   
   ```java
       private void doForkCommandLineList(List<String> commandLineList, Path classpath, String separator) {
           //commandLineList.add("java");
   
           // TODO: Need some help to complete this!  Is it safe to get codesource of FileSystemCompilerFacade.class?
           ClassLoader parent = getClass().getClassLoader();
           if (parent instanceof AntClassLoader) {
               commandLineList.add("-classpath");
               commandLineList.add(((AntClassLoader) parent).getClasspath());
           } else {
               // TODO: add enough classpath entries to support execution of FileSystemCompilerFacade
               throw new AssertionError("not yet implemented");
           }
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services