Unverified Commit b594cf85 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

Remove extra slash from builder that is not handled on windows (#28027)

parent 72b6ed35
...@@ -155,11 +155,11 @@ class FlutterKernelBuilder implements Builder { ...@@ -155,11 +155,11 @@ class FlutterKernelBuilder implements Builder {
if (incrementalCompilerByteStorePath != null) { if (incrementalCompilerByteStorePath != null) {
arguments.add('--incremental'); arguments.add('--incremental');
} }
final String generatedRoot = path.join(projectDir.absolute.path, '.dart_tool', 'build', 'generated', '$packageName', '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'); final String normalRoot = path.join(projectDir.absolute.path, 'lib${Platform.pathSeparator}');
arguments.addAll(<String>[ arguments.addAll(<String>[
'--packages', '--packages',
packagesFile.path, Uri.file(packagesFile.path).toString(),
'--output-dill', '--output-dill',
outputFile.path, outputFile.path,
'--filesystem-root', '--filesystem-root',
......
...@@ -4,8 +4,9 @@ ...@@ -4,8 +4,9 @@
import 'dart:async'; import 'dart:async';
import 'package:build_daemon/data/build_status.dart';
import 'package:build_daemon/data/build_target.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/server_log.dart';
import 'package:build_daemon/data/build_status.dart' as build; import 'package:build_daemon/data/build_status.dart' as build;
import 'package:build_daemon/client.dart'; import 'package:build_daemon/client.dart';
...@@ -87,7 +88,7 @@ class BuildRunner extends CodeGenerator { ...@@ -87,7 +88,7 @@ class BuildRunner extends CodeGenerator {
.stdout .stdout
.transform(utf8.decoder) .transform(utf8.decoder)
.transform(const LineSplitter()) .transform(const LineSplitter())
.listen(printStatus); .listen(printTrace);
buildProcess buildProcess
.stderr .stderr
.transform(utf8.decoder) .transform(utf8.decoder)
...@@ -153,7 +154,7 @@ class BuildRunner extends CodeGenerator { ...@@ -153,7 +154,7 @@ class BuildRunner extends CodeGenerator {
final File syntheticPubspec = fs.file(fs.path.join(generatedDirectory, 'pubspec.yaml')); final File syntheticPubspec = fs.file(fs.path.join(generatedDirectory, 'pubspec.yaml'));
final StringBuffer stringBuffer = StringBuffer(); final StringBuffer stringBuffer = StringBuffer();
stringBuffer.writeln('name: synthetic_example'); stringBuffer.writeln('name: flutter_tool');
stringBuffer.writeln('dependencies:'); stringBuffer.writeln('dependencies:');
final YamlMap builders = await flutterProject.builders; final YamlMap builders = await flutterProject.builders;
for (String name in builders.keys) { for (String name in builders.keys) {
...@@ -252,8 +253,17 @@ class _BuildRunnerCodegenDaemon implements CodegenDaemon { ...@@ -252,8 +253,17 @@ class _BuildRunnerCodegenDaemon implements CodegenDaemon {
final File dillFile; final File dillFile;
@override @override
Stream<bool> get buildResults => buildDaemonClient.buildResults.map((build.BuildResults results) { Stream<CodegenStatus> get buildResults => buildDaemonClient.buildResults.map((build.BuildResults results) {
return results.results.first.status == build.BuildStatus.succeeded; 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 @override
......
...@@ -132,7 +132,7 @@ class UnsupportedCodeGenerator extends CodeGenerator { ...@@ -132,7 +132,7 @@ class UnsupportedCodeGenerator extends CodeGenerator {
abstract class CodegenDaemon { abstract class CodegenDaemon {
/// Whether the previously enqueued build was successful. /// Whether the previously enqueued build was successful.
Stream<bool> get buildResults; Stream<CodegenStatus> get buildResults;
/// Starts a new build. /// Starts a new build.
void startBuild(); void startBuild();
...@@ -229,14 +229,19 @@ class CodeGeneratingResidentCompiler implements ResidentCompiler { ...@@ -229,14 +229,19 @@ class CodeGeneratingResidentCompiler implements ResidentCompiler {
trackWidgetCreation: trackWidgetCreation, trackWidgetCreation: trackWidgetCreation,
); );
codegenDaemon.startBuild(); 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( final ResidentCompiler residentCompiler = ResidentCompiler(
artifacts.getArtifactPath(Artifact.flutterPatchedSdkPath), artifacts.getArtifactPath(Artifact.flutterPatchedSdkPath),
trackWidgetCreation: trackWidgetCreation, trackWidgetCreation: trackWidgetCreation,
packagesPath: codegenDaemon.packagesFile.path, packagesPath: codegenDaemon.packagesFile.path,
fileSystemRoots: <String>[ fileSystemRoots: <String>[
flutterProject.generated.absolute.path, fs.path.join(flutterProject.generated.absolute.path, 'lib${platform.pathSeparator}'),
flutterProject.directory.path, fs.path.join(flutterProject.directory.path, 'lib${platform.pathSeparator}'),
], ],
fileSystemScheme: _kMultiRootScheme, fileSystemScheme: _kMultiRootScheme,
targetModel: TargetModel.flutter, targetModel: TargetModel.flutter,
...@@ -261,7 +266,12 @@ class CodeGeneratingResidentCompiler implements ResidentCompiler { ...@@ -261,7 +266,12 @@ class CodeGeneratingResidentCompiler implements ResidentCompiler {
@override @override
Future<CompilerOutput> recompile(String mainPath, List<String> invalidatedFiles, {String outputPath, String packagesFilePath}) async { Future<CompilerOutput> recompile(String mainPath, List<String> invalidatedFiles, {String outputPath, String packagesFilePath}) async {
_codegenDaemon.startBuild(); _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. // Delete this file so that the frontend_server can handle multi-root.
// TODO(jonahwilliams): investigate frontend_server behavior in the presence // TODO(jonahwilliams): investigate frontend_server behavior in the presence
// of multi-root and initialize from dill. // of multi-root and initialize from dill.
...@@ -291,3 +301,16 @@ class CodeGeneratingResidentCompiler implements ResidentCompiler { ...@@ -291,3 +301,16 @@ class CodeGeneratingResidentCompiler implements ResidentCompiler {
return _residentCompiler.shutdown(); 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
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment