Unverified Commit a25dca4a authored by Jenn Magder's avatar Jenn Magder Committed by GitHub

Ad-hoc codesign Flutter.framework when code signing is disabled (#93556)

parent 4ec54e29
......@@ -625,9 +625,9 @@ Future<void> _createStubAppFramework(File outputFile, Environment environment,
}
void _signFramework(Environment environment, String binaryPath, BuildMode buildMode) {
final String codesignIdentity = environment.defines[kCodesignIdentity];
String codesignIdentity = environment.defines[kCodesignIdentity];
if (codesignIdentity == null || codesignIdentity.isEmpty) {
return;
codesignIdentity = '-';
}
final ProcessResult result = environment.processManager.runSync(<String>[
'codesign',
......
......@@ -72,7 +72,8 @@ void main() {
testUsingContext('DebugUniversalFramework creates simulator binary', () async {
environment.defines[kIosArchs] = 'x86_64';
environment.defines[kSdkRoot] = 'path/to/iPhoneSimulator.sdk';
processManager.addCommand(
final String appFrameworkPath = environment.buildDir.childDirectory('App.framework').childFile('App').path;
processManager.addCommands(<FakeCommand>[
FakeCommand(command: <String>[
'xcrun',
'clang',
......@@ -98,12 +99,17 @@ void main() {
'-isysroot',
'path/to/iPhoneSimulator.sdk',
'-o',
environment.buildDir
.childDirectory('App.framework')
.childFile('App')
.path,
appFrameworkPath,
]),
);
FakeCommand(command: <String>[
'codesign',
'--force',
'--sign',
'-',
'--timestamp=none',
appFrameworkPath,
]),
]);
await const DebugUniversalFramework().build(environment);
expect(processManager.hasRemainingExpectations, isFalse);
......@@ -116,7 +122,8 @@ void main() {
testUsingContext('DebugUniversalFramework creates expected binary with arm64 only arch', () async {
environment.defines[kIosArchs] = 'arm64';
environment.defines[kSdkRoot] = 'path/to/iPhoneOS.sdk';
processManager.addCommand(
final String appFrameworkPath = environment.buildDir.childDirectory('App.framework').childFile('App').path;
processManager.addCommands(<FakeCommand>[
FakeCommand(command: <String>[
'xcrun',
'clang',
......@@ -129,12 +136,17 @@ void main() {
'.tmp_rand0', 'flutter_tools_stub_source.rand0', 'debug_app.cc')),
..._kSharedConfig,
'-o',
environment.buildDir
.childDirectory('App.framework')
.childFile('App')
.path,
appFrameworkPath,
]),
);
FakeCommand(command: <String>[
'codesign',
'--force',
'--sign',
'-',
'--timestamp=none',
appFrameworkPath,
]),
]);
await const DebugUniversalFramework().build(environment);
expect(processManager.hasRemainingExpectations, isFalse);
......@@ -317,6 +329,7 @@ void main() {
FakeCommand lipoCommandNonFatResult;
FakeCommand lipoVerifyArm64Command;
FakeCommand bitcodeStripCommand;
FakeCommand adHocCodesignCommand;
setUp(() {
final FileSystem fileSystem = MemoryFileSystem.test();
......@@ -353,6 +366,15 @@ void main() {
'-o',
binary.path,
]);
adHocCodesignCommand = FakeCommand(command: <String>[
'codesign',
'--force',
'--sign',
'-',
'--timestamp=none',
binary.path,
]);
});
testWithoutContext('iphonesimulator', () async {
......@@ -389,6 +411,7 @@ void main() {
'-verify_arch',
'x86_64',
]),
adHocCodesignCommand,
]);
await const DebugUnpackIOS().build(environment);
......@@ -538,6 +561,7 @@ void main() {
copyPhysicalFrameworkCommand,
lipoCommandNonFatResult,
lipoVerifyArm64Command,
adHocCodesignCommand,
]);
await const DebugUnpackIOS().build(environment);
......@@ -587,6 +611,7 @@ void main() {
'armv7',
binary.path,
]),
adHocCodesignCommand,
]);
await const DebugUnpackIOS().build(environment);
......@@ -658,6 +683,7 @@ void main() {
lipoCommandNonFatResult,
lipoVerifyArm64Command,
bitcodeStripCommand,
adHocCodesignCommand,
]);
await const DebugUnpackIOS().build(environment);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment