dart-lang / tools

This repository is home to tooling related Dart packages.
BSD 3-Clause "New" or "Revised" License
30 stars 21 forks source link

getSdkPath does not return correct path when run via flutter_tester #819

Open shyndman opened 4 years ago

shyndman commented 4 years ago

Hi there,

My Flutter application uses the analyzer package, and I'm finding that after a upgrade, our tests are now failing.

It looks like getSdkPath wasn't designed to accommodate a Platform.resolvedExecutable of flutter_tester (which lives under bin/cache/artifacts/engine/{platform}/flutter_tester

I'm running analyzer 0.39.17, and cli_util 0.2.0.

Here's the exception:

FileSystemException(path=/Users/shyndman/work-code/flutter/bin/cache/artifacts/engine/version; message=Cannot open file)
  package:analyzer/file_system/physical_file_system.dart 194:7               _PhysicalFile.readAsStringSync
  package:analyzer/src/dart/sdk/sdk.dart 428:12                              FolderBasedDartSdk.languageVersion
  package:analyzer/src/context/builder.dart 257:40                           ContextBuilder.findSdk
  package:analyzer/src/context/builder.dart 200:19                           ContextBuilder.createSourceFactory
  package:analyzer/src/context/builder.dart 114:16                           ContextBuilder.buildDriver
  package:analyzer/src/dart/analysis/context_builder.dart 92:37              ContextBuilderImpl.createContext
  package:analyzer/src/dart/analysis/analysis_context_collection.dart 54:36  new AnalysisContextCollectionImpl

Any suggestions?

shyndman commented 4 years ago

I have upgraded to the latest analyzer (0.40.4), and this is still the case. I am using a dependency override pointing to a fork (referenced above) to sidestep the issue for now.