Skip to content

Conversation

@progamax
Copy link

Description
This PR fixes a build failure introduced in version 9.2.0 (native assets migration) when the package is fetched from a custom pub repository (e.g., Artifactory).

Issue
When using a custom pub host, the pub cache directory often contains URL-encoded characters (e.g., %47 or %25). The hook/build.dart script was handling file paths inconsistently:

  • Source files (src/): Were retrieved using Directory.listSync(). The file.path property correctly returned the decoded OS file system path.

  • Test files (test/util.c): Were retrieved using uri.resolve(path).path. This returned the encoded URI path (e.g., retaining %2547), causing clang to fail with no such file or directory.

Fix
I updated the resolution of testFiles to use File.fromUri(...).path. This ensures that the path is correctly decoded to the OS file system format, matching the behavior used for the source files.

fixes: #2990


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

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

Note: The Dart team is trialing Gemini Code Assist. Don't take its comments as final Dart team feedback. Use the suggestions if they're helpful; otherwise, wait for a human reviewer.

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 @progamax! 🙏

Could you please add a test to cover this? Either add a test or make it so that an existing test that runs in a temp dir runs in a subdir with characters that get encoded.

@dcharkes dcharkes requested a review from liamappelbe January 21, 2026 09:46
@github-actions
Copy link

PR Health

License Headers ✔️
// Copyright (c) 2026, 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/hooks_runner/test_data/download_assets/hook/build.dart
pkgs/jni/test/debug_release_test.dart
pkgs/objective_c/example/command_line/lib/main.dart
pkgs/objective_c/lib/src/ns_input_stream.dart

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

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 symbol Leaking sources
objective_c _FinalizablePointer internal.dart::_ObjCReference::new::_finalizable

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

Breaking changes ✔️
Package Change Current Version New Version Needed Version Looking good?
objective_c None 9.2.3 9.2.3 9.2.3 ✔️

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

Changelog Entry ✔️
Package Changed Files

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.

@coveralls
Copy link

coveralls commented Jan 21, 2026

Coverage Status

coverage: 81.942%. remained the same
when pulling c3b55c1 on progamax:progamax-patch-1
into 7f45c84 on dart-lang:main.

@progamax
Copy link
Author

progamax commented Jan 21, 2026

@dcharkes
I am not really sure of how to test the hook behavior. Would it be okay if I extract the method that resolves the test file ?
Otherwise, I am open to other suggestions

@dcharkes
Copy link
Collaborator

Ah, the fix is in the hook, not in package:native_toolchain_c. We have https://pub.dev/documentation/code_assets/latest/code_assets/testCodeBuildHook.html for testing hooks, but that one doesn't allow you to create a temp directory with a weird path currently.

If you want, you could try making a PR so that testCodeBuildHook will always select a temp directory with weird encodings. That way everyone using testCodeBuildHook will catch it.

@liamappelbe owns package:objective_c, I'll leave it to him whether he just wants to merge this PR as is or adopt testCodeBuildHook.

Copy link
Contributor

@liamappelbe liamappelbe left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, but there's already one in progress for this. #2996 (which is a re-upload of #2959).

@progamax progamax deleted the progamax-patch-1 branch January 22, 2026 05:00
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.

[objective_c] Failed to build assets since 9.2.0 during tests

4 participants