Skip to content

WIP: [objective_c] Migrate to native assets #2329

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

Draft
wants to merge 21 commits into
base: main
Choose a base branch
from
Draft

Conversation

liamappelbe
Copy link
Contributor

@liamappelbe liamappelbe commented May 26, 2025

Notes

  • I'm using on @Native annotations to load all the ffi symbols. Previously this worked because I loaded the dylib into the executable first, then relied on the @Native fallback behavior to load the symbols from the exe. Now I'm explicitly setting the asset name to the built dylib. But all the core ObjC runtime symbols (eg objc_msgSend) are linked into the exe, not the dylib. So I had to split the C bindings. There are now 3 sets of ffigen created bindings: the objective C bindings, the bindings for my C code, and the bindings for the built in C code.
  • ffigen has a dev dep on package:objective_c for testing. All the ObjC tests are disabled on linux and windows, but afaik there's no way of avoiding pulling in the dependency on those platforms. So I had to modify package:objective_c's build script to no-op on those platforms. Seems like a sub-optimal solution.

Copy link

github-actions bot commented May 26, 2025

PR Health

Changelog Entry
Package Changed Files
package:objective_c pkgs/objective_c/example/README.md
pkgs/objective_c/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md
pkgs/objective_c/example/pubspec.yaml
pkgs/objective_c/lib/objective_c.dart
pkgs/objective_c/lib/src/c_bindings_generated.dart
pkgs/objective_c/lib/src/internal.dart
pkgs/objective_c/lib/src/objective_c_bindings_generated.dart
pkgs/objective_c/lib/src/objective_c_native_base.dart
pkgs/objective_c/lib/src/protocol_builder.dart
pkgs/objective_c/lib/src/runtime_bindings_generated.dart
pkgs/objective_c/lib/src/selector.dart
pkgs/objective_c/pubspec.yaml

Changes to files need to be accounted for in their respective changelogs.

This check can be disabled by tagging the PR with skip-changelog-check.

License Headers ⚠️
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
Files
pkgs/objective_c/example/lib/main.dart
pkgs/objective_c/lib/src/objective_c_native_base.dart

All source files should start with a license header.

Unrelated files missing license headers
Files
pkgs/jni/lib/src/third_party/generated_bindings.dart
pkgs/native_doc_dartifier/example/native_doc_dartifier_example.dart
pkgs/native_doc_dartifier/lib/native_doc_dartifier.dart
pkgs/native_doc_dartifier/lib/src/native_doc_dartifier_base.dart
pkgs/objective_c/lib/src/ns_input_stream.dart

This check can be disabled by tagging the PR with skip-license-check.

@github-actions github-actions bot added the type-infra A repository infrastructure change or enhancement label Jun 13, 2025
@coveralls
Copy link

coveralls commented Jun 18, 2025

Coverage Status

coverage: 88.284% (-3.5%) from 91.739%
when pulling 42ca198 on objc_native
into b0e8676 on main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:ffigen package:objective_c type-infra A repository infrastructure change or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants