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

clean up macro examples and README.md, remove run.dart script #3582

Merged
merged 5 commits into from
Jan 23, 2024

Conversation

jakemac53
Copy link
Contributor

  • Delete run.dart script and update the README.md to indicate you can just pass --enable-experiment=macros.
  • Break up user_main.dart into separate scripts for each macro example, which allows you to run the ones that do work, and also keeps the example apps more targetted. These were only combined into one previously to make it easier to run them through run.dart.
  • Update the observable example so it is runnable.
  • Update the data class example to create the unnamed constructor instead of one called gen.

@mnordine
Copy link
Contributor

mnordine commented Jan 23, 2024

I checked out this branch, and did:

$ dart --version
Dart SDK version: 3.4.0-34.0.dev (dev) (Mon Jan 15 16:04:21 2024 -0800) on "macos_arm64"

$ dart pub get
$ dart --enable-experiment=macros run bin/json_serializable_main.dart  
                                                         
Error: Exception when reading 'org-dartlang-macro:///a/b/c/.dart_tool/package_config.json': FileSystemException(uri=org-dartlang-macro:///a/b/c/.dart_tool/package_config.json; message=StandardFileSystem only supports file:* and data:* URIs)
Crash when compiling org-dartlang-macro:///a/b/c/main.dart:
Invalid argument(s): Exception when reading 'org-dartlang-macro:///a/b/c/.dart_tool/package_config.json': FileSystemException(uri=org-dartlang-macro:///a/b/c/.dart_tool/package_config.json; message=StandardFileSystem only supports file:* and data:* URIs)

#0      ProcessedOptions._findPackages.checkInDir (package:front_end/src/base/processed_options.dart:671:9)
<asynchronous suspension>
#1      ProcessedOptions._findPackages (package:front_end/src/base/processed_options.dart:676:22)
<asynchronous suspension>
#2      ProcessedOptions._getPackages (package:front_end/src/base/processed_options.dart:556:24)
<asynchronous suspension>
#3      ProcessedOptions.getUriTranslator (package:front_end/src/base/processed_options.dart:481:32)
<asynchronous suspension>
#4      generateKernelInternal.<anonymous closure> (package:front_end/src/kernel_generator_impl.dart:73:37)
<asynchronous suspension>
#5      withCrashReporting (package:front_end/src/fasta/crash.dart:133:12)
<asynchronous suspension>
#6      kernelForProgramInternal.<anonymous closure> (package:front_end/src/api_prototype/kernel_generator.dart:62:29)
<asynchronous suspension>
#7      CompilerContext.clear (package:front_end/src/fasta/compiler_context.dart:139:3)
<asynchronous suspension>
#8      kernelForProgramInternal (package:front_end/src/api_prototype/kernel_generator.dart:61:10)
<asynchronous suspension>
#9      _compileMacros (package:front_end/src/kernel_generator_impl.dart:349:7)
<asynchronous suspension>
#10     precompileMacros (package:front_end/src/kernel_generator_impl.dart:305:16)
<asynchronous suspension>
#11     generateKernelInternal.<anonymous closure> (package:front_end/src/kernel_generator_impl.dart:104:11)
<asynchronous suspension>
#12     withCrashReporting (package:front_end/src/fasta/crash.dart:133:12)
<asynchronous suspension>
#13     generateKernel.<anonymous closure> (package:front_end/src/kernel_generator_impl.dart:49:12)
<asynchronous suspension>
#14     CompilerContext.clear (package:front_end/src/fasta/compiler_context.dart:139:3)
<asynchronous suspension>
#15     generateKernel (package:front_end/src/kernel_generator_impl.dart:48:10)
<asynchronous suspension>
#16     kernelForModule (package:front_end/src/api_prototype/kernel_generator.dart:100:11)
<asynchronous suspension>
#17     SingleShotCompilerWrapper.compileInternal (file:///Volumes/Work/s/w/ir/x/w/sdk/pkg/vm/bin/kernel_service.dart:419:11)
<asynchronous suspension>
#18     Compiler.compile.<anonymous closure> (file:///Volumes/Work/s/w/ir/x/w/sdk/pkg/vm/bin/kernel_service.dart:225:45)
<asynchronous suspension>
#19     _processLoadRequest (file:///Volumes/Work/s/w/ir/x/w/sdk/pkg/vm/bin/kernel_service.dart:906:37)
<asynchronous suspension>

Similar result for all examples.

@jakemac53
Copy link
Contributor Author

@mnordine did you run a dart pub get?

@jakemac53
Copy link
Contributor Author

Also fwiw, the observable one is I think the only one that works right this moment

@mnordine
Copy link
Contributor

mnordine commented Jan 23, 2024

@mnordine did you run a dart pub get?

Yes, multiple times.

Also fwiw, the observable one is I think the only one that works right this moment

Ok, there is no file in bin for that one.

@davidmorgan
Copy link
Contributor

@mnordine that issue was fixed very on Jan 19th--you'll need a more recent SDK.

@jakemac53
Copy link
Contributor Author

Ok, there is no file in bin for that one.

Oh sorry, I meant the auto_dispose one, in this PR. I have another PR out which adds a main for observable which does in fact work as well.

@mnordine
Copy link
Contributor

mnordine commented Jan 23, 2024

@mnordine that issue was fixed very on Jan 19th--you'll need a more recent SDK.

Ok, I'll prob wait until next dev release, since latest on brew was built on Jan 18. Thanks.

@jakemac53 jakemac53 merged commit b1e9584 into main Jan 23, 2024
3 checks passed
@jakemac53 jakemac53 deleted the cleanup-macro-examples branch January 23, 2024 18:57
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

Successfully merging this pull request may close these issues.

3 participants