Skip to content

Commit 4443e4d

Browse files
authored
Cleanup FLX related code (flutter#16416)
1 parent 1ba4336 commit 4443e4d

File tree

16 files changed

+166
-430
lines changed

16 files changed

+166
-430
lines changed

examples/flutter_gallery/BUILD.gn

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,4 @@ flutter_app("flutter_gallery") {
1616
"//third_party/dart-pkg/pub/url_launcher",
1717
]
1818

19-
# TODO(chinmaygarde): Assets must be packaged in the FLX.
2019
}

packages/flutter_tools/bin/fuchsia_asset_builder.dart

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@ import 'package:flutter_tools/src/cache.dart';
1313
import 'package:flutter_tools/src/context_runner.dart';
1414
import 'package:flutter_tools/src/devfs.dart';
1515
import 'package:flutter_tools/src/disabled_usage.dart';
16-
import 'package:flutter_tools/src/flx.dart';
16+
import 'package:flutter_tools/src/bundle.dart';
1717
import 'package:flutter_tools/src/globals.dart';
1818
import 'package:flutter_tools/src/usage.dart';
1919

2020
const String _kOptionPackages = 'packages';
21-
const String _kOptionWorking = 'working-dir';
21+
const String _kOptionAsset = 'asset-dir';
2222
const String _kOptionManifest = 'manifest';
2323
const String _kOptionAssetManifestOut = 'asset-manifest-out';
2424
const List<String> _kRequiredOptions = const <String>[
2525
_kOptionPackages,
26-
_kOptionWorking,
26+
_kOptionAsset,
2727
_kOptionAssetManifestOut,
2828
];
2929

@@ -43,7 +43,7 @@ Future<Null> writeFile(libfs.File outputFile, DevFSContent content) async {
4343
Future<Null> run(List<String> args) async {
4444
final ArgParser parser = new ArgParser()
4545
..addOption(_kOptionPackages, help: 'The .packages file')
46-
..addOption(_kOptionWorking,
46+
..addOption(_kOptionAsset,
4747
help: 'The directory where to put temporary files')
4848
..addOption(_kOptionManifest, help: 'The manifest file')
4949
..addOption(_kOptionAssetManifestOut);
@@ -55,10 +55,10 @@ Future<Null> run(List<String> args) async {
5555
}
5656
Cache.flutterRoot = platform.environment['FLUTTER_ROOT'];
5757

58-
final String workingDir = argResults[_kOptionWorking];
58+
final String assetDir = argResults[_kOptionAsset];
5959
final AssetBundle assets = await buildAssets(
6060
manifestPath: argResults[_kOptionManifest] ?? defaultManifestPath,
61-
workingDirPath: workingDir,
61+
assetDirPath: assetDir,
6262
packagesPath: argResults[_kOptionPackages],
6363
includeDefaultFonts: false,
6464
);
@@ -70,13 +70,13 @@ Future<Null> run(List<String> args) async {
7070

7171
final List<Future<Null>> calls = <Future<Null>>[];
7272
assets.entries.forEach((String fileName, DevFSContent content) {
73-
final libfs.File outputFile = libfs.fs.file(libfs.fs.path.join(workingDir, fileName));
73+
final libfs.File outputFile = libfs.fs.file(libfs.fs.path.join(assetDir, fileName));
7474
calls.add(writeFile(outputFile, content));
7575
});
7676
await Future.wait(calls);
7777

7878
final String outputMan = argResults[_kOptionAssetManifestOut];
79-
await writeFuchsiaManifest(assets, argResults[_kOptionWorking], outputMan);
79+
await writeFuchsiaManifest(assets, argResults[_kOptionAsset], outputMan);
8080
}
8181

8282
Future<Null> writeFuchsiaManifest(AssetBundle assets, String outputBase, String fileDest) async {

packages/flutter_tools/bin/fuchsia_builder.dart

Lines changed: 0 additions & 126 deletions
This file was deleted.

packages/flutter_tools/bin/xcode_backend.sh

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ BuildApp() {
8585

8686
RunCommand rm -rf -- "${derived_dir}/Flutter.framework"
8787
RunCommand rm -rf -- "${derived_dir}/App.framework"
88-
RunCommand rm -f -- "${derived_dir}/app.flx"
8988
RunCommand cp -r -- "${framework_path}/Flutter.framework" "${derived_dir}"
9089
RunCommand find "${derived_dir}/Flutter.framework" -type f -exec chmod a-w "{}" \;
9190
RunCommand pushd "${project_path}" > /dev/null
@@ -146,14 +145,13 @@ BuildApp() {
146145
fi
147146

148147
StreamOutput " ├─Assembling Flutter resources..."
149-
RunCommand "${FLUTTER_ROOT}/bin/flutter" --suppress-analytics build flx \
150-
--target="${target_path}" \
151-
--output-file="${derived_dir}/app.flx" \
152-
--snapshot="${build_dir}/snapshot_blob.bin" \
153-
--depfile="${build_dir}/snapshot_blob.bin.d" \
154-
--working-dir="${derived_dir}/flutter_assets" \
155-
${precompilation_flag} \
156-
${local_engine_flag} \
148+
RunCommand "${FLUTTER_ROOT}/bin/flutter" --suppress-analytics build bundle \
149+
--target="${target_path}" \
150+
--snapshot="${build_dir}/snapshot_blob.bin" \
151+
--depfile="${build_dir}/snapshot_blob.bin.d" \
152+
--asset-dir="${derived_dir}/flutter_assets" \
153+
${precompilation_flag} \
154+
${local_engine_flag} \
157155
${preview_dart_2_flag}
158156

159157
if [[ $? -ne 0 ]]; then

packages/flutter_tools/gradle/flutter.gradle

Lines changed: 6 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -302,27 +302,7 @@ class FlutterPlugin implements Plugin<Project> {
302302
}
303303
}
304304

305-
GenerateDependencies dependenciesTask = project.tasks.create(name: "flutterDependencies${variant.name.capitalize()}", type: GenerateDependencies) {
306-
flutterRoot this.flutterRoot
307-
flutterExecutable this.flutterExecutable
308-
buildMode flutterBuildMode
309-
localEngine this.localEngine
310-
localEngineSrcPath this.localEngineSrcPath
311-
targetPath target
312-
previewDart2 previewDart2Value
313-
fileSystemRoots fileSystemRootsValue
314-
fileSystemScheme fileSystemSchemeValue
315-
trackWidgetCreation trackWidgetCreationValue
316-
preferSharedLibrary preferSharedLibraryValue
317-
targetPlatform targetPlatformValue
318-
sourceDir project.file(project.flutter.source)
319-
intermediateDir project.file("${project.buildDir}/${AndroidProject.FD_INTERMEDIATES}/flutter/${variant.name}")
320-
extraFrontEndOptions extraFrontEndOptionsValue
321-
extraGenSnapshotOptions extraGenSnapshotOptionsValue
322-
}
323-
324305
FlutterTask flutterTask = project.tasks.create(name: "flutterBuild${variant.name.capitalize()}", type: FlutterTask) {
325-
dependsOn dependenciesTask
326306
flutterRoot this.flutterRoot
327307
flutterExecutable this.flutterExecutable
328308
buildMode flutterBuildMode
@@ -341,14 +321,14 @@ class FlutterPlugin implements Plugin<Project> {
341321
extraGenSnapshotOptions extraGenSnapshotOptionsValue
342322
}
343323

344-
Task copyFlxTask = project.tasks.create(name: "copyFlutterAssets${variant.name.capitalize()}", type: Copy) {
324+
Task copyFlutterAssetsTask = project.tasks.create(name: "copyFlutterAssets${variant.name.capitalize()}", type: Copy) {
345325
dependsOn flutterTask
346326
dependsOn variant.mergeAssets
347327
dependsOn "clean${variant.mergeAssets.name.capitalize()}"
348328
into variant.mergeAssets.outputDir
349329
with flutterTask.assets
350330
}
351-
variant.outputs[0].processResources.dependsOn(copyFlxTask)
331+
variant.outputs[0].processResources.dependsOn(copyFlutterAssetsTask)
352332
}
353333
if (project.android.hasProperty("applicationVariants")) {
354334
project.android.applicationVariants.all addFlutterDeps
@@ -398,7 +378,7 @@ abstract class BaseFlutterTask extends DefaultTask {
398378
return project.file("${intermediateDir}/snapshot_blob.bin.d")
399379
}
400380

401-
void buildFlx() {
381+
void buildBundle() {
402382
if (!sourceDir.isDirectory()) {
403383
throw new GradleException("Invalid Flutter source directory: ${sourceDir}")
404384
}
@@ -450,7 +430,7 @@ abstract class BaseFlutterTask extends DefaultTask {
450430
args "--local-engine", localEngine
451431
args "--local-engine-src-path", localEngineSrcPath
452432
}
453-
args "build", "flx"
433+
args "build", "bundle"
454434
args "--suppress-analytics"
455435
args "--target", targetPath
456436
if (previewDart2) {
@@ -469,7 +449,6 @@ abstract class BaseFlutterTask extends DefaultTask {
469449
if (trackWidgetCreation) {
470450
args "--track-widget-creation"
471451
}
472-
args "--output-file", "${intermediateDir}/app.flx"
473452
if (buildMode != "debug") {
474453
args "--precompiled"
475454
} else {
@@ -478,17 +457,7 @@ abstract class BaseFlutterTask extends DefaultTask {
478457
args "--snapshot", "${intermediateDir}/snapshot_blob.bin"
479458
}
480459
}
481-
args "--working-dir", "${intermediateDir}/flutter_assets"
482-
}
483-
}
484-
}
485-
486-
class GenerateDependencies extends BaseFlutterTask {
487-
@TaskAction
488-
void build() {
489-
File dependenciesFile = getDependenciesFile();
490-
if (!dependenciesFile.exists()) {
491-
buildFlx()
460+
args "--asset-dir", "${intermediateDir}/flutter_assets"
492461
}
493462
}
494463
}
@@ -565,6 +534,6 @@ class FlutterTask extends BaseFlutterTask {
565534

566535
@TaskAction
567536
void build() {
568-
buildFlx()
537+
buildBundle()
569538
}
570539
}

packages/flutter_tools/lib/src/asset.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ abstract class AssetBundle {
3939
/// Returns 0 for success; non-zero for failure.
4040
Future<int> build({
4141
String manifestPath: _ManifestAssetBundle.defaultManifestPath,
42-
String workingDirPath,
42+
String assetDirPath,
4343
String packagesPath,
4444
bool includeDefaultFonts: true,
4545
bool reportLicensedPackages: false
@@ -87,12 +87,12 @@ class _ManifestAssetBundle implements AssetBundle {
8787
@override
8888
Future<int> build({
8989
String manifestPath: defaultManifestPath,
90-
String workingDirPath,
90+
String assetDirPath,
9191
String packagesPath,
9292
bool includeDefaultFonts: true,
9393
bool reportLicensedPackages: false
9494
}) async {
95-
workingDirPath ??= getAssetBuildDirectory();
95+
assetDirPath ??= getAssetBuildDirectory();
9696
packagesPath ??= fs.path.absolute(PackageMap.globalPackagesPath);
9797
FlutterManifest flutterManifest;
9898
try {
@@ -124,7 +124,7 @@ class _ManifestAssetBundle implements AssetBundle {
124124
packageMap,
125125
flutterManifest,
126126
assetBasePath,
127-
excludeDirs: <String>[workingDirPath, getBuildDirectory()]
127+
excludeDirs: <String>[assetDirPath, getBuildDirectory()]
128128
);
129129

130130
if (assetVariants == null)

0 commit comments

Comments
 (0)