Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JavaVM framework with XCode 12.2 / macOS 11.0 #215

Closed
weisJ opened this issue Dec 7, 2020 · 7 comments
Closed

JavaVM framework with XCode 12.2 / macOS 11.0 #215

weisJ opened this issue Dec 7, 2020 · 7 comments

Comments

@weisJ
Copy link

weisJ commented Dec 7, 2020

From XCode version 12.2 onwards the framwork set of macOS 11.0 is used, which doesn't include the JavaVM framework.
Of course an installation of the Jdk still should include these files, so a new method to discover the JavaVM framework may be needed.

Relevant stackoverflow question

For now the solution is to stay on XCode 12.1. For github actions this can be easily achieved using this action.

@lacasseio
Copy link
Member

Thanks for the information, I will look at it this week.

@lacasseio lacasseio added this to the 0.5 - Source configurations milestone Dec 16, 2020
@lacasseio
Copy link
Member

The situation isn't ideal for this particular framework given Apple sort-of free-styled the framework division. JavaVM framework has been deprecated for a long time now but included the important JavaNativeFoundation framework. Subframework is supposed to be an implementation detail of the framework but JavaVM is particular as people were using its subframeworks. In the newer Xcode, JavaVM is gone but JavaNativeFoundation is not a top-level framework. My guess is it should still work if we declare a dependency on nativeImplementation 'dev.nokee.framework:JavaNativeFoundation:latest.release'. These two frameworks may require some special handling so users can just depend on JavaNativeFoundation and we would discover it regardless if it's a sub-framework or a system framework.

Note that JavaVM can be found at /System/Library/Frameworks/JavaVM.framework but it's only for runtime, it doesn't include any headers, subframework or libraries to link against.

There is some work that needs to happen in the system component discovery so I'm unsure if I will spend some time now to add an exception or later. @weisJ Could you see if using a dependency directly on JavaNativeFoundation works for you? Also, do you need to build on earlier versions of Xcode? The quick fix right now would be to conditionally configure the dependencies based on which version of Xcode is used. Unfortunately, we don't offer a way to query which Xcode version will be used, yet. The best way would be to use the environment already declared.

Screen Shot 2020-12-16 at 1 41 28 PM

@lacasseio
Copy link
Member

This should be the fix for Xcode 12.2 and later: https://github.com/nokeedev/gradle-native/pull/220/files

Tell me if that works for you, I will open a different issue around adding special treatment for JavaNativeFoundation.

@weisJ
Copy link
Author

weisJ commented Dec 16, 2020

This should be the fix for Xcode 12.2 and later: https://github.com/nokeedev/gradle-native/pull/220/files

Tell me if that works for you, I will open a different issue around adding special treatment for JavaNativeFoundation.

This works for me. Thank you very much!

Also, do you need to build on earlier versions of Xcode? The quick fix right now would be to conditionally configure the dependencies based on which version of Xcode is used. Unfortunately, we don't offer a way to query which Xcode version will be used, yet. The best way would be to use the environment already declared.

I myself don't need to build on earlier versions of XCode as the libraries are build using github actions. However if one wishes to build the project locally he might run into problems when using an earlier version of the problem. I don't think that choosing the dependency based on the XCode version would be the best (idiomatic) way to solve the problem.

What I think would be a good idea is to have "soft" dependencies which are allowed to be missing. Then one could declare both dependencies as only ever one of both will be available. If no suitable dependency is available it would be nice to have the option for a silent failure (which would just issue a warning and mark the component unbuildable), which would allow for using pre-build libraries as a fallback without a failure. What do you think about this?

@lacasseio
Copy link
Member

That makes sense, it would be a lenient configuration. Hopefully, I can soon get the ability for adding Gradle configuration from Nokee component directly which will allow you to do exactly that.

@lacasseio
Copy link
Member

We will continue this work with #221. As explained in this issue, the dependencies changed on the Apple/Xcode side. Using the right coordinate will work without issue. Most of the solutions here can be handled via normal Gradle configuration. The pain point is mostly around synching Gradle configuration with Nokee configuration which will be addressed in another milestone: https://github.com/nokeedev/gradle-native/milestone/13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants