Skip to content

Glob patterns with subdirectories whose parent directory does not exist fail #1999

Closed
dart-archive/glob
#60
@Xiphoseer

Description

@Xiphoseer

While writing my second Builder, I encountered the following:

$ dart run build_runner build
Building package executable...
Built build_runner:build_runner.
[INFO] Generating build script completed, took 235ms
[WARNING] Invalidated precompiled build script due to missing asset graph.
[INFO] Precompiling build script... completed, took 4.6s
[SEVERE] Nothing can be built, yet a build was requested.
[INFO] Initializing inputs

You have hit a bug in build_runner
Please file an issue with reproduction steps at https://github.com/dart-lang/build/issues


FileSystemException: Directory listing failed, path = 'c:\<path to project>\not\*' (OS Error: The system cannot find the path specified.
, errno = 3)
Instance of '_StringStackTrace'

Steps to reproduce

  1. Create a new dart package (e.g. using dart create -t package-simple bug_report)
  2. Add build_runner: to dev_dependencies in pubspec.yaml
  3. Add the build.yaml below
  4. Invoke build_runner (e.g. using dart run build_runner build) on Windows
# build.yaml
targets:
  $default:
    sources:
      include:
      - $package$
      - lib/$lib$
      - not/exists/**

Expected Results

Nothing. <path to project>/not doesn't exist and shouldn't cause anything. I.e. exactly what happens when includeing just not/**. Under WSL/Ubuntu, the same example package doesn't crash.

What builder(s) you are using (or writing yourself).

I'm writing a builder that is supposed to take data from a JSON file and turn it into dart classes at build time.

Context: We're looking for a way to turn ISO alpha-2 codes into localized country names using CLDR data without using a plugin (which limits platform choices) or one of the many packages with vendored lists (usually limited to english names). Essentially, something akin to how date_symbol_data_local is generated.

In practice I'm npm installing https://www.npmjs.com/package/cldr-localenames-modern as a lightweight alternative to vendoring https://github.com/unicode-org/cldr-json/tree/main/cldr-json/cldr-localenames-modern as files or a git submodule.

I'm currently debugging why the JSON files (located in <path to project>/sub_package/node_modules/...) are not passed to the builder instance created (it prints a log statement) for the $default target in sub_package when running build_runner build on the root project. I still don't know why not, but that's a different issue (also hit dart-lang/build#2835 in the process).

However, includeing sub_package/node_modules/** as test on whether the working directory was somehow wrong is how I encountered this bug.

Dart SDK Version

$ flutter pub --version
Flutter 2.10.4 • channel stable • https://github.com/flutter/flutter.git
Framework • revision c860cba910 (4 weeks ago) • 2022-03-25 00:23:12 -0500
Engine • revision 57d3bac3dd
Tools • Dart 2.16.2 • DevTools 2.9.2

What package(s) from this repo you are using, and the version

build: 2.3.0
build_config: 1.0.0
build_runner: 2.1.10

Whether you are using Windows, MacOSX, or Linux

Windows 11

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions