Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
0943693e
Unverified
Commit
0943693e
authored
Nov 03, 2022
by
Zachary Anderson
Committed by
GitHub
Nov 03, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "[tools]validation basic Xcode settings for build ipa (#113412)" (#114615)
This reverts commit
e6300da2
.
parent
e6300da2
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
10 additions
and
158 deletions
+10
-158
build_ios.dart
packages/flutter_tools/lib/src/commands/build_ios.dart
+0
-39
application_package.dart
packages/flutter_tools/lib/src/ios/application_package.dart
+0
-6
plist_parser.dart
packages/flutter_tools/lib/src/ios/plist_parser.dart
+1
-4
application_package.dart
...ages/flutter_tools/lib/src/macos/application_package.dart
+1
-1
build_ipa_test.dart
...er_tools/test/commands.shard/hermetic/build_ipa_test.dart
+8
-108
No files found.
packages/flutter_tools/lib/src/commands/build_ios.dart
View file @
0943693e
...
@@ -15,7 +15,6 @@ import '../convert.dart';
...
@@ -15,7 +15,6 @@ import '../convert.dart';
import
'../globals.dart'
as
globals
;
import
'../globals.dart'
as
globals
;
import
'../ios/application_package.dart'
;
import
'../ios/application_package.dart'
;
import
'../ios/mac.dart'
;
import
'../ios/mac.dart'
;
import
'../ios/plist_parser.dart'
;
import
'../runner/flutter_command.dart'
;
import
'../runner/flutter_command.dart'
;
import
'build.dart'
;
import
'build.dart'
;
...
@@ -130,49 +129,12 @@ class BuildIOSArchiveCommand extends _BuildIOSSubCommand {
...
@@ -130,49 +129,12 @@ class BuildIOSArchiveCommand extends _BuildIOSSubCommand {
return
super
.
validateCommand
();
return
super
.
validateCommand
();
}
}
Future
<
void
>
_validateXcodeBuildSettingsAfterArchive
()
async
{
final
BuildableIOSApp
app
=
await
buildableIOSApp
;
final
String
plistPath
=
app
.
builtInfoPlistPathAfterArchive
;
if
(!
globals
.
fs
.
file
(
plistPath
).
existsSync
())
{
globals
.
printError
(
'Invalid iOS archive. Does not contain Info.plist.'
);
return
;
}
final
Map
<
String
,
String
?>
xcodeProjectSettingsMap
=
<
String
,
String
?>{};
xcodeProjectSettingsMap
[
'Version Number'
]
=
globals
.
plistParser
.
getStringValueFromFile
(
plistPath
,
PlistParser
.
kCFBundleShortVersionStringKey
);
xcodeProjectSettingsMap
[
'Build Number'
]
=
globals
.
plistParser
.
getStringValueFromFile
(
plistPath
,
PlistParser
.
kCFBundleVersionKey
);
xcodeProjectSettingsMap
[
'Display Name'
]
=
globals
.
plistParser
.
getStringValueFromFile
(
plistPath
,
PlistParser
.
kCFBundleDisplayNameKey
);
xcodeProjectSettingsMap
[
'Deployment Target'
]
=
globals
.
plistParser
.
getStringValueFromFile
(
plistPath
,
PlistParser
.
kMinimumOSVersionKey
);
xcodeProjectSettingsMap
[
'Bundle Identifier'
]
=
globals
.
plistParser
.
getStringValueFromFile
(
plistPath
,
PlistParser
.
kCFBundleIdentifierKey
);
final
StringBuffer
buffer
=
StringBuffer
();
xcodeProjectSettingsMap
.
forEach
((
String
title
,
String
?
info
)
{
buffer
.
writeln
(
'
$title
:
${info ?? "Missing"}
'
);
});
final
String
message
;
if
(
xcodeProjectSettingsMap
.
values
.
any
((
String
?
element
)
=>
element
==
null
))
{
buffer
.
writeln
(
'
\n
You must set up the missing settings'
);
buffer
.
write
(
'Instructions: https://docs.flutter.dev/deployment/ios'
);
message
=
buffer
.
toString
();
}
else
{
// remove the new line
message
=
buffer
.
toString
().
trim
();
}
globals
.
printBox
(
message
,
title:
'App Settings'
);
}
@override
@override
Future
<
FlutterCommandResult
>
runCommand
()
async
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
final
BuildInfo
buildInfo
=
await
cachedBuildInfo
;
final
BuildInfo
buildInfo
=
await
cachedBuildInfo
;
displayNullSafetyMode
(
buildInfo
);
displayNullSafetyMode
(
buildInfo
);
final
FlutterCommandResult
xcarchiveResult
=
await
super
.
runCommand
();
final
FlutterCommandResult
xcarchiveResult
=
await
super
.
runCommand
();
await
_validateXcodeBuildSettingsAfterArchive
();
// xcarchive failed or not at expected location.
// xcarchive failed or not at expected location.
if
(
xcarchiveResult
.
exitStatus
!=
ExitStatus
.
success
)
{
if
(
xcarchiveResult
.
exitStatus
!=
ExitStatus
.
success
)
{
globals
.
printStatus
(
'Skipping IPA.'
);
globals
.
printStatus
(
'Skipping IPA.'
);
...
@@ -327,7 +289,6 @@ abstract class _BuildIOSSubCommand extends BuildSubCommand {
...
@@ -327,7 +289,6 @@ abstract class _BuildIOSSubCommand extends BuildSubCommand {
/// The result of the Xcode build command. Null until it finishes.
/// The result of the Xcode build command. Null until it finishes.
@protected
@protected
XcodeBuildResult
?
xcodeBuildResult
;
XcodeBuildResult
?
xcodeBuildResult
;
EnvironmentType
get
environmentType
;
EnvironmentType
get
environmentType
;
bool
get
configOnly
;
bool
get
configOnly
;
...
...
packages/flutter_tools/lib/src/ios/application_package.dart
View file @
0943693e
...
@@ -145,12 +145,6 @@ class BuildableIOSApp extends IOSApp {
...
@@ -145,12 +145,6 @@ class BuildableIOSApp extends IOSApp {
String
get
archiveBundleOutputPath
=>
String
get
archiveBundleOutputPath
=>
globals
.
fs
.
path
.
setExtension
(
archiveBundlePath
,
'.xcarchive'
);
globals
.
fs
.
path
.
setExtension
(
archiveBundlePath
,
'.xcarchive'
);
String
get
builtInfoPlistPathAfterArchive
=>
globals
.
fs
.
path
.
join
(
archiveBundleOutputPath
,
'Products'
,
'Applications'
,
_hostAppBundleName
==
null
?
'Runner.app'
:
_hostAppBundleName
!,
'Info.plist'
);
String
get
ipaOutputPath
=>
String
get
ipaOutputPath
=>
globals
.
fs
.
path
.
join
(
getIosBuildDirectory
(),
'ipa'
);
globals
.
fs
.
path
.
join
(
getIosBuildDirectory
(),
'ipa'
);
...
...
packages/flutter_tools/lib/src/ios/plist_parser.dart
View file @
0943693e
...
@@ -26,10 +26,7 @@ class PlistParser {
...
@@ -26,10 +26,7 @@ class PlistParser {
static
const
String
kCFBundleIdentifierKey
=
'CFBundleIdentifier'
;
static
const
String
kCFBundleIdentifierKey
=
'CFBundleIdentifier'
;
static
const
String
kCFBundleShortVersionStringKey
=
'CFBundleShortVersionString'
;
static
const
String
kCFBundleShortVersionStringKey
=
'CFBundleShortVersionString'
;
static
const
String
kCFBundleExecutableKey
=
'CFBundleExecutable'
;
static
const
String
kCFBundleExecutable
=
'CFBundleExecutable'
;
static
const
String
kCFBundleVersionKey
=
'CFBundleVersion'
;
static
const
String
kCFBundleDisplayNameKey
=
'CFBundleDisplayName'
;
static
const
String
kMinimumOSVersionKey
=
'MinimumOSVersion'
;
/// Returns the content, converted to XML, of the plist file located at
/// Returns the content, converted to XML, of the plist file located at
/// [plistFilePath].
/// [plistFilePath].
...
...
packages/flutter_tools/lib/src/macos/application_package.dart
View file @
0943693e
...
@@ -87,7 +87,7 @@ abstract class MacOSApp extends ApplicationPackage {
...
@@ -87,7 +87,7 @@ abstract class MacOSApp extends ApplicationPackage {
}
}
final
Map
<
String
,
dynamic
>
propertyValues
=
globals
.
plistParser
.
parseFile
(
plistPath
);
final
Map
<
String
,
dynamic
>
propertyValues
=
globals
.
plistParser
.
parseFile
(
plistPath
);
final
String
?
id
=
propertyValues
[
PlistParser
.
kCFBundleIdentifierKey
]
as
String
?;
final
String
?
id
=
propertyValues
[
PlistParser
.
kCFBundleIdentifierKey
]
as
String
?;
final
String
?
executableName
=
propertyValues
[
PlistParser
.
kCFBundleExecutable
Key
]
as
String
?;
final
String
?
executableName
=
propertyValues
[
PlistParser
.
kCFBundleExecutable
]
as
String
?;
if
(
id
==
null
)
{
if
(
id
==
null
)
{
globals
.
printError
(
'Invalid prebuilt macOS app. Info.plist does not contain bundle identifier'
);
globals
.
printError
(
'Invalid prebuilt macOS app. Info.plist does not contain bundle identifier'
);
return
null
;
return
null
;
...
...
packages/flutter_tools/test/commands.shard/hermetic/build_ipa_test.dart
View file @
0943693e
...
@@ -9,10 +9,8 @@ import 'package:flutter_tools/src/base/platform.dart';
...
@@ -9,10 +9,8 @@ import 'package:flutter_tools/src/base/platform.dart';
import
'package:flutter_tools/src/cache.dart'
;
import
'package:flutter_tools/src/cache.dart'
;
import
'package:flutter_tools/src/commands/build.dart'
;
import
'package:flutter_tools/src/commands/build.dart'
;
import
'package:flutter_tools/src/commands/build_ios.dart'
;
import
'package:flutter_tools/src/commands/build_ios.dart'
;
import
'package:flutter_tools/src/ios/plist_parser.dart'
;
import
'package:flutter_tools/src/ios/xcodeproj.dart'
;
import
'package:flutter_tools/src/ios/xcodeproj.dart'
;
import
'package:flutter_tools/src/reporting/reporting.dart'
;
import
'package:flutter_tools/src/reporting/reporting.dart'
;
import
'package:test/fake.dart'
;
import
'../../general.shard/ios/xcresult_test_data.dart'
;
import
'../../general.shard/ios/xcresult_test_data.dart'
;
import
'../../src/common.dart'
;
import
'../../src/common.dart'
;
...
@@ -52,20 +50,10 @@ final Platform notMacosPlatform = FakePlatform(
...
@@ -52,20 +50,10 @@ final Platform notMacosPlatform = FakePlatform(
}
}
);
);
class
FakePlistUtils
extends
Fake
implements
PlistParser
{
final
Map
<
String
,
Map
<
String
,
Object
>>
fileContents
=
<
String
,
Map
<
String
,
Object
>>{};
@override
String
?
getStringValueFromFile
(
String
plistFilePath
,
String
key
)
{
return
fileContents
[
plistFilePath
]![
key
]
as
String
?;
}
}
void
main
(
)
{
void
main
(
)
{
late
FileSystem
fileSystem
;
late
FileSystem
fileSystem
;
late
TestUsage
usage
;
late
TestUsage
usage
;
late
FakeProcessManager
fakeProcessManager
;
late
FakeProcessManager
fakeProcessManager
;
late
FakePlistUtils
plistUtils
;
setUpAll
(()
{
setUpAll
(()
{
Cache
.
disableLocking
();
Cache
.
disableLocking
();
...
@@ -75,7 +63,6 @@ void main() {
...
@@ -75,7 +63,6 @@ void main() {
fileSystem
=
MemoryFileSystem
.
test
();
fileSystem
=
MemoryFileSystem
.
test
();
usage
=
TestUsage
();
usage
=
TestUsage
();
fakeProcessManager
=
FakeProcessManager
.
empty
();
fakeProcessManager
=
FakeProcessManager
.
empty
();
plistUtils
=
FakePlistUtils
();
});
});
// Sets up the minimal mock project files necessary to look like a Flutter project.
// Sets up the minimal mock project files necessary to look like a Flutter project.
...
@@ -259,7 +246,8 @@ void main() {
...
@@ -259,7 +246,8 @@ void main() {
FileSystem:
()
=>
fileSystem
,
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
Platform:
()
=>
macosPlatform
,
Platform:
()
=>
macosPlatform
,
XcodeProjectInterpreter:
()
=>
FakeXcodeProjectInterpreterWithBuildSettings
(),
XcodeProjectInterpreter:
()
=>
FakeXcodeProjectInterpreterWithBuildSettings
(),
});
});
testUsingContext
(
'ipa build fails when --export-options-plist and --export-method are used together'
,
()
async
{
testUsingContext
(
'ipa build fails when --export-options-plist and --export-method are used together'
,
()
async
{
...
@@ -282,7 +270,8 @@ void main() {
...
@@ -282,7 +270,8 @@ void main() {
FileSystem:
()
=>
fileSystem
,
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
Platform:
()
=>
macosPlatform
,
Platform:
()
=>
macosPlatform
,
XcodeProjectInterpreter:
()
=>
FakeXcodeProjectInterpreterWithBuildSettings
(),
XcodeProjectInterpreter:
()
=>
FakeXcodeProjectInterpreterWithBuildSettings
(),
});
});
testUsingContext
(
'ipa build reports when IPA fails'
,
()
async
{
testUsingContext
(
'ipa build reports when IPA fails'
,
()
async
{
...
@@ -532,7 +521,8 @@ void main() {
...
@@ -532,7 +521,8 @@ void main() {
FileSystem:
()
=>
fileSystem
,
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
Platform:
()
=>
macosPlatform
,
Platform:
()
=>
macosPlatform
,
XcodeProjectInterpreter:
()
=>
FakeXcodeProjectInterpreterWithBuildSettings
(),
XcodeProjectInterpreter:
()
=>
FakeXcodeProjectInterpreterWithBuildSettings
(),
});
});
testUsingContext
(
'Performs code size analysis and sends analytics'
,
()
async
{
testUsingContext
(
'Performs code size analysis and sends analytics'
,
()
async
{
...
@@ -611,7 +601,8 @@ void main() {
...
@@ -611,7 +601,8 @@ void main() {
FileSystem:
()
=>
fileSystem
,
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
fakeProcessManager
,
ProcessManager:
()
=>
fakeProcessManager
,
Platform:
()
=>
macosPlatform
,
Platform:
()
=>
macosPlatform
,
XcodeProjectInterpreter:
()
=>
FakeXcodeProjectInterpreterWithBuildSettings
(),
XcodeProjectInterpreter:
()
=>
FakeXcodeProjectInterpreterWithBuildSettings
(),
});
});
testUsingContext
(
'Trace error if xcresult is empty.'
,
()
async
{
testUsingContext
(
'Trace error if xcresult is empty.'
,
()
async
{
...
@@ -744,97 +735,6 @@ void main() {
...
@@ -744,97 +735,6 @@ void main() {
Platform:
()
=>
macosPlatform
,
Platform:
()
=>
macosPlatform
,
XcodeProjectInterpreter:
()
=>
FakeXcodeProjectInterpreterWithBuildSettings
(),
XcodeProjectInterpreter:
()
=>
FakeXcodeProjectInterpreterWithBuildSettings
(),
});
});
testUsingContext
(
'Validate basic Xcode settings with missing settings'
,
()
async
{
const
String
plistPath
=
'build/ios/archive/Runner.xcarchive/Products/Applications/Runner.app/Info.plist'
;
fakeProcessManager
.
addCommands
(<
FakeCommand
>[
xattrCommand
,
setUpFakeXcodeBuildHandler
(
onRun:
()
{
fileSystem
.
file
(
plistPath
).
createSync
(
recursive:
true
);
}),
exportArchiveCommand
(
exportOptionsPlist:
_exportOptionsPlist
),
]);
createMinimalMockProjectFiles
();
plistUtils
.
fileContents
[
plistPath
]
=
<
String
,
String
>{
'CFBundleIdentifier'
:
'io.flutter.someProject'
,
};
final
BuildCommand
command
=
BuildCommand
();
await
createTestCommandRunner
(
command
).
run
(
<
String
>[
'build'
,
'ipa'
,
'--no-pub'
]);
expect
(
testLogger
.
statusText
,
contains
(
'┌─ App Settings ────────────────────────────────────────┐
\n
'
'│ Version Number: Missing │
\n
'
'│ Build Number: Missing │
\n
'
'│ Display Name: Missing │
\n
'
'│ Deployment Target: Missing │
\n
'
'│ Bundle Identifier: io.flutter.someProject │
\n
'
'│ │
\n
'
'│ You must set up the missing settings │
\n
'
'│ Instructions: https://docs.flutter.dev/deployment/ios │
\n
'
'└───────────────────────────────────────────────────────┘'
)
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
fakeProcessManager
,
Platform:
()
=>
macosPlatform
,
XcodeProjectInterpreter:
()
=>
FakeXcodeProjectInterpreterWithBuildSettings
(),
PlistParser:
()
=>
plistUtils
,
});
testUsingContext
(
'Validate basic Xcode settings with full settings'
,
()
async
{
const
String
plistPath
=
'build/ios/archive/Runner.xcarchive/Products/Applications/Runner.app/Info.plist'
;
fakeProcessManager
.
addCommands
(<
FakeCommand
>[
xattrCommand
,
setUpFakeXcodeBuildHandler
(
onRun:
()
{
fileSystem
.
file
(
plistPath
).
createSync
(
recursive:
true
);
}),
exportArchiveCommand
(
exportOptionsPlist:
_exportOptionsPlist
),
]);
createMinimalMockProjectFiles
();
plistUtils
.
fileContents
[
plistPath
]
=
<
String
,
String
>{
'CFBundleIdentifier'
:
'io.flutter.someProject'
,
'CFBundleDisplayName'
:
'Awesome Gallery'
,
'MinimumOSVersion'
:
'11.0'
,
'CFBundleVersion'
:
'666'
,
'CFBundleShortVersionString'
:
'12.34.56'
,
};
final
BuildCommand
command
=
BuildCommand
();
await
createTestCommandRunner
(
command
).
run
(
<
String
>[
'build'
,
'ipa'
,
'--no-pub'
]);
expect
(
testLogger
.
statusText
,
contains
(
'┌─ App Settings ────────────────────────────┐
\n
'
'│ Version Number: 12.34.56 │
\n
'
'│ Build Number: 666 │
\n
'
'│ Display Name: Awesome Gallery │
\n
'
'│ Deployment Target: 11.0 │
\n
'
'│ Bundle Identifier: io.flutter.someProject │
\n
'
'└───────────────────────────────────────────┘
\n
'
)
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
fakeProcessManager
,
Platform:
()
=>
macosPlatform
,
XcodeProjectInterpreter:
()
=>
FakeXcodeProjectInterpreterWithBuildSettings
(),
PlistParser:
()
=>
plistUtils
,
});
}
}
const
String
_xcBundleFilePath
=
'/.tmp_rand0/flutter_ios_build_temp_dirrand0/temporary_xcresult_bundle'
;
const
String
_xcBundleFilePath
=
'/.tmp_rand0/flutter_ios_build_temp_dirrand0/temporary_xcresult_bundle'
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment