Closed liamappelbe closed 1 month ago
The coverage is a bit misleading. Overall the coverage has gone up to 92.37%, but the package:objective_c data isn't included in this report. I spent some time trying to debug it, but I think it's just because objective_c_tests
is new. I think the problem will resolve itself after this PR is submitted.
FYI @HosseinYousefi for changes to jni infra. Apparently we were missing some carryforwards.
FYI @HosseinYousefi for changes to jni infra. Apparently we were missing some carryforwards.
Before, we had the carryforward
s for each file to be all the flag-name
s for every other file. This works, but it's a bit fiddly to maintain. Setting all the carryforward
s to include all the flag-name
s means they can all be identical, which will be easier to maintain. From the carryforward
documentation, the behavior should be the same either way.
Moves classes like
NSObject
andNSString
to package:objective_c.You can find a full list of the classes exposed by package:objective_c in
pkgs/objective_c/ffigen_objc.yaml
, underinclude:
. This list was generated by pulling in a few core classes, and then seeing what transitive deps they pull in. The list is complete in the sense that it includes every ObjC wrapper class inlib/src/objective_c_bindings_generated.dart
. The reason it needs to be complete is that if we choose not to expose one of them, sayNSCharacterSet
, it will instead end up in the user's generated code, but that version ofNSCharacterSet
won't be compatible with the one used by ourNSString
. This list is replicated in a few different places so one of the tests verifies that they're all in sync.At the moment, the only class that has convenience utils is
NSString
. I wanted to put all those utils inlib/src/ns_string.dart
, but some of them need to be built into the class itself. So the rest are intool/extra_methods.dart
, and are inserted into the generatedNSString
class bytool/generate_code.dart
. This tool also runs the two separate ffigen configs. There's one config for the C bindings of the ObjC runtime functions, and another for the ObjC bindings for all the core classes, because ffigen only handles one language at a time.Ffigen changes:
generate-for-package-objective-c
, which controls whether those core classes are code genned normally, or imported from package:objective_c. Also controls whether package:objective_c is imported using a relative path.NSObject
etc now live in a different package.-[no]-format
option to the ffigen command line tool, so I can defer formatting until the end oftool/generate_code.dart
.Fixes https://github.com/dart-lang/native/issues/430