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 overwrite inputs" #175

Closed
filiph opened this issue Jan 23, 2017 · 12 comments · Fixed by #185
Closed

"Cannot overwrite inputs" #175

filiph opened this issue Jan 23, 2017 · 12 comments · Fixed by #185
Assignees
Labels
P1 A high priority bug; for example, a single project is unusable or has many test failures package:build_runner type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@filiph
Copy link

filiph commented Jan 23, 2017

When running the watcher for a while, it starts failing with "Cannot overwrite inputs."

[INFO] Build: Checking build script for updates completed, took 35ms
[INFO] Build: Finalizing build setup completed, took 207ms
[SEVERE] Build: Failed after 255ms
InvalidOutputException: Asset: edgehead|lib/fractal_stories/actor.g.dart
Cannot overwrite inputs.
package:build/src/generate/build_impl.dart 518:11  BuildImpl._runBuilder.<_runBuilder_async_gen_body>
dart:async                                         _AsyncStarStreamController.addError
package:build/src/generate/build_impl.dart 584:3   BuildImpl._runBuilder.<_runBuilder_async_gen_body>
dart:async                                         _StreamIterator.moveNext
package:build/src/generate/build_impl.dart 441:16  BuildImpl._runPhases.<async>.<fn>.<async>
dart:async                                         Future.wait
package:build/src/generate/build_impl.dart 438:20  BuildImpl._runPhases.<async>
dart:async                                         Future.Future.microtask
...

The thing is that this file (actor.g.dart) is generated. It's not an input, at least not to my understanding. Here's my setup.

final PhaseGroup phases = new PhaseGroup.singleAction(
    new GeneratorBuilder([new BuiltValueGenerator()]),
    new InputSet('edgehead', const [
      'lib/fractal_stories/actor.dart',
      'lib/fractal_stories/room.dart',
      'lib/fractal_stories/team.dart',
      'lib/src/**/*_situation.dart',
    ]));

This did not happen when I had a Watcher set up in IntelliJ (that watcher just ran build instead of watch). That worked well but it was also way too slow. So I thought I'd rather run build's watcher in a terminal. That's when I started encountering the problem.

@jakemac53 jakemac53 self-assigned this Jan 25, 2017
@jakemac53
Copy link
Contributor

That is definitely weird, but I can't seem to reproduce it (using the example in the built_json package). I tried switching back and forth between both the build and watch options as well.

Do you know of any consistent repro steps?

@jakemac53
Copy link
Contributor

fwiw, you might be able to just delete your .dart_tool/build directory to solve the issue.

@filiph
Copy link
Author

filiph commented Jan 25, 2017

I just got to a repro, I think. And it's on a clean clone of the repo, so I assume deleting .dart_tool/build would not help me.

git clone https://github.com/filiph/edgehead.git
cd edgehead

Edit pubspec.yaml: delete the dependency on egamebook and switch to pub dependency of slot_machine. Your pubspec should now look like this:

name: edgehead
version: 0.0.1
description: A demo of fractal_stories.
author: Filip Hracek <filip.hracek@gmail.com>
homepage: https://www.egamebook.com

environment:
  sdk: '>=1.21.0 <2.0.0'

dependencies:
  browser: '>=0.10.0 <0.11.0'
  dart_to_js_script_rewriter: '^0.1.0'
  sass: '^0.4.2'
  built_collection: 1.2.0
  built_value: 0.4.3
#  egamebook:
#    path: ../egamebook
  meta: any
  logging: any
  path: any
  slot_machine: any

dev_dependencies:
  build: any
  built_value_generator: any
  simple_preprocessor: any
  source_gen: any
  test: any

transformers:
- simple_preprocessor
- dart_to_js_script_rewriter
- sass

Then:

pub get
dart tool/watch.dart

Wait for initial source gen to finish.

Then open lib/src/fight/fight_situation.dart and start editing that file. (I used sublime so that I know this is not an interference with IntelliJ.)

Add new field to the FightSituation abstract class. Like this:

int get something;

Save. Then immediately after that, add another field:

bool get elserg;

Save.

The build process should go into an infinite loop, complaining about actor.g.dart. If not, try adding more fields or saving with a syntax error.

@jakemac53
Copy link
Contributor

jakemac53 commented Jan 25, 2017

Hmm, I tried doing that but it doesn't seem to be reproing for me :(. Maybe its a mac/windows issue? Are you on one of those platforms?

@filiph
Copy link
Author

filiph commented Jan 25, 2017 via email

@jakemac53
Copy link
Contributor

Ok, I will try it out on my mac later tonight then and see if I can get a repro going.

@filiph
Copy link
Author

filiph commented Jan 25, 2017

Can I run it in some kind of verbose mode that would help you?

@jakemac53
Copy link
Contributor

You can pass a custom log Level (from package:logging) to watch via the logLevel named parameter. If you pass Level.ALL you should get some more output, but I don't know how much that will help (I don't think it logs all things it thinks are inputs for instance).

If you pipe the output to a file it will also be a bit better since when its logging to a terminal it overwrites info messages to keep down on the spam.

@jakemac53
Copy link
Contributor

Ok, I can definitely reproduce this on my mac, taking a look.

@filiph
Copy link
Author

filiph commented Jan 26, 2017

Thanks! Let me know if you want me to proceed with the logging.Level.ALL approach. (I assume you can get more useful info yourself since you can reproduce.)

@jakemac53
Copy link
Contributor

Ya I can take it from here, will let you know if I need anything else.

@jakemac53 jakemac53 added P1 A high priority bug; for example, a single project is unusable or has many test failures package:build_runner S1 high type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) labels Jan 30, 2017
jakemac53 added a commit that referenced this issue Jan 30, 2017
…#185)

As a part of a normal build, invalidated outputs are deleted at the start, causing a `delete` event to be captured by the watcher. This ensures that those delete events are not tracked as real edits, and don't cause an infinite loop of builds.

In practice on linux the add events for the files being recreated were coming through fast enough that we were ignoring the delete events anyways, but on mac it was consistently not happening that way (the add event came through to late for some files, after we started the next build).
@jakemac53
Copy link
Contributor

This should be resolved, but you will need to update to build_runner version 0.3.0. This is going to be temporarily blocked on built_value publishing a new version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 A high priority bug; for example, a single project is unusable or has many test failures package:build_runner type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants