Skip to content

Commit 7095532

Browse files
Fix analysis.setContextRoots failed when DAS launched from Android Studio (#304)
1 parent 81fe258 commit 7095532

File tree

3 files changed

+6
-44
lines changed

3 files changed

+6
-44
lines changed

packages/custom_lint/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## Unreleased fix
2+
3+
- Fix Android Studio/InteliJ (thanks to @EricSchlichting)
4+
15
## 0.7.1 - 2025-01-08
26

37
- Support analyzer 7.0.0

packages/custom_lint/lib/src/workspace.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -744,8 +744,7 @@ publish_to: 'none'
744744

745745
/// Run "pub get" in the client project.
746746
Future<void> runPubGet(Directory tempDir) async {
747-
final command = isUsingFlutter ? 'flutter' : 'dart';
748-
747+
final command = Platform.resolvedExecutable;
749748
final result = await runProcess(
750749
command,
751750
const ['pub', 'get'],

packages/custom_lint/test/src/workspace_test.dart

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -947,51 +947,10 @@ dependency_overrides:
947947
completes,
948948
);
949949

950-
expect(
951-
processes.removeFirst(),
952-
(executable: 'dart', args: const ['pub', 'get'], runInShell: false),
953-
);
954-
expect(processes, isEmpty);
955-
});
956-
957-
test('uses fluter pub get if isUsingFlutter is true',
958-
timeout: const Timeout.factor(2), () async {
959-
final workingDir = await createSimpleWorkspace([
960-
'flutter',
961-
'custom_lint_builder',
962-
Pubspec(
963-
'plugin1',
964-
environment: {'sdk': VersionConstraint.parse('^3.0.0')},
965-
dependencies: {'custom_lint_builder': HostedDependency()},
966-
),
967-
Pubspec(
968-
'a',
969-
environment: {'sdk': VersionConstraint.parse('^3.0.0')},
970-
devDependencies: {
971-
'plugin1': PathDependency('../plugin1'),
972-
'flutter': PathDependency('../flutter'),
973-
},
974-
),
975-
]);
976-
977-
final processes = spyProcess();
978-
979-
final workspace = await fromContextRootsFromPaths(
980-
['a'],
981-
workingDirectory: workingDir,
982-
);
983-
984-
expect(processes, isEmpty);
985-
986-
await expectLater(
987-
workspace.runPubGet(workingDir.dir('a')),
988-
completes,
989-
);
990-
991950
expect(
992951
processes.removeFirst(),
993952
(
994-
executable: 'flutter',
953+
executable: Platform.resolvedExecutable,
995954
args: const ['pub', 'get'],
996955
runInShell: false,
997956
),

0 commit comments

Comments
 (0)