Pass entry points JSON files to front-end server, take 2 (#15227)
* Pass entry points JSON files to front-end server (#15180) * Fix ios/debug build which uses 'flutter build aot': do not require entry points files and disable AOT transformations in this mode
This commit is contained in:
@@ -15,6 +15,8 @@ import 'globals.dart';
|
||||
enum Artifact {
|
||||
dartIoEntriesTxt,
|
||||
dartVmEntryPointsTxt,
|
||||
entryPointsJson,
|
||||
entryPointsExtraJson,
|
||||
genSnapshot,
|
||||
flutterTester,
|
||||
snapshotDart,
|
||||
@@ -35,6 +37,10 @@ String _artifactToFileName(Artifact artifact) {
|
||||
return 'dart_io_entries.txt';
|
||||
case Artifact.dartVmEntryPointsTxt:
|
||||
return 'dart_vm_entry_points.txt';
|
||||
case Artifact.entryPointsJson:
|
||||
return 'entry_points.json';
|
||||
case Artifact.entryPointsExtraJson:
|
||||
return 'entry_points_extra.json';
|
||||
case Artifact.genSnapshot:
|
||||
return 'gen_snapshot';
|
||||
case Artifact.flutterTester:
|
||||
@@ -124,6 +130,8 @@ class CachedArtifacts extends Artifacts {
|
||||
switch (artifact) {
|
||||
case Artifact.dartIoEntriesTxt:
|
||||
case Artifact.dartVmEntryPointsTxt:
|
||||
case Artifact.entryPointsJson:
|
||||
case Artifact.entryPointsExtraJson:
|
||||
case Artifact.frontendServerSnapshotForEngineDartSdk:
|
||||
assert(mode != BuildMode.debug, 'Artifact $artifact only available in non-debug mode.');
|
||||
return fs.path.join(engineDir, _artifactToFileName(artifact));
|
||||
@@ -142,6 +150,8 @@ class CachedArtifacts extends Artifacts {
|
||||
switch (artifact) {
|
||||
case Artifact.dartIoEntriesTxt:
|
||||
case Artifact.dartVmEntryPointsTxt:
|
||||
case Artifact.entryPointsJson:
|
||||
case Artifact.entryPointsExtraJson:
|
||||
case Artifact.genSnapshot:
|
||||
case Artifact.snapshotDart:
|
||||
case Artifact.flutterFramework:
|
||||
@@ -236,6 +246,9 @@ class LocalEngineArtifacts extends Artifacts {
|
||||
return fs.path.join(_engineSrcPath, 'third_party', 'dart', 'runtime', 'bin', _artifactToFileName(artifact));
|
||||
case Artifact.dartVmEntryPointsTxt:
|
||||
return fs.path.join(_engineSrcPath, 'flutter', 'runtime', _artifactToFileName(artifact));
|
||||
case Artifact.entryPointsJson:
|
||||
case Artifact.entryPointsExtraJson:
|
||||
return fs.path.join(engineOutPath, 'dart_entry_points', _artifactToFileName(artifact));
|
||||
case Artifact.snapshotDart:
|
||||
return fs.path.join(_engineSrcPath, 'flutter', 'lib', 'snapshot', _artifactToFileName(artifact));
|
||||
case Artifact.genSnapshot:
|
||||
|
||||
@@ -188,6 +188,14 @@ Future<String> _buildAotSnapshot(
|
||||
);
|
||||
final String ioEntryPoints = artifacts.getArtifactPath(Artifact.dartIoEntriesTxt, platform, buildMode);
|
||||
|
||||
final List<String> entryPointsJsonFiles = <String>[];
|
||||
if (previewDart2 && !interpreter) {
|
||||
entryPointsJsonFiles.addAll(<String>[
|
||||
artifacts.getArtifactPath(Artifact.entryPointsJson, platform, buildMode),
|
||||
artifacts.getArtifactPath(Artifact.entryPointsExtraJson, platform, buildMode),
|
||||
]);
|
||||
}
|
||||
|
||||
final PackageMap packageMap = new PackageMap(PackageMap.globalPackagesPath);
|
||||
final String packageMapError = packageMap.checkValid();
|
||||
if (packageMapError != null) {
|
||||
@@ -207,6 +215,8 @@ Future<String> _buildAotSnapshot(
|
||||
mainPath,
|
||||
];
|
||||
|
||||
inputPaths.addAll(entryPointsJsonFiles);
|
||||
|
||||
final Set<String> outputPaths = new Set<String>();
|
||||
|
||||
// These paths are used only on iOS.
|
||||
@@ -370,7 +380,8 @@ Future<String> _buildAotSnapshot(
|
||||
depFilePath: dependencies,
|
||||
extraFrontEndOptions: extraFrontEndOptions,
|
||||
linkPlatformKernelIn : true,
|
||||
aot : true,
|
||||
aot : !interpreter,
|
||||
entryPointsJsonFiles: entryPointsJsonFiles,
|
||||
trackWidgetCreation: false,
|
||||
);
|
||||
if (mainPath == null) {
|
||||
|
||||
@@ -48,6 +48,7 @@ Future<String> compile(
|
||||
String depFilePath,
|
||||
bool linkPlatformKernelIn: false,
|
||||
bool aot: false,
|
||||
List<String> entryPointsJsonFiles,
|
||||
bool trackWidgetCreation: false,
|
||||
List<String> extraFrontEndOptions,
|
||||
String incrementalCompilerByteStorePath,
|
||||
@@ -74,6 +75,11 @@ Future<String> compile(
|
||||
if (aot) {
|
||||
command.add('--aot');
|
||||
}
|
||||
if (entryPointsJsonFiles != null) {
|
||||
for (String entryPointsJson in entryPointsJsonFiles) {
|
||||
command.addAll(<String>['--entry-points', entryPointsJson]);
|
||||
}
|
||||
}
|
||||
if (incrementalCompilerByteStorePath != null) {
|
||||
command.add('--incremental');
|
||||
}
|
||||
|
||||
@@ -31,6 +31,10 @@ void main() {
|
||||
artifacts.getArtifactPath(Artifact.flutterFramework, TargetPlatform.ios, BuildMode.release),
|
||||
fs.path.join(tempDir.path, 'bin', 'cache', 'artifacts', 'engine', 'ios-release', 'Flutter.framework')
|
||||
);
|
||||
expect(
|
||||
artifacts.getArtifactPath(Artifact.entryPointsExtraJson, TargetPlatform.android_arm64, BuildMode.release),
|
||||
fs.path.join(tempDir.path, 'bin', 'cache', 'artifacts', 'engine', 'android-arm64-release', 'entry_points_extra.json')
|
||||
);
|
||||
expect(
|
||||
artifacts.getArtifactPath(Artifact.flutterTester),
|
||||
fs.path.join(tempDir.path, 'bin', 'cache', 'artifacts', 'engine', 'linux-x64', 'flutter_tester')
|
||||
@@ -81,6 +85,10 @@ void main() {
|
||||
artifacts.getArtifactPath(Artifact.dartIoEntriesTxt, TargetPlatform.android_arm, BuildMode.debug),
|
||||
fs.path.join(tempDir.path, 'third_party', 'dart', 'runtime', 'bin', 'dart_io_entries.txt')
|
||||
);
|
||||
expect(
|
||||
artifacts.getArtifactPath(Artifact.entryPointsJson, TargetPlatform.android_arm, BuildMode.profile),
|
||||
fs.path.join(tempDir.path, 'out', 'android_debug_unopt', 'dart_entry_points', 'entry_points.json')
|
||||
);
|
||||
expect(
|
||||
artifacts.getArtifactPath(Artifact.flutterFramework, TargetPlatform.ios, BuildMode.release),
|
||||
fs.path.join(tempDir.path, 'out', 'android_debug_unopt', 'Flutter.framework')
|
||||
|
||||
Reference in New Issue
Block a user