Skip to content

Commit

Permalink
Fix analysis.setContextRoots failed when DAS launched from Android St…
Browse files Browse the repository at this point in the history
…udio (#304)
  • Loading branch information
EricSchlichting authored Jan 29, 2025
1 parent 81fe258 commit 7095532
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 44 deletions.
4 changes: 4 additions & 0 deletions packages/custom_lint/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## Unreleased fix

- Fix Android Studio/InteliJ (thanks to @EricSchlichting)

## 0.7.1 - 2025-01-08

- Support analyzer 7.0.0
Expand Down
3 changes: 1 addition & 2 deletions packages/custom_lint/lib/src/workspace.dart
Original file line number Diff line number Diff line change
Expand Up @@ -744,8 +744,7 @@ publish_to: 'none'

/// Run "pub get" in the client project.
Future<void> runPubGet(Directory tempDir) async {
final command = isUsingFlutter ? 'flutter' : 'dart';

final command = Platform.resolvedExecutable;
final result = await runProcess(
command,
const ['pub', 'get'],
Expand Down
43 changes: 1 addition & 42 deletions packages/custom_lint/test/src/workspace_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -947,51 +947,10 @@ dependency_overrides:
completes,
);

expect(
processes.removeFirst(),
(executable: 'dart', args: const ['pub', 'get'], runInShell: false),
);
expect(processes, isEmpty);
});

test('uses fluter pub get if isUsingFlutter is true',
timeout: const Timeout.factor(2), () async {
final workingDir = await createSimpleWorkspace([
'flutter',
'custom_lint_builder',
Pubspec(
'plugin1',
environment: {'sdk': VersionConstraint.parse('^3.0.0')},
dependencies: {'custom_lint_builder': HostedDependency()},
),
Pubspec(
'a',
environment: {'sdk': VersionConstraint.parse('^3.0.0')},
devDependencies: {
'plugin1': PathDependency('../plugin1'),
'flutter': PathDependency('../flutter'),
},
),
]);

final processes = spyProcess();

final workspace = await fromContextRootsFromPaths(
['a'],
workingDirectory: workingDir,
);

expect(processes, isEmpty);

await expectLater(
workspace.runPubGet(workingDir.dir('a')),
completes,
);

expect(
processes.removeFirst(),
(
executable: 'flutter',
executable: Platform.resolvedExecutable,
args: const ['pub', 'get'],
runInShell: false,
),
Expand Down

0 comments on commit 7095532

Please sign in to comment.