[flutter_tools] Clean up build_aot code post assemble migration (#48771)

This commit is contained in:
Jonah Williams
2020-01-14 19:07:15 -08:00
committed by GitHub
parent 8092f6a2b6
commit 63c65e5cdb
5 changed files with 9 additions and 101 deletions

View File

@@ -1,59 +0,0 @@
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter_tools/src/build_system/build_system.dart';
import 'package:flutter_tools/src/build_system/targets/dart.dart';
import 'package:flutter_tools/src/cache.dart';
import 'package:flutter_tools/src/commands/build.dart';
import 'package:mockito/mockito.dart';
import 'package:flutter_tools/src/globals.dart' as globals;
import '../../src/common.dart';
import '../../src/mocks.dart';
import '../../src/testbed.dart';
void main() {
Testbed testbed;
setUpAll(() {
Cache.disableLocking();
});
tearDownAll(() {
Cache.enableLocking();
});
setUp(() {
testbed = Testbed(overrides: <Type, Generator>{
BuildSystem: () => MockBuildSystem(),
});
});
test('invokes assemble for android aot build.', () => testbed.run(() async {
globals.fs.file('pubspec.yaml').createSync();
globals.fs.file('.packages').createSync();
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
when(buildSystem.build(any, any)).thenAnswer((Invocation invocation) async {
return BuildResult(success: true);
});
final BuildCommand command = BuildCommand();
applyMocksToCommand(command);
await createTestCommandRunner(command).run(<String>[
'build',
'aot',
'--target-platform=android-arm',
'--no-pub',
]);
final Environment environment = verify(buildSystem.build(any, captureAny)).captured.single as Environment;
expect(environment.defines, <String, String>{
kTargetFile: globals.fs.path.absolute(globals.fs.path.join('lib', 'main.dart')),
kBuildMode: 'release',
kTargetPlatform: 'android-arm',
});
}));
}
class MockBuildSystem extends Mock implements BuildSystem {}

View File

@@ -404,14 +404,6 @@ flutter_tools:lib/''');
ProcessManager: () => mockProcessManager,
}));
test('Profile/ReleaseCopyFlutterAotBundle copies .so to correct output directory', () => testbed.run(() async {
androidEnvironment.buildDir.createSync(recursive: true);
androidEnvironment.buildDir.childFile('app.so').createSync();
await const ProfileCopyFlutterAotBundle().build(androidEnvironment);
expect(androidEnvironment.outputDir.childFile('app.so').existsSync(), true);
}));
test('kExtraGenSnapshotOptions passes values to gen_snapshot', () => testbed.run(() async {
androidEnvironment.defines[kExtraGenSnapshotOptions] = 'foo,bar,baz=2';