-
Notifications
You must be signed in to change notification settings - Fork 27.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
select ResidentCompiler during FlutterDevice initialization #28603
select ResidentCompiler during FlutterDevice initialization #28603
Conversation
PTAL @yjbanov |
|
||
// Create a scratch space file that can be read/written by the frontend server. | ||
// It is okay to hard-code these file names because we will copy them back | ||
// from the temp directory at the end of the build step. | ||
final Directory tempDirecory = await Directory.systemTemp.createTemp('_flutter_build'); | ||
final File packagesFile = File(path.join(tempDirecory.path, _kPackagesExtension)); | ||
final Directory projectDir = File(packagesPath).parent; | ||
final String packagesFilePath = path.join(projectDir.path, '.packages.generated'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: how about generatedPackagesFilePath
to disambiguate from .packages
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to delete this file in the next PR, so for the sake of brevity I'll leave it as is for now.
import '../dart/pub.dart'; | ||
import '../globals.dart'; | ||
import '../project.dart'; | ||
import '../resident_runner.dart'; | ||
import 'build_script_generator.dart'; | ||
|
||
const String _kMultirootScheme = 'org-dartlang-app'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A comment explaining the choice of this value would be helpful, even if it was chosen arbitrarily.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
} | ||
|
||
// Create generated packages file which adds a multi-root scheme to the user's | ||
// project directory. currently we only replace the root package with a multiroot |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: "Currently"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
_server.kill(); | ||
return _server.exitCode; | ||
_server?.kill(); | ||
return _server?.exitCode; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it meaningful to return null
if _server
is null
? Maybe return 0
? If it an unexpected situation, perhaps throw or print a warning?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Description
Rather than have each command be responsible for creating the correct ResidentCompiler, use a static method to create the FlutterDevice which is responsible for creating it. This simplifies the commands responsible for creating the flutter device, and frees us up to use different generators/build scripts for flutter web or other targets.
This also moves the generation of the .packages file outside of the builders. In cases where the build fails we still to produce a valid .packages file. This also makes it easier for flutter tester
Related Issues
#27141
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]
). This will ensure a smooth and quick review process.///
).flutter analyze --flutter-repo
) does not report any problems on my PR.Breaking Change
Does your PR require Flutter developers to manually update their apps to accommodate your change?