I think what you are describing is "incremental compilation". There are open issue items about incremental compilation: * https://issues.apache.org/jira/browse/GROOVY-11666 * https://issues.apache.org/jira/browse/GROOVY-10932
This feature is not mentioned in the docs for groovyc. https://groovy-lang.org/groovyc.html I don't think there is explicit support to provide all sources and a partially populated binary directory and have the compiler work out just what to build. Maven might provide some of this on top of groovyc. Incremental is indicated as on by default since Maven 3.1: https://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html#useIncrementalCompilation ________________________________ From: Saravanan Palanichamy <chava...@gmail.com> Sent: Monday, June 9, 2025 11:01 AM To: dev@groovy.apache.org <dev@groovy.apache.org> Subject: [EXT] Re: Controlled compilation External Email: Use caution with links and attachments. Thank you Jochen for your reply some followup * My source files may be in different locations (I want to say here's three different source directories, they form the source closure. But compile only foo.groovy and let the compiler decide what other files in what locations need to be pulled up for the compile). I saw that groovyc is backed by FileSystemCompiler.java and it is doing the same thing I am doing I think (it adds all source files passed in the command line args to the compile unit). What's the way to pass in only foo.groovy but then say here are other source units/files one of which is bar.groovy, just use the ones you need and leave out the others If it helps, * I assume every file will only have one class defined (these are java files that are being compiled with the Groovy compiler, so java limitations will help) * I can also do multi pass compiles, time to compile is not a limitation regards Saravanan On Mon, Jun 9, 2025 at 4:21 AM Jochen Theodorou <blackd...@gmx.org<mailto:blackd...@gmx.org>> wrote: On 09.06.25 09:21, Saravanan Palanichamy wrote: > Hello Groovy devs > > I am trying to understand how to do this with the Groovy Compiler > > * I have say 20 files in my project > * I know I have to compile just one of those files groovyc foo.groovy will compile foo.groovy and potentially its dependencies. A dependency should be compiled filed in class format, or source file. If both are available then which is newer decide if recompilation happens. If a dependency is not found compilation will fail. bye Jochen