18 Dec 2019
|
fix
binding
bro-gen
postfix
This post continues the series of fixes discovered during compilation of CocoaTouch library and improvements to compiler.
PostFix #6: Fixes to Network framework bindings
As metntioned in gitter channel a try to use NWPathMonitor
fails with ObjCClassNotFoundException: OS_nw_path_monitor
. The binding of Network framework differs from common approach in way it is completely functional interface. Most of API might be simply grouped into two groups:
- creators: CLASS INST = function_Create()
- usage: function_Usage(CLASS INST, other params)
RoboVM bro compiler allow to use such functions as class memebers, e.g.:
function_Usage(CLASS INST, other params)
to
class CLASS {
@Bridge
function_Usage( other params)
}
Same time bro-gen extracts types defined in framework as protocols (like NWPathMonitor
is defined as OS_nw_path_monitor
) and closes binding for it is a NativeProtocolProxy
. Which shall work in general case but not this.
19 Nov 2019
|
whatsnew
What’s new
- [fixed] #408 Cannot compile AUMIDIEvent;
- [fixed] #414 Deployment to ios13 device, updated libimobiledevice lib’s bindings;
- [fixed] swiched to
simctl
to support Xcode11 simulator PR#410;
- [improvement] kotlin improvements: debugger and compilation PR#349
- [fixed] #387 CGBitmapContext.create fails on real device for big sizes;
- [added] support for packed structures PR#378;
- [fixed] Broken enum marshallers cleanup PR#377;
- [fixed] Debugger crashed when native thread exited while paused on breakpoint PR#384;
What’s in progress
Meanwhile work in progress happening in support for JDK12 tools on host branch, it contains following changes:
- all builds scripts reworked to allow building RoboVM using JDK9+ (works with JDK13) PR#400;
- ios13 bindings PR#406;
- Idea plugin workaround for long-going
android gradle
faset #242, PR#401;
- On-going series of Cocoa13-postfixes
Happy coding!
Please report any issue to tracker.
17 Nov 2019
|
fix
compiler
postfix
This post continues the series of fixes discovered during compilation of CocoaTouch library and improvements to compiler.
PostFix #5: Struct.offsetOf
always returns zero
Other postfixes:
Struct.offsetOf
is required to proper implement initialization of variable size structs with flexible array member such as:
struct vectord {
size_t len;
double arr[]; // the flexible array member must be last
};
Root case and fix
Struct
has offsetOf
definition and it returns always zero similar to sizeOf
method. `` its implemenation is being synthesized by RoboVM compiler and invocation of sizeOf
being fixed during trampoline phase from Struct.sizeOf
to DestStruct.sizeOf
(DestStruct – an example struct implementation).
Root case – compiler doesn’t not synthesize offsetOf
.
15 Nov 2019
|
bro-gen
binding
robopods
altpods
AltPods were update to v1.4.0-SNAPSHOTS to sync with recent releases. Part of list didn’t receive any API update hovewer bindings were re-generated against recent version of frameworks. Update list look as bellow:
Updated pod
Unchanged pod
These pods were pushed to https://oss.sonatype.org/content/repositories/snapshots
maven repo under 1.4.0-SNAPSHOTS
version.
Source code @github
Updates are not fullty tested, please open issue if bug found.
NB: AltPods – are robopods kept at my personal standalone repo. This is done to prevent main robopods repo from turning into code graveyard. As these pods have low interest of community and low chances to be updated.
22 Oct 2019
|
fix
compiler
postfix
This post continues the series of fixes discovered during compilation of CocoaTouch library.
PostFix #4: @Bridge annotated covatiant return bridget methods
Other postfixes:
Issue was discovered while compiling NWTxtRecord
:
java.lang.IllegalArgumentException: @Bridge annotated method <org.robovm.apple.network.NWTxtRecord: org.robovm.apple.foundation.NSObject copy()> must be native
at org.robovm.compiler.BridgeMethodCompiler.validateBridgeMethod(BridgeMethodCompiler.java:87)
at org.robovm.compiler.BridgeMethodCompiler.doCompile(BridgeMethodCompiler.java:233)
Root case and fix
In source code NWTxtRecord
doesn’t contain NSObject copy()
method but containts NWTxtRecord copy()
.
Hovewer once class file is decompiled following methods can be found there:
21 Oct 2019
|
fix
compiler
postfix
This post continues the series of fixes discovered during compilation of CocoaTouch library.
PostFix #3: Adding support @Block members in structs
Other postfixes:
Issue was discovered while compiling CMBufferHandlers
:
java.lang.IllegalArgumentException: No @Marshaler found for return type of @StructMember method <org.robovm.apple.coremedia.CMBufferHandlers: org.robovm.objc.block.Block1 getGetDecodeTimeStamp()>
at org.robovm.compiler.MarshalerLookup.findMarshalerMethod(MarshalerLookup.java:169)
at org.robovm.compiler.BroMethodCompiler.getStructMemberType(BroMethodCompiler.java:977)
at org.robovm.compiler.BroMethodCompiler.getStructType(BroMethodCompiler.java:677)
at org.robovm.compiler.BroMethodCompiler.getStructType(BroMethodCompiler.java:568)
at org.robovm.compiler.StructMemberMethodCompiler.reset(StructMemberMethodCompiler.java:63)
Root case and fix
Root case and fix is clear from exception: there is no @Marshaller
for @Block
return type at moment StructMemberMethodCompiler
performs reset. And the fix is to provide such.
In details there are several moments and fixes:
- Marshallers for
@Block
affected methods are generated by ObjCBlockPlugin
in ObjCBlockPlugin.Before
class run. The problem here is that ClassCompiler
invokes it after StructMemberMethodCompiler.reset
where this marshaller is required (and where exception is happening). The fix is to move reset section of method compilers below invocation of plugins Before
. This makes marshallers generated at moment StructMemberMethodCompiler.reset
needs it.
- Second moment is that
ObjCBlockPlugin.Before
was not considering @StructMember annotated methods as subject for method transformation and the fix is trivial – extending condition to include the case.
The fix is delivered as PR421
20 Oct 2019
|
fix
compiler
postfix
bro-gen
This post continues series of fixes discovered during compilation of CocoaTouch library.
PostFix #2: Adding support for non-static @Bridge method in enums classes
Other postfixes:
Issue was discovered during compiling of UIImageSymbolWeight
class:
java.lang.IllegalArgumentException: Receiver of non static @Bridge method <org.robovm.apple.uikit.UIImageSymbolWeight: double toFontWeight()> must either be a Struct or a NativeObject
at org.robovm.compiler.BroMethodCompiler.getBridgeOrCallbackFunctionType(BroMethodCompiler.java:554)
at org.robovm.compiler.BroMethodCompiler.getBridgeFunctionType(BroMethodCompiler.java:526)
What is wrong
19 Oct 2019
|
fix
compiler
postfix
iOS13 bindings are complete but CocoaTouch related issues keep arriving, part of them about compiler not able to compile one or other class.
Most of these issues can be detected just by compiling entire CocoaTouch library as simple smock test to find out outstanding issues. This can be done by force linking its class path with template like this:
<forceLinkClasses>
<pattern>org.robovm.apple.**</pattern>
</forceLinkClasses>
This post start series of fixes discovered during compilation of CocoaTouch library.
PostFix #1: Generic class arguments and @Block parameters
Other postfixes:
10 Oct 2019
|
fix
ios13
libmobiledevice
History: errors when deploying to ios13 #414
Fix: PR416
Root case
libmobiledevice when locking services has to perform SSL handshake if required.
in iOS13 debugerserver started requiring this as well by including EnableServiceSSL
in response:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>EnableServiceSSL</key>
<true/>
<key>Port</key>
<integer>49745</integer>
<key>Request</key>
<string>StartService</string>
<key>Service</key>
<string>com.apple.debugserver</string>
</dict>
The weird thing is that after SSL handshake debug server service switches back to plain text communication over same underlayer socket. There was a try-fix in libmobiledevice to close SSL connection but it didn’t work.
Root case of it is that it was trying close SSL connection by calling SSL_shutdown
which sends close_notify shutdown to underlaying socket. But debugserver expects clear text GDP protocol communication and close_notify
aren’t expected which causes gdp protocol error.
This issue was also discussed on libimobiledevice
repo: issue789
The fix
18 Sep 2019
|
bro-gen
ios13
binding
iOS 13
bindings have arrived as PR406.
iOS13 introduces bunch of new frameworks:
- ImageCaptureCore
- VisionKit
- SoundAnalysis
- QuickLookThumbnailing
- PencilKit
- MetricKit
- CryptoTokenKit
- CoreHaptics
- BackgroundTasks
- LinkPresentaion
Beside new ones also missing in previous binding cycle frameworks were added:
- (new from ios 10) Speech
- (new from ios 9.3) HealthKitUI
- (new from ios 11) DeviceCheck
- (new from ios 10) CallKit
- (new from ios 11.3) BusinessChat
Beside new framework there was massive API from iOS13. Also this PR delivers lot of fixes to existing bindings as well as generic classes received template parameters (with enhanced version of bro-gen).
Known issues
- ios13 changed few previously existing classes were common api were moved to new super class introduced in ios13. As result running on pre-ios12 will cause crash due native class not found. This to be fixed in RoboVM obj-c runtime itself;
- several existing API naming were changed (to improve namings). this might break existing code;