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

Cannot generate docs with a local version of the snippets tool #144408

Open
goderbauer opened this issue Feb 29, 2024 · 26 comments
Open

Cannot generate docs with a local version of the snippets tool #144408

goderbauer opened this issue Feb 29, 2024 · 26 comments
Assignees
Labels
d: api docs Issues with https://api.flutter.dev/ dependency: dart Dart team may need to help us found in release: 3.20 Found to occur in 3.20 framework flutter/packages/flutter repository. See also f: labels. has reproducible steps The issue has been confirmed reproducible and is ready to work on P2 Important issues not at the top of the work list team-framework Owned by Framework team triaged-framework Triaged by Framework team

Comments

@goderbauer
Copy link
Member

Steps to reproduce:

  1. Checkout the snippets tool from https://github.com/flutter/assets-for-api-docs/tree/main/packages/snippets
  2. Modify https://github.com/flutter/flutter/blob/master/dev/bots/docs.sh to activate the snippets tool from the local checkout:
"$DART" pub global activate --source path <path/to/local/snippets/tool>
  1. Run dev/bots/docs.sh to generate the docs
  2. It fails with strange permission errors:
dartdoc:stderr:   error: tool execution failed: Tool "dartpad" returned non-zero exit code (1) when run as "/Users/goderbauer/dev/flutter/bin/cache/dart-sdk/bin/dart pub global run snippets --output-directory=doc/snippets --type=dartpad" from /private/tmp/dartdoc.n04eN
dartdoc:stderr: Input to dartpad was:
dartdoc:stderr: This sample shows how to override the default label [Text]
dartdoc:stderr: widget with one that forces the menu entry to appear on one line
dartdoc:stderr: by specifying [Text.maxLines] and [Text.overflow].
dartdoc:stderr:
dartdoc:stderr: ** See code in examples/api/lib/material/dropdown_menu/dropdown_menu_entry_label_widget.0.dart **
dartdoc:stderr: Stderr output was:
dartdoc:stderr: Could not make "/Users/goderbauer/.pub-cache/bin/snippets" executable (exit code 1):
dartdoc:stderr: chmod: /Users/goderbauer/.pub-cache/bin/snippets: No such file or directory
dartdoc:stderr:
dartdoc:stderr:
dartdoc:stderr:     from material.DropdownMenuEntry.labelWidget: (file:///Users/goderbauer/dev/flutter/packages/flutter/lib/src/material/dropdown_menu.dart:80:17)
dartdoc:stderr:   error: tool execution failed: Tool "snippet" returned non-zero exit code (1) when run as "/Users/goderbauer/dev/flutter/bin/cache/dart-sdk/bin/dart pub global run snippets --output-directory=doc/snippets --type=snippet" from /private/tmp/dartdoc.n04eN
dartdoc:stderr: Input to snippet was:
dartdoc:stderr:
dartdoc:stderr: This example, which would be inserted into a [CustomScrollView.slivers]
dartdoc:stderr: list, shows twenty boxes in a pretty teal grid:
dartdoc:stderr:
dartdoc:stderr: ```dart
dartdoc:stderr: SliverGrid(
dartdoc:stderr:   gridDelegate: const SliverGridDelegateWithMaxCrossAxisExtent(
dartdoc:stderr:     maxCrossAxisExtent: 200.0,
dartdoc:stderr:     mainAxisSpacing: 10.0,
dartdoc:stderr:     crossAxisSpacing: 10.0,
dartdoc:stderr:     childAspectRatio: 4.0,
dartdoc:stderr:   ),
dartdoc:stderr:   delegate: SliverChildBuilderDelegate(
dartdoc:stderr:     (BuildContext context, int index) {
dartdoc:stderr:       return Container(
dartdoc:stderr:         alignment: Alignment.center,
dartdoc:stderr:         color: Colors.teal[100 * (index % 9)],
dartdoc:stderr:         child: Text('grid item $index'),
dartdoc:stderr:       );
dartdoc:stderr:     },
dartdoc:stderr:     childCount: 20,
dartdoc:stderr:   ),
dartdoc:stderr: )
dartdoc:stderr: ```
dartdoc:stderr: Stderr output was:
dartdoc:stderr: Could not make "/Users/goderbauer/.pub-cache/bin/snippets" executable (exit code 1):
dartdoc:stderr: chmod: /Users/goderbauer/.pub-cache/bin/snippets: No such file or directory

Running the command from the error directly works without issues. The file it is complaining about not existing definitely exists.

@goderbauer
Copy link
Member Author

@srawlins @parlough Apologies, this is a bit of a shot in the dark. I am not exactly sure where the issue here is, but we are able to reproduce it on three different machines. Does the Dart CLI tool mess something up when dart pub global activateing something from a file path? Does dartdoc do something strange when calling that executable?

@goderbauer
Copy link
Member Author

@gspencergoog figured out a work around: you can run a local version of the snapshot tool by building an exe with dart compile exe bin/snippets.dart and referencing that in the dartdoc_options.yaml file. While that unblocks me, it should still be possible to just run from source.

@goderbauer goderbauer added the dependency: dart Dart team may need to help us label Feb 29, 2024
@goderbauer
Copy link
Member Author

The failure seems to be coming from the pub tool:

https://github.com/dart-lang/pub/blob/5b5fdd320a3b60a6a00bdd3122f03c6f67a39eeb/lib/src/global_packages.dart#L873

@sigurdm @szakarias Do you maybe have any insights?

@huycozy huycozy added the in triage Presently being triaged by the triage team label Mar 1, 2024
@huycozy
Copy link
Member

huycozy commented Mar 1, 2024

I also see the same issue on the master channel 3.20.0-16.0.pre.40:

Output log (just the head of the output log, it has more)
dartdoc:stdout: Documenting Flutter...
dartdoc:stdout: Discovering libraries...
dartdoc:stdout: Linking elements...
dartdoc:stdout: Precaching local docs for 800333 elements...
dartdoc:stderr:   error: tool execution failed: Tool "snippet" returned non-zero exit code (1) when run as "/Users/huynq/Documents/GitHub/flutter_master/bin/cache/dart-sdk/bin/dart pub global run snippets --output-directory=doc/snippets --type=snippet" from /private/tmp/dartdoc.CkGj0
dartdoc:stderr: Input to snippet was:
dartdoc:stderr:
dartdoc:stderr: A card with `Hello World!` embedded inline within a TextSpan tree.
dartdoc:stderr:
dartdoc:stderr: ```dart
dartdoc:stderr: const Text.rich(
dartdoc:stderr:   TextSpan(
dartdoc:stderr:     children: <InlineSpan>[
dartdoc:stderr:       TextSpan(text: 'Flutter is'),
dartdoc:stderr:       WidgetSpan(
dartdoc:stderr:         child: SizedBox(
dartdoc:stderr:           width: 120,
dartdoc:stderr:           height: 50,
dartdoc:stderr:           child: Card(
dartdoc:stderr:             child: Center(
dartdoc:stderr:               child: Text('Hello World!')
dartdoc:stderr:             )
dartdoc:stderr:           ),
dartdoc:stderr:         )
dartdoc:stderr:       ),
dartdoc:stderr:       TextSpan(text: 'the best!'),
dartdoc:stderr:     ],
dartdoc:stderr:   )
dartdoc:stderr: )
dartdoc:stderr: ```
dartdoc:stderr: Stderr output was:
dartdoc:stderr: Could not make "/Users/huynq/.pub-cache/bin/snippets" executable (exit code 1):
dartdoc:stderr: chmod: /Users/huynq/.pub-cache/bin/snippets: No such file or directory
dartdoc:stderr:
dartdoc:stderr:
dartdoc:stderr:     from material.WidgetSpan: (file:///Users/huynq/Documents/GitHub/flutter_master/packages/flutter/lib/src/widgets/widget_span.dart:67:7)
dartdoc:stderr:   error: tool execution failed: Tool "snippet" returned non-zero exit code (1) when run as "/Users/huynq/Documents/GitHub/flutter_master/bin/cache/dart-sdk/bin/dart pub global run snippets --output-directory=doc/snippets --type=snippet" from /private/tmp/dartdoc.CkGj0
dartdoc:stderr: Input to snippet was:
dartdoc:stderr:
dartdoc:stderr: This example shows some [Text] when the `_visible` member field is true, and
dartdoc:stderr: hides it when it is false:
dartdoc:stderr:
dartdoc:stderr: ```dart
dartdoc:stderr: Opacity(
dartdoc:stderr:   opacity: _visible ? 1.0 : 0.0,
dartdoc:stderr:   child: const Text("Now you see me, now you don't!"),
dartdoc:stderr: )
dartdoc:stderr: ```
dartdoc:stderr: Stderr output was:
dartdoc:stderr: Could not make "/Users/huynq/.pub-cache/bin/snippets" executable (exit code 1):
dartdoc:stderr: chmod: /Users/huynq/.pub-cache/bin/snippets: No such file or directory
.....
flutter doctor -v (master)
[!] Flutter (Channel master, 3.20.0-16.0.pre.40, on macOS 14.1 23B74 darwin-x64, locale en-VN)
    • Flutter version 3.20.0-16.0.pre.40 on channel master at /Users/huynq/Documents/GitHub/flutter_master
    ! Warning: `flutter` on your path resolves to /Users/huynq/Documents/GitHub/flutter/bin/flutter, which is not inside your current Flutter SDK checkout at /Users/huynq/Documents/GitHub/flutter_master. Consider adding /Users/huynq/Documents/GitHub/flutter_master/bin to the front of your path.
    ! Warning: `dart` on your path resolves to /Users/huynq/Documents/GitHub/flutter/bin/dart, which is not inside your current Flutter SDK checkout at /Users/huynq/Documents/GitHub/flutter_master. Consider adding /Users/huynq/Documents/GitHub/flutter_master/bin to the front of your path.
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision a78a0d5934 (48 minutes ago), 2024-02-29 21:22:19 -0500
    • Engine revision 34cf95c7bd
    • Dart version 3.4.0 (build 3.4.0-190.0.dev)
    • DevTools version 2.33.1
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/huynq/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = /Users/huynq/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.0.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15A507
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • android-studio-dir = /Applications/Android Studio.app/
    • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)

[✓] VS Code (version 1.87.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.82.0

[✓] Connected device (4 available)
    • RMX2001 (mobile) • EUYTFEUSQSRGDA6D                         • android-arm64  • Android 11 (API 30)
    • iPhone (mobile)  • d9a94afe2b649fef56ba0bfeb052f0f2a7dae95e • ios            • iOS 15.8 19H370
    • macOS (desktop)  • macos                                    • darwin-x64     • macOS 14.1 23B74 darwin-x64
    • Chrome (web)     • chrome                                   • web-javascript • Google Chrome 122.0.6261.94

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.

@huycozy huycozy added framework flutter/packages/flutter repository. See also f: labels. d: api docs Issues with https://api.flutter.dev/ has reproducible steps The issue has been confirmed reproducible and is ready to work on team-framework Owned by Framework team found in release: 3.20 Found to occur in 3.20 and removed in triage Presently being triaged by the triage team labels Mar 1, 2024
@sigurdm
Copy link
Contributor

sigurdm commented Mar 4, 2024

Yeah something is wrong. It seems the "binstub" (small script that can be used to run the activated binary) doesn't exist while pub expects it to.

I cannot reproduce I tried

git clone https://github.com/flutter/assets-for-api-docs
cd assets-for-api-docs/packages/snippets/
dart pub global activate -spath .
cd $FLUTTER_ROOT # (my actual flutter root)
git checkout 3.20.0-15.0.pre 
dev/bots/docs.sh
output
Mon Mar  4 10:27:20 AM UTC 2024: Running docs.sh
Writing docs build temporary output to /tmp/dartdoc.zvWJI/doc
Package dartdoc is currently active at version 8.0.2.
The package dartdoc is already activated at newest available version.
To recompile executables, first run `dart pub global deactivate dartdoc`.
Installed executable dartdoc.
Warning: Pub installs executables into $HOME/.pub-cache/bin, which is not on your path.
You can fix that by adding this to your shell's config file (.bashrc, .bash_profile, etc.):

  export PATH="$PATH":"$HOME/.pub-cache/bin"

Activated dartdoc 8.0.2.
Package snippets is currently active at version 0.4.0.
The package snippets is already activated at newest available version.
To recompile executables, first run `dart pub global deactivate snippets`.
Installed executable snippets.
Warning: Pub installs executables into $HOME/.pub-cache/bin, which is not on your path.
You can fix that by adding this to your shell's config file (.bashrc, .bash_profile, etc.):

  export PATH="$PATH":"$HOME/.pub-cache/bin"

Activated snippets 0.4.0.
Downloading package sky_engine...                                  774ms
Downloading flutter_patched_sdk tools...                           908ms
Downloading flutter_patched_sdk_product tools...                   919ms
Downloading linux-x64 tools...                                      3.3s
Downloading linux-x64/font-subset tools...                         745ms
Resolving dependencies... (1.3s)
> _fe_analyzer_shared 67.0.0 (was 66.0.0)
> analyzer 6.4.1 (was 6.4.0)
  archive 3.3.2 (affected by advisories: [^0], [^1], 3.4.10 available)
  http 0.13.6 (1.2.1 available)
  intl 0.18.1 (0.19.0 available)
  js 0.6.7 (0.7.1 available)
> meta 1.12.0 (was 1.11.0)
> test 1.25.2 (was 1.24.9)
> test_api 0.7.0 (was 0.6.1)
> test_core 0.6.0 (was 0.5.9)
> vm_service 14.0.0 (was 13.0.0) (14.1.0 available)
  web 0.4.2 (0.5.0 available)
  web_socket_channel 2.4.3 (2.4.4 available)
Changed 7 dependencies!
Dependencies are affected by security advisories:
  [^0]: https://github.com/advisories/GHSA-9v85-q87q-g4vg
  [^1]: https://github.com/advisories/GHSA-r285-q736-9v95
7 packages have newer versions incompatible with dependency constraints.
Try `flutter pub outdated` for more information.
Unexpected package '/usr/local/google/home/sigurdm/projects/flutter/packages/flutter_goldens_client' found in packages directory
Unexpected package '/usr/local/google/home/sigurdm/projects/flutter/packages/flutter_goldens_client' found in packages directory
Copied /usr/local/google/home/sigurdm/projects/flutter/dev/docs/README.md to /tmp/dartdoc.zvWJI/README.md
Copied /usr/local/google/home/sigurdm/projects/flutter/dev/docs/analysis_options.yaml to /tmp/dartdoc.zvWJI/analysis_options.yaml
Copied /usr/local/google/home/sigurdm/projects/flutter/dev/docs/dartdoc_options.yaml to /tmp/dartdoc.zvWJI/dartdoc_options.yaml
Copied /usr/local/google/home/sigurdm/projects/flutter/dev/docs/assets/api_survey.js to /tmp/dartdoc.zvWJI/doc/assets/api_survey.js
Copied /usr/local/google/home/sigurdm/projects/flutter/dev/docs/assets/snippets.css to /tmp/dartdoc.zvWJI/doc/assets/snippets.css
Copied /usr/local/google/home/sigurdm/projects/flutter/dev/docs/assets/overrides.css to /tmp/dartdoc.zvWJI/doc/assets/overrides.css
Copied /usr/local/google/home/sigurdm/projects/flutter/dev/docs/assets/snippets.js to /tmp/dartdoc.zvWJI/doc/assets/snippets.js
Extracting android-javadoc.zip to /tmp/dartdoc.zvWJI/doc/javadoc
Android ready to go!
Extracting ios-docs.zip to /tmp/dartdoc.zvWJI/doc/ios-embedder
iOS ready to go!
Extracting macos-docs.zip to /tmp/dartdoc.zvWJI/doc/macos-embedder
macOS ready to go!
Extracting linux-docs.zip to /tmp/dartdoc.zvWJI/doc/linux-embedder
Linux ready to go!
Extracting windows-docs.zip to /tmp/dartdoc.zvWJI/doc/windows-embedder
Windows ready to go!
Extracting impeller-docs.zip to /tmp/dartdoc.zvWJI/doc/impeller
Impeller ready to go!
pub:stdout: Resolving dependencies...
pub:stdout: + async 2.11.0
pub:stdout: + boolean_selector 2.1.1
pub:stdout: + characters 1.3.0
pub:stdout: + clock 1.1.1
pub:stdout: + collection 1.18.0
pub:stdout: + crypto 3.0.3
pub:stdout: + fake_async 1.3.1
pub:stdout: + file 7.0.0
pub:stdout: + flutter 0.0.0 from sdk flutter
pub:stdout: + flutter_driver 0.0.0 from sdk flutter
pub:stdout: + flutter_goldens 0.0.0 from sdk flutter
pub:stdout: + flutter_localizations 0.0.0 from sdk flutter
pub:stdout: + flutter_test 0.0.0 from sdk flutter
pub:stdout: + flutter_web_plugins 0.0.0 from sdk flutter
pub:stdout: + fuchsia_remote_debug_protocol 0.0.0 from sdk flutter
pub:stdout: + integration_test 0.0.0 from sdk flutter
pub:stdout: + intl 0.18.1 (0.19.0 available)
pub:stdout: + leak_tracker 10.0.4
pub:stdout: + leak_tracker_flutter_testing 3.0.3
pub:stdout: + leak_tracker_testing 3.0.1
pub:stdout: + matcher 0.12.16+1
pub:stdout: + material_color_utilities 0.8.0
pub:stdout: + meta 1.12.0
pub:stdout: + path 1.9.0
pub:stdout: + platform 3.1.4
pub:stdout: ! platform_integration 0.0.0 from path /usr/local/google/home/sigurdm/projects/flutter/dev/docs/platform_integration (overridden)
pub:stdout: + process 5.0.2
pub:stdout: + sky_engine 0.0.99 from sdk flutter
pub:stdout: + source_span 1.10.0
pub:stdout: + stack_trace 1.11.1
pub:stdout: + stream_channel 2.1.2
pub:stdout: + string_scanner 1.2.0
pub:stdout: + sync_http 0.3.1
pub:stdout: + term_glyph 1.2.1
pub:stdout: + test_api 0.7.0
pub:stdout: + typed_data 1.3.2
pub:stdout: + vector_math 2.1.4
pub:stdout: + vm_service 14.0.0 (14.1.0 available)
pub:stdout: + webdriver 3.0.3
pub:stdout: Changed 38 dependencies!
pub:stdout: 2 packages have newer versions incompatible with dependency constraints.
pub:stdout: Try `flutter pub outdated` for more information.

dartdoc version: 8.0.2
snippets version: 0.4.0
flutter version: 3.20.0-15.0.pre

Unexpected package '/usr/local/google/home/sigurdm/projects/flutter/packages/flutter_goldens_client' found in packages directory
Executing: (cd "/tmp/dartdoc.zvWJI" ; /usr/local/google/home/sigurdm/projects/flutter/bin/dart global run --enable-asserts dartdoc --output /tmp/dartdoc.zvWJI/doc/flutter --allow-tools --no-validate-links --link-to-source-excludes /usr/local/google/home/sigurdm/projects/flutter/bin/cache --link-to-source-root /usr/local/google/home/sigurdm/projects/flutter --link-to-source-uri-template https://github.com/flutter/flutter/blob/master/%f%#L%l% --inject-html --use-base-href --header /usr/local/google/home/sigurdm/projects/flutter/dev/docs/styles.html --header /usr/local/google/home/sigurdm/projects/flutter/dev/docs/analytics-header.html --header /usr/local/google/home/sigurdm/projects/flutter/dev/docs/survey.html --header /usr/local/google/home/sigurdm/projects/flutter/dev/docs/snippets.html --header /usr/local/google/home/sigurdm/projects/flutter/dev/docs/opensearch.html --footer /usr/local/google/home/sigurdm/projects/flutter/dev/docs/analytics-footer.html --footer-text /tmp/dartdoc.zvWJI/footer.html --allow-warnings-in-packages Flutter,platform_integration,flutter_driver,integration_test,flutter_web_plugins,flutter_goldens,flutter,flutter_localizations,flutter_test --exclude-packages analyzer,args,barback,csslib,flutter_goldens,flutter_goldens_client,front_end,fuchsia_remote_debug_protocol,glob,html,http_multi_server,io,isolate,js,kernel,logging,mime,mockito,node_preamble,plugin,shelf,shelf_packages_handler,shelf_static,shelf_web_socket,utf,watcher,yaml --exclude dart:io/network_policy.dart,package:Flutter/temp_doc.dart,package:http/browser_client.dart,package:intl/intl_browser.dart,package:matcher/mirror_matchers.dart,package:quiver/io.dart,package:quiver/mirrors.dart,package:vm_service_client/vm_service_client.dart,package:web_socket_channel/html.dart --favicon /usr/local/google/home/sigurdm/projects/flutter/dev/docs/favicon.ico --package-order flutter,Dart,platform_integration,flutter_test,flutter_driver --auto-include-dependencies)
dartdoc:stdout: Documenting Flutter...
dartdoc:stdout: Discovering libraries...
dartdoc:stdout: Linking elements...
dartdoc:stdout: Precaching local docs for 800154 elements...
dartdoc:stderr:   error: tool execution failed: Tool "dartpad" returned non-zero exit code (255) when run as "/usr/local/google/home/sigurdm/projects/flutter/bin/cache/dart-sdk/bin/dart pub global run snippets --output-directory=doc/snippets --type=dartpad" from /tmp/dartdoc.zvWJI
dartdoc:stderr: Input to dartpad was:
dartdoc:stderr: The following code implements the [RotationTransition] as seen in the video
dartdoc:stderr: above:
dartdoc:stderr:
dartdoc:stderr: ** See code in examples/api/lib/widgets/transitions/rotation_transition.0.dart **
dartdoc:stderr: Stderr output was:
dartdoc:stderr: An unexpected error was encountered by the Dart CLI.
dartdoc:stderr: Please file an issue at https://github.com/dart-lang/sdk/issues/new with the following details:
dartdoc:stderr:
dartdoc:stderr: Invocation: 'dart pub global run snippets --output-directory=doc/snippets --type=dartpad'
dartdoc:stderr: Exception: 'LateInitializationError: Field 'userProperty' has not been initialized.'
dartdoc:stderr: Stack Trace:
dartdoc:stderr: #0      AnalyticsImpl.userProperty (package:unified_analytics/src/analytics.dart)
dartdoc:stderr: #1      AnalyticsImpl.send (package:unified_analytics/src/analytics.dart:613:21)
dartdoc:stderr: #2      ErrorHandler.log (package:unified_analytics/src/error_handler.dart:29:18)
dartdoc:stderr: #3      Session._refreshSessionData (package:unified_analytics/src/session.dart:102:21)
dartdoc:stderr: #4      new Session (package:unified_analytics/src/session.dart:37:27)
dartdoc:stderr: #5      new AnalyticsImpl (package:unified_analytics/src/analytics.dart:429:23)
dartdoc:stderr: #6      new Analytics (package:unified_analytics/src/analytics.dart:87:12)
dartdoc:stderr: #7      createUnifiedAnalytics (package:dartdev/src/unified_analytics.dart:23:10)
dartdoc:stderr: #8      DartdevRunner.runCommand (package:dartdev/dartdev.dart:165:27)
dartdoc:stderr: #9      CommandRunner.run.<anonymous closure> (package:args/command_runner.dart:122:25)
dartdoc:stderr: #10     new Future.sync (dart:async/future.dart:306:31)
dartdoc:stderr: #11     CommandRunner.run (package:args/command_runner.dart:122:14)
dartdoc:stderr: #12     runDartdev (package:dartdev/dartdev.dart:46:29)
dartdoc:stderr: #13     main (file:///b/s/w/ir/x/w/sdk/pkg/dartdev/bin/dartdev.dart:11:9)
dartdoc:stderr: #14     _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:293:33)
dartdoc:stderr: #15     _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)
dartdoc:stderr:
dartdoc:stderr:
dartdoc:stderr:
dartdoc:stderr:     from material.RotationTransition: (file:///usr/local/google/home/sigurdm/projects/flutter/packages/flutter/lib/src/widgets/transitions.dart:373:7)
dartdoc:stderr:   error: tool execution failed: Tool "dartpad" returned non-zero exit code (255) when run as "/usr/local/google/home/sigurdm/projects/flutter/bin/cache/dart-sdk/bin/dart pub global run snippets --output-directory=doc/snippets --type=dartpad" from /tmp/dartdoc.zvWJI
dartdoc:stderr: Input to dartpad was:
dartdoc:stderr: These two images have two [ColorFilter]s applied with different [BlendMode]s,
dartdoc:stderr: one with red color and [BlendMode.modulate] another with a grey color and [BlendMode.saturation].
dartdoc:stderr:
dartdoc:stderr: ** See code in examples/api/lib/widgets/color_filter/color_filtered.0.dart **
dartdoc:stderr: Stderr output was:
dartdoc:stderr: An unexpected error was encountered by the Dart CLI.
dartdoc:stderr: Please file an issue at https://github.com/dart-lang/sdk/issues/new with the following details:
dartdoc:stderr:
dartdoc:stderr: Invocation: 'dart pub global run snippets --output-directory=doc/snippets --type=dartpad'
dartdoc:stderr: Exception: 'LateInitializationError: Field 'userProperty' has not been initialized.'
dartdoc:stderr: Stack Trace:
dartdoc:stderr: #0      AnalyticsImpl.userProperty (package:unified_analytics/src/analytics.dart)
dartdoc:stderr: #1      AnalyticsImpl.send (package:unified_analytics/src/analytics.dart:613:21)
dartdoc:stderr: #2      ErrorHandler.log (package:unified_analytics/src/error_handler.dart:29:18)
dartdoc:stderr: #3      Session._refreshSessionData (package:unified_analytics/src/session.dart:102:21)
dartdoc:stderr: #4      new Session (package:unified_analytics/src/session.dart:37:27)
dartdoc:stderr: #5      new AnalyticsImpl (package:unified_analytics/src/analytics.dart:429:23)
dartdoc:stderr: #6      new Analytics (package:unified_analytics/src/analytics.dart:87:12)
dartdoc:stderr: #7      createUnifiedAnalytics (package:dartdev/src/unified_analytics.dart:23:10)
dartdoc:stderr: #8      DartdevRunner.runCommand (package:dartdev/dartdev.dart:165:27)
dartdoc:stderr: #9      CommandRunner.run.<anonymous closure> (package:args/command_runner.dart:122:25)
dartdoc:stderr: #10     new Future.sync (dart:async/future.dart:306:31)
dartdoc:stderr: #11     CommandRunner.run (package:args/command_runner.dart:122:14)
dartdoc:stderr: #12     runDartdev (package:dartdev/dartdev.dart:46:29)
dartdoc:stderr: #13     main (file:///b/s/w/ir/x/w/sdk/pkg/dartdev/bin/dartdev.dart:11:9)
dartdoc:stderr: #14     _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:293:33)
dartdoc:stderr: #15     _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)
dartdoc:stderr:
dartdoc:stderr:
dartdoc:stderr:
dartdoc:stderr:     from cupertino.ColorFiltered: (file:///usr/local/google/home/sigurdm/projects/flutter/packages/flutter/lib/src/widgets/color_filter.dart:33:7)
dartdoc:stderr:   error: tool execution failed: Tool "snippet" returned non-zero exit code (255) when run as "/usr/local/google/home/sigurdm/projects/flutter/bin/cache/dart-sdk/bin/dart pub global run snippets --output-directory=doc/snippets --type=snippet" from /tmp/dartdoc.zvWJI
dartdoc:stderr: Input to snippet was:
dartdoc:stderr:
dartdoc:stderr: ```dart
dartdoc:stderr: class MyRenderObject extends RenderAligningShiftedBox with DebugOverflowIndicatorMixin {
dartdoc:stderr:   MyRenderObject({
dartdoc:stderr:     super.alignment = Alignment.center,
dartdoc:stderr:     required super.textDirection,
dartdoc:stderr:     super.child,
dartdoc:stderr:   });
dartdoc:stderr:
dartdoc:stderr:   late Rect _containerRect;
dartdoc:stderr:   late Rect _childRect;
dartdoc:stderr:
dartdoc:stderr:   @override
dartdoc:stderr:   void performLayout() {
dartdoc:stderr:     // ...
dartdoc:stderr:     final BoxParentData childParentData = child!.parentData! as BoxParentData;
dartdoc:stderr:     _containerRect = Offset.zero & size;
dartdoc:stderr:     _childRect = childParentData.offset & child!.size;
dartdoc:stderr:   }
dartdoc:stderr:
dartdoc:stderr:   @override
dartdoc:stderr:   void paint(PaintingContext context, Offset offset) {
dartdoc:stderr:     // Do normal painting here...
dartdoc:stderr:     // ...
dartdoc:stderr:
dartdoc:stderr:     assert(() {
dartdoc:stderr:       paintOverflowIndicator(context, offset, _containerRect, _childRect);
dartdoc:stderr:       return true;
dartdoc:stderr:     }());
dartdoc:stderr:   }
dartdoc:stderr: }
dartdoc:stderr: ```
dartdoc:stderr: Stderr output was:
dartdoc:stderr: An unexpected error was encountered by the Dart CLI.
dartdoc:stderr: Please file an issue at https://github.com/dart-lang/sdk/issues/new with the following details:
dartdoc:stderr:
dartdoc:stderr: Invocation: 'dart pub global run snippets --output-directory=doc/snippets --type=snippet'
dartdoc:stderr: Exception: 'LateInitializationError: Field 'userProperty' has not been initialized.'
dartdoc:stderr: Stack Trace:
dartdoc:stderr: #0      AnalyticsImpl.userProperty (package:unified_analytics/src/analytics.dart)
dartdoc:stderr: #1      AnalyticsImpl.send (package:unified_analytics/src/analytics.dart:613:21)
dartdoc:stderr: #2      ErrorHandler.log (package:unified_analytics/src/error_handler.dart:29:18)
dartdoc:stderr: #3      Session._refreshSessionData (package:unified_analytics/src/session.dart:102:21)
dartdoc:stderr: #4      new Session (package:unified_analytics/src/session.dart:37:27)
dartdoc:stderr: #5      new AnalyticsImpl (package:unified_analytics/src/analytics.dart:429:23)
dartdoc:stderr: #6      new Analytics (package:unified_analytics/src/analytics.dart:87:12)
dartdoc:stderr: #7      createUnifiedAnalytics (package:dartdev/src/unified_analytics.dart:23:10)
dartdoc:stderr: #8      DartdevRunner.runCommand (package:dartdev/dartdev.dart:165:27)
dartdoc:stderr: #9      CommandRunner.run.<anonymous closure> (package:args/command_runner.dart:122:25)
dartdoc:stderr: #10     new Future.sync (dart:async/future.dart:306:31)
dartdoc:stderr: #11     CommandRunner.run (package:args/command_runner.dart:122:14)
dartdoc:stderr: #12     runDartdev (package:dartdev/dartdev.dart:46:29)
dartdoc:stderr: #13     main (file:///b/s/w/ir/x/w/sdk/pkg/dartdev/bin/dartdev.dart:11:9)
dartdoc:stderr: #14     _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:293:33)
dartdoc:stderr: #15     _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)
dartdoc:stderr:
dartdoc:stderr:
dartdoc:stderr:
dartdoc:stderr:     from rendering.DebugOverflowIndicatorMixin: (file:///usr/local/google/home/sigurdm/projects/flutter/packages/flutter/lib/src/rendering/debug_overflow_indicator.dart:90:7)
dartdoc:stderr:   error: tool execution failed: Tool "snippet" returned non-zero exit code (255) when run as "/usr/local/google/home/sigurdm/projects/flutter/bin/cache/dart-sdk/bin/dart pub global run snippets --output-directory=doc/snippets --type=snippet" from /tmp/dartdoc.zvWJI
dartdoc:stderr: Input to snippet was:
dartdoc:stderr:
dartdoc:stderr: Using a [Stack] you can position widgets over one another.
dartdoc:stderr:
dartdoc:stderr: ![The sample creates a blue box that overlaps a larger green box, which itself overlaps an even larger red box.](https://flutter.github.io/assets-for-api-docs/assets/widgets/stack.png)
dartdoc:stderr:
dartdoc:stderr: ```dart
dartdoc:stderr: Stack(
dartdoc:stderr:   children: <Widget>[
dartdoc:stderr:     Container(
dartdoc:stderr:       width: 100,
dartdoc:stderr:       height: 100,
dartdoc:stderr:       color: Colors.red,
dartdoc:stderr:     ),
dartdoc:stderr:     Container(
dartdoc:stderr:       width: 90,
dartdoc:stderr:       height: 90,
dartdoc:stderr:       color: Colors.green,
dartdoc:stderr:     ),
dartdoc:stderr:     Container(
dartdoc:stderr:       width: 80,
dartdoc:stderr:       height: 80,
dartdoc:stderr:       color: Colors.blue,
dartdoc:stderr:     ),
dartdoc:stderr:   ],
dartdoc:stderr: )
dartdoc:stderr: ```
dartdoc:stderr: Stderr output was:
dartdoc:stderr: An unexpected error was encountered by the Dart CLI.
dartdoc:stderr: Please file an issue at https://github.com/dart-lang/sdk/issues/new with the following details:
dartdoc:stderr:
dartdoc:stderr: Invocation: 'dart pub global run snippets --output-directory=doc/snippets --type=snippet'
dartdoc:stderr: Exception: 'LateInitializationError: Field 'userProperty' has not been initialized.'
dartdoc:stderr: Stack Trace:
dartdoc:stderr: #0      AnalyticsImpl.userProperty (package:unified_analytics/src/analytics.dart)
dartdoc:stderr: #1      AnalyticsImpl.send (package:unified_analytics/src/analytics.dart:613:21)
dartdoc:stderr: #2      ErrorHandler.log (package:unified_analytics/src/error_handler.dart:29:18)
dartdoc:stderr: #3      Session._refreshSessionData (package:unified_analytics/src/session.dart:102:21)
dartdoc:stderr: #4      new Session (package:unified_analytics/src/session.dart:37:27)
dartdoc:stderr: #5      new AnalyticsImpl (package:unified_analytics/src/analytics.dart:429:23)
dartdoc:stderr: #6      new Analytics (package:unified_analytics/src/analytics.dart:87:12)
dartdoc:stderr: #7      createUnifiedAnalytics (package:dartdev/src/unified_analytics.dart:23:10)
dartdoc:stderr: #8      DartdevRunner.runCommand (package:dartdev/dartdev.dart:165:27)
dartdoc:stderr: #9      CommandRunner.run.<anonymous closure> (package:args/command_runner.dart:122:25)
dartdoc:stderr: #10     new Future.sync (dart:async/future.dart:306:31)
dartdoc:stderr: #11     CommandRunner.run (package:args/command_runner.dart:122:14)
dartdoc:stderr: #12     runDartdev (package:dartdev/dartdev.dart:46:29)
dartdoc:stderr: #13     main (file:///b/s/w/ir/x/w/sdk/pkg/dartdev/bin/dartdev.dart:11:9)
dartdoc:stderr: #14     _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:293:33)
dartdoc:stderr: #15     _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)
dartdoc:stderr:
dartdoc:stderr:
dartdoc:stderr:
dartdoc:stderr:     from widgets.Stack: (file:///usr/local/google/home/sigurdm/projects/flutter/packages/flutter/lib/src/widgets/basic.dart:3874:7)
dartdoc:stderr:   error: tool execution failed: Tool "dartpad" returned non-zero exit code (255) when run as "/usr/local/google/home/sigurdm/projects/flutter/bin/cache/dart-sdk/bin/dart pub global run snippets --output-directory=doc/snippets --type=dartpad" from /tmp/dartdoc.zvWJI
dartdoc:stderr: Input to dartpad was:
dartdoc:stderr: This example demonstrates using a [FocusScope] to restrict focus to a particular
dartdoc:stderr: portion of the app. In this case, restricting focus to the visible part of a
dartdoc:stderr: Stack.
dartdoc:stderr:
dartdoc:stderr: ** See code in examples/api/lib/widgets/focus_scope/focus_scope.0.dart **
dartdoc:stderr: Stderr output was:
dartdoc:stderr: An unexpected error was encountered by the Dart CLI.
dartdoc:stderr: Please file an issue at https://github.com/dart-lang/sdk/issues/new with the following details:
dartdoc:stderr:
dartdoc:stderr: Invocation: 'dart pub global run snippets --output-directory=doc/snippets --type=dartpad'
dartdoc:stderr: Exception: 'LateInitializationError: Field 'userProperty' has not been initialized.'
dartdoc:stderr: Stack Trace:
dartdoc:stderr: #0      AnalyticsImpl.userProperty (package:unified_analytics/src/analytics.dart)
dartdoc:stderr: #1      AnalyticsImpl.send (package:unified_analytics/src/analytics.dart:613:21)
dartdoc:stderr: #2      ErrorHandler.log (package:unified_analytics/src/error_handler.dart:29:18)
dartdoc:stderr: #3      Session._refreshSessionData (package:unified_analytics/src/session.dart:102:21)
dartdoc:stderr: #4      new Session (package:unified_analytics/src/session.dart:37:27)
dartdoc:stderr: #5      new AnalyticsImpl (package:unified_analytics/src/analytics.dart:429:23)
dartdoc:stderr: #6      new Analytics (package:unified_analytics/src/analytics.dart:87:12)
dartdoc:stderr: #7      createUnifiedAnalytics (package:dartdev/src/unified_analytics.dart:23:10)
dartdoc:stderr: #8      DartdevRunner.runCommand (package:dartdev/dartdev.dart:165:27)
dartdoc:stderr: #9      CommandRunner.run.<anonymous closure> (package:args/command_runner.dart:122:25)
dartdoc:stderr: #10     new Future.sync (dart:async/future.dart:306:31)
dartdoc:stderr: #11     CommandRunner.run (package:args/command_runner.dart:122:14)
dartdoc:stderr: #12     runDartdev (package:dartdev/dartdev.dart:46:29)
dartdoc:stderr: #13     main (file:///b/s/w/ir/x/w/sdk/pkg/dartdev/bin/dartdev.dart:11:9)
dartdoc:stderr: #14     _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:293:33)
dartdoc:stderr: #15     _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)
dartdoc:stderr:
dartdoc:stderr:
dartdoc:stderr:
dartdoc:stderr:     from widgets.FocusScope: (file:///usr/local/google/home/sigurdm/projects/flutter/packages/flutter/lib/src/widgets/focus_scope.dart:750:7)
dartdoc:stdout: Initialized dartdoc with 1287 libraries
dartdoc:stdout: Generating docs for package flutter...
dartdoc:stdout: Generating docs for package Dart...
dartdoc:stdout: Generating docs for package platform_integration...
dartdoc:stdout: Generating docs for package flutter_test...
dartdoc:stdout: Generating docs for package flutter_driver...
dartdoc:stdout: Generating docs for package Flutter...
dartdoc:stdout: Generating docs for package flutter_localizations...
dartdoc:stdout: Generating docs for package flutter_web_plugins...
dartdoc:stdout: Generating docs for package leak_tracker_flutter_testing...
dartdoc:stdout: Generating docs for package async...
dartdoc:stdout: Generating docs for package boolean_selector...
dartdoc:stdout: Generating docs for package characters...
dartdoc:stdout: Generating docs for package clock...
dartdoc:stdout: Generating docs for package collection...
dartdoc:stdout: Generating docs for package crypto...
dartdoc:stdout: Generating docs for package fake_async...
dartdoc:stdout: Generating docs for package file...
dartdoc:stdout: Generating docs for package integration_test...
dartdoc:stdout: Generating docs for package intl...
dartdoc:stdout: Generating docs for package leak_tracker...
dartdoc:stdout: Generating docs for package leak_tracker_testing...
dartdoc:stdout: Generating docs for package matcher...
dartdoc:stdout: Generating docs for package material_color_utilities...
dartdoc:stdout: Generating docs for package meta...
dartdoc:stdout: Generating docs for package path...
dartdoc:stdout: Generating docs for package platform...
dartdoc:stdout: Generating docs for package process...
dartdoc:stdout: Generating docs for package source_span...
dartdoc:stdout: Generating docs for package stack_trace...
dartdoc:stdout: Generating docs for package stream_channel...
dartdoc:stdout: Generating docs for package string_scanner...
dartdoc:stdout: Generating docs for package sync_http...
dartdoc:stdout: Generating docs for package term_glyph...
dartdoc:stdout: Generating docs for package test_api...
dartdoc:stdout: Generating docs for package typed_data...
dartdoc:stdout: Generating docs for package vector_math...
dartdoc:stdout: Generating docs for package vm_service...
dartdoc:stdout: Generating docs for package webdriver...
dartdoc:stderr: Found 0 warnings and 5 errors.
dartdoc:stdout: Documented 157 public libraries in 770.3 seconds
dartdoc:stderr:
dartdoc:stderr: dartdoc 8.0.2 (/usr/local/google/home/sigurdm/.pub-cache/global_packages/dartdoc/bin/dartdoc.dart-3.4.0-186.0.dev.snapshot) failed: encountered 5 errors
dartdoc:stderr: #0      Dartdoc.generateDocs (package:dartdoc/src/dartdoc.dart:247:9)
dartdoc:stderr: <asynchronous suspension>
dartdoc:stderr: #1      Dartdoc.executeGuarded.<anonymous closure> (package:dartdoc/src/dartdoc.dart:274:9)
dartdoc:stderr: <asynchronous suspension>
dartdoc:stderr:

I get some other errors, but not the pub one.

Is this something that used to work, but is now failing? Or a new task that is supposed to work?

@goderbauer
Copy link
Member Author

@sigurdm Thanks for taking a look.

Is this something that used to work, but is now failing? Or a new task that is supposed to work?

This used to work about 8 month ago when I last worked on the docs.

I get some other errors, but not the pub one.

The error you're seeing is dart-lang/sdk#55056, which is fixed, but hasn't rolled into flutter yet. You can work around it by disabling analytics for dart with dart --disable-analytics. Once you do that, you should be seeing the error I posted above.

@goderbauer goderbauer added P2 Important issues not at the top of the work list triaged-framework Triaged by Framework team labels Mar 4, 2024
@a-siva
Copy link
Contributor

a-siva commented Mar 6, 2024

can this be closed as the issue is fixed on the dart side

@goderbauer
Copy link
Member Author

Where/how was this problem fixed on the dart side?

@a-siva
Copy link
Contributor

a-siva commented Mar 7, 2024

I was looking at your comment above about dart-lang/sdk#55056 and assumed that was the fix, if that is not the case let me know and I will direct this issue to the appropriate team

@sigurdm
Copy link
Contributor

sigurdm commented Mar 7, 2024

@a-siva - that was a fix for another problem, that I saw while trying to reproduce. And that other problem has indeed been fixed, but is not the one this issue is about.

For now this looks like a pub issue - I will try to find time to look at it.

Is p2 the correct priority, since this has a workaround?

@sigurdm
Copy link
Contributor

sigurdm commented Mar 7, 2024

Are you running things in parallel?

@goderbauer
Copy link
Member Author

Are you running things in parallel?

I don't think there's anything running in parallel. Although, I don't know for sure if dartdoc is parallelizing anything with tool invocations (maybe @srawlins can speak to that with more certainty).

Is p2 the correct priority, since this has a workaround?

The only lower P-level we have would be P3, which is basically for something that'll never get fixed. Despite the work around, I am hoping that this can eventually get fixed since it makes working on our documentation somewhat painful. It's not super time-critical since this is not a workflow we execute every day, though.

@srawlins
Copy link
Contributor

srawlins commented Mar 7, 2024

Are you running things in parallel?

I don't think there's anything running in parallel. Although, I don't know for sure if dartdoc is parallelizing anything with tool invocations (maybe @srawlins can speak to that with more certainty).

That's entirely possible actually.

@eliasyishak
Copy link
Contributor

Where/how was this problem fixed on the dart side?

There was a bug in the analytics package that likely caused this error based on the outputted logs above, the analytics version should be getting bumped in the sdk to fix this: https://dart-review.googlesource.com/c/sdk/+/358220

@goderbauer
Copy link
Member Author

@eliasyishak That analytics error was a separate problem that we saw while reproducing the other problem the original post is about. As far as I can tell, that original problem is not fixed yet (and likely unrelated to analytics).

@a-siva
Copy link
Contributor

a-siva commented Mar 27, 2024

@sigurdm are you the right owner for this issue ?

@sigurdm
Copy link
Contributor

sigurdm commented Apr 11, 2024

Tried reproducing again

> git clone https://github.com/flutter/assets-for-api-docs
...
> cd assets-for-api-docs/packages/snippets/
snippets (main)> dart pub global activate -spath .
Resolving dependencies... (2.5s)
..
Activated snippets 0.4.3 at path "/usr/local/google/home/sigurdm/projects/assets-for-api-docs/packages/snippets".
~/p/a/p/snippets (main)> cd ~/projects/flutter/
~/p/flutter ((3.20.0-15.0.pre))> dev/bots/docs.sh
Thu Apr 11 10:39:20 AM UTC 2024: Running docs.sh
....
Docs ready to go!
Documentation written to /tmp/dartdoc.0kf7F/doc
Removing staging documentation output from /tmp/dartdoc.0kf7F
Wrote docs ZIP file to /usr/local/google/home/sigurdm/projects/flutter/dev/docs/api_docs.zip

Not sure how using a local version is supposed to work, as the dev/bots/docs.sh script always activates a fixed version of snippets before starting processing.

My only guess as to what happened is that we global run snippet twice concurrently, each of them finds that the snapshot needs recompilation, and after recompilation they replace the binstub, and the two executions race.

Probably we don't need to delete the binstub before rewriting it in:
https://github.com/dart-lang/pub/blob/ed20b45589766d6fd135e93460b9e8255ccba519/lib/src/global_packages.dart#L621

And probably we could write the binstub to a temp-file, chmod it there, and do an atomic move.

Filed dart-lang/pub#4216

I would highly suggest you don't rely on pub global for doing scripted processing, it messes with the user-wide configuration.

Why is snippets not a dependency of the dev/tools/pubspec.yaml? Then it could be invoked with dart run snippets local to current context. And testing a local version could happen by making a path dependency-override.
(Not sure how snippets i invoked, perhaps you need an executable?, then I would urge you to write your own invocation script, and inject that into PATH when needed.`).

@sigurdm
Copy link
Contributor

sigurdm commented Apr 11, 2024

Reading the code again, we already create the binstub atomically since dart-lang/pub#3285

Are you using a dart sdk from before that? Otherwise the error message should also not be
"Could not make "/Users/goderbauer/.pub-cache/bin/snippets" executable (exit code 1):" but refer to a temp directory in the cache.

@goderbauer
Copy link
Member Author

goderbauer commented Apr 11, 2024

Thanks for looking into this!

Not sure how using a local version is supposed to work, as the dev/bots/docs.sh script always activates a fixed version of snippets before starting processing.

As mentioned in my original post: You have to modify the script here to activate a local version.

I would highly suggest you don't rely on pub global for doing scripted processing, it messes with the user-wide configuration.

Agreed, that this could be improved. I don't know how to set this up with the dartdocs generation (see below).

Not sure how snippets i invoked

Dartdoc is configured here to invoke it.

Are you using a dart sdk from before that?

The problem still reproduces for me today with tip of tree flutter using Dart SDK version: 3.5.0-47.0.dev.

@sigurdm
Copy link
Contributor

sigurdm commented Apr 12, 2024

As mentioned in my original post: You have to modify the script here to activate a local version.

Oh sorry - completely misread that - I need more coffee.

The problem still reproduces for me today with tip of tree flutter using Dart SDK version: 3.5.0-47.0.dev.

Yes! - I found the bug! https://github.com/dart-lang/pub/pull/3285/files#diff-609b203653065d15282bde9c47cbf5c38885fa92957ce5b89adbf9be5db0b1c8R793 joins an absolute path to the temp-path, effectively using just the absolute path. Made it look like the temp-path wasn't used at all

Will make a fix!

@sigurdm
Copy link
Contributor

sigurdm commented Apr 12, 2024

Fix is taking a bit longer than expected. There are a few more races involved.

@goderbauer
Copy link
Member Author

Awesome. Thanks for debugging this!

@srawlins
Copy link
Contributor

Wow, thanks @sigurdm!! Great find!!

@sigurdm
Copy link
Contributor

sigurdm commented Apr 15, 2024

Wow, thanks @sigurdm!! Great find!!

(Thanks - Not sure how proud I am - I created this bug in the first place :) )

@gspencergoog
Copy link
Contributor

This now appears to be causing the build to break. Not sure what changed so that the build machines now fail as well as running it locally, but maybe it's just some race condition in Linux that changed when it was updated.

@gspencergoog gspencergoog added P0 Critical issues such as a build break or regression and removed P2 Important issues not at the top of the work list labels May 1, 2024
@gspencergoog
Copy link
Contributor

Returning this to P2 priority now that dart-lang/pub#4205 has been reverted in dart-lang/pub#4255.

@gspencergoog gspencergoog added P2 Important issues not at the top of the work list and removed P0 Critical issues such as a build break or regression labels May 1, 2024
auto-submit bot pushed a commit that referenced this issue May 3, 2024
## Description

This moves the snippets package back into the Flutter repo so that API documentation generation can happen without the use of `dart pub global run` because `pub run` doesn't handle concurrency well.

The change modifies the dartdoc building process to include building an executable from the snippets tool and installing that in the cache directory for use during docs generation.

The snippets tool will reside in dev/snippets, where it originally resided before being moved to https://github.com/flutter/assets-for-api-docs.

The snippets code itself is unchanged from the code that is in https://github.com/flutter/assets-for-api-docs/packages/snippets.

## Related Issues
 - #144408
 - #147609
 - #147645

## Tests
 - Added snippets tests to the overall testing build.
auto-submit bot pushed a commit that referenced this issue May 7, 2024
…l. (#147893)

## Description

This fixes the API doc generation that I broke when I moved the snippets tool into the framework.

It removes the last of the template support (properly this time), and makes sure all of the tests pass.

## Related Issues
 - #144408
 - #147609
 - #147645

## Tests
 - Fixed tests, including smoke test of doc generation.
itsjustkevin pushed a commit to itsjustkevin/flutter that referenced this issue May 8, 2024
This moves the snippets package back into the Flutter repo so that API documentation generation can happen without the use of `dart pub global run` because `pub run` doesn't handle concurrency well.

The change modifies the dartdoc building process to include building an executable from the snippets tool and installing that in the cache directory for use during docs generation.

The snippets tool will reside in dev/snippets, where it originally resided before being moved to https://github.com/flutter/assets-for-api-docs.

The snippets code itself is unchanged from the code that is in https://github.com/flutter/assets-for-api-docs/packages/snippets.

 - flutter#144408
 - flutter#147609
 - flutter#147645

 - Added snippets tests to the overall testing build.
itsjustkevin pushed a commit to itsjustkevin/flutter that referenced this issue May 8, 2024
…l. (flutter#147893)

## Description

This fixes the API doc generation that I broke when I moved the snippets tool into the framework.

It removes the last of the template support (properly this time), and makes sure all of the tests pass.

## Related Issues
 - flutter#144408
 - flutter#147609
 - flutter#147645

## Tests
 - Fixed tests, including smoke test of doc generation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
d: api docs Issues with https://api.flutter.dev/ dependency: dart Dart team may need to help us found in release: 3.20 Found to occur in 3.20 framework flutter/packages/flutter repository. See also f: labels. has reproducible steps The issue has been confirmed reproducible and is ready to work on P2 Important issues not at the top of the work list team-framework Owned by Framework team triaged-framework Triaged by Framework team
Projects
None yet
Development

No branches or pull requests

7 participants