Download and handle product version of flutter patched sdk (#31063)
* Support release/debug flavors of flutter_patched_sdk * Use [anyNamed] instead of [any] for mocking named arguments * Fix use of local engine in release mode
This commit is contained in:
committed by
GitHub
parent
4ef0292790
commit
d775908c7e
@@ -105,7 +105,7 @@ abstract class Artifacts {
|
||||
}
|
||||
|
||||
// Returns the requested [artifact] for the [platform] and [mode] combination.
|
||||
String getArtifactPath(Artifact artifact, [ TargetPlatform platform, BuildMode mode ]);
|
||||
String getArtifactPath(Artifact artifact, { TargetPlatform platform, BuildMode mode });
|
||||
|
||||
// Returns which set of engine artifacts is currently used for the [platform]
|
||||
// and [mode] combination.
|
||||
@@ -116,7 +116,7 @@ abstract class Artifacts {
|
||||
class CachedArtifacts extends Artifacts {
|
||||
|
||||
@override
|
||||
String getArtifactPath(Artifact artifact, [ TargetPlatform platform, BuildMode mode ]) {
|
||||
String getArtifactPath(Artifact artifact, { TargetPlatform platform, BuildMode mode }) {
|
||||
platform ??= _currentHostPlatform;
|
||||
switch (platform) {
|
||||
case TargetPlatform.android_arm:
|
||||
@@ -173,9 +173,10 @@ class CachedArtifacts extends Artifacts {
|
||||
}
|
||||
}
|
||||
|
||||
String _getFlutterPatchedSdkPath() {
|
||||
String _getFlutterPatchedSdkPath(BuildMode mode) {
|
||||
final String engineArtifactsPath = cache.getArtifactDirectory('engine').path;
|
||||
return fs.path.join(engineArtifactsPath, 'common', 'flutter_patched_sdk');
|
||||
return fs.path.join(engineArtifactsPath, 'common',
|
||||
mode == BuildMode.release ? 'flutter_patched_sdk_product' : 'flutter_patched_sdk');
|
||||
}
|
||||
|
||||
String _getFlutterWebSdkPath() {
|
||||
@@ -200,11 +201,11 @@ class CachedArtifacts extends Artifacts {
|
||||
case Artifact.engineDartBinary:
|
||||
return fs.path.join(dartSdkPath, 'bin', _artifactToFileName(artifact));
|
||||
case Artifact.platformKernelDill:
|
||||
return fs.path.join(_getFlutterPatchedSdkPath(), _artifactToFileName(artifact));
|
||||
return fs.path.join(_getFlutterPatchedSdkPath(mode), _artifactToFileName(artifact));
|
||||
case Artifact.platformLibrariesJson:
|
||||
return fs.path.join(_getFlutterPatchedSdkPath(), 'lib', _artifactToFileName(artifact));
|
||||
return fs.path.join(_getFlutterPatchedSdkPath(mode), 'lib', _artifactToFileName(artifact));
|
||||
case Artifact.flutterPatchedSdkPath:
|
||||
return _getFlutterPatchedSdkPath();
|
||||
return _getFlutterPatchedSdkPath(mode);
|
||||
case Artifact.flutterWebSdk:
|
||||
return _getFlutterWebSdkPath();
|
||||
case Artifact.dart2jsSnapshot:
|
||||
@@ -262,7 +263,7 @@ class LocalEngineArtifacts extends Artifacts {
|
||||
String _hostEngineOutPath;
|
||||
|
||||
@override
|
||||
String getArtifactPath(Artifact artifact, [ TargetPlatform platform, BuildMode mode ]) {
|
||||
String getArtifactPath(Artifact artifact, { TargetPlatform platform, BuildMode mode }) {
|
||||
switch (artifact) {
|
||||
case Artifact.snapshotDart:
|
||||
return fs.path.join(_engineSrcPath, 'flutter', 'lib', 'snapshot', _artifactToFileName(artifact));
|
||||
@@ -274,13 +275,17 @@ class LocalEngineArtifacts extends Artifacts {
|
||||
case Artifact.vmSnapshotData:
|
||||
return fs.path.join(engineOutPath, 'gen', 'flutter', 'lib', 'snapshot', _artifactToFileName(artifact));
|
||||
case Artifact.platformKernelDill:
|
||||
return fs.path.join(_getFlutterPatchedSdkPath(), _artifactToFileName(artifact));
|
||||
return fs.path.join(_getFlutterPatchedSdkPath(mode), _artifactToFileName(artifact));
|
||||
case Artifact.platformLibrariesJson:
|
||||
return fs.path.join(_getFlutterPatchedSdkPath(), 'lib', _artifactToFileName(artifact));
|
||||
return fs.path.join(_getFlutterPatchedSdkPath(mode), 'lib', _artifactToFileName(artifact));
|
||||
case Artifact.flutterFramework:
|
||||
return fs.path.join(engineOutPath, _artifactToFileName(artifact));
|
||||
case Artifact.flutterPatchedSdkPath:
|
||||
return _getFlutterPatchedSdkPath();
|
||||
// When using local engine always use [BuildMode.debug] regardless of
|
||||
// what was specified in [mode] argument because local engine will
|
||||
// have only one flutter_patched_sdk in standard location, that
|
||||
// is happen to be what debug(non-release) mode is using.
|
||||
return _getFlutterPatchedSdkPath(BuildMode.debug);
|
||||
case Artifact.flutterWebSdk:
|
||||
return _getFlutterWebSdkPath();
|
||||
case Artifact.frontendServerSnapshotForEngineDartSdk:
|
||||
@@ -303,8 +308,9 @@ class LocalEngineArtifacts extends Artifacts {
|
||||
return fs.path.basename(engineOutPath);
|
||||
}
|
||||
|
||||
String _getFlutterPatchedSdkPath() {
|
||||
return fs.path.join(engineOutPath, 'flutter_patched_sdk');
|
||||
String _getFlutterPatchedSdkPath(BuildMode buildMode) {
|
||||
return fs.path.join(engineOutPath,
|
||||
buildMode == BuildMode.release ? 'flutter_patched_sdk_product' : 'flutter_patched_sdk');
|
||||
}
|
||||
|
||||
String _getFlutterWebSdkPath() {
|
||||
@@ -356,7 +362,7 @@ class OverrideArtifacts implements Artifacts {
|
||||
final File flutterPatchedSdk;
|
||||
|
||||
@override
|
||||
String getArtifactPath(Artifact artifact, [ TargetPlatform platform, BuildMode mode ]) {
|
||||
String getArtifactPath(Artifact artifact, { TargetPlatform platform, BuildMode mode }) {
|
||||
if (artifact == Artifact.frontendServerSnapshotForEngineDartSdk && frontendServer != null) {
|
||||
return frontendServer.path;
|
||||
}
|
||||
@@ -369,7 +375,7 @@ class OverrideArtifacts implements Artifacts {
|
||||
if (artifact == Artifact.flutterPatchedSdkPath && flutterPatchedSdk != null) {
|
||||
return flutterPatchedSdk.path;
|
||||
}
|
||||
return parent.getArtifactPath(artifact, platform, mode);
|
||||
return parent.getArtifactPath(artifact, platform: platform, mode: mode);
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -43,7 +43,7 @@ class GenSnapshot {
|
||||
|
||||
static String getSnapshotterPath(SnapshotType snapshotType) {
|
||||
return artifacts.getArtifactPath(
|
||||
Artifact.genSnapshot, snapshotType.platform, snapshotType.mode);
|
||||
Artifact.genSnapshot, platform: snapshotType.platform, mode: snapshotType.mode);
|
||||
}
|
||||
|
||||
Future<int> run({
|
||||
@@ -317,7 +317,7 @@ class AOTSnapshotter {
|
||||
final String depfilePath = fs.path.join(outputPath, 'kernel_compile.d');
|
||||
final KernelCompiler kernelCompiler = await kernelCompilerFactory.create(flutterProject);
|
||||
final CompilerOutput compilerOutput = await _timedStep('frontend', () => kernelCompiler.compile(
|
||||
sdkRoot: artifacts.getArtifactPath(Artifact.flutterPatchedSdkPath),
|
||||
sdkRoot: artifacts.getArtifactPath(Artifact.flutterPatchedSdkPath, mode: buildMode),
|
||||
mainPath: mainPath,
|
||||
packagesPath: packagesPath,
|
||||
outputFilePath: getKernelPathForTransformerOptions(
|
||||
@@ -391,8 +391,8 @@ class JITSnapshotter {
|
||||
final Directory outputDir = fs.directory(outputPath);
|
||||
outputDir.createSync(recursive: true);
|
||||
|
||||
final String engineVmSnapshotData = artifacts.getArtifactPath(Artifact.vmSnapshotData, null, buildMode);
|
||||
final String engineIsolateSnapshotData = artifacts.getArtifactPath(Artifact.isolateSnapshotData, null, buildMode);
|
||||
final String engineVmSnapshotData = artifacts.getArtifactPath(Artifact.vmSnapshotData, mode: buildMode);
|
||||
final String engineIsolateSnapshotData = artifacts.getArtifactPath(Artifact.isolateSnapshotData, mode: buildMode);
|
||||
final String isolateSnapshotData = fs.path.join(outputDir.path, 'isolate_snapshot_data');
|
||||
final String isolateSnapshotInstructions = fs.path.join(outputDir.path, 'isolate_snapshot_instr');
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ Future<void> build({
|
||||
ensureDirectoryExists(applicationKernelFilePath);
|
||||
final KernelCompiler kernelCompiler = await kernelCompilerFactory.create(flutterProject);
|
||||
final CompilerOutput compilerOutput = await kernelCompiler.compile(
|
||||
sdkRoot: artifacts.getArtifactPath(Artifact.flutterPatchedSdkPath),
|
||||
sdkRoot: artifacts.getArtifactPath(Artifact.flutterPatchedSdkPath, mode: buildMode),
|
||||
incrementalCompilerByteStorePath: compilationTraceFilePath != null ? null :
|
||||
fs.path.absolute(getIncrementalCompilerByteStoreDirectory()),
|
||||
mainPath: fs.file(mainPath).absolute.path,
|
||||
@@ -202,15 +202,15 @@ Future<void> assemble({
|
||||
final Map<String, DevFSContent> assetEntries = Map<String, DevFSContent>.from(assetBundle.entries);
|
||||
if (kernelContent != null) {
|
||||
if (compilationTraceFilePath != null) {
|
||||
final String vmSnapshotData = artifacts.getArtifactPath(Artifact.vmSnapshotData, null, buildMode);
|
||||
final String vmSnapshotData = artifacts.getArtifactPath(Artifact.vmSnapshotData, mode: buildMode);
|
||||
final String isolateSnapshotData = fs.path.join(getBuildDirectory(), _kIsolateSnapshotData);
|
||||
final String isolateSnapshotInstr = fs.path.join(getBuildDirectory(), _kIsolateSnapshotInstr);
|
||||
assetEntries[_kVMSnapshotData] = DevFSFileContent(fs.file(vmSnapshotData));
|
||||
assetEntries[_kIsolateSnapshotData] = DevFSFileContent(fs.file(isolateSnapshotData));
|
||||
assetEntries[_kIsolateSnapshotInstr] = DevFSFileContent(fs.file(isolateSnapshotInstr));
|
||||
} else {
|
||||
final String vmSnapshotData = artifacts.getArtifactPath(Artifact.vmSnapshotData, null, buildMode);
|
||||
final String isolateSnapshotData = artifacts.getArtifactPath(Artifact.isolateSnapshotData, null, buildMode);
|
||||
final String vmSnapshotData = artifacts.getArtifactPath(Artifact.vmSnapshotData, mode: buildMode);
|
||||
final String isolateSnapshotData = artifacts.getArtifactPath(Artifact.isolateSnapshotData, mode: buildMode);
|
||||
assetEntries[_kKernelKey] = kernelContent;
|
||||
assetEntries[_kVMSnapshotData] = DevFSFileContent(fs.file(vmSnapshotData));
|
||||
assetEntries[_kIsolateSnapshotData] = DevFSFileContent(fs.file(isolateSnapshotData));
|
||||
|
||||
@@ -609,6 +609,7 @@ class FlutterSdk extends EngineCachedArtifact {
|
||||
List<List<String>> getBinaryDirs() {
|
||||
final List<List<String>> binaryDirs = <List<String>>[
|
||||
<String>['common', 'flutter_patched_sdk.zip'],
|
||||
<String>['common', 'flutter_patched_sdk_product.zip'],
|
||||
];
|
||||
if (cache.includeAllPlatforms) {
|
||||
binaryDirs.addAll(<List<String>>[
|
||||
|
||||
@@ -216,6 +216,7 @@ class AttachCommand extends FlutterCommand {
|
||||
viewFilter: argResults['isolate-filter'],
|
||||
target: argResults['target'],
|
||||
targetModel: TargetModel(argResults['target-model']),
|
||||
buildMode: getBuildMode(),
|
||||
);
|
||||
flutterDevice.observatoryUris = <Uri>[ observatoryUri ];
|
||||
final List<FlutterDevice> flutterDevices = <FlutterDevice>[flutterDevice];
|
||||
|
||||
@@ -351,6 +351,7 @@ class AppDomain extends Domain {
|
||||
dillOutputPath: dillOutputPath,
|
||||
viewFilter: isolateFilter,
|
||||
target: target,
|
||||
buildMode: options.buildInfo.mode,
|
||||
);
|
||||
|
||||
ResidentRunner runner;
|
||||
|
||||
@@ -369,6 +369,7 @@ class RunCommand extends RunCommandBase {
|
||||
viewFilter: argResults['isolate-filter'],
|
||||
experimentalFlags: expFlags,
|
||||
target: argResults['target'],
|
||||
buildMode: getBuildMode(),
|
||||
);
|
||||
flutterDevices.add(flutterDevice);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,8 @@ final RegExp _settingExpr = RegExp(r'(\w+)\s*=\s*(.*)$');
|
||||
final RegExp _varExpr = RegExp(r'\$\(([^)]*)\)');
|
||||
|
||||
String flutterFrameworkDir(BuildMode mode) {
|
||||
return fs.path.normalize(fs.path.dirname(artifacts.getArtifactPath(Artifact.flutterFramework, TargetPlatform.ios, mode)));
|
||||
return fs.path.normalize(fs.path.dirname(artifacts.getArtifactPath(
|
||||
Artifact.flutterFramework, platform: TargetPlatform.ios, mode: mode)));
|
||||
}
|
||||
|
||||
/// Writes or rewrites Xcode property files with the specified information.
|
||||
|
||||
@@ -38,9 +38,10 @@ class FlutterDevice {
|
||||
TargetModel targetModel = TargetModel.flutter,
|
||||
List<String> experimentalFlags,
|
||||
ResidentCompiler generator,
|
||||
@required BuildMode buildMode,
|
||||
}) : assert(trackWidgetCreation != null),
|
||||
generator = generator ?? ResidentCompiler(
|
||||
artifacts.getArtifactPath(Artifact.flutterPatchedSdkPath),
|
||||
artifacts.getArtifactPath(Artifact.flutterPatchedSdkPath, mode: buildMode),
|
||||
trackWidgetCreation: trackWidgetCreation,
|
||||
fileSystemRoots: fileSystemRoots,
|
||||
fileSystemScheme: fileSystemScheme,
|
||||
@@ -60,6 +61,7 @@ class FlutterDevice {
|
||||
TargetModel targetModel = TargetModel.flutter,
|
||||
List<String> experimentalFlags,
|
||||
ResidentCompiler generator,
|
||||
@required BuildMode buildMode,
|
||||
}) async {
|
||||
ResidentCompiler generator;
|
||||
final FlutterProject flutterProject = await FlutterProject.current();
|
||||
@@ -69,7 +71,7 @@ class FlutterDevice {
|
||||
);
|
||||
} else {
|
||||
generator = ResidentCompiler(
|
||||
artifacts.getArtifactPath(Artifact.flutterPatchedSdkPath),
|
||||
artifacts.getArtifactPath(Artifact.flutterPatchedSdkPath, mode: buildMode),
|
||||
trackWidgetCreation: trackWidgetCreation,
|
||||
fileSystemRoots: fileSystemRoots,
|
||||
fileSystemScheme: fileSystemScheme,
|
||||
@@ -87,6 +89,7 @@ class FlutterDevice {
|
||||
experimentalFlags: experimentalFlags,
|
||||
targetModel: targetModel,
|
||||
generator: generator,
|
||||
buildMode: buildMode,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -252,7 +252,8 @@ someOtherTask
|
||||
String expectedBuildName,
|
||||
String expectedBuildNumber,
|
||||
}) async {
|
||||
when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, TargetPlatform.android_arm, any)).thenReturn('engine');
|
||||
when(mockArtifacts.getArtifactPath(Artifact.flutterFramework,
|
||||
platform: TargetPlatform.android_arm, mode: anyNamed('mode'))).thenReturn('engine');
|
||||
when(mockArtifacts.engineOutPath).thenReturn(fs.path.join('out', 'android_arm'));
|
||||
|
||||
final File manifestFile = fs.file('path/to/project/pubspec.yaml');
|
||||
|
||||
@@ -28,7 +28,7 @@ void main() {
|
||||
|
||||
testUsingContext('getArtifactPath', () {
|
||||
expect(
|
||||
artifacts.getArtifactPath(Artifact.flutterFramework, TargetPlatform.ios, BuildMode.release),
|
||||
artifacts.getArtifactPath(Artifact.flutterFramework, platform: TargetPlatform.ios, mode: BuildMode.release),
|
||||
fs.path.join(tempDir.path, 'bin', 'cache', 'artifacts', 'engine', 'ios-release', 'Flutter.framework'),
|
||||
);
|
||||
expect(
|
||||
@@ -78,7 +78,7 @@ void main() {
|
||||
|
||||
testUsingContext('getArtifactPath', () {
|
||||
expect(
|
||||
artifacts.getArtifactPath(Artifact.flutterFramework, TargetPlatform.ios, BuildMode.release),
|
||||
artifacts.getArtifactPath(Artifact.flutterFramework, platform: TargetPlatform.ios, mode: BuildMode.release),
|
||||
fs.path.join(tempDir.path, 'out', 'android_debug_unopt', 'Flutter.framework'),
|
||||
);
|
||||
expect(
|
||||
|
||||
@@ -114,7 +114,8 @@ void main() {
|
||||
mockXcode = MockXcode();
|
||||
bufferLogger = BufferLogger();
|
||||
for (BuildMode mode in BuildMode.values) {
|
||||
when(mockArtifacts.getArtifactPath(Artifact.snapshotDart, any, mode)).thenReturn(kSnapshotDart);
|
||||
when(mockArtifacts.getArtifactPath(Artifact.snapshotDart,
|
||||
platform: anyNamed('platform'), mode: mode)).thenReturn(kSnapshotDart);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -552,9 +553,11 @@ void main() {
|
||||
mockArtifacts = MockArtifacts();
|
||||
|
||||
for (BuildMode mode in BuildMode.values) {
|
||||
when(mockArtifacts.getArtifactPath(Artifact.vmSnapshotData, null, mode))
|
||||
when(mockArtifacts.getArtifactPath(Artifact.vmSnapshotData,
|
||||
platform: anyNamed('platform'), mode: mode))
|
||||
.thenReturn(kEngineVmSnapshotData);
|
||||
when(mockArtifacts.getArtifactPath(Artifact.isolateSnapshotData, null, mode))
|
||||
when(mockArtifacts.getArtifactPath(Artifact.isolateSnapshotData,
|
||||
platform: anyNamed('platform'), mode: mode))
|
||||
.thenReturn(kEngineIsolateSnapshotData);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter_tools/src/artifacts.dart';
|
||||
import 'package:flutter_tools/src/build_info.dart';
|
||||
import 'package:flutter_tools/src/devfs.dart';
|
||||
import 'package:flutter_tools/src/device.dart';
|
||||
import 'package:flutter_tools/src/resident_runner.dart';
|
||||
@@ -130,7 +131,7 @@ void main() {
|
||||
when(mockDevice.supportsHotRestart).thenReturn(false);
|
||||
// Trigger hot restart.
|
||||
final List<FlutterDevice> devices = <FlutterDevice>[
|
||||
FlutterDevice(mockDevice, generator: residentCompiler, trackWidgetCreation: false)..devFS = mockDevFs,
|
||||
FlutterDevice(mockDevice, generator: residentCompiler, trackWidgetCreation: false, buildMode: BuildMode.debug)..devFS = mockDevFs,
|
||||
];
|
||||
final OperationResult result = await HotRunner(devices).restart(fullRestart: true);
|
||||
// Expect hot restart failed.
|
||||
@@ -151,8 +152,8 @@ void main() {
|
||||
when(mockHotDevice.supportsHotRestart).thenReturn(true);
|
||||
// Trigger hot restart.
|
||||
final List<FlutterDevice> devices = <FlutterDevice>[
|
||||
FlutterDevice(mockDevice, generator: residentCompiler, trackWidgetCreation: false)..devFS = mockDevFs,
|
||||
FlutterDevice(mockHotDevice, generator: residentCompiler, trackWidgetCreation: false)..devFS = mockDevFs,
|
||||
FlutterDevice(mockDevice, generator: residentCompiler, trackWidgetCreation: false, buildMode: BuildMode.debug)..devFS = mockDevFs,
|
||||
FlutterDevice(mockHotDevice, generator: residentCompiler, trackWidgetCreation: false, buildMode: BuildMode.debug)..devFS = mockDevFs,
|
||||
];
|
||||
final OperationResult result = await HotRunner(devices).restart(fullRestart: true);
|
||||
// Expect hot restart failed.
|
||||
@@ -173,8 +174,8 @@ void main() {
|
||||
when(mockHotDevice.supportsHotRestart).thenReturn(true);
|
||||
// Trigger a restart.
|
||||
final List<FlutterDevice> devices = <FlutterDevice>[
|
||||
FlutterDevice(mockDevice, generator: residentCompiler, trackWidgetCreation: false)..devFS = mockDevFs,
|
||||
FlutterDevice(mockHotDevice, generator: residentCompiler, trackWidgetCreation: false)..devFS = mockDevFs,
|
||||
FlutterDevice(mockDevice, generator: residentCompiler, trackWidgetCreation: false, buildMode: BuildMode.debug)..devFS = mockDevFs,
|
||||
FlutterDevice(mockHotDevice, generator: residentCompiler, trackWidgetCreation: false, buildMode: BuildMode.debug)..devFS = mockDevFs,
|
||||
];
|
||||
final OperationResult result = await HotRunner(devices).restart(fullRestart: true);
|
||||
// Expect hot restart was successful.
|
||||
@@ -190,7 +191,7 @@ void main() {
|
||||
when(mockDevice.supportsHotReload).thenReturn(true);
|
||||
when(mockDevice.supportsHotRestart).thenReturn(true);
|
||||
final List<FlutterDevice> devices = <FlutterDevice>[
|
||||
FlutterDevice(mockDevice, generator: residentCompiler, trackWidgetCreation: false),
|
||||
FlutterDevice(mockDevice, generator: residentCompiler, trackWidgetCreation: false, buildMode: BuildMode.debug),
|
||||
];
|
||||
final OperationResult result = await HotRunner(devices).restart(fullRestart: true);
|
||||
expect(result.isOk, false);
|
||||
@@ -207,7 +208,7 @@ void main() {
|
||||
when(mockDevice.supportsHotRestart).thenReturn(true);
|
||||
// Trigger hot restart.
|
||||
final List<FlutterDevice> devices = <FlutterDevice>[
|
||||
FlutterDevice(mockDevice, generator: residentCompiler, trackWidgetCreation: false)..devFS = mockDevFs,
|
||||
FlutterDevice(mockDevice, generator: residentCompiler, trackWidgetCreation: false, buildMode: BuildMode.debug)..devFS = mockDevFs,
|
||||
];
|
||||
final OperationResult result = await HotRunner(devices).restart(fullRestart: true);
|
||||
// Expect hot restart successful.
|
||||
@@ -233,7 +234,7 @@ void main() {
|
||||
when(mockDevice.supportsHotRestart).thenReturn(true);
|
||||
when(mockDevice.supportsStopApp).thenReturn(false);
|
||||
final List<FlutterDevice> devices = <FlutterDevice>[
|
||||
FlutterDevice(mockDevice, generator: residentCompiler, trackWidgetCreation: false),
|
||||
FlutterDevice(mockDevice, generator: residentCompiler, trackWidgetCreation: false, buildMode: BuildMode.debug),
|
||||
];
|
||||
await HotRunner(devices).cleanupAfterSignal();
|
||||
expect(shutdownTestingConfig.shutdownHookCalled, true);
|
||||
@@ -248,7 +249,7 @@ void main() {
|
||||
when(mockDevice.supportsHotRestart).thenReturn(true);
|
||||
when(mockDevice.supportsStopApp).thenReturn(false);
|
||||
final List<FlutterDevice> devices = <FlutterDevice>[
|
||||
FlutterDevice(mockDevice, generator: residentCompiler, trackWidgetCreation: false),
|
||||
FlutterDevice(mockDevice, generator: residentCompiler, trackWidgetCreation: false, buildMode: BuildMode.debug),
|
||||
];
|
||||
await HotRunner(devices).preStop();
|
||||
expect(shutdownTestingConfig.shutdownHookCalled, true);
|
||||
|
||||
@@ -282,7 +282,8 @@ Information about project "Runner":
|
||||
}
|
||||
|
||||
testUsingOsxContext('sets ARCHS=armv7 when armv7 local engine is set', () async {
|
||||
when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, TargetPlatform.ios, any)).thenReturn('engine');
|
||||
when(mockArtifacts.getArtifactPath(Artifact.flutterFramework,
|
||||
platform: TargetPlatform.ios, mode: anyNamed('mode'))).thenReturn('engine');
|
||||
when(mockArtifacts.engineOutPath).thenReturn(fs.path.join('out', 'ios_profile_arm'));
|
||||
|
||||
const BuildInfo buildInfo = BuildInfo(BuildMode.debug, null, targetPlatform: TargetPlatform.ios);
|
||||
@@ -300,7 +301,8 @@ Information about project "Runner":
|
||||
});
|
||||
|
||||
testUsingOsxContext('sets TRACK_WIDGET_CREATION=true when trackWidgetCreation is true', () async {
|
||||
when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, TargetPlatform.ios, any)).thenReturn('engine');
|
||||
when(mockArtifacts.getArtifactPath(Artifact.flutterFramework,
|
||||
platform: TargetPlatform.ios, mode: anyNamed('mode'))).thenReturn('engine');
|
||||
when(mockArtifacts.engineOutPath).thenReturn(fs.path.join('out', 'ios_profile_arm'));
|
||||
const BuildInfo buildInfo = BuildInfo(BuildMode.debug, null, trackWidgetCreation: true, targetPlatform: TargetPlatform.ios);
|
||||
final FlutterProject project = await FlutterProject.fromPath('path/to/project');
|
||||
@@ -317,7 +319,8 @@ Information about project "Runner":
|
||||
});
|
||||
|
||||
testUsingOsxContext('does not set TRACK_WIDGET_CREATION when trackWidgetCreation is false', () async {
|
||||
when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, TargetPlatform.ios, any)).thenReturn('engine');
|
||||
when(mockArtifacts.getArtifactPath(Artifact.flutterFramework,
|
||||
platform: TargetPlatform.ios, mode: anyNamed('mode'))).thenReturn('engine');
|
||||
when(mockArtifacts.engineOutPath).thenReturn(fs.path.join('out', 'ios_profile_arm'));
|
||||
const BuildInfo buildInfo = BuildInfo(BuildMode.debug, null, targetPlatform: TargetPlatform.ios);
|
||||
final FlutterProject project = await FlutterProject.fromPath('path/to/project');
|
||||
@@ -334,7 +337,8 @@ Information about project "Runner":
|
||||
});
|
||||
|
||||
testUsingOsxContext('sets ARCHS=armv7 when armv7 local engine is set', () async {
|
||||
when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, TargetPlatform.ios, any)).thenReturn('engine');
|
||||
when(mockArtifacts.getArtifactPath(Artifact.flutterFramework,
|
||||
platform: TargetPlatform.ios, mode: anyNamed('mode'))).thenReturn('engine');
|
||||
when(mockArtifacts.engineOutPath).thenReturn(fs.path.join('out', 'ios_profile'));
|
||||
const BuildInfo buildInfo = BuildInfo(BuildMode.debug, null, targetPlatform: TargetPlatform.ios);
|
||||
|
||||
@@ -366,7 +370,8 @@ Information about project "Runner":
|
||||
String expectedBuildName,
|
||||
String expectedBuildNumber,
|
||||
}) async {
|
||||
when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, TargetPlatform.ios, any)).thenReturn('engine');
|
||||
when(mockArtifacts.getArtifactPath(Artifact.flutterFramework,
|
||||
platform: TargetPlatform.ios, mode: anyNamed('mode'))).thenReturn('engine');
|
||||
when(mockArtifacts.engineOutPath).thenReturn(fs.path.join('out', 'ios'));
|
||||
|
||||
final File manifestFile = fs.file('path/to/project/pubspec.yaml');
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:async';
|
||||
import 'package:flutter_tools/src/build_info.dart';
|
||||
import 'package:flutter_tools/src/device.dart';
|
||||
import 'package:flutter_tools/src/resident_runner.dart';
|
||||
import 'package:mockito/mockito.dart';
|
||||
@@ -53,7 +54,7 @@ void main() {
|
||||
// TODO(jacobr): make these tests run with `trackWidgetCreation: true` as
|
||||
// well as the default flags.
|
||||
return TestRunner(
|
||||
<FlutterDevice>[FlutterDevice(MockDevice(), trackWidgetCreation: false)],
|
||||
<FlutterDevice>[FlutterDevice(MockDevice(), trackWidgetCreation: false, buildMode: BuildMode.debug)],
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user