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

"flutter" tool poorly handles there being a file called "build" in the project directory #5661

Open
DaveShuckerow opened this issue Aug 30, 2016 · 5 comments
Labels
a: quality A truly polished experience P3 Issues that are less important to the Flutter project team-tool Owned by Flutter Tool team tool Affects the "flutter" command-line tool. See also t: labels. triaged-tool Triaged by Flutter Tool team

Comments

@DaveShuckerow
Copy link
Contributor

If a project directory contains a file named 'build', there will be a name collision with Flutter's build directory.

To my understanding, there also exists a system-level configuration to specify the name of the build directory, but this would be impractical to configure on a team with a large number of people switching between projects based out of different version control systems.

Is there or can there be a way to avoid this name collision on a project scale?

(if you would like additional clarification, feel free to ping me)

@cbracken
Copy link
Member

For reference, the user-level config is to set a value for build-dir in the ~/.flutter_settings (JSON format) config file; e.g.:

{"build-dir": "out"}

One option would be to support a project-level output dir in flutter.yaml, defaulted to the current default value build. Most of what's in there today describes build inputs (assets, configuration) rather than build outputs, but if this seems generally useful enough, it'd be a relatively small change.

@eseidelGoogle
Copy link
Contributor

As noted in #6064, mostly our error handling in this case is poor. FYI @danrubel

@eseidelGoogle
Copy link
Contributor

Our failure mode is still pretty bad. If you rm -rf build && touch build before flutter run we print this and then hang:

Launching lib/main.dart on iPhone 6s in debug mode...
Exception from flutter run: FileSystemException: Creation failed, path = 'build' (OS Error: Not a directory, errno = 20)
dart:io                                                   _Directory.createSync
package:file/src/forwarding/forwarding_directory.dart 15  _LocalFileSystemEntity&ForwardingDirectory.createSync
package:flutter_tools/src/base/file_system.dart 29        ensureDirectoryExists
package:flutter_tools/src/flx.dart 162                    assemble.<async>
dart:async                                                _SyncCompleter.complete
package:flutter_tools/src/asset.dart 148                  AssetBundle.build.<async>
dart:async                                                _SyncCompleter.complete
package:flutter_tools/src/asset.dart 294                  _obtainLicenses.<async>
===== asynchronous gap ===========================
dart:async                                                _Completer.completeError
package:flutter_tools/src/flx.dart 169                    assemble.<async>
dart:async                                                _SyncCompleter.complete
package:flutter_tools/src/asset.dart 148                  AssetBundle.build.<async>
dart:async                                                _SyncCompleter.complete
package:flutter_tools/src/asset.dart 294                  _obtainLicenses.<async>
===== asynchronous gap ===========================
dart:async                                                _asyncThenWrapperHelper
package:flutter_tools/src/flx.dart                        assemble
package:flutter_tools/src/flx.dart 113                    build.<async>
===== asynchronous gap ===========================
dart:async                                                Future.Future.microtask
package:flutter_tools/src/flx.dart                        build
package:flutter_tools/src/ios/simulators.dart 527         IOSSimulator._sideloadUpdatedAssetsForInstalledApplicationBundle
package:flutter_tools/src/ios/simulators.dart 502         IOSSimulator._setupUpdatedApplicationBundle.<async>
===== asynchronous gap ===========================
dart:async                                                Future.Future.microtask
package:flutter_tools/src/ios/simulators.dart             IOSSimulator._setupUpdatedApplicationBundle
package:flutter_tools/src/ios/simulators.dart 426         IOSSimulator.startApp.<async>
===== asynchronous gap ===========================
dart:async                                                Future.Future.microtask
package:flutter_tools/src/ios/simulators.dart             IOSSimulator.startApp
package:flutter_tools/src/run_hot.dart 161                HotRunner._run.<async>
dart:async                                                _SyncCompleter.complete
package:flutter_tools/src/resident_runner.dart 185        ResidentRunner.startEchoingDeviceLog.<async>
===== asynchronous gap ===========================
dart:async                                                _asyncThenWrapperHelper
package:flutter_tools/src/run_hot.dart                    HotRunner._run
package:flutter_tools/src/run_hot.dart 78                 HotRunner.run.<fn>
package:stack_trace                                       Chain.capture
package:flutter_tools/src/run_hot.dart 77                 HotRunner.run
package:flutter_tools/src/commands/run.dart 278           RunCommand.runCommand.<async>

@eseidelGoogle eseidelGoogle added tool Affects the "flutter" command-line tool. See also t: labels. easy fix labels Feb 3, 2017
@cbracken
Copy link
Member

cbracken commented Feb 4, 2017

Giant stack trace should be fixed now (#7874).

@Hixie
Copy link
Contributor

Hixie commented Jan 15, 2018

Now you get a giant dump from Gradle instead.

I think it's reasonable for us to reserve the "build" directory name, but we should handle the case of it being a file much better.

@Hixie Hixie changed the title Possibility for build directory to collide with a file named build "flutter" tool poorly handles there being a file called "build" in the project directory Jan 15, 2018
@Hixie Hixie removed the easy fix label Jan 15, 2018
@Hixie Hixie modified the milestones: Stretch Goals, New Stretch Goals Jan 7, 2020
@zanderso zanderso added the a: quality A truly polished experience label Mar 5, 2020
@kf6gpe kf6gpe added the P3 Issues that are less important to the Flutter project label May 29, 2020
@kf6gpe kf6gpe modified the milestone: Stretch Goals Jun 1, 2020
@Hixie Hixie removed this from the [DEPRECATED] Stretch Goals milestone Jun 16, 2020
@kf6gpe kf6gpe removed this from the [DEPRECATED] Stretch Goals milestone Jul 7, 2020
@kf6gpe kf6gpe modified the milestone: [DEPRECATED] Stretch Goals Jul 22, 2020
@Hixie Hixie removed this from the - milestone Aug 17, 2020
@flutter-triage-bot flutter-triage-bot bot added the team-tool Owned by Flutter Tool team label Jul 8, 2023
@flutter-triage-bot flutter-triage-bot bot added the triaged-tool Triaged by Flutter Tool team label Jul 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a: quality A truly polished experience P3 Issues that are less important to the Flutter project team-tool Owned by Flutter Tool team tool Affects the "flutter" command-line tool. See also t: labels. triaged-tool Triaged by Flutter Tool team
Projects
None yet
Development

No branches or pull requests

6 participants