Remove extra slash from builder that is not handled on windows (#28027)
This commit is contained in:
@@ -155,11 +155,11 @@ class FlutterKernelBuilder implements Builder {
|
||||
if (incrementalCompilerByteStorePath != null) {
|
||||
arguments.add('--incremental');
|
||||
}
|
||||
final String generatedRoot = path.join(projectDir.absolute.path, '.dart_tool', 'build', 'generated', '$packageName', 'lib');
|
||||
final String normalRoot = path.join(projectDir.absolute.path, 'lib');
|
||||
final String generatedRoot = path.join(projectDir.absolute.path, '.dart_tool', 'build', 'generated', '$packageName', 'lib${Platform.pathSeparator}');
|
||||
final String normalRoot = path.join(projectDir.absolute.path, 'lib${Platform.pathSeparator}');
|
||||
arguments.addAll(<String>[
|
||||
'--packages',
|
||||
packagesFile.path,
|
||||
Uri.file(packagesFile.path).toString(),
|
||||
'--output-dill',
|
||||
outputFile.path,
|
||||
'--filesystem-root',
|
||||
|
||||
@@ -4,8 +4,9 @@
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:build_daemon/data/build_status.dart';
|
||||
import 'package:build_daemon/data/build_target.dart';
|
||||
import 'package:build_runner_core/build_runner_core.dart';
|
||||
import 'package:build_runner_core/build_runner_core.dart' hide BuildStatus;
|
||||
import 'package:build_daemon/data/server_log.dart';
|
||||
import 'package:build_daemon/data/build_status.dart' as build;
|
||||
import 'package:build_daemon/client.dart';
|
||||
@@ -87,7 +88,7 @@ class BuildRunner extends CodeGenerator {
|
||||
.stdout
|
||||
.transform(utf8.decoder)
|
||||
.transform(const LineSplitter())
|
||||
.listen(printStatus);
|
||||
.listen(printTrace);
|
||||
buildProcess
|
||||
.stderr
|
||||
.transform(utf8.decoder)
|
||||
@@ -153,7 +154,7 @@ class BuildRunner extends CodeGenerator {
|
||||
final File syntheticPubspec = fs.file(fs.path.join(generatedDirectory, 'pubspec.yaml'));
|
||||
final StringBuffer stringBuffer = StringBuffer();
|
||||
|
||||
stringBuffer.writeln('name: synthetic_example');
|
||||
stringBuffer.writeln('name: flutter_tool');
|
||||
stringBuffer.writeln('dependencies:');
|
||||
final YamlMap builders = await flutterProject.builders;
|
||||
for (String name in builders.keys) {
|
||||
@@ -252,8 +253,17 @@ class _BuildRunnerCodegenDaemon implements CodegenDaemon {
|
||||
final File dillFile;
|
||||
|
||||
@override
|
||||
Stream<bool> get buildResults => buildDaemonClient.buildResults.map((build.BuildResults results) {
|
||||
return results.results.first.status == build.BuildStatus.succeeded;
|
||||
Stream<CodegenStatus> get buildResults => buildDaemonClient.buildResults.map((build.BuildResults results) {
|
||||
if (results.results.first.status == BuildStatus.failed) {
|
||||
return CodegenStatus.Failed;
|
||||
}
|
||||
if (results.results.first.status == BuildStatus.started) {
|
||||
return CodegenStatus.Started;
|
||||
}
|
||||
if (results.results.first.status == BuildStatus.succeeded) {
|
||||
return CodegenStatus.Succeeded;
|
||||
}
|
||||
return null;
|
||||
});
|
||||
|
||||
@override
|
||||
|
||||
@@ -132,7 +132,7 @@ class UnsupportedCodeGenerator extends CodeGenerator {
|
||||
|
||||
abstract class CodegenDaemon {
|
||||
/// Whether the previously enqueued build was successful.
|
||||
Stream<bool> get buildResults;
|
||||
Stream<CodegenStatus> get buildResults;
|
||||
|
||||
/// Starts a new build.
|
||||
void startBuild();
|
||||
@@ -229,14 +229,19 @@ class CodeGeneratingResidentCompiler implements ResidentCompiler {
|
||||
trackWidgetCreation: trackWidgetCreation,
|
||||
);
|
||||
codegenDaemon.startBuild();
|
||||
await codegenDaemon.buildResults.firstWhere((bool result) => result);
|
||||
final CodegenStatus status = await codegenDaemon.buildResults.firstWhere((CodegenStatus status) {
|
||||
return status ==CodegenStatus.Succeeded || status == CodegenStatus.Failed;
|
||||
});
|
||||
if (status == CodegenStatus.Failed) {
|
||||
printError('Codegeneration failed, halting build.');
|
||||
}
|
||||
final ResidentCompiler residentCompiler = ResidentCompiler(
|
||||
artifacts.getArtifactPath(Artifact.flutterPatchedSdkPath),
|
||||
trackWidgetCreation: trackWidgetCreation,
|
||||
packagesPath: codegenDaemon.packagesFile.path,
|
||||
fileSystemRoots: <String>[
|
||||
flutterProject.generated.absolute.path,
|
||||
flutterProject.directory.path,
|
||||
fs.path.join(flutterProject.generated.absolute.path, 'lib${platform.pathSeparator}'),
|
||||
fs.path.join(flutterProject.directory.path, 'lib${platform.pathSeparator}'),
|
||||
],
|
||||
fileSystemScheme: _kMultiRootScheme,
|
||||
targetModel: TargetModel.flutter,
|
||||
@@ -261,7 +266,12 @@ class CodeGeneratingResidentCompiler implements ResidentCompiler {
|
||||
@override
|
||||
Future<CompilerOutput> recompile(String mainPath, List<String> invalidatedFiles, {String outputPath, String packagesFilePath}) async {
|
||||
_codegenDaemon.startBuild();
|
||||
await _codegenDaemon.buildResults.first;
|
||||
final CodegenStatus status = await _codegenDaemon.buildResults.firstWhere((CodegenStatus status) {
|
||||
return status ==CodegenStatus.Succeeded || status == CodegenStatus.Failed;
|
||||
});
|
||||
if (status == 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.
|
||||
@@ -291,3 +301,16 @@ class CodeGeneratingResidentCompiler implements ResidentCompiler {
|
||||
return _residentCompiler.shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
/// The current status of a codegen build.
|
||||
enum CodegenStatus {
|
||||
/// The build has started running.
|
||||
///
|
||||
/// If this is the current status when running a hot reload, an additional build does
|
||||
/// not need to be started.
|
||||
Started,
|
||||
/// The build succeeded.
|
||||
Succeeded,
|
||||
/// The build failed.
|
||||
Failed
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user