dart-lang / build

A build system for Dart written in Dart
https://pub.dev/packages/build
BSD 3-Clause "New" or "Revised" License
791 stars 211 forks source link

No asset graph found #3772

Closed stryder123451 closed 2 days ago

stryder123451 commented 3 days ago

During build command , build_runner doesn't locate any changes, and also doesn't doesn't delete generated files during clean command: build

[√] Flutter (Channel stable, 3.24.5, on Microsoft Windows [Version 10.0.19045.3803], locale ru-RU)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[√] Chrome - develop for the web
[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.8.3)
[√] Android Studio (version 2023.1)
[√] VS Code (version 1.95.3)
[√] Connected device (4 available)
[√] Network resources
jakemac53 commented 3 days ago

This isn't enough info to go off of, we will need reproduction instructions or more information. It looks like the clean command didn't clean anything up because it didn't have an asset graph from a previous build, which is a requirement to do so.

stryder123451 commented 3 days ago

This isn't enough info to go off of, we will need reproduction instructions or more information. It looks like the clean command didn't clean anything up because it didn't have an asset graph from a previous build, which is a requirement to do so.

Sorry, i just don't know , what info i could give. What can i show you else?

jakemac53 commented 3 days ago

What are the negative effects you are experiencing? These warnings alone are not anything to really worry about - it is mostly just telling you "I don't have a previous build so I don't know what to delete". Did you have a previous build, or maybe you just checked out a new repo and then ran a clean command? If so, there isn't anything we can do here, it is working as intended.

If you really want to clean up the generated files, you can run a new build command (will have to pass --delete-conflicting-outputs I think), and then a clean.

stryder123451 commented 3 days ago

What are the negative effects you are experiencing? These warnings alone are not anything to really worry about - it is mostly just telling you "I don't have a previous build so I don't know what to delete". Did you have a previous build, or maybe you just checked out a new repo and then ran a clean command? If so, there isn't anything we can do here, it is working as intended.

If you really want to clean up the generated files, you can run a new build command (will have to pass --delete-conflicting-outputs I think), and then a clean.

Yes , i have generated file, and after checked a new repo , build_runner doesn't detect any changes. So, yes i want restore detecting function. I've already tried delete all files and run build again , but it also doesn't work. Is there any ways to set new asset path?

jakemac53 commented 3 days ago

Yes , i have generated file, and after checked a new repo , build_runner doesn't detect any changes. So, yes i want restore detecting function. I've already tried delete all files and run build again , but it also doesn't work. Is there any ways to set new asset path?

All you should have to do in order to get an up to date build from a new checkout is run the dart run build_runner build --delete-conflicting-outputs.

If that isn't working, then I would need a full reproduction case or something in order to diagnose the issue.

Most likely, there are some misbehaving builders which are using dart:io to read files directly, so we don't know about their inputs and can't detect changes to them.

stryder123451 commented 3 days ago

Yes , i have generated file, and after checked a new repo , build_runner doesn't detect any changes. So, yes i want restore detecting function. I've already tried delete all files and run build again , but it also doesn't work. Is there any ways to set new asset path?

All you should have to do in order to get an up to date build from a new checkout is run the dart run build_runner build --delete-conflicting-outputs.

If that isn't working, then I would need a full reproduction case or something in order to diagnose the issue.

Most likely, there are some misbehaving builders which are using dart:io to read files directly, so we don't know about their inputs and can't detect changes to them.

I've already tried it's not working, it was drift library. Interesting thing that codegen with drift commands works, but codegen with build runner don't

jakemac53 commented 3 days ago

cc @simolus3 idk if you are aware of anything that would cause that

stryder123451 commented 3 days ago

It works on old repo build runner + drift , after install on new repo from git , build runner stop generate files

simolus3 commented 3 days ago

This is surprising to me as well, drift shouldn't use direct IO APIs to read assets in builds.

@stryder123451, some general troubleshooting questions that come to mind: Do you have a dev-dependency on drift_dev in the directory where you're running build_runner? Does the new repo happen to have a build.yaml file in that directory and if so, could you share it? Since you have it working in another repo, it might be interesting to check for configuration changes (which would mostly be the pubspec and build.yaml files). And to be sure, you don't have any Dart code outside of the "regular" folders like lib/, test/, bin/, example/ and so on, right? If you have a completely custom package layout, build_runner won't recognize that by default.

stryder123451 commented 2 days ago

This is surprising to me as well, drift shouldn't use direct IO APIs to read assets in builds.

If you have a completely custom package layout, build_runner won't recognize that by default.

Yes, i suppose my project have different layout, it's similar to : https://sizzle.lazebny.io/essentials/folder-structure/

So, i suppose, i have to setup build_runner to my layout?

No, i don't have build.yaml my folders hierarchy data database.g.dart being ignored by build_runner. Yes, outside lib folder i have fork from pub.dev

simolus3 commented 2 days ago

So just to clarify, your directory layout in relation to pubspec.yaml looks like this?

sources/
├─ lib/
│  ├─ src/
│  │  ├─ core/
│  │  │  ├─ components/
│  │  │  │  ├─ database/
│  │  │  │  │  ├─ database.dart
lib/
pubspec.yaml

That's not a typical Dart package layout and I suggest you adopt the common conventions to avoid other issues. But you can make build_runner consider files in sources/ by creating a build.yaml file next to pubspec.yaml with the following contents:

additional_public_assets:
  - 'sources/**'
stryder123451 commented 2 days ago

So just to clarify, your directory layout in relation to pubspec.yaml looks like this?

sources/
├─ lib/
│  ├─ src/
│  │  ├─ core/
│  │  │  ├─ components/
│  │  │  │  ├─ database/
│  │  │  │  │  ├─ database.dart
lib/
pubspec.yaml

That's not a typical Dart package layout and I suggest you adopt the common conventions to avoid other issues. But you can make build_runner consider files in sources/ by creating a build.yaml file next to pubspec.yaml with the following contents:

additional_public_assets:
  - 'sources/**'

IT WORKS , THANK YOU MUCH.