Skip to content

Commit 5431615

Browse files
committed
fix: improve colon handling in dependency discovery for windows
1 parent 9e29ed9 commit 5431615

File tree

2 files changed

+1
-25
lines changed

2 files changed

+1
-25
lines changed

native_toolchain_rust/lib/src/dependency_discoverer.dart

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,7 @@ interface class DependencyDiscoverer {
1616
logger.fine('Discovering dependencies in $dependencyFilePath');
1717
return File(dependencyFilePath)
1818
.readAsLinesSync()
19-
.map((line) {
20-
final splitIndex = line.indexOf(':');
21-
if (splitIndex < 0) return null;
22-
return line.substring(splitIndex + 1).trim();
23-
})
24-
.nonNulls
25-
.expand((files) => files.split(' '))
19+
.expand((line) => line.trim().split(' ').skip(1))
2620
.followedBy([dependencyFilePath])
2721
.map(path.toUri);
2822
}

native_toolchain_rust/test/dependency_discoverer_test.dart

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -56,24 +56,6 @@ target/debug/librust_lib.a: /path/to/some/other/file.rs
5656
);
5757
});
5858

59-
test('discover ignores lines without a colon', () {
60-
final dependencyFilePath = path.join(tempDir.path, 'test.d');
61-
File(dependencyFilePath).writeAsStringSync('''
62-
invalid line
63-
target/debug/librust_lib.a: src/lib.rs
64-
''');
65-
66-
final dependencies = dependencyDiscoverer.discover(dependencyFilePath);
67-
68-
expect(
69-
dependencies,
70-
containsAll([
71-
path.toUri('src/lib.rs'),
72-
path.toUri(dependencyFilePath),
73-
]),
74-
);
75-
expect(dependencies.length, 2);
76-
});
7759

7860
test('discover handles an empty dependency file', () {
7961
final dependencyFilePath = path.join(tempDir.path, 'test.d');

0 commit comments

Comments
 (0)