Skip to content

[native_toolchain_c] Add linking for iOS #2363

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

Merged
merged 2 commits into from
Jun 17, 2025

Conversation

goderbauer
Copy link
Contributor

@goderbauer goderbauer commented Jun 16, 2025

Towards #1376

We were basically able re reuse all the macOS work from #2360 for iOS and just had to add iOS-specific Tests.

This PR also fixes an issue with the treeshaking tests, which were accidentally overwriting size results from other test cases. An expect has been added to guard against this issue in the future.

Hint for reviewers: treeshake_helper.dart is easier to review with github's Hide whitespace option turned on.


  • I’ve reviewed the contributor guide and applied the relevant portions to this PR.
Contribution guidelines:

Note that many Dart repos have a weekly cadence for reviewing PRs - please allow for some latency before initial review feedback.

Copy link

Package publishing

Package Version Status Publish tag (post-merge)
package:code_assets 0.19.4 already published at pub.dev
package:data_assets 0.19.1 already published at pub.dev
package:ffi 2.1.4 already published at pub.dev
package:ffigen 19.1.0-wip WIP (no publish necessary)
package:hooks 0.19.5 already published at pub.dev
package:hooks_runner 0.21.0 already published at pub.dev
package:jni 0.14.2 already published at pub.dev
package:jnigen 0.15.0-wip WIP (no publish necessary)
package:native_doc_dartifier 0.0.1-pre already published at pub.dev
package:native_toolchain_c 0.16.5 ready to publish native_toolchain_c-v0.16.5
package:objective_c 8.1.0-wip WIP (no publish necessary)
package:swift2objc 0.0.1-wip WIP (no publish necessary)
package:swiftgen 0.0.1-wip WIP (no publish necessary)

Documentation at https://github.com/dart-lang/ecosystem/wiki/Publishing-automation.

Copy link

github-actions bot commented Jun 16, 2025

PR Health

Changelog Entry ✔️
Package Changed Files

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

API leaks ✔️

The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.

Package Leaked API symbols
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
no missing headers

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

@goderbauer
Copy link
Contributor Author

Skipping the breaking-check because of #2361. Local run is clean:

No changes detected!
Version Check
New version is OK!

Old version: "0.16.4"
New version: "0.16.5"
Needed version: "0.16.4"

Got "0.16.5" which is >= "0.16.4" (no changes)

@coveralls
Copy link

Coverage Status

coverage: 88.027%. remained the same
when pulling 3abe9e3 on goderbauer:ios-linker
into 92e243f on dart-lang:main.

Copy link
Collaborator

@dcharkes dcharkes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @goderbauer 🙏

@@ -16,7 +16,7 @@ void main() {
flutterAndroidNdkVersionLowestSupported,
flutterAndroidNdkVersionHighestSupported,
]) {
group('Android API$apiLevel', () {
group('Android API$apiLevel:', () {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intentional change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, to make it match the other tests.

targetArchitecture: targetArchitecture,
linkModePreference: LinkModePreference.dynamic,
cCompiler: cCompiler,
android: androidTargetNdkApi != null
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be targetOs == OS.android instead, with a ! on androidTargetNdkApi? Ditto for the other OSes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we check at the top of the method that androidTargetNdkApi must be set iff targetOS is Android it shouldn't matter logically. I find the current way without the extra null check easier to read, which is why I opted for that one.

@goderbauer goderbauer merged commit ea44685 into dart-lang:main Jun 17, 2025
20 checks passed
@goderbauer goderbauer deleted the ios-linker branch June 17, 2025 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants