Add integration to all targets (#29020)
This commit is contained in:
@@ -29,11 +29,6 @@ import 'build_script_generator.dart';
|
||||
/// The minimum version of build_runner we can support in the flutter tool.
|
||||
const String kMinimumBuildRunnerVersion = '1.2.8';
|
||||
|
||||
// Arbitrarily choosen multi-root file scheme. This is used to configure the
|
||||
// frontend_server to resolve a package uri to multiple filesystem directories.
|
||||
// In this case, the source directory and a generated directory.
|
||||
const String _kMultirootScheme = 'org-dartlang-app';
|
||||
|
||||
/// A wrapper for a build_runner process which delegates to a generated
|
||||
/// build script.
|
||||
///
|
||||
@@ -170,7 +165,7 @@ class BuildRunner extends CodeGenerator {
|
||||
void _generatePackages(FlutterProject flutterProject) {
|
||||
final String oldPackagesContents = fs.file(PackageMap.globalPackagesPath).readAsStringSync();
|
||||
final String appName = flutterProject.manifest.appName;
|
||||
final String newPackagesContents = oldPackagesContents.replaceFirst('$appName:lib/', '$appName:$_kMultirootScheme:/');
|
||||
final String newPackagesContents = oldPackagesContents.replaceFirst('$appName:lib/', '$appName:$kMultiRootScheme:/');
|
||||
final String generatedPackagesPath = fs.path.setExtension(PackageMap.globalPackagesPath, '.generated');
|
||||
fs.file(generatedPackagesPath).writeAsStringSync(newPackagesContents);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,10 @@ import 'dart/package_map.dart';
|
||||
import 'globals.dart';
|
||||
import 'project.dart';
|
||||
|
||||
const String _kMultiRootScheme = 'org-dartlang-app';
|
||||
// Arbitrarily choosen multi-root file scheme. This is used to configure the
|
||||
// frontend_server to resolve a package uri to multiple filesystem directories.
|
||||
// In this case, the source directory and a generated directory.
|
||||
const String kMultiRootScheme = 'org-dartlang-app';
|
||||
|
||||
/// The [CodeGenerator] instance.
|
||||
///
|
||||
@@ -109,6 +112,7 @@ class CodeGeneratingKernelCompiler implements KernelCompiler {
|
||||
String fileSystemScheme,
|
||||
String depFilePath,
|
||||
TargetModel targetModel = TargetModel.flutter,
|
||||
String initializeFromDill,
|
||||
}) async {
|
||||
if (fileSystemRoots != null || fileSystemScheme != null || depFilePath != null || targetModel != null || sdkRoot != null || packagesPath != null) {
|
||||
printTrace('fileSystemRoots, fileSystemScheme, depFilePath, targetModel,'
|
||||
@@ -141,9 +145,11 @@ class CodeGeneratingKernelCompiler implements KernelCompiler {
|
||||
fs.path.join(flutterProject.generated.path, 'lib${platform.pathSeparator}'),
|
||||
fs.path.join(flutterProject.directory.path, 'lib${platform.pathSeparator}'),
|
||||
],
|
||||
fileSystemScheme: _kMultiRootScheme,
|
||||
fileSystemScheme: kMultiRootScheme,
|
||||
depFilePath: depFilePath,
|
||||
targetModel: targetModel,
|
||||
// Pass an invalid file name to prevent frontend_server from initializing from dill.
|
||||
initializeFromDill: ' ',
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -179,10 +185,11 @@ class CodeGeneratingResidentCompiler implements ResidentCompiler {
|
||||
fs.path.join(flutterProject.generated.path, 'lib${platform.pathSeparator}'),
|
||||
fs.path.join(flutterProject.directory.path, 'lib${platform.pathSeparator}'),
|
||||
],
|
||||
fileSystemScheme: _kMultiRootScheme,
|
||||
fileSystemScheme: kMultiRootScheme,
|
||||
targetModel: TargetModel.flutter,
|
||||
unsafePackageSerialization: unsafePackageSerialization,
|
||||
initializeFromDill: initializeFromDill,
|
||||
// Pass an invalid file name to prevent frontend_server from initializing from dill.
|
||||
initializeFromDill: ' ',
|
||||
);
|
||||
return CodeGeneratingResidentCompiler._(residentCompiler, codegenDaemon);
|
||||
}
|
||||
@@ -210,12 +217,6 @@ class CodeGeneratingResidentCompiler implements ResidentCompiler {
|
||||
if (_codegenDaemon.lastStatus == CodegenStatus.Failed) {
|
||||
printError('Codegeneration failed, halting build.');
|
||||
}
|
||||
// Delete this file so that the frontend_server can handle multi-root.
|
||||
// TODO(jonahwilliams): investigate frontend_server behavior in the presence
|
||||
// of multi-root and initialize from dill.
|
||||
if (outputPath != null && fs.file(outputPath).existsSync()) {
|
||||
fs.file(outputPath).deleteSync();
|
||||
}
|
||||
return _residentCompiler.recompile(
|
||||
mainPath,
|
||||
invalidatedFiles,
|
||||
|
||||
@@ -175,6 +175,7 @@ class KernelCompiler {
|
||||
List<String> fileSystemRoots,
|
||||
String fileSystemScheme,
|
||||
bool targetProductVm = false,
|
||||
String initializeFromDill,
|
||||
}) async {
|
||||
final String frontendServer = artifacts.getArtifactPath(
|
||||
Artifact.frontendServerSnapshotForEngineDartSdk
|
||||
@@ -251,6 +252,9 @@ class KernelCompiler {
|
||||
if (fileSystemScheme != null) {
|
||||
command.addAll(<String>['--filesystem-scheme', fileSystemScheme]);
|
||||
}
|
||||
if (initializeFromDill != null) {
|
||||
command.addAll(<String>['--initialize-from-dill', initializeFromDill]);
|
||||
}
|
||||
|
||||
if (extraFrontEndOptions != null)
|
||||
command.addAll(extraFrontEndOptions);
|
||||
|
||||
Reference in New Issue
Block a user