RFR: 7903731: Jextract should support macOS frameworks

Nizar Benalla nbenalla at openjdk.org
Tue Dec 31 11:38:47 UTC 2024


On Tue, 31 Dec 2024 00:06:57 GMT, Marcono1234 <duke at openjdk.org> wrote:

>> Read the JBS issue for more detail.
>> 
>> This patch adds two new mac specific options, to make it easier to use frameworks and remove the need of a `compile_flags.txt` file. An exception is thrown if those options are used from an other platform, the error message is inspired from `jpackage`
>
> The review comments below are only suggestions, feel free to ignore them, I am not a JDK member. Though hopefully the comments are useful nonetheless.

Thanks @Marcono1234 for the comments. They were useful.

> doc/GUIDE.md line 995:
> 
>> 993: | Option                       | Meaning                                                                                                                                                                                                                                 |
>> 994: |:-----------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
>> 995: | `--mac-framework-dir <dir>`  | specify the framework directory dir include files <br/>defaults to the current Mac OS X SDK dir<br/> This removes the need of having a compile_flags.txt with the required `-framework XYZ` options in the folder where jextract is ran |
> 
> Is this "directory dir" intentional?
> Suggestion:
> 
> | `--mac-framework-dir <dir>`  | specify the framework directory include files <br/>defaults to the current Mac OS X SDK dir<br/> This removes the need of having a compile_flags.txt with the required `-framework XYZ` options in the folder where jextract is ran |

The apple gcc manual says

> -Fdir 
Add the framework directory dir to the head of the list of directories to be
searched for header files. These directories are interleaved with those specified
by -I options and are scanned in a left-to-right order.

I tried to follow similar conventions of C compilers

> src/main/java/org/openjdk/jextract/JextractTool.java line 295:
> 
>> 293:         static boolean checkIfSupported( String option) {
>> 294:             return platformOptions.contains(option);
>> 295:         }
> 
> Maybe this name `checkIfSupported` (and the way the method is used below) is a bit misleading, the method just seems to return if this is a known platform option, so what about `isPlatformOption` instead?

You're right, I copied the name from the `jpackage` sources but it's not very accurate.

-------------

PR Comment: https://git.openjdk.org/jextract/pull/268#issuecomment-2566373277
PR Review Comment: https://git.openjdk.org/jextract/pull/268#discussion_r1900067855
PR Review Comment: https://git.openjdk.org/jextract/pull/268#discussion_r1900068441


More information about the jextract-dev mailing list