RFR: 7903633: Make source mode the default, and drop compiled mode [v2]
Maurizio Cimadamore
mcimadamore at openjdk.org
Fri Jan 19 10:42:54 UTC 2024
On Thu, 18 Jan 2024 15:06:58 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:
>> Make the source output mode the default, and drop the class output mode. (See JBS issue for motivation).
>>
>> This is fairly straightforward. I've touched up the `Options` class a bit as well, as I noticed there were some unused elements. For the tests:
>> - Merged `JtregJextractSources` and `JtregJextract`. Updated generator tests to only call the merged runner
>> - `JextractToolRunner::run` is now also responsible for compiling generated source files. Renamed it to `runAndCompile`, and made the output directory an explicit argument, so that the util method can pick it up and compile the generated sources. Note that this method is now also responsible for checking that jextract runs successfully (which is required if we want to compile the output).
>> - Added a `JextractToolRunner::runNoOutput` method which just runs jextract without trying to look at the generated files (e.g. for negative tests that look for CLI errors).
>> - Added a `JextractToolRunner::run` method again, for the 2 tests that ran jextract with `--source`.
>>
>> Furthermore, now that we only generate source files, `Writer` can be simplified a lot. I've removed our dependency on `JavaFileObject`, and replaced it with a new `JavaSourceFile` record. Unfortunately, I could not remove the module dependency on java.compiler, since the `NameMangler` also uses `SourceVersion`. Does replacing JavaFileObject seem like the right move? It reduces our dependency on java.compiler (maybe we could remove it completely at some point), and replaces `JavaFileObject` with a simpler API.
>
> Jorn Vernee has updated the pull request incrementally with one additional commit since the last revision:
>
> Simplify Writer + Remove JavaFileObject dependency
src/main/java/org/openjdk/jextract/impl/CodeGenerator.java line 37:
> 35: private CodeGenerator() {}
> 36:
> 37: public static JavaSourceFile[] generate(Declaration.Scoped decl, String headerName,
Also this looks more like a method in JextractTool
test/jtreg/generator/clinitCycles/TestGlobal.java line 32:
> 30:
> 31: /*
> 32: * @test id
note that `id` is the name that is given to the test run, which is then visible in the output (e.g. so that we could separate between issues in `sources` and `classes`). If there's only one run, the `id` is no longer needed, I think
-------------
PR Review Comment: https://git.openjdk.org/jextract/pull/186#discussion_r1458764599
PR Review Comment: https://git.openjdk.org/jextract/pull/186#discussion_r1458767544
More information about the jextract-dev
mailing list