iOS aot assembly requires SDK root (#71094)

This commit is contained in:
Jenn Magder
2020-11-23 14:10:10 -08:00
committed by GitHub
parent 39155dcb6b
commit 3379435185
2 changed files with 33 additions and 0 deletions

View File

@@ -47,6 +47,10 @@ abstract class AotAssemblyBase extends Target {
if (environment.defines[kTargetPlatform] == null) {
throw MissingDefineException(kTargetPlatform, 'aot_assembly');
}
if (environment.defines[kSdkRoot] == null) {
throw MissingDefineException(kSdkRoot, 'aot_assembly');
}
final List<String> extraGenSnapshotOptions = decodeDartDefines(environment.defines, kExtraGenSnapshotOptions);
final bool bitcode = environment.defines[kBitcodeFlag] == 'true';
final BuildMode buildMode = getBuildModeForName(environment.defines[kBuildMode]);

View File

@@ -187,6 +187,7 @@ void main() {
fileSystem.currentDirectory,
defines: <String, String>{
kTargetPlatform: 'ios',
kSdkRoot: 'path/to/sdk',
},
processManager: processManager,
artifacts: artifacts,
@@ -209,6 +210,34 @@ void main() {
Platform: () => macPlatform,
});
testUsingContext('AotAssemblyRelease throws exception if sdk root is missing', () async {
final FileSystem fileSystem = MemoryFileSystem.test();
final Environment environment = Environment.test(
fileSystem.currentDirectory,
defines: <String, String>{
kTargetPlatform: 'ios',
},
processManager: processManager,
artifacts: artifacts,
logger: logger,
fileSystem: fileSystem,
);
environment.defines[kBuildMode] = 'release';
environment.defines[kIosArchs] = 'x86_64';
expect(const AotAssemblyRelease().build(environment), throwsA(isA<Exception>()
.having(
(Exception exception) => exception.toString(),
'description',
contains('required define SdkRoot but it was not provided'),
)
));
}, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
ProcessManager: () => processManager,
Platform: () => macPlatform,
});
testWithoutContext('Unpack copies Flutter.framework', () async {
final FileSystem fileSystem = MemoryFileSystem.test();
final Directory outputDir = fileSystem.directory('output');