Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions pkgs/native_toolchain_c/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.17.4

- Fixed resolution of C compiler and tools on macOS when `swiftly` is installed.
- Broaden compiler tool discovery on macOS.

## 0.17.3

- Bump `package:hooks` and `package:code_assets`to 1.0.0.
Expand Down
15 changes: 15 additions & 0 deletions pkgs/native_toolchain_c/lib/src/native_toolchain/apple_clang.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// 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.

import 'package:code_assets/code_assets.dart';

import '../tool/tool.dart';
import '../tool/tool_resolver.dart';

Expand Down Expand Up @@ -31,6 +33,10 @@ final Tool appleAr = Tool(
wrappedResolver: appleClang.defaultResolver!,
relativePath: Uri.file('ar'),
),
PathToolResolver(
toolName: 'Apple archiver',
executableName: OS.current.executableFileName('ar'),
),
]),
);

Expand All @@ -43,6 +49,15 @@ final Tool appleLd = Tool(
wrappedResolver: appleClang.defaultResolver!,
relativePath: Uri.file('ld'),
),
PathToolResolver(
toolName: 'Apple linker',
executableName: OS.current.executableFileName('ld'),
),
RelativeToolResolver(
toolName: 'Apple linker',
wrappedResolver: appleClang.defaultResolver!,
relativePath: Uri.file(OS.current.executableFileName('ld.lld')),
),
]),
);

Expand Down
4 changes: 3 additions & 1 deletion pkgs/native_toolchain_c/lib/src/tool/tool_resolver.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,10 @@ class PathToolResolver extends ToolResolver {
if (process.exitCode == 0) {
final file = File(LineSplitter.split(process.stdout).first);
final uri = File(await file.resolveSymbolicLinks()).uri;
if (uri.pathSegments.last == 'llvm') {
if (uri.pathSegments.last == 'llvm' ||
uri.pathSegments.last == 'swiftly') {
// https://github.com/dart-lang/native/issues/136
// https://github.com/dart-lang/native/issues/2792
return file.uri;
}
return uri;
Expand Down
2 changes: 1 addition & 1 deletion pkgs/native_toolchain_c/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: native_toolchain_c
description: >-
A library to invoke the native C compiler installed on the host machine.
version: 0.17.3
version: 0.17.4
repository: https://github.com/dart-lang/native/tree/main/pkgs/native_toolchain_c

topics:
Expand Down
Loading