RFR: 7903633: Make source mode the default, and drop compiled mode [v4]
Maurizio Cimadamore
mcimadamore at openjdk.org
Fri Jan 19 13:27:56 UTC 2024
On Fri, 19 Jan 2024 13:19:00 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 two additional commits since the last revision:
>
> - Update JEP number
> - re-add tracing section to readme
Marked as reviewed by mcimadamore (Reviewer).
README.md line 157:
> 155: ---
> 156:
> 157: ### Building & Testing
We have Building & Testing - and then Testing again?` I suggest maybe renaming this to `Building jextract` (for symmetry) and then `Testing jextract`.
src/main/java/org/openjdk/jextract/JextractTool.java line 133:
> 131: }
> 132:
> 133: private static JavaSourceFile[] generate(Declaration.Scoped decl, String headerName,
Thanks - I think seeing everything here helps a bit - as opposed to having to chase multiple classes around which only contained a single method.
-------------
PR Review: https://git.openjdk.org/jextract/pull/186#pullrequestreview-1832572853
PR Review Comment: https://git.openjdk.org/jextract/pull/186#discussion_r1459001179
PR Review Comment: https://git.openjdk.org/jextract/pull/186#discussion_r1459002499
More information about the jextract-dev
mailing list