Skip to content Skip to sidebar Skip to footer

Error When Reading 'packages/flutter_tools/.packages': the System Cannot Find the File Specified.

Standalone generator and watcher for Dart using package:build.
Issues related to build_runner Pub Package Version Latest Dartdocs Join the chat on Gitter

The build_runner package provides a concrete way of generating files using Dart lawmaking, outside of tools similar pub. Dissimilar pub serve/build, files are e'er generated straight on deejay, and rebuilds are incremental - inspired by tools such as Bazel.

Note: Are you a user of this package? You may exist interested in simplified user-facing documentation, such as our getting started guide.

  • Installation
  • Usage
    • Built-in commands
    • Inputs
    • Outputs
    • Source control
    • Publishing packages
  • Contributing
    • Testing

This bundle is intended to support development of Dart projects with packet:build. In general, put information technology under dev_dependencies, in your pubspec.yaml.

          dev_dependencies:   build_runner:                  

When the packages providing Builders are configured with a build.yaml file they are designed to exist consumed using an generated build script. Most builders should need little or no configuration, see the documentation provided with the Architect to decide whether the build needs to be customized. If it does you may also provide a build.yaml with the configuration. Encounter the package:build_config README for more information on this file.

To have spider web code compiled to js add together a dev_dependency on build_web_compilers.

Built-in Commands #

The build_runner package exposes a binary past the same proper noun, which can be invoked using dart run build_runner <command>.

The bachelor commands are build, watch, serve, and test.

  • build: Runs a single build and exits.
  • watch: Runs a persistent build server that watches the files system for edits and does rebuilds as necessary.
  • serve: Same as watch, only runs a evolution server as well.
    • By default this serves the web and test directories, on port 8080 and 8081 respectively. Come across beneath for how to configure this.
  • exam: Runs a single build, creates a merged output directory, then runs dart run test --precompiled <merged-output-dir>. Encounter below for instructions on passing custom args to the test command.

Command Line Options

All the in a higher place commands support the post-obit arguments:

  • --help: Impress usage data for the command.
  • --delete-conflicting-outputs: Assume conflicting outputs in the users package are from previous builds, and skip the user prompt that would usually exist provided.
  • --[no-]fail-on-severe: Whether to consider the build a failure on an error logged. By default this is false.

Some commands also have additional options:

serve
  • --hostname: The host to run the server on.
  • --live-reload: Enables automated page reloading on rebuilds.

Trailing args of the form <directory>:<port> are supported to customize what directories are served, and on what ports.

For case to serve the case and spider web directories on ports 8000 and 8001 you would practice dart run build_runner serve example:8000 spider web:8001.

examination

The test command volition forwards any arguments after an empty -- arg to the dart run examination control.

For example if you wanted to pass -p chrome yous would practise dart run build_runner test -- -p chrome.

Valid inputs follow the general dart bundle rules. You lot can read any files under the pinnacle level lib folder any package dependency, and you can read all files from the electric current packet.

In general it is best to be as specific as possible with your InputSets, because all matching files will exist checked against a Builder's buildExtensions - see outputs for more than information.

  • You lot may output files anywhere in the current package.

Notation: When a BuilderApplication specifies hideOutput: true it may output nether the lib binder of whatsoever package you depend on.

  • Builders are not allowed to overwrite existing files, only create new ones.
  • Outputs from previous builds will non be treated as inputs to later ones.
  • Y'all may utilise a previous BuilderApplications'southward outputs as an input to a later action.

This package creates a summit level .dart_tool folder in your package, which should not be submitted to your source control repository. Yous tin run into our ain .gitignore as an instance.

          # Files generated by dart tools .dart_tool                  

When it comes to generated files it is generally best to not submit them to source control, only a specific Builder may provide a recommendation otherwise.

It should be noted that if you lot do submit generated files to your repo and then when you change branches or merge in changes you may get a warning on your next build about declared outputs that already exist. This will be followed up with a prompt to delete those files. Yous can type 50 to list the files, and then blazon y to delete them if everything looks right. If you think something is wrong you can blazon north to carelessness the build without taking whatsoever action.

In full general generated files should be published with your packet, but this may not always be the case. Some Architects may provide a recommendation for this besides.

If the generated script does not do everything you need it's possible to manually write 1. With this approach every parcel which uses a Architect must have it'south own script, they cannot exist reused from other packages. A package which defines a Builder may have an example you can reference, merely a unique script must be written for the consuming packages equally well. Y'all can reference the generated script at .dart_tool/build/entrypoint/build.sprint for an example.

Your script should the run functions divers in this library.

run has a required parameter which is a List<BuilderApplication>. These correspond to the BuilderDefinition class from package:build_config. See apply and applyToRoot to create instances of this class. These will be translated into actions past crawling through dependencies. The guild of this list is important. Each Architect may read the generated outputs of whatever Builder that ran on a bundle earlier in the dependency graph, but for the packet it is running on information technology may merely read the generated outputs from Builders earlier in the listing of BuilderApplications.

Annotation: Any time you change your build script (or any of its dependencies), the next build volition be a full rebuild. This is considering the system has no style of knowing how that change may have affected the outputs.

Nosotros welcome a diverse set of contributions, including, but not express to:

  • Filing bugs and characteristic requests
  • Ship a pull request
  • Or, create something awesome using this API and share with us and others!

For the stability of the API and existing users, consider opening an result starting time before implementing a large new feature or breaking an API. For smaller changes (like documentation, minor bug fixes), merely send a pull request.

All pull requests are validated against CI, and must pass. The build_runner parcel lives in a mono repository with other build packages, and all of the post-obit checks must pass for each parcel.

Ensure code passes all our analyzer checks:

          $ dartanalyzer .                  

Ensure all code is formatted with the latest dev-channel SDK.

          $ dartfmt -w .                  

Run all of our unit tests:

          $ dart run examination                  

Publisher

shield icon for verified publisherstools.dart.dev

A build system for Dart code generation and modular compilation.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-three-Clause (LICENSE)

Dependencies

analyzer, args, async, build, build_config, build_daemon, build_resolvers, build_runner_core, code_builder, collection, crypto, dart_style, frontend_server_client, glob, graphs, http_multi_server, io, js, logging, meta, mime, package_config, path, pool, pub_semver, pubspec_parse, shelf, shelf_web_socket, stack_trace, stream_transform, timing, watcher, web_socket_channel, yaml

More than

Packages that depend on build_runner

lewisquou1993.blogspot.com

Source: https://pub.dev/packages/build_runner

Postar um comentário for "Error When Reading 'packages/flutter_tools/.packages': the System Cannot Find the File Specified."