RFR: 7903731: Jextract should support macOS frameworks [v12]

Jorn Vernee jvernee at openjdk.org
Mon Mar 10 10:49:07 UTC 2025


On Fri, 7 Mar 2025 19:43:45 GMT, Nizar Benalla <nbenalla 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`
>
> Nizar Benalla has updated the pull request incrementally with one additional commit since the last revision:
> 
>   review feedback: improve error message

It would be nice if some tests could be added for this, but I expect it's tricky since we don't know if there's any frameworks or SDKs installed on the target system.

src/main/java/org/openjdk/jextract/JextractTool.java line 371:

> 369:         parser.accepts("--version", "help.version", false);
> 370:         parser.accepts("-F", "help.mac.framework", true);
> 371:         parser.accepts("-framework", "help.framework.library.path", true);

e.g. something simple like:
Suggestion:

        if (isMacOSX) {
            parser.accepts("-F", "help.mac.framework", true);
            parser.accepts("-framework", "help.framework.library.path", true);
        }

src/main/java/org/openjdk/jextract/JextractTool.java line 456:

> 454:             paths.forEach(p -> builder.addClangArg("-F" + p));
> 455:             frameworkPaths.addAll(0, paths);
> 456:         }

My only concern left is what now happens on non-mac platforms when `-F` or `-framework` is used. I suppose clang might error out on the flag in the case of `-F`, not sure what happens for `-framework`.

I think these options should perhaps be disabled on platforms besides mac, since they are only intended to be used there.

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

PR Review: https://git.openjdk.org/jextract/pull/268#pullrequestreview-2670506439
PR Review Comment: https://git.openjdk.org/jextract/pull/268#discussion_r1987037128
PR Review Comment: https://git.openjdk.org/jextract/pull/268#discussion_r1987035427


More information about the jextract-dev mailing list