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
07f079a9
Unverified
Commit
07f079a9
authored
Aug 15, 2019
by
Dan Field
Committed by
GitHub
Aug 15, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve bitcode check (#38587)
parent
2a6f1b73
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
14 deletions
+68
-14
build_aot.dart
packages/flutter_tools/lib/src/commands/build_aot.dart
+28
-5
build_aot_test.dart
...ter_tools/test/general.shard/commands/build_aot_test.dart
+40
-9
No files found.
packages/flutter_tools/lib/src/commands/build_aot.dart
View file @
07f079a9
...
...
@@ -11,6 +11,7 @@ import '../base/context.dart';
import
'../base/file_system.dart'
;
import
'../base/logger.dart'
;
import
'../base/process.dart'
;
import
'../base/version.dart'
;
import
'../build_info.dart'
;
import
'../dart/package_map.dart'
;
import
'../globals.dart'
;
...
...
@@ -225,13 +226,35 @@ Future<void> validateBitcode() async {
fs
.
path
.
join
(
flutterFrameworkPath
,
'Info.plist'
),
'ClangVersion'
,
);
if
(
clangVersion
!=
engineClangVersion
)
{
printStatus
(
final
Version
engineClangSemVer
=
_parseVersionFromClang
(
engineClangVersion
);
final
Version
clangSemVer
=
_parseVersionFromClang
(
clangVersion
);
if
(
engineClangSemVer
>
clangSemVer
)
{
throwToolExit
(
'The Flutter.framework at
$flutterFrameworkPath
was built '
'with "
${engineClangVersion ?? 'unknown'}
", but the current version '
'of clang is "
$clangVersion
". This
may result in failures when
'
'archiv
ing your application in Xcode.'
,
emphasis:
true
,
'of clang is "
$clangVersion
". This
will result in failures when trying to
'
'archiv
e an IPA. To resolve this issue, update your version of Xcode to '
'at least
$engineClangSemVer
.'
,
);
}
}
Version
_parseVersionFromClang
(
String
clangVersion
)
{
const
String
prefix
=
'Apple LLVM version '
;
void
_invalid
()
{
throwToolExit
(
'Unable to parse Clang version from "
$clangVersion
". '
'Expected a string like "
$prefix
#.#.# (clang-####.#.##.#)".'
);
}
if
(
clangVersion
==
null
||
clangVersion
.
length
<=
prefix
.
length
||
!
clangVersion
.
startsWith
(
prefix
))
{
_invalid
();
}
final
int
lastSpace
=
clangVersion
.
lastIndexOf
(
' '
);
if
(
lastSpace
==
-
1
)
{
_invalid
();
}
final
Version
version
=
Version
.
parse
(
clangVersion
.
substring
(
prefix
.
length
,
lastSpace
));
if
(
version
==
null
)
{
_invalid
();
}
return
version
;
}
packages/flutter_tools/test/general.shard/commands/build_aot_test.dart
View file @
07f079a9
...
...
@@ -82,19 +82,50 @@ void main() {
const
<
String
>[
'foo'
],
);
final
RunResult
clangResult
=
RunResult
(
FakeProcessResult
(
stdout:
'
BadVersion
\n
BlahBlah
\n
'
,
stderr:
''
),
FakeProcessResult
(
stdout:
'
Apple LLVM version 10.0.0 (clang-4567.1.1.1)
\n
BlahBlah
\n
'
,
stderr:
''
),
const
<
String
>[
'foo'
],
);
when
(
mockXcode
.
otool
(
any
)).
thenAnswer
((
_
)
=>
Future
<
RunResult
>.
value
(
otoolResult
));
when
(
mockXcode
.
clang
(
any
)).
thenAnswer
((
_
)
=>
Future
<
RunResult
>.
value
(
clangResult
));
when
(
mockIOSWorkflow
.
getPlistValueFromFile
(
infoPlist
.
path
,
'ClangVersion'
)).
thenReturn
(
'Apple LLVM
Version 10.0.1
'
);
when
(
mockIOSWorkflow
.
getPlistValueFromFile
(
infoPlist
.
path
,
'ClangVersion'
)).
thenReturn
(
'Apple LLVM
version 10.0.1 (clang-1234.1.12.1)
'
);
await
validateBitcode
();
await
expectToolExitLater
(
validateBitcode
(),
equals
(
'The Flutter.framework at ios_profile/Flutter.framework was built with "Apple LLVM version 10.0.1 '
'(clang-1234.1.12.1)", but the current version of clang is "Apple LLVM version 10.0.0 (clang-4567.1.1.1)". '
'This will result in failures when trying toarchive an IPA. To resolve this issue, update your version '
'of Xcode to at least 10.0.1.'
),
);
},
overrides:
<
Type
,
Generator
>{
Artifacts:
()
=>
LocalEngineArtifacts
(
'/engine'
,
'ios_profile'
,
'host_profile'
),
FileSystem:
()
=>
memoryFileSystem
,
ProcessManager:
()
=>
mockProcessManager
,
Xcode:
()
=>
mockXcode
,
Logger:
()
=>
bufferLogger
,
IOSWorkflow:
()
=>
mockIOSWorkflow
,
});
expect
(
bufferLogger
.
statusText
,
startsWith
(
'The Flutter.framework at
${flutterFramework.path}
was built with "Apple LLVM Version 10.0.1'
),
testUsingContext
(
'build aot validates and succeeds - same version of Xcode'
,
()
async
{
final
Directory
flutterFramework
=
memoryFileSystem
.
directory
(
'ios_profile/Flutter.framework'
)
..
createSync
(
recursive:
true
);
flutterFramework
.
childFile
(
'Flutter'
).
createSync
();
final
File
infoPlist
=
flutterFramework
.
childFile
(
'Info.plist'
)..
createSync
();
final
RunResult
otoolResult
=
RunResult
(
FakeProcessResult
(
stdout:
'__LLVM'
,
stderr:
''
),
const
<
String
>[
'foo'
],
);
final
RunResult
clangResult
=
RunResult
(
FakeProcessResult
(
stdout:
'Apple LLVM version 10.0.1 (clang-1234.1.12.1)
\n
BlahBlah
\n
'
,
stderr:
''
),
const
<
String
>[
'foo'
],
);
when
(
mockXcode
.
otool
(
any
)).
thenAnswer
((
_
)
=>
Future
<
RunResult
>.
value
(
otoolResult
));
when
(
mockXcode
.
clang
(
any
)).
thenAnswer
((
_
)
=>
Future
<
RunResult
>.
value
(
clangResult
));
when
(
mockIOSWorkflow
.
getPlistValueFromFile
(
infoPlist
.
path
,
'ClangVersion'
)).
thenReturn
(
'Apple LLVM version 10.0.1 (clang-1234.1.12.1)'
);
await
validateBitcode
();
expect
(
bufferLogger
.
statusText
,
''
);
},
overrides:
<
Type
,
Generator
>{
Artifacts:
()
=>
LocalEngineArtifacts
(
'/engine'
,
'ios_profile'
,
'host_profile'
),
FileSystem:
()
=>
memoryFileSystem
,
...
...
@@ -104,7 +135,7 @@ void main() {
IOSWorkflow:
()
=>
mockIOSWorkflow
,
});
testUsingContext
(
'build aot validates and succeeds'
,
()
async
{
testUsingContext
(
'build aot validates and succeeds
when user has newer version of Xcode
'
,
()
async
{
final
Directory
flutterFramework
=
memoryFileSystem
.
directory
(
'ios_profile/Flutter.framework'
)
..
createSync
(
recursive:
true
);
flutterFramework
.
childFile
(
'Flutter'
).
createSync
();
...
...
@@ -115,12 +146,12 @@ void main() {
const
<
String
>[
'foo'
],
);
final
RunResult
clangResult
=
RunResult
(
FakeProcessResult
(
stdout:
'Apple LLVM
Version 10.0.1
\n
BlahBlah
\n
'
,
stderr:
''
),
FakeProcessResult
(
stdout:
'Apple LLVM
version 11.0.1 (clang-1234.1.12.1)
\n
BlahBlah
\n
'
,
stderr:
''
),
const
<
String
>[
'foo'
],
);
when
(
mockXcode
.
otool
(
any
)).
thenAnswer
((
_
)
=>
Future
<
RunResult
>.
value
(
otoolResult
));
when
(
mockXcode
.
clang
(
any
)).
thenAnswer
((
_
)
=>
Future
<
RunResult
>.
value
(
clangResult
));
when
(
mockIOSWorkflow
.
getPlistValueFromFile
(
infoPlist
.
path
,
'ClangVersion'
)).
thenReturn
(
'Apple LLVM
Version 10.0.1
'
);
when
(
mockIOSWorkflow
.
getPlistValueFromFile
(
infoPlist
.
path
,
'ClangVersion'
)).
thenReturn
(
'Apple LLVM
version 10.0.1 (clang-1234.1.12.1)
'
);
await
validateBitcode
();
...
...
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