mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Merge pull request #3140 from chinmaygarde/master
Add a `--no-codesign` option to `ios build` to disable code signing.
This commit is contained in:
parent
dea7c34718
commit
0bf68cc5cb
@ -15,7 +15,9 @@ import 'package:path/path.dart' as path;
|
||||
|
||||
class BuildIOSCommand extends FlutterCommand {
|
||||
BuildIOSCommand() {
|
||||
argParser.addFlag('simulator', help: 'Build for the iOS simulator instead of the device');
|
||||
argParser.addFlag('simulator', help: 'Build for the iOS simulator instead of the device.');
|
||||
argParser.addFlag('codesign', negatable: true, defaultsTo: true,
|
||||
help: 'Codesign the application bundle (only available on device builds).');
|
||||
}
|
||||
|
||||
@override
|
||||
@ -39,6 +41,12 @@ class BuildIOSCommand extends FlutterCommand {
|
||||
}
|
||||
|
||||
bool forSimulator = argResults['simulator'];
|
||||
bool shouldCodesign = argResults['codesign'];
|
||||
|
||||
if (!forSimulator && !shouldCodesign) {
|
||||
printStatus('Warning: Building for device with codesigning disabled.');
|
||||
printStatus('You will have to manually codesign before deploying to device.');
|
||||
}
|
||||
|
||||
String logTarget = forSimulator ? "simulator" : "device";
|
||||
|
||||
@ -50,7 +58,7 @@ class BuildIOSCommand extends FlutterCommand {
|
||||
await buildDir.create();
|
||||
|
||||
bool result = await buildIOSXcodeProject(app,
|
||||
buildForDevice: !forSimulator, buildDirectory: buildDir);
|
||||
buildForDevice: !forSimulator, buildDirectory: buildDir, codesign: shouldCodesign);
|
||||
|
||||
if (!result) {
|
||||
printError('Encountered error while building for $logTarget.');
|
||||
|
||||
@ -97,7 +97,7 @@ bool _xcodeVersionCheckValid(int major, int minor) {
|
||||
}
|
||||
|
||||
Future<bool> buildIOSXcodeProject(ApplicationPackage app,
|
||||
{ bool buildForDevice, Directory buildDirectory }) async {
|
||||
{ bool buildForDevice, Directory buildDirectory, bool codesign: true }) async {
|
||||
String flutterProjectPath = Directory.current.path;
|
||||
|
||||
if (xcodeProjectRequiresUpdate()) {
|
||||
@ -125,6 +125,8 @@ Future<bool> buildIOSXcodeProject(ApplicationPackage app,
|
||||
'/usr/bin/env',
|
||||
'xcrun',
|
||||
'xcodebuild',
|
||||
'clean',
|
||||
'build',
|
||||
'-target', 'Runner',
|
||||
'-configuration', 'Release',
|
||||
'ONLY_ACTIVE_ARCH=YES',
|
||||
@ -141,6 +143,15 @@ Future<bool> buildIOSXcodeProject(ApplicationPackage app,
|
||||
|
||||
if (buildForDevice) {
|
||||
commands.addAll(<String>['-sdk', 'iphoneos', '-arch', 'arm64']);
|
||||
if (!codesign) {
|
||||
commands.addAll(
|
||||
<String>[
|
||||
'CODE_SIGNING_ALLOWED=NO',
|
||||
'CODE_SIGNING_REQUIRED=NO',
|
||||
'CODE_SIGNING_IDENTITY=""'
|
||||
]
|
||||
);
|
||||
}
|
||||
} else {
|
||||
commands.addAll(<String>['-sdk', 'iphonesimulator', '-arch', 'x86_64']);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user