Skip to content

Commit

Permalink
Fix minor bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
jyotirmoy-paul committed Apr 17, 2023
1 parent f9da8bc commit 0ab5a3b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions lib/cached_build_runner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ class CachedBuildRunner {
);

dependencies.addAll(importDependency);
testFiles.add(dependencies);
}
}

Expand Down
8 changes: 5 additions & 3 deletions lib/core/dependency_visitor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class DependencyVisitor {
final withRegex = RegExp(r"with\s+([\w\s,]+)");

/// Regex for parsing import statements
final importRegex = RegExp(r'''import\s+(?!'package:)(?:'|")(.*?)('|");?''');
final relativeImportRegex = RegExp(r'''import\s+(?!(\w+:))(?:'|")(.*?)('|");?''');
final packageImportRegex = RegExp(
'import\\s+\'package:${Utils.appPackageName}(.*)\';',
);
Expand Down Expand Up @@ -76,13 +76,15 @@ class DependencyVisitor {
final lines = dartSource.split('\n');

for (final line in lines) {
final relativeMatch = importRegex.firstMatch(line);
final relativeMatch = relativeImportRegex.firstMatch(line);
final packageMatch = packageImportRegex.firstMatch(line);

if (relativeMatch != null) {
final importedPath = relativeMatch.group(1);
if (importedPath != null) relativeImports.add(importedPath);
} else if (packageMatch != null) {
}

if (packageMatch != null) {
final importedPath = packageMatch.group(1);
if (importedPath != null) absoluteImports.add(importedPath);
}
Expand Down

0 comments on commit 0ab5a3b

Please sign in to comment.