Skip to content

Several Flutter tools doesn't use Dart language versioning #70084

Closed

Description

@mit-mit

Discovered while doing #70078: The logic in flutter updates-packages calculates package versions by writing a temporary pubspec.yaml file. This file doesn't have an SDK constraint, so it's language version is undefined.

/// Generates the source of a fake pubspec.yaml file given a list of
/// dependencies.
String _generateFakePubspec(Iterable<PubspecDependency> dependencies) {
  final StringBuffer result = StringBuffer();
  final StringBuffer overrides = StringBuffer();
  result.writeln('name: flutter_update_packages');
  result.writeln('dependencies:');
  overrides.writeln('dependency_overrides:');

https://github.com/flutter/flutter/blob/master/packages/flutter_tools/lib/src/commands/update_packages.dart#L1261

Activity

  1. changed the title [-]flutter updates-packages doesn't use Dart language versioning[/-] [+]Several Flutter tools doesn't use Dart language versioning[/+] on Nov 9, 2020
  2. mit-mit commented on Nov 9, 2020

    @mit-mit
    MemberAuthor

    dev/tool/dartdoc.dart is another instance of this:

      // Create the pubspec.yaml file.
      final StringBuffer buf = StringBuffer();
      buf.writeln('name: $kDummyPackageName');
      buf.writeln('homepage: https://flutter.dev');
      // TODO(dnfield): Re-factor for proper versioning, https://github.com/flutter/flutter/issues/55409
      buf.writeln('version: 0.0.0');

    https://github.com/flutter/flutter/blob/master/dev/tools/dartdoc.dart#L53

  3. johnpryan commented on Nov 9, 2020

    @johnpryan
    Contributor

    I think this might be causing the doc generation script (dev/bots/docs.sh) to fail:

    output
    dartdoc:stderr: , from material.DataTable: (file:///Users/ryjohn/code/tmp/flutter/packages/flutter/lib/src/material/data_table.dart:384:7)
    dartdoc:stderr:   error: tool execution failed: Tool "snippet" returned non-zero exit code (64) when run as "/Users/ryjohn/code/tmp/flutter/bin/cache/dart-sdk/bin/dart /var/folders/3q/2gm34ftd37n43w9sxr09h0d000m6cw/T/dartdoc_snapshot_cache_WAZpHV/snapshot_0 --type=snippet" from /Users/ryjohn/code/tmp/flutter/dev/docs
    dartdoc:stderr: Input to snippet was:
    dartdoc:stderr:
    dartdoc:stderr: This sample creates a [MaterialApp] widget that stores `ThemeData` and
    dartdoc:stderr: passes the `ThemeData` to descendant widgets. The [AppBar] widget uses the
    dartdoc:stderr: [primaryColor] to create a blue background. The [Text] widget uses the
    dartdoc:stderr: [TextTheme.bodyText2] to create purple text. The [FloatingActionButton] widget
    dartdoc:stderr: uses the [accentColor] to create a green background.
    dartdoc:stderr:
    dartdoc:stderr: ![](https://flutter.github.io/assets-for-api-docs/assets/material/material_app_theme_data.png)
    dartdoc:stderr:
    dartdoc:stderr: ```dart
    dartdoc:stderr: MaterialApp(
    dartdoc:stderr:   theme: ThemeData(
    dartdoc:stderr:     primaryColor: Colors.blue,
    dartdoc:stderr:     accentColor: Colors.green,
    dartdoc:stderr:     textTheme: TextTheme(bodyText2: TextStyle(color: Colors.purple)),
    dartdoc:stderr:   ),
    dartdoc:stderr:   home: Scaffold(
    dartdoc:stderr:     appBar: AppBar(
    dartdoc:stderr:       title: const Text('ThemeData Demo'),
    dartdoc:stderr:     ),
    dartdoc:stderr:     floatingActionButton: FloatingActionButton(
    dartdoc:stderr:       child: const Icon(Icons.add),
    dartdoc:stderr:       onPressed: () {},
    dartdoc:stderr:     ),
    dartdoc:stderr:     body: Center(
    dartdoc:stderr:       child: Text(
    dartdoc:stderr:         'Button pressed 0 times',
    dartdoc:stderr:       ),
    dartdoc:stderr:     ),
    dartdoc:stderr:   ),
    dartdoc:stderr: )
    dartdoc:stderr: ```
    dartdoc:stderr: Stderr output was:
    dartdoc:stderr: Could not find an option named "type".
    dartdoc:stderr:
    dartdoc:stderr: Usage: dart [<vm-flags>] <command|dart-file> [<arguments>]
    dartdoc:stderr:
    dartdoc:stderr: Global options:
    dartdoc:stderr: -h, --help                 Print this usage information.
    dartdoc:stderr: -v, --verbose              Show additional command output.
    dartdoc:stderr:     --version              Print the Dart SDK version.
    dartdoc:stderr:     --enable-analytics     Enable anonymous analytics.
    dartdoc:stderr:     --disable-analytics    Disable anonymous analytics.
    dartdoc:stderr:
    dartdoc:stderr: Available commands:
    dartdoc:stderr:   analyze   Analyze the project's Dart code.
    dartdoc:stderr:   compile   Compile Dart to various formats.
    dartdoc:stderr:   create    Create a new project.
    dartdoc:stderr:   format    Idiomatically format Dart source code.
    dartdoc:stderr:   migrate   Perform a null safety migration on a project or package.
    dartdoc:stderr:   pub       Work with packages.
    dartdoc:stderr:   run       Run a Dart program.
    dartdoc:stderr:   test      Run tests in this package.
    dartdoc:stderr:
    dartdoc:stderr: Run "dart help <command>" for more information about a command.
    dartdoc:stderr: See https://dart.dev/tools/dart-tool for detailed documentation.
    
  4. jmagman commented on Nov 10, 2020

    @jmagman
    Member

    I split the dartdoc request out to #70239 \cc @johnpryan. @jonahwilliams is looking into the flutter updates-packages piece.

  5. jonahwilliams commented on Nov 11, 2020

    @jonahwilliams
    Contributor

    Looks like this one was fixed with 168ad5d, closing.

    Thanks @mit-mit !

  6. github-actions commented on Aug 10, 2021

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  7. locked as resolved and limited conversation to collaborators on Aug 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    toolAffects the "flutter" command-line tool. See also t: labels.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions