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

AnalysisException: Cannot compute SOURCE_KIND for Instance of 'AssetBasedSource' #268

Closed
thosakwe opened this issue Jul 29, 2017 · 13 comments

Comments

@thosakwe
Copy link

Hi, experiencing a rather cryptic error, the cause of which I am having a tough time of diagnosing.

Here is my project: https://github.com/thosakwe/lsp4dart
It's got nothing in it except for tool/ boilerplate and two files which will eventually contain serializable classes.

When I run tool/build.dart, I get the following error:

[SEVERE] Build: Failed after 518ms
AnalysisException: Cannot compute SOURCE_KIND for Instance of 'AssetBasedSource'
Caused by Could not resolve "dart:core": SDK incorrectly configured
#0      ParseDartTask.internalPerform (package:analyzer/src/task/dart.dart:4059:7)
#1      AnalysisTask._safelyPerform (package:analyzer/task/model.dart:339:9)
#2      AnalysisTask.perform (package:analyzer/task/model.dart:238:7)
#3      AnalysisDriver.performWorkItem (package:analyzer/src/task/driver.dart:284:10)
#4      AnalysisDriver.computeResult (package:analyzer/src/task/driver.dart:109:22)
#5      AnalysisContextImpl.computeResult (package:analyzer/src/context/context.dart:723:14)
#6      AnalysisContextImpl.computeKindOf (package:analyzer/src/context/context.dart:686:14)
#7      ResolverImpl._performResolve.<anonymous closure>.<anonymous closure> (package:code_transformers/src/resolver_impl.dart:165:29)
#8      MappedListIterable.elementAt (dart:_internal/iterable.dart:413)
#9      ListIterable.toList (dart:_internal/iterable.dart:218)
#10     ResolverImpl._performResolve.<anonymous closure> (package:code_transformers/src/resolver_impl.dart:168:10)
#11     StackZoneSpecification._registerUnaryCallback.<anonymous closure>.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:109:26)
#12     StackZoneSpecification._run (package:stack_trace/src/stack_zone_specification.dart:187:15)
#13     StackZoneSpecification._registerUnaryCallback.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:109:14)
#14     _rootRunUnary (dart:async/zone.dart:1128)
#15     _CustomZone.runUnary (dart:async/zone.dart:1012)
#16     _FutureListener.handleValue (dart:async/future_impl.dart:129)
#17     _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:636)
#18     _Future._propagateToListeners (dart:async/future_impl.dart:665)
#19     _Future._completeWithValue (dart:async/future_impl.dart:478)
#20     _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:510)
#21     StackZoneSpecification._run (package:stack_trace/src/stack_zone_specification.dart:187:15)
#22     StackZoneSpecification._registerCallback.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:99:48)
#23     _rootRun (dart:async/zone.dart:1120)
#24     _CustomZone.run (dart:async/zone.dart:1001)
#25     _CustomZone.runGuarded (dart:async/zone.dart:901)
#26     _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:926)
#27     _microtaskLoop (dart:async/schedule_microtask.dart:41)
#28     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50)
#29     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:99)
#30     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:152)


package:analyzer/src/context/context.dart 728:7           AnalysisContextImpl.computeResult
package:analyzer/src/context/context.dart 686:14          AnalysisContextImpl.computeKindOf
package:code_transformers/src/resolver_impl.dart 165:29   ResolverImpl._performResolve.<fn>.<fn>
dart:_internal                                            ListIterable.toList
package:code_transformers/src/resolver_impl.dart 168:10   ResolverImpl._performResolve.<fn>
dart:async                                                _Future.then
package:code_transformers/src/resolver_impl.dart 154:28   ResolverImpl._performResolve
package:code_transformers/src/resolver_impl.dart 90:14    ResolverImpl.resolve.<fn>
dart:async                                                _Future.whenComplete
package:code_transformers/src/resolver_impl.dart 88:37    ResolverImpl.resolve
package:code_transformers/src/resolvers.dart 63:17        Resolvers.get
package:build_barback/src/analyzer/resolver.dart 47:44    BarbackResolvers.get
dart:async                                                new Future.microtask
package:build_barback/src/analyzer/resolver.dart 46:61    BarbackResolvers.get
package:build/src/builder/build_step_impl.dart 56:61      BuildStepImpl.resolver
package:source_gen/src/builder.dart 32:36                 GeneratorBuilder.build
dart:async                                                new Future.microtask
package:source_gen/src/builder.dart 31:43                 GeneratorBuilder.build
package:build/src/generate/run_builder.dart 33:21         runBuilder.buildForInput
dart:async                                                new Future.microtask
package:build/src/generate/run_builder.dart 28:51         runBuilder.buildForInput
dart:async                                                Future.wait
package:build/src/generate/run_builder.dart 39:31         runBuilder.<fn>
dart:async                                                runZoned
package:build/src/builder/logging.dart 13:5               scopeLog
package:build/src/generate/run_builder.dart 39:9          runBuilder
dart:async                                                new Future.microtask
package:build/src/generate/run_builder.dart 24:48         runBuilder
package:build_runner/src/generate/build_impl.dart 552:13  BuildImpl._runBuilder
dart:async                                                _StreamIterator.moveNext
package:build_runner/src/generate/build_impl.dart 442:16  BuildImpl._runPhases.<fn>
dart:async                                                new Future.microtask
package:build_runner/src/generate/build_impl.dart 439:50  BuildImpl._runPhases.<fn>
dart:async                                                Future.wait
package:build_runner/src/generate/build_impl.dart 439:20  BuildImpl._runPhases
dart:async                                                new Future.microtask
package:build_runner/src/generate/build_impl.dart 430:42  BuildImpl._runPhases
package:build_runner/src/logging/logging.dart 19:28       logWithTime
dart:async                                                new Future.microtask
package:build_runner/src/logging/logging.dart 16:70       logWithTime
package:build_runner/src/generate/build_impl.dart 146:26  BuildImpl.runBuild.<fn>
dart:async                                                _asyncThenWrapperHelper
package:build_runner/src/generate/build_impl.dart 78:28   BuildImpl.runBuild.<fn>
package:stack_trace                                       Chain.capture
package:build_runner/src/generate/build_impl.dart 78:11   BuildImpl.runBuild

I've run into this error with both of the following generators, in separate projects:

  • owl_codegen
  • angel_serialize_generator

So I am assuming there is some underlying issue that I am missing somewhere. I get this error both with source_gen@0.5.5 and source_gen@0.6.0. Haven't tried any versions in between.

Thanks in advance for your help.

@natebosch
Copy link
Member

What version of the SDK are you on?

Also, can you check with pub deps the versions you have for the following packages: build, build_barback, analyzer and code_transformers.
We changed the way we find the SDK here - I wonder if that broke something? Or if you're on an old version maybe the old way broke?
dart-archive/code_transformers@4eca2de

If you can upgrade to source_gen 0.7.0 we'd have the best chance at getting this resolved.

On a side note - is there anything that would be useful to split out from https://github.com/natebosch/dart_language_server ? I've got a subset of the LSP spec working, could split out the messages and wire protocol stuff if there is utility in having it without the Analysis Server integration bits... Or if you want to take a stab at natebosch/dart_lsp#14 it could be useful to share.

@thosakwe
Copy link
Author

  • build@0.9.3
  • analyzer@0.29.11
  • code_transformers@0.5.1+3
  • build_barback@0.3.0

Dart SDK v1.24.2, running on Windows 10.

Unfortunately, I can't yet upgrade to v0.7.0 because it's got some breaking changes, and the owl package is not mine.

Also, it would be fantastic if we could split out the messages+wire protocol, and then I could add the rest to be fully compliant with the spec. It would be even better if I could generate something to do this automatically (stay tuned!)

@natebosch
Copy link
Member

Hmm, I can't repro with those package versions so it might be another package I didn't think to check, or something going on with the Windows SDK.

Could you share your full pubspec.lock? You can either push a branch with it checked in or upload it somewhere else I can grab.

@thosakwe
Copy link
Author

One thing that may have caused this is that I was previously using the third-party Windows installer, but upgraded to 1.24.2 using Chocolately. I'm not sure why, but I feel like that might be a factor here.

@natebosch
Copy link
Member

that could be a factor... If you add a local override for code_transformers you could edit the file lib/src/dart_sdk.dart and print the directory it finds in the getter dartSdkDirectory. I'm wondering if somehow installing the new way made it unable to find the SDK anymore, or to find the wrong place or something along those lines.

We'd hope that the SDK directory found there lines up with the dart executable you are running.

@matanlurey
Copy link
Contributor

I don't see any actionable item here, so I'm closing. Please re-open if you can reproduce.

@fmatuszewski
Copy link

I am experiencing the same issue using beta version trying to build https://github.com/brianegan/flutter_architecture_samples/tree/master/example/built_redux

@fmatuszewski
Copy link

dart tools/build.dart

@natebosch
Copy link
Member

The build.dart script in the built_redux example is using an old version of build_runner that might not work on the latest sdks.

@matanlurey
Copy link
Contributor

@fmatuszewski You'll want to contact the authors of that repository and ask them to upgrade.

@fmatuszewski
Copy link

Thanks a lot. actually I use centos 7 and previously I have build dartsdk from sources from develpment branch. I solved this issue by downloading compiled sources from here https://www.dartlang.org/install/archive

@fmatuszewski
Copy link

this version worked for me 2.0.0-dev.35.0 (ref 654f509)

@matanlurey
Copy link
Contributor

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants