Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix analysis.setContextRoots failed when DAS launched from Android Studio #304

Merged
merged 6 commits into from
Jan 29, 2025
Merged
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
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;
EricSchlichting marked this conversation as resolved.
Show resolved Hide resolved
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