Remove legacy scenec stuff from flutter_tool (#163569)
o7 Removes the legacy scenec logic from flutter_tool. We removed scenec from the engine/shipped artifacts long ago. Originally added in https://github.com/flutter/flutter/pull/118157. This has since been replaced by [flutter_scene_importer](https://pub.dev/packages/flutter_scene_importer/versions)!
This commit is contained in:
parent
6018856ece
commit
911aa7547e
@ -122,8 +122,6 @@ enum HostArtifact {
|
|||||||
|
|
||||||
// The Impeller shader compiler.
|
// The Impeller shader compiler.
|
||||||
impellerc,
|
impellerc,
|
||||||
// The Impeller Scene 3D model importer.
|
|
||||||
scenec,
|
|
||||||
// Impeller's tessellation library.
|
// Impeller's tessellation library.
|
||||||
libtessellator,
|
libtessellator,
|
||||||
}
|
}
|
||||||
@ -264,8 +262,6 @@ String _hostArtifactToFileName(HostArtifact artifact, Platform platform) {
|
|||||||
return 'dart_sdk.js.map';
|
return 'dart_sdk.js.map';
|
||||||
case HostArtifact.impellerc:
|
case HostArtifact.impellerc:
|
||||||
return 'impellerc$exe';
|
return 'impellerc$exe';
|
||||||
case HostArtifact.scenec:
|
|
||||||
return 'scenec$exe';
|
|
||||||
case HostArtifact.libtessellator:
|
case HostArtifact.libtessellator:
|
||||||
return 'libtessellator$dll';
|
return 'libtessellator$dll';
|
||||||
}
|
}
|
||||||
@ -480,7 +476,6 @@ class CachedArtifacts implements Artifacts {
|
|||||||
final String artifactFileName = _hostArtifactToFileName(artifact, _platform);
|
final String artifactFileName = _hostArtifactToFileName(artifact, _platform);
|
||||||
return _cache.getArtifactDirectory('usbmuxd').childFile(artifactFileName);
|
return _cache.getArtifactDirectory('usbmuxd').childFile(artifactFileName);
|
||||||
case HostArtifact.impellerc:
|
case HostArtifact.impellerc:
|
||||||
case HostArtifact.scenec:
|
|
||||||
case HostArtifact.libtessellator:
|
case HostArtifact.libtessellator:
|
||||||
final String artifactFileName = _hostArtifactToFileName(artifact, _platform);
|
final String artifactFileName = _hostArtifactToFileName(artifact, _platform);
|
||||||
final String engineDir =
|
final String engineDir =
|
||||||
@ -1147,7 +1142,6 @@ class CachedLocalEngineArtifacts implements Artifacts {
|
|||||||
final String artifactFileName = _hostArtifactToFileName(artifact, _platform);
|
final String artifactFileName = _hostArtifactToFileName(artifact, _platform);
|
||||||
return _cache.getArtifactDirectory('usbmuxd').childFile(artifactFileName);
|
return _cache.getArtifactDirectory('usbmuxd').childFile(artifactFileName);
|
||||||
case HostArtifact.impellerc:
|
case HostArtifact.impellerc:
|
||||||
case HostArtifact.scenec:
|
|
||||||
case HostArtifact.libtessellator:
|
case HostArtifact.libtessellator:
|
||||||
final String artifactFileName = _hostArtifactToFileName(artifact, _platform);
|
final String artifactFileName = _hostArtifactToFileName(artifact, _platform);
|
||||||
final File file = _fileSystem.file(
|
final File file = _fileSystem.file(
|
||||||
@ -1506,7 +1500,6 @@ class CachedLocalWebSdkArtifacts implements Artifacts {
|
|||||||
case HostArtifact.iproxy:
|
case HostArtifact.iproxy:
|
||||||
case HostArtifact.skyEnginePath:
|
case HostArtifact.skyEnginePath:
|
||||||
case HostArtifact.impellerc:
|
case HostArtifact.impellerc:
|
||||||
case HostArtifact.scenec:
|
|
||||||
case HostArtifact.libtessellator:
|
case HostArtifact.libtessellator:
|
||||||
return _parent.getHostArtifact(artifact);
|
return _parent.getHostArtifact(artifact);
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ abstract class AssetBundleFactory {
|
|||||||
AssetBundle createBundle();
|
AssetBundle createBundle();
|
||||||
}
|
}
|
||||||
|
|
||||||
enum AssetKind { regular, font, shader, model }
|
enum AssetKind { regular, font, shader }
|
||||||
|
|
||||||
/// Contains all information about an asset needed by tool the to prepare and
|
/// Contains all information about an asset needed by tool the to prepare and
|
||||||
/// copy an asset file to the build output.
|
/// copy an asset file to the build output.
|
||||||
@ -959,22 +959,6 @@ class ManifestAssetBundle implements AssetBundle {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (final Uri modelUri in flutterManifest.models) {
|
|
||||||
_parseAssetFromFile(
|
|
||||||
packageConfig,
|
|
||||||
flutterManifest,
|
|
||||||
assetBase,
|
|
||||||
cache,
|
|
||||||
result,
|
|
||||||
modelUri,
|
|
||||||
packageName: packageName,
|
|
||||||
attributedPackage: attributedPackage,
|
|
||||||
assetKind: AssetKind.model,
|
|
||||||
flavors: <String>{},
|
|
||||||
transformers: <AssetTransformerEntry>[],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add assets referenced in the fonts section of the manifest.
|
// Add assets referenced in the fonts section of the manifest.
|
||||||
for (final Font font in flutterManifest.fonts) {
|
for (final Font font in flutterManifest.fonts) {
|
||||||
for (final FontAsset fontAsset in font.fontAssets) {
|
for (final FontAsset fontAsset in font.fontAssets) {
|
||||||
|
@ -16,7 +16,6 @@ import '../build_system.dart';
|
|||||||
import '../depfile.dart';
|
import '../depfile.dart';
|
||||||
import '../exceptions.dart';
|
import '../exceptions.dart';
|
||||||
import '../tools/asset_transformer.dart';
|
import '../tools/asset_transformer.dart';
|
||||||
import '../tools/scene_importer.dart';
|
|
||||||
import '../tools/shader_compiler.dart';
|
import '../tools/shader_compiler.dart';
|
||||||
import 'common.dart';
|
import 'common.dart';
|
||||||
import 'icon_tree_shaker.dart';
|
import 'icon_tree_shaker.dart';
|
||||||
@ -83,12 +82,6 @@ Future<Depfile> copyAssets(
|
|||||||
fileSystem: environment.fileSystem,
|
fileSystem: environment.fileSystem,
|
||||||
artifacts: environment.artifacts,
|
artifacts: environment.artifacts,
|
||||||
);
|
);
|
||||||
final SceneImporter sceneImporter = SceneImporter(
|
|
||||||
processManager: environment.processManager,
|
|
||||||
logger: environment.logger,
|
|
||||||
fileSystem: environment.fileSystem,
|
|
||||||
artifacts: environment.artifacts,
|
|
||||||
);
|
|
||||||
final AssetTransformer assetTransformer = AssetTransformer(
|
final AssetTransformer assetTransformer = AssetTransformer(
|
||||||
processManager: environment.processManager,
|
processManager: environment.processManager,
|
||||||
fileSystem: environment.fileSystem,
|
fileSystem: environment.fileSystem,
|
||||||
@ -160,12 +153,6 @@ Future<Depfile> copyAssets(
|
|||||||
outputPath: file.path,
|
outputPath: file.path,
|
||||||
targetPlatform: targetPlatform,
|
targetPlatform: targetPlatform,
|
||||||
);
|
);
|
||||||
case AssetKind.model:
|
|
||||||
doCopy =
|
|
||||||
!await sceneImporter.importScene(
|
|
||||||
input: content.file as File,
|
|
||||||
outputPath: file.path,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
if (doCopy) {
|
if (doCopy) {
|
||||||
await (content.file as File).copy(file.path);
|
await (content.file as File).copy(file.path);
|
||||||
|
@ -1,151 +0,0 @@
|
|||||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style license that can be
|
|
||||||
// found in the LICENSE file.
|
|
||||||
|
|
||||||
import 'dart:math' as math;
|
|
||||||
import 'dart:typed_data';
|
|
||||||
|
|
||||||
import 'package:meta/meta.dart';
|
|
||||||
import 'package:pool/pool.dart';
|
|
||||||
import 'package:process/process.dart';
|
|
||||||
|
|
||||||
import '../../artifacts.dart';
|
|
||||||
import '../../base/error_handling_io.dart';
|
|
||||||
import '../../base/file_system.dart';
|
|
||||||
import '../../base/io.dart';
|
|
||||||
import '../../base/logger.dart';
|
|
||||||
import '../../convert.dart';
|
|
||||||
import '../../devfs.dart';
|
|
||||||
import '../build_system.dart';
|
|
||||||
|
|
||||||
/// A wrapper around [SceneImporter] to support hot reload of 3D models.
|
|
||||||
class DevelopmentSceneImporter {
|
|
||||||
DevelopmentSceneImporter({
|
|
||||||
required SceneImporter sceneImporter,
|
|
||||||
required FileSystem fileSystem,
|
|
||||||
@visibleForTesting math.Random? random,
|
|
||||||
}) : _sceneImporter = sceneImporter,
|
|
||||||
_fileSystem = fileSystem,
|
|
||||||
_random = random ?? math.Random();
|
|
||||||
|
|
||||||
final SceneImporter _sceneImporter;
|
|
||||||
final FileSystem _fileSystem;
|
|
||||||
final Pool _compilationPool = Pool(4);
|
|
||||||
final math.Random _random;
|
|
||||||
|
|
||||||
/// Recompile the input ipscene and return a devfs content that should be
|
|
||||||
/// synced to the attached device in its place.
|
|
||||||
Future<DevFSContent?> reimportScene(DevFSContent inputScene) async {
|
|
||||||
final File output = _fileSystem.systemTempDirectory.childFile('${_random.nextDouble()}.temp');
|
|
||||||
late File inputFile;
|
|
||||||
bool cleanupInput = false;
|
|
||||||
Uint8List result;
|
|
||||||
PoolResource? resource;
|
|
||||||
try {
|
|
||||||
resource = await _compilationPool.request();
|
|
||||||
if (inputScene is DevFSFileContent) {
|
|
||||||
inputFile = inputScene.file as File;
|
|
||||||
} else {
|
|
||||||
inputFile = _fileSystem.systemTempDirectory.childFile('${_random.nextDouble()}.temp');
|
|
||||||
inputFile.writeAsBytesSync(await inputScene.contentsAsBytes());
|
|
||||||
cleanupInput = true;
|
|
||||||
}
|
|
||||||
final bool success = await _sceneImporter.importScene(
|
|
||||||
input: inputFile,
|
|
||||||
outputPath: output.path,
|
|
||||||
fatal: false,
|
|
||||||
);
|
|
||||||
if (!success) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
result = output.readAsBytesSync();
|
|
||||||
} finally {
|
|
||||||
resource?.release();
|
|
||||||
ErrorHandlingFileSystem.deleteIfExists(output);
|
|
||||||
if (cleanupInput) {
|
|
||||||
ErrorHandlingFileSystem.deleteIfExists(inputFile);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return DevFSByteContent(result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A class the wraps the functionality of the Impeller Scene importer scenec.
|
|
||||||
class SceneImporter {
|
|
||||||
SceneImporter({
|
|
||||||
required ProcessManager processManager,
|
|
||||||
required Logger logger,
|
|
||||||
required FileSystem fileSystem,
|
|
||||||
required Artifacts artifacts,
|
|
||||||
}) : _processManager = processManager,
|
|
||||||
_logger = logger,
|
|
||||||
_fs = fileSystem,
|
|
||||||
_artifacts = artifacts;
|
|
||||||
|
|
||||||
final ProcessManager _processManager;
|
|
||||||
final Logger _logger;
|
|
||||||
final FileSystem _fs;
|
|
||||||
final Artifacts _artifacts;
|
|
||||||
|
|
||||||
/// The [Source] inputs that targets using this should depend on.
|
|
||||||
///
|
|
||||||
/// See [Target.inputs].
|
|
||||||
static const List<Source> inputs = <Source>[
|
|
||||||
Source.pattern(
|
|
||||||
'{FLUTTER_ROOT}/packages/flutter_tools/lib/src/build_system/tools/scene_importer.dart',
|
|
||||||
),
|
|
||||||
Source.hostArtifact(HostArtifact.scenec),
|
|
||||||
];
|
|
||||||
|
|
||||||
/// Calls scenec, which transforms the [input] 3D model into an imported
|
|
||||||
/// ipscene at [outputPath].
|
|
||||||
///
|
|
||||||
/// All parameters are required.
|
|
||||||
///
|
|
||||||
/// If the scene importer subprocess fails, it will print the stdout and
|
|
||||||
/// stderr to the log and throw a [SceneImporterException]. Otherwise, it
|
|
||||||
/// will return true.
|
|
||||||
Future<bool> importScene({
|
|
||||||
required File input,
|
|
||||||
required String outputPath,
|
|
||||||
bool fatal = true,
|
|
||||||
}) async {
|
|
||||||
final File scenec = _fs.file(_artifacts.getHostArtifact(HostArtifact.scenec));
|
|
||||||
if (!scenec.existsSync()) {
|
|
||||||
throw SceneImporterException._(
|
|
||||||
'The scenec utility is missing at "${scenec.path}". '
|
|
||||||
'Run "flutter doctor".',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
final List<String> cmd = <String>[scenec.path, '--input=${input.path}', '--output=$outputPath'];
|
|
||||||
_logger.printTrace('scenec command: $cmd');
|
|
||||||
final Process scenecProcess = await _processManager.start(cmd);
|
|
||||||
final int code = await scenecProcess.exitCode;
|
|
||||||
if (code != 0) {
|
|
||||||
final String stdout = await utf8.decodeStream(scenecProcess.stdout);
|
|
||||||
final String stderr = await utf8.decodeStream(scenecProcess.stderr);
|
|
||||||
_logger.printTrace(stdout);
|
|
||||||
_logger.printError(stderr);
|
|
||||||
if (fatal) {
|
|
||||||
throw SceneImporterException._(
|
|
||||||
'Scene import of "${input.path}" to "$outputPath" '
|
|
||||||
'failed with exit code $code.\n'
|
|
||||||
'scenec stdout:\n$stdout\n'
|
|
||||||
'scenec stderr:\n$stderr',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class SceneImporterException implements Exception {
|
|
||||||
SceneImporterException._(this.message);
|
|
||||||
|
|
||||||
final String message;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() => 'SceneImporterException: $message\n\n';
|
|
||||||
}
|
|
@ -15,7 +15,6 @@ import 'build_info.dart';
|
|||||||
import 'build_system/build_system.dart';
|
import 'build_system/build_system.dart';
|
||||||
import 'build_system/depfile.dart';
|
import 'build_system/depfile.dart';
|
||||||
import 'build_system/tools/asset_transformer.dart';
|
import 'build_system/tools/asset_transformer.dart';
|
||||||
import 'build_system/tools/scene_importer.dart';
|
|
||||||
import 'build_system/tools/shader_compiler.dart';
|
import 'build_system/tools/shader_compiler.dart';
|
||||||
import 'bundle.dart';
|
import 'bundle.dart';
|
||||||
import 'cache.dart';
|
import 'cache.dart';
|
||||||
@ -166,13 +165,6 @@ Future<void> writeBundle(
|
|||||||
artifacts: artifacts,
|
artifacts: artifacts,
|
||||||
);
|
);
|
||||||
|
|
||||||
final SceneImporter sceneImporter = SceneImporter(
|
|
||||||
processManager: processManager,
|
|
||||||
logger: logger,
|
|
||||||
fileSystem: fileSystem,
|
|
||||||
artifacts: artifacts,
|
|
||||||
);
|
|
||||||
|
|
||||||
final AssetTransformer assetTransformer = AssetTransformer(
|
final AssetTransformer assetTransformer = AssetTransformer(
|
||||||
processManager: processManager,
|
processManager: processManager,
|
||||||
fileSystem: fileSystem,
|
fileSystem: fileSystem,
|
||||||
@ -225,8 +217,6 @@ Future<void> writeBundle(
|
|||||||
outputPath: file.path,
|
outputPath: file.path,
|
||||||
targetPlatform: targetPlatform,
|
targetPlatform: targetPlatform,
|
||||||
);
|
);
|
||||||
case AssetKind.model:
|
|
||||||
doCopy = !await sceneImporter.importScene(input: input, outputPath: file.path);
|
|
||||||
}
|
}
|
||||||
if (doCopy) {
|
if (doCopy) {
|
||||||
input.copySync(file.path);
|
input.copySync(file.path);
|
||||||
|
@ -525,8 +525,6 @@ final class WidgetPreviewStartCommand extends WidgetPreviewSubCommandBase with C
|
|||||||
|
|
||||||
final List<Uri> shaders = rootManifest.shaders.map(transformAssetUri).toList();
|
final List<Uri> shaders = rootManifest.shaders.map(transformAssetUri).toList();
|
||||||
|
|
||||||
final List<Uri> models = rootManifest.models.map(transformAssetUri).toList();
|
|
||||||
|
|
||||||
final List<DeferredComponent>? deferredComponents =
|
final List<DeferredComponent>? deferredComponents =
|
||||||
rootManifest.deferredComponents?.map(transformDeferredComponent).toList();
|
rootManifest.deferredComponents?.map(transformDeferredComponent).toList();
|
||||||
|
|
||||||
@ -535,7 +533,6 @@ final class WidgetPreviewStartCommand extends WidgetPreviewSubCommandBase with C
|
|||||||
assets: assets,
|
assets: assets,
|
||||||
fonts: fonts,
|
fonts: fonts,
|
||||||
shaders: shaders,
|
shaders: shaders,
|
||||||
models: models,
|
|
||||||
deferredComponents: deferredComponents,
|
deferredComponents: deferredComponents,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,6 @@ import 'base/net.dart';
|
|||||||
import 'base/os.dart';
|
import 'base/os.dart';
|
||||||
import 'build_info.dart';
|
import 'build_info.dart';
|
||||||
import 'build_system/tools/asset_transformer.dart';
|
import 'build_system/tools/asset_transformer.dart';
|
||||||
import 'build_system/tools/scene_importer.dart';
|
|
||||||
import 'build_system/tools/shader_compiler.dart';
|
import 'build_system/tools/shader_compiler.dart';
|
||||||
import 'compile.dart';
|
import 'compile.dart';
|
||||||
import 'convert.dart' show base64, utf8;
|
import 'convert.dart' show base64, utf8;
|
||||||
@ -476,7 +475,6 @@ class DevFS {
|
|||||||
final Directory rootDirectory;
|
final Directory rootDirectory;
|
||||||
final Set<String> assetPathsToEvict = <String>{};
|
final Set<String> assetPathsToEvict = <String>{};
|
||||||
final Set<String> shaderPathsToEvict = <String>{};
|
final Set<String> shaderPathsToEvict = <String>{};
|
||||||
final Set<String> scenePathsToEvict = <String>{};
|
|
||||||
|
|
||||||
// A flag to indicate whether we have called `setAssetDirectory` on the target device.
|
// A flag to indicate whether we have called `setAssetDirectory` on the target device.
|
||||||
bool hasSetAssetDirectory = false;
|
bool hasSetAssetDirectory = false;
|
||||||
@ -564,7 +562,6 @@ class DevFS {
|
|||||||
required PackageConfig packageConfig,
|
required PackageConfig packageConfig,
|
||||||
required String dillOutputPath,
|
required String dillOutputPath,
|
||||||
required DevelopmentShaderCompiler shaderCompiler,
|
required DevelopmentShaderCompiler shaderCompiler,
|
||||||
DevelopmentSceneImporter? sceneImporter,
|
|
||||||
DevFSWriter? devFSWriter,
|
DevFSWriter? devFSWriter,
|
||||||
String? target,
|
String? target,
|
||||||
AssetBundle? bundle,
|
AssetBundle? bundle,
|
||||||
@ -654,23 +651,6 @@ class DevFS {
|
|||||||
shaderPathsToEvict.add(archivePath);
|
shaderPathsToEvict.add(archivePath);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
case AssetKind.model:
|
|
||||||
if (sceneImporter == null) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
final Future<DevFSContent?> pending = sceneImporter.reimportScene(entry.content);
|
|
||||||
pendingAssetBuilds.add(pending);
|
|
||||||
pending.then((DevFSContent? content) {
|
|
||||||
if (content == null) {
|
|
||||||
assetBuildFailed = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
dirtyEntries[deviceUri] = content;
|
|
||||||
syncedBytes += content.size;
|
|
||||||
if (!bundleFirstUpload) {
|
|
||||||
scenePathsToEvict.add(archivePath);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
case AssetKind.regular:
|
case AssetKind.regular:
|
||||||
case AssetKind.font:
|
case AssetKind.font:
|
||||||
case null:
|
case null:
|
||||||
|
@ -16,9 +16,6 @@ import 'base/utils.dart';
|
|||||||
import 'globals.dart' as globals;
|
import 'globals.dart' as globals;
|
||||||
import 'plugins.dart';
|
import 'plugins.dart';
|
||||||
|
|
||||||
/// Whether or not Impeller Scene 3D model import is enabled.
|
|
||||||
const bool kIs3dSceneSupported = true;
|
|
||||||
|
|
||||||
const Set<String> _kValidPluginPlatforms = <String>{
|
const Set<String> _kValidPluginPlatforms = <String>{
|
||||||
'android',
|
'android',
|
||||||
'ios',
|
'ios',
|
||||||
@ -81,7 +78,6 @@ class FlutterManifest {
|
|||||||
List<AssetsEntry>? assets,
|
List<AssetsEntry>? assets,
|
||||||
List<Font>? fonts,
|
List<Font>? fonts,
|
||||||
List<Uri>? shaders,
|
List<Uri>? shaders,
|
||||||
List<Uri>? models,
|
|
||||||
List<DeferredComponent>? deferredComponents,
|
List<DeferredComponent>? deferredComponents,
|
||||||
}) {
|
}) {
|
||||||
final FlutterManifest copy = FlutterManifest._(logger: _logger);
|
final FlutterManifest copy = FlutterManifest._(logger: _logger);
|
||||||
@ -106,12 +102,6 @@ class FlutterManifest {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (models != null && models.isNotEmpty) {
|
|
||||||
copy._flutterDescriptor['models'] = YamlList.wrap(
|
|
||||||
models.map((Uri uri) => uri.toString()).toList(),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (deferredComponents != null && deferredComponents.isNotEmpty) {
|
if (deferredComponents != null && deferredComponents.isNotEmpty) {
|
||||||
copy._flutterDescriptor['deferred-components'] = YamlList.wrap(
|
copy._flutterDescriptor['deferred-components'] = YamlList.wrap(
|
||||||
deferredComponents.map((DeferredComponent dc) => dc.descriptor).toList(),
|
deferredComponents.map((DeferredComponent dc) => dc.descriptor).toList(),
|
||||||
@ -407,8 +397,6 @@ class FlutterManifest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
late final List<Uri> shaders = _extractAssetUris('shaders', 'Shader');
|
late final List<Uri> shaders = _extractAssetUris('shaders', 'Shader');
|
||||||
late final List<Uri> models =
|
|
||||||
kIs3dSceneSupported ? _extractAssetUris('models', 'Model') : <Uri>[];
|
|
||||||
|
|
||||||
List<Uri> _extractAssetUris(String key, String singularName) {
|
List<Uri> _extractAssetUris(String key, String singularName) {
|
||||||
if (!_flutterDescriptor.containsKey(key)) {
|
if (!_flutterDescriptor.containsKey(key)) {
|
||||||
@ -571,18 +559,6 @@ void _validateFlutter(YamlMap? yaml, List<String> errors) {
|
|||||||
'Expected "$yamlKey" to be a list of strings, but the first element is $yamlValue (${yamlValue.runtimeType}).',
|
'Expected "$yamlKey" to be a list of strings, but the first element is $yamlValue (${yamlValue.runtimeType}).',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
case 'models':
|
|
||||||
if (yamlValue is! YamlList) {
|
|
||||||
errors.add(
|
|
||||||
'Expected "$yamlKey" to be a list, but got $yamlValue (${yamlValue.runtimeType}).',
|
|
||||||
);
|
|
||||||
} else if (yamlValue.isEmpty) {
|
|
||||||
break;
|
|
||||||
} else if (yamlValue[0] is! String) {
|
|
||||||
errors.add(
|
|
||||||
'Expected "$yamlKey" to be a list of strings, but the first element is $yamlValue (${yamlValue.runtimeType}).',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
case 'fonts':
|
case 'fonts':
|
||||||
if (yamlValue is! YamlList) {
|
if (yamlValue is! YamlList) {
|
||||||
errors.add(
|
errors.add(
|
||||||
|
@ -24,7 +24,6 @@ import '../base/logger.dart';
|
|||||||
import '../base/net.dart';
|
import '../base/net.dart';
|
||||||
import '../base/platform.dart';
|
import '../base/platform.dart';
|
||||||
import '../build_info.dart';
|
import '../build_info.dart';
|
||||||
import '../build_system/tools/scene_importer.dart';
|
|
||||||
import '../build_system/tools/shader_compiler.dart';
|
import '../build_system/tools/shader_compiler.dart';
|
||||||
import '../bundle_builder.dart';
|
import '../bundle_builder.dart';
|
||||||
import '../cache.dart';
|
import '../cache.dart';
|
||||||
@ -1031,7 +1030,6 @@ class WebDevFS implements DevFS {
|
|||||||
required PackageConfig packageConfig,
|
required PackageConfig packageConfig,
|
||||||
required String dillOutputPath,
|
required String dillOutputPath,
|
||||||
required DevelopmentShaderCompiler shaderCompiler,
|
required DevelopmentShaderCompiler shaderCompiler,
|
||||||
DevelopmentSceneImporter? sceneImporter,
|
|
||||||
DevFSWriter? devFSWriter,
|
DevFSWriter? devFSWriter,
|
||||||
String? target,
|
String? target,
|
||||||
AssetBundle? bundle,
|
AssetBundle? bundle,
|
||||||
@ -1234,9 +1232,6 @@ class WebDevFS implements DevFS {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Set<String> get shaderPathsToEvict => <String>{};
|
Set<String> get shaderPathsToEvict => <String>{};
|
||||||
|
|
||||||
@override
|
|
||||||
Set<String> get scenePathsToEvict => <String>{};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class ReleaseAssetServer {
|
class ReleaseAssetServer {
|
||||||
|
@ -24,7 +24,6 @@ import 'base/terminal.dart';
|
|||||||
import 'base/utils.dart';
|
import 'base/utils.dart';
|
||||||
import 'build_info.dart';
|
import 'build_info.dart';
|
||||||
import 'build_system/build_system.dart';
|
import 'build_system/build_system.dart';
|
||||||
import 'build_system/tools/scene_importer.dart';
|
|
||||||
import 'build_system/tools/shader_compiler.dart';
|
import 'build_system/tools/shader_compiler.dart';
|
||||||
import 'bundle.dart';
|
import 'bundle.dart';
|
||||||
import 'cache.dart';
|
import 'cache.dart';
|
||||||
@ -51,7 +50,6 @@ class FlutterDevice {
|
|||||||
ResidentCompiler? generator,
|
ResidentCompiler? generator,
|
||||||
this.userIdentifier,
|
this.userIdentifier,
|
||||||
required this.developmentShaderCompiler,
|
required this.developmentShaderCompiler,
|
||||||
this.developmentSceneImporter,
|
|
||||||
}) : generator =
|
}) : generator =
|
||||||
generator ??
|
generator ??
|
||||||
ResidentCompiler(
|
ResidentCompiler(
|
||||||
@ -100,16 +98,6 @@ class FlutterDevice {
|
|||||||
fileSystem: globals.fs,
|
fileSystem: globals.fs,
|
||||||
);
|
);
|
||||||
|
|
||||||
final DevelopmentSceneImporter sceneImporter = DevelopmentSceneImporter(
|
|
||||||
sceneImporter: SceneImporter(
|
|
||||||
artifacts: globals.artifacts!,
|
|
||||||
logger: globals.logger,
|
|
||||||
processManager: globals.processManager,
|
|
||||||
fileSystem: globals.fs,
|
|
||||||
),
|
|
||||||
fileSystem: globals.fs,
|
|
||||||
);
|
|
||||||
|
|
||||||
final ResidentCompiler generator;
|
final ResidentCompiler generator;
|
||||||
|
|
||||||
// For both web and non-web platforms we initialize dill to/from
|
// For both web and non-web platforms we initialize dill to/from
|
||||||
@ -205,7 +193,6 @@ class FlutterDevice {
|
|||||||
buildInfo: buildInfo,
|
buildInfo: buildInfo,
|
||||||
userIdentifier: userIdentifier,
|
userIdentifier: userIdentifier,
|
||||||
developmentShaderCompiler: shaderCompiler,
|
developmentShaderCompiler: shaderCompiler,
|
||||||
developmentSceneImporter: sceneImporter,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,7 +202,6 @@ class FlutterDevice {
|
|||||||
final BuildInfo buildInfo;
|
final BuildInfo buildInfo;
|
||||||
final String? userIdentifier;
|
final String? userIdentifier;
|
||||||
final DevelopmentShaderCompiler developmentShaderCompiler;
|
final DevelopmentShaderCompiler developmentShaderCompiler;
|
||||||
final DevelopmentSceneImporter? developmentSceneImporter;
|
|
||||||
|
|
||||||
DevFSWriter? devFSWriter;
|
DevFSWriter? devFSWriter;
|
||||||
Stream<Uri?>? vmServiceUris;
|
Stream<Uri?>? vmServiceUris;
|
||||||
@ -557,7 +543,6 @@ class FlutterDevice {
|
|||||||
packageConfig: packageConfig,
|
packageConfig: packageConfig,
|
||||||
devFSWriter: devFSWriter,
|
devFSWriter: devFSWriter,
|
||||||
shaderCompiler: developmentShaderCompiler,
|
shaderCompiler: developmentShaderCompiler,
|
||||||
sceneImporter: developmentSceneImporter,
|
|
||||||
dartPluginRegistrant: FlutterProject.current().dartPluginRegistrant,
|
dartPluginRegistrant: FlutterProject.current().dartPluginRegistrant,
|
||||||
);
|
);
|
||||||
} on DevFSException {
|
} on DevFSException {
|
||||||
|
@ -557,7 +557,6 @@ class HotRunner extends ResidentRunner {
|
|||||||
}
|
}
|
||||||
devFS.assetPathsToEvict.clear();
|
devFS.assetPathsToEvict.clear();
|
||||||
devFS.shaderPathsToEvict.clear();
|
devFS.shaderPathsToEvict.clear();
|
||||||
devFS.scenePathsToEvict.clear();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1163,9 +1162,7 @@ class HotRunner extends ResidentRunner {
|
|||||||
Future<void> evictDirtyAssets() async {
|
Future<void> evictDirtyAssets() async {
|
||||||
final List<Future<void>> futures = <Future<void>>[];
|
final List<Future<void>> futures = <Future<void>>[];
|
||||||
for (final FlutterDevice? device in flutterDevices) {
|
for (final FlutterDevice? device in flutterDevices) {
|
||||||
if (device!.devFS!.assetPathsToEvict.isEmpty &&
|
if (device!.devFS!.assetPathsToEvict.isEmpty && device.devFS!.shaderPathsToEvict.isEmpty) {
|
||||||
device.devFS!.shaderPathsToEvict.isEmpty &&
|
|
||||||
device.devFS!.scenePathsToEvict.isEmpty) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
final List<FlutterView> views = await device.vmService!.getFlutterViews();
|
final List<FlutterView> views = await device.vmService!.getFlutterViews();
|
||||||
@ -1215,14 +1212,8 @@ class HotRunner extends ResidentRunner {
|
|||||||
device.vmService!.flutterEvictShader(assetPath, isolateId: views.first.uiIsolate!.id!),
|
device.vmService!.flutterEvictShader(assetPath, isolateId: views.first.uiIsolate!.id!),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
for (final String assetPath in device.devFS!.scenePathsToEvict) {
|
|
||||||
futures.add(
|
|
||||||
device.vmService!.flutterEvictScene(assetPath, isolateId: views.first.uiIsolate!.id!),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
device.devFS!.assetPathsToEvict.clear();
|
device.devFS!.assetPathsToEvict.clear();
|
||||||
device.devFS!.shaderPathsToEvict.clear();
|
device.devFS!.shaderPathsToEvict.clear();
|
||||||
device.devFS!.scenePathsToEvict.clear();
|
|
||||||
}
|
}
|
||||||
await Future.wait<void>(futures);
|
await Future.wait<void>(futures);
|
||||||
}
|
}
|
||||||
|
@ -717,14 +717,6 @@ class FlutterVmService {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Map<String, Object?>?> flutterEvictScene(String assetPath, {required String isolateId}) {
|
|
||||||
return invokeFlutterExtensionRpcRaw(
|
|
||||||
'ext.ui.window.reinitializeScene',
|
|
||||||
isolateId: isolateId,
|
|
||||||
args: <String, Object?>{'assetKey': assetPath},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Exit the application by calling [exit] from `dart:io`.
|
/// Exit the application by calling [exit] from `dart:io`.
|
||||||
///
|
///
|
||||||
/// This method is only supported by certain embedders. This is
|
/// This method is only supported by certain embedders. This is
|
||||||
|
@ -89,7 +89,6 @@ void main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
expect(updated.shaders, root.shaders.map(WidgetPreviewStartCommand.transformAssetUri));
|
expect(updated.shaders, root.shaders.map(WidgetPreviewStartCommand.transformAssetUri));
|
||||||
expect(updated.models, root.models.map(WidgetPreviewStartCommand.transformAssetUri));
|
|
||||||
|
|
||||||
expect(updated.deferredComponents?.length, root.deferredComponents?.length);
|
expect(updated.deferredComponents?.length, root.deferredComponents?.length);
|
||||||
if (root.deferredComponents != null) {
|
if (root.deferredComponents != null) {
|
||||||
@ -161,8 +160,6 @@ flutter:
|
|||||||
asset: package/assetUri
|
asset: package/assetUri
|
||||||
shaders:
|
shaders:
|
||||||
- shaderUri
|
- shaderUri
|
||||||
models:
|
|
||||||
- modelUri
|
|
||||||
deferred-components:
|
deferred-components:
|
||||||
- name: deferredComponent
|
- name: deferredComponent
|
||||||
libraries:
|
libraries:
|
||||||
|
@ -1490,7 +1490,6 @@ flutter:
|
|||||||
FontAsset(Uri(path: 'assetUri'), weight: 100, style: 'normal'),
|
FontAsset(Uri(path: 'assetUri'), weight: 100, style: 'normal'),
|
||||||
]),
|
]),
|
||||||
],
|
],
|
||||||
models: <Uri>[Uri(path: 'modelUri')],
|
|
||||||
shaders: <Uri>[Uri(path: 'shaderUri')],
|
shaders: <Uri>[Uri(path: 'shaderUri')],
|
||||||
deferredComponents: <DeferredComponent>[
|
deferredComponents: <DeferredComponent>[
|
||||||
DeferredComponent(
|
DeferredComponent(
|
||||||
@ -1535,8 +1534,6 @@ flutter:
|
|||||||
asset: assetUri
|
asset: assetUri
|
||||||
shaders:
|
shaders:
|
||||||
- shaderUri
|
- shaderUri
|
||||||
models:
|
|
||||||
- modelUri
|
|
||||||
deferred-components:
|
deferred-components:
|
||||||
- name: deferredComponent
|
- name: deferredComponent
|
||||||
libraries:
|
libraries:
|
||||||
|
@ -37,9 +37,6 @@ class FakeDevFs extends Fake implements DevFS {
|
|||||||
@override
|
@override
|
||||||
Set<String> shaderPathsToEvict = <String>{};
|
Set<String> shaderPathsToEvict = <String>{};
|
||||||
|
|
||||||
@override
|
|
||||||
Set<String> scenePathsToEvict = <String>{};
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Uri? baseUri;
|
Uri? baseUri;
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@ import 'package:flutter_tools/src/asset.dart';
|
|||||||
import 'package:flutter_tools/src/base/dds.dart';
|
import 'package:flutter_tools/src/base/dds.dart';
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
import 'package:flutter_tools/src/build_info.dart';
|
import 'package:flutter_tools/src/build_info.dart';
|
||||||
import 'package:flutter_tools/src/build_system/tools/scene_importer.dart';
|
|
||||||
import 'package:flutter_tools/src/build_system/tools/shader_compiler.dart';
|
import 'package:flutter_tools/src/build_system/tools/shader_compiler.dart';
|
||||||
import 'package:flutter_tools/src/compile.dart';
|
import 'package:flutter_tools/src/compile.dart';
|
||||||
import 'package:flutter_tools/src/devfs.dart';
|
import 'package:flutter_tools/src/devfs.dart';
|
||||||
@ -450,9 +449,6 @@ class FakeDevFS extends Fake implements DevFS {
|
|||||||
@override
|
@override
|
||||||
Set<String> shaderPathsToEvict = <String>{};
|
Set<String> shaderPathsToEvict = <String>{};
|
||||||
|
|
||||||
@override
|
|
||||||
Set<String> scenePathsToEvict = <String>{};
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool didUpdateFontManifest = false;
|
bool didUpdateFontManifest = false;
|
||||||
|
|
||||||
@ -481,7 +477,6 @@ class FakeDevFS extends Fake implements DevFS {
|
|||||||
required PackageConfig packageConfig,
|
required PackageConfig packageConfig,
|
||||||
required String dillOutputPath,
|
required String dillOutputPath,
|
||||||
required DevelopmentShaderCompiler shaderCompiler,
|
required DevelopmentShaderCompiler shaderCompiler,
|
||||||
DevelopmentSceneImporter? sceneImporter,
|
|
||||||
DevFSWriter? devFSWriter,
|
DevFSWriter? devFSWriter,
|
||||||
String? target,
|
String? target,
|
||||||
AssetBundle? bundle,
|
AssetBundle? bundle,
|
||||||
|
@ -17,7 +17,6 @@ import 'package:flutter_tools/src/base/platform.dart';
|
|||||||
import 'package:flutter_tools/src/base/terminal.dart';
|
import 'package:flutter_tools/src/base/terminal.dart';
|
||||||
import 'package:flutter_tools/src/base/time.dart';
|
import 'package:flutter_tools/src/base/time.dart';
|
||||||
import 'package:flutter_tools/src/build_info.dart';
|
import 'package:flutter_tools/src/build_info.dart';
|
||||||
import 'package:flutter_tools/src/build_system/tools/scene_importer.dart';
|
|
||||||
import 'package:flutter_tools/src/build_system/tools/shader_compiler.dart';
|
import 'package:flutter_tools/src/build_system/tools/shader_compiler.dart';
|
||||||
import 'package:flutter_tools/src/compile.dart';
|
import 'package:flutter_tools/src/compile.dart';
|
||||||
import 'package:flutter_tools/src/dart/pub.dart';
|
import 'package:flutter_tools/src/dart/pub.dart';
|
||||||
@ -1815,7 +1814,6 @@ class FakeWebDevFS extends Fake implements WebDevFS {
|
|||||||
required PackageConfig packageConfig,
|
required PackageConfig packageConfig,
|
||||||
required String dillOutputPath,
|
required String dillOutputPath,
|
||||||
required DevelopmentShaderCompiler shaderCompiler,
|
required DevelopmentShaderCompiler shaderCompiler,
|
||||||
DevelopmentSceneImporter? sceneImporter,
|
|
||||||
DevFSWriter? devFSWriter,
|
DevFSWriter? devFSWriter,
|
||||||
String? target,
|
String? target,
|
||||||
AssetBundle? bundle,
|
AssetBundle? bundle,
|
||||||
|
@ -106,7 +106,7 @@ void main() {
|
|||||||
// Simulate changing the root project's pubspec.yaml and verify that we should regenerate
|
// Simulate changing the root project's pubspec.yaml and verify that we should regenerate
|
||||||
// the widget preview scaffold's pubspec.yaml.
|
// the widget preview scaffold's pubspec.yaml.
|
||||||
rootProject.replacePubspec(
|
rootProject.replacePubspec(
|
||||||
rootProject.manifest.copyWith(logger: logger, models: <Uri>[Uri(host: 'Random')]),
|
rootProject.manifest.copyWith(logger: logger, shaders: <Uri>[Uri(host: 'Random')]),
|
||||||
);
|
);
|
||||||
expect(previewManifest.shouldRegeneratePubspec(), true);
|
expect(previewManifest.shouldRegeneratePubspec(), true);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user