Support a configurable build directory (#5601)
This change adds a top-level getBuildDirectory func and funcs for
android, aot, asset, ios build products.
Developers may now add a "build-dir" mapping to their
~/.flutter_settings (JSON format) config file. Output directory is
relative to the main flutter application directory.
This change also changes the default build directory for iOS builds to a
subdirectory of the configured build directory, 'build/ios' by default.
diff --git a/packages/flutter_tools/lib/src/devfs.dart b/packages/flutter_tools/lib/src/devfs.dart
index 80a40f2..4c515d0 100644
--- a/packages/flutter_tools/lib/src/devfs.dart
+++ b/packages/flutter_tools/lib/src/devfs.dart
@@ -9,6 +9,7 @@
import 'package:path/path.dart' as path;
import 'base/logger.dart';
+import 'build_info.dart';
import 'dart/package_map.dart';
import 'asset.dart';
import 'globals.dart';
@@ -335,9 +336,10 @@
status = logger.startProgress('Scanning asset files...');
// Synchronize asset bundle.
for (AssetBundleEntry entry in bundle.entries) {
- // We write the assets into 'build/flx' so that they are in the
- // same location in DevFS and the iOS simulator.
- final String devicePath = path.join('build/flx', entry.archivePath);
+ // We write the assets into the AssetBundle working dir so that they
+ // are in the same location in DevFS and the iOS simulator.
+ final String devicePath =
+ path.join(getAssetBuildDirectory(), entry.archivePath);
_scanBundleEntry(devicePath, entry, bundleDirty);
}
status.stop(showElapsedTime: true);
@@ -457,7 +459,7 @@
bool _shouldIgnore(String devicePath) {
List<String> ignoredPrefixes = <String>['android/',
- 'build/',
+ getBuildDirectory(),
'ios/',
'.pub/'];
for (String ignoredPrefix in ignoredPrefixes) {