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
9184f4d6
Unverified
Commit
9184f4d6
authored
Dec 18, 2019
by
Jenn Magder
Committed by
GitHub
Dec 18, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Build iOS frameworks with relative output path (#47369)
parent
beb86d2c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
275 additions
and
174 deletions
+275
-174
build_ios_framework_module_test.dart
dev/devicelab/bin/tasks/build_ios_framework_module_test.dart
+58
-7
build_ios_framework.dart
...s/flutter_tools/lib/src/commands/build_ios_framework.dart
+217
-167
No files found.
dev/devicelab/bin/tasks/build_ios_framework_module_test.dart
View file @
9184f4d6
...
...
@@ -45,19 +45,20 @@ Future<void> main() async {
// This builds all build modes' frameworks by default
section
(
'Build frameworks'
);
const
String
outputDirectoryName
=
'flutter-frameworks'
;
await
inDirectory
(
projectDir
,
()
async
{
await
flutter
(
'build'
,
options:
<
String
>[
'ios-framework'
],
options:
<
String
>[
'ios-framework'
,
'--xcframework'
,
'--output=
$outputDirectoryName
'
],
);
});
final
String
outputPath
=
path
.
join
(
projectDir
.
path
,
'build'
,
'ios'
,
'framework'
,
);
final
String
outputPath
=
path
.
join
(
projectDir
.
path
,
outputDirectoryName
);
section
(
'Check debug build has Dart snapshot as asset'
);
...
...
@@ -157,6 +158,22 @@ Future<void> main() async {
'Flutter.framework'
,
'Flutter'
,
));
checkFileExists
(
path
.
join
(
outputPath
,
mode
,
'Flutter.xcframework'
,
'ios-armv7_arm64'
,
'Flutter.framework'
,
'Flutter'
,
));
checkFileExists
(
path
.
join
(
outputPath
,
mode
,
'Flutter.xcframework'
,
'ios-x86_64-simulator'
,
'Flutter.framework'
,
'Flutter'
,
));
}
section
(
"Check all modes' engine header"
);
...
...
@@ -177,6 +194,22 @@ Future<void> main() async {
'device_info.framework'
,
'device_info'
,
));
checkFileExists
(
path
.
join
(
outputPath
,
mode
,
'device_info.xcframework'
,
'ios-armv7_arm64'
,
'device_info.framework'
,
'device_info'
,
));
checkFileExists
(
path
.
join
(
outputPath
,
mode
,
'device_info.xcframework'
,
'ios-x86_64-simulator'
,
'device_info.framework'
,
'device_info'
,
));
}
section
(
"Check all modes' have generated plugin registrant"
);
...
...
@@ -189,6 +222,24 @@ Future<void> main() async {
'Headers'
,
'GeneratedPluginRegistrant.h'
,
));
checkFileExists
(
path
.
join
(
outputPath
,
mode
,
'FlutterPluginRegistrant.xcframework'
,
'ios-armv7_arm64'
,
'FlutterPluginRegistrant.framework'
,
'Headers'
,
'GeneratedPluginRegistrant.h'
,
));
checkFileExists
(
path
.
join
(
outputPath
,
mode
,
'FlutterPluginRegistrant.xcframework'
,
'ios-x86_64-simulator'
,
'FlutterPluginRegistrant.framework'
,
'Headers'
,
'GeneratedPluginRegistrant.h'
,
));
}
return
TaskResult
.
success
(
null
);
...
...
packages/flutter_tools/lib/src/commands/build_ios_framework.dart
View file @
9184f4d6
...
...
@@ -146,7 +146,7 @@ class BuildIOSFrameworkCommand extends BuildSubCommand {
throwToolExit
(
"Module's iOS folder missing"
);
}
final
Directory
outputDirectory
=
fs
.
directory
(
fs
.
path
.
normalize
(
outputArgument
));
final
Directory
outputDirectory
=
fs
.
directory
(
fs
.
path
.
absolute
(
fs
.
path
.
normalize
(
outputArgument
)
));
aotBuilder
??=
AotBuilder
();
bundleBuilder
??=
BundleBuilder
();
...
...
@@ -175,15 +175,18 @@ class BuildIOSFrameworkCommand extends BuildSubCommand {
}
final
Status
status
=
logger
.
startProgress
(
' └─Moving to
${fs.path.relative(modeDirectory.path)}
'
,
timeout:
timeoutConfiguration
.
slowOperation
);
// Delete the intermediaries since they would have been copied into our
// output frameworks.
if
(
iPhoneBuildOutput
.
existsSync
())
{
iPhoneBuildOutput
.
deleteSync
(
recursive:
true
);
}
if
(
simulatorBuildOutput
.
existsSync
())
{
simulatorBuildOutput
.
deleteSync
(
recursive:
true
);
try
{
// Delete the intermediaries since they would have been copied into our
// output frameworks.
if
(
iPhoneBuildOutput
.
existsSync
())
{
iPhoneBuildOutput
.
deleteSync
(
recursive:
true
);
}
if
(
simulatorBuildOutput
.
existsSync
())
{
simulatorBuildOutput
.
deleteSync
(
recursive:
true
);
}
}
finally
{
status
.
stop
();
}
status
.
stop
();
}
printStatus
(
'Frameworks written to
${outputDirectory.path}
.'
);
...
...
@@ -192,66 +195,81 @@ class BuildIOSFrameworkCommand extends BuildSubCommand {
}
Future
<
void
>
_produceFlutterFramework
(
Directory
outputDirectory
,
BuildMode
mode
,
Directory
iPhoneBuildOutput
,
Directory
simulatorBuildOutput
,
Directory
modeDirectory
)
async
{
final
Status
status
=
logger
.
startProgress
(
' ├─Populating Flutter.framework...'
,
timeout:
timeoutConfiguration
.
fastOperation
);
final
String
engineCacheFlutterFrameworkDirectory
=
artifacts
.
getArtifactPath
(
Artifact
.
flutterFramework
,
platform:
TargetPlatform
.
ios
,
mode:
mode
);
// Copy universal engine cache framework to mode directory.
final
String
flutterFrameworkFileName
=
fs
.
path
.
basename
(
engineCacheFlutterFrameworkDirectory
);
final
Directory
fatFlutterFrameworkCopy
=
modeDirectory
.
childDirectory
(
flutterFrameworkFileName
);
copyDirectorySync
(
fs
.
directory
(
engineCacheFlutterFrameworkDirectory
),
fatFlutterFrameworkCopy
);
if
(
boolArg
(
'xcframework'
))
{
// Copy universal framework to variant directory.
final
Directory
armFlutterFrameworkDirectory
=
iPhoneBuildOutput
.
childDirectory
(
flutterFrameworkFileName
);
final
File
armFlutterFrameworkBinary
=
armFlutterFrameworkDirectory
.
childFile
(
'Flutter'
);
final
File
fatFlutterFrameworkBinary
=
fatFlutterFrameworkCopy
.
childFile
(
'Flutter'
);
copyDirectorySync
(
fatFlutterFrameworkCopy
,
armFlutterFrameworkDirectory
);
// Create iOS framework.
List
<
String
>
lipoCommand
=
<
String
>[
'xcrun'
,
'lipo'
,
fatFlutterFrameworkBinary
.
path
,
'-remove'
,
'x86_64'
,
'-output'
,
armFlutterFrameworkBinary
.
path
];
await
processUtils
.
run
(
lipoCommand
,
workingDirectory:
outputDirectory
.
path
,
allowReentrantFlutter:
false
,
);
final
Status
status
=
logger
.
startProgress
(
' ├─Populating Flutter.framework...'
,
timeout:
timeoutConfiguration
.
slowOperation
);
try
{
final
String
engineCacheFlutterFrameworkDirectory
=
artifacts
.
getArtifactPath
(
Artifact
.
flutterFramework
,
platform:
TargetPlatform
.
ios
,
mode:
mode
);
// Copy universal engine cache framework to mode directory.
final
String
flutterFrameworkFileName
=
fs
.
path
.
basename
(
engineCacheFlutterFrameworkDirectory
);
final
Directory
fatFlutterFrameworkCopy
=
modeDirectory
.
childDirectory
(
flutterFrameworkFileName
);
copyDirectorySync
(
fs
.
directory
(
engineCacheFlutterFrameworkDirectory
),
fatFlutterFrameworkCopy
);
if
(
boolArg
(
'xcframework'
))
{
// Copy universal framework to variant directory.
final
Directory
armFlutterFrameworkDirectory
=
iPhoneBuildOutput
.
childDirectory
(
flutterFrameworkFileName
);
final
File
armFlutterFrameworkBinary
=
armFlutterFrameworkDirectory
.
childFile
(
'Flutter'
);
final
File
fatFlutterFrameworkBinary
=
fatFlutterFrameworkCopy
.
childFile
(
'Flutter'
);
copyDirectorySync
(
fatFlutterFrameworkCopy
,
armFlutterFrameworkDirectory
);
// Create iOS framework.
List
<
String
>
lipoCommand
=
<
String
>[
'xcrun'
,
'lipo'
,
fatFlutterFrameworkBinary
.
path
,
'-remove'
,
'x86_64'
,
'-output'
,
armFlutterFrameworkBinary
.
path
];
RunResult
lipoResult
=
processUtils
.
runSync
(
lipoCommand
,
workingDirectory:
outputDirectory
.
path
,
allowReentrantFlutter:
false
,
);
if
(
lipoResult
.
exitCode
!=
0
)
{
throwToolExit
(
'Unable to create ARM engine framework:
${lipoResult.stderr}
'
);
}
// Create simulator framework.
final
Directory
simulatorFlutterFrameworkDirectory
=
simulatorBuildOutput
.
childDirectory
(
flutterFrameworkFileName
);
final
File
simulatorFlutterFrameworkBinary
=
simulatorFlutterFrameworkDirectory
.
childFile
(
'Flutter'
);
copyDirectorySync
(
fatFlutterFrameworkCopy
,
simulatorFlutterFrameworkDirectory
);
// Create simulator framework.
final
Directory
simulatorFlutterFrameworkDirectory
=
simulatorBuildOutput
.
childDirectory
(
flutterFrameworkFileName
);
final
File
simulatorFlutterFrameworkBinary
=
simulatorFlutterFrameworkDirectory
.
childFile
(
'Flutter'
);
copyDirectorySync
(
fatFlutterFrameworkCopy
,
simulatorFlutterFrameworkDirectory
);
lipoCommand
=
<
String
>[
'xcrun'
,
'lipo'
,
fatFlutterFrameworkBinary
.
path
,
'-thin'
,
'x86_64'
,
'-output'
,
simulatorFlutterFrameworkBinary
.
path
];
lipoCommand
=
<
String
>[
'xcrun'
,
'lipo'
,
fatFlutterFrameworkBinary
.
path
,
'-thin'
,
'x86_64'
,
'-output'
,
simulatorFlutterFrameworkBinary
.
path
];
await
processUtils
.
run
(
lipoCommand
,
workingDirectory:
outputDirectory
.
path
,
allowReentrantFlutter:
false
,
);
lipoResult
=
processUtils
.
runSync
(
lipoCommand
,
workingDirectory:
outputDirectory
.
path
,
allowReentrantFlutter:
false
,
);
// Create XCFramework from iOS and simulator frameworks.
final
List
<
String
>
xcframeworkCommand
=
<
String
>[
'xcrun'
,
'xcodebuild'
,
'-create-xcframework'
,
'-framework'
,
armFlutterFrameworkDirectory
.
path
,
'-framework'
,
simulatorFlutterFrameworkDirectory
.
path
,
'-output'
,
modeDirectory
.
childFile
(
'Flutter.xcframework'
)
.
path
];
if
(
lipoResult
.
exitCode
!=
0
)
{
throwToolExit
(
'Unable to create simulator engine framework:
${lipoResult.stderr}
'
);
}
await
processUtils
.
run
(
xcframeworkCommand
,
workingDirectory:
outputDirectory
.
path
,
allowReentrantFlutter:
false
,
);
}
// Create XCFramework from iOS and simulator frameworks.
final
List
<
String
>
xcframeworkCommand
=
<
String
>[
'xcrun'
,
'xcodebuild'
,
'-create-xcframework'
,
'-framework'
,
armFlutterFrameworkDirectory
.
path
,
'-framework'
,
simulatorFlutterFrameworkDirectory
.
path
,
'-output'
,
modeDirectory
.
childFile
(
'Flutter.xcframework'
)
.
path
];
final
RunResult
xcframeworkResult
=
processUtils
.
runSync
(
xcframeworkCommand
,
workingDirectory:
outputDirectory
.
path
,
allowReentrantFlutter:
false
,
);
if
(
xcframeworkResult
.
exitCode
!=
0
)
{
throwToolExit
(
'Unable to create engine XCFramework:
${xcframeworkResult.stderr}
'
);
}
}
if
(!
boolArg
(
'universal'
))
{
fatFlutterFrameworkCopy
.
deleteSync
(
recursive:
true
);
if
(!
boolArg
(
'universal'
))
{
fatFlutterFrameworkCopy
.
deleteSync
(
recursive:
true
);
}
}
finally
{
status
.
stop
();
}
status
.
stop
();
}
Future
<
void
>
_produceAppFramework
(
BuildMode
mode
,
Directory
iPhoneBuildOutput
,
Directory
simulatorBuildOutput
,
Directory
modeDirectory
)
async
{
...
...
@@ -261,8 +279,11 @@ class BuildIOSFrameworkCommand extends BuildSubCommand {
if
(
mode
==
BuildMode
.
debug
)
{
final
Status
status
=
logger
.
startProgress
(
' ├─Add placeholder App.framework for debug...'
,
timeout:
timeoutConfiguration
.
fastOperation
);
await
_produceStubAppFrameworkIfNeeded
(
mode
,
iPhoneBuildOutput
,
simulatorBuildOutput
,
destinationAppFrameworkDirectory
);
status
.
stop
();
try
{
await
_produceStubAppFrameworkIfNeeded
(
mode
,
iPhoneBuildOutput
,
simulatorBuildOutput
,
destinationAppFrameworkDirectory
);
}
finally
{
status
.
stop
();
}
}
else
{
await
_produceAotAppFrameworkIfNeeded
(
mode
,
iPhoneBuildOutput
,
destinationAppFrameworkDirectory
);
}
...
...
@@ -273,15 +294,18 @@ class BuildIOSFrameworkCommand extends BuildSubCommand {
destinationInfoPlist
.
writeAsBytesSync
(
sourceInfoPlist
.
readAsBytesSync
());
final
Status
status
=
logger
.
startProgress
(
' ├─Assembling Flutter resources for App.framework...'
,
timeout:
timeoutConfiguration
.
slowOperation
);
await
bundleBuilder
.
build
(
platform:
TargetPlatform
.
ios
,
buildMode:
mode
,
// Relative paths show noise in the compiler https://github.com/dart-lang/sdk/issues/37978.
mainPath:
fs
.
path
.
absolute
(
targetFile
),
assetDirPath:
destinationAppFrameworkDirectory
.
childDirectory
(
'flutter_assets'
).
path
,
precompiledSnapshot:
mode
!=
BuildMode
.
debug
,
);
status
.
stop
();
try
{
await
bundleBuilder
.
build
(
platform:
TargetPlatform
.
ios
,
buildMode:
mode
,
// Relative paths show noise in the compiler https://github.com/dart-lang/sdk/issues/37978.
mainPath:
fs
.
path
.
absolute
(
targetFile
),
assetDirPath:
destinationAppFrameworkDirectory
.
childDirectory
(
'flutter_assets'
).
path
,
precompiledSnapshot:
mode
!=
BuildMode
.
debug
,
);
}
finally
{
status
.
stop
();
}
}
Future
<
void
>
_produceStubAppFrameworkIfNeeded
(
BuildMode
mode
,
Directory
iPhoneBuildOutput
,
Directory
simulatorBuildOutput
,
Directory
destinationAppFrameworkDirectory
)
async
{
...
...
@@ -309,10 +333,14 @@ class BuildIOSFrameworkCommand extends BuildSubCommand {
destinationAppFrameworkDirectory
.
childFile
(
binaryName
).
path
];
await
processUtils
.
run
(
final
RunResult
lipoResult
=
processUtils
.
runSync
(
lipoCommand
,
allowReentrantFlutter:
false
,
);
if
(
lipoResult
.
exitCode
!=
0
)
{
throwToolExit
(
'Unable to create compiled dart universal framework:
${lipoResult.stderr}
'
);
}
}
Future
<
void
>
_produceAotAppFrameworkIfNeeded
(
BuildMode
mode
,
Directory
iPhoneBuildOutput
,
Directory
destinationAppFrameworkDirectory
)
async
{
...
...
@@ -320,22 +348,25 @@ class BuildIOSFrameworkCommand extends BuildSubCommand {
return
;
}
final
Status
status
=
logger
.
startProgress
(
' ├─Building Dart AOT for App.framework...'
,
timeout:
timeoutConfiguration
.
slowOperation
);
await
aotBuilder
.
build
(
platform:
TargetPlatform
.
ios
,
outputPath:
iPhoneBuildOutput
.
path
,
buildMode:
mode
,
// Relative paths show noise in the compiler https://github.com/dart-lang/sdk/issues/37978.
mainDartFile:
fs
.
path
.
absolute
(
targetFile
),
quiet:
true
,
bitcode:
true
,
reportTimings:
false
,
iosBuildArchs:
<
DarwinArch
>[
DarwinArch
.
armv7
,
DarwinArch
.
arm64
],
dartDefines:
dartDefines
,
);
try
{
await
aotBuilder
.
build
(
platform:
TargetPlatform
.
ios
,
outputPath:
iPhoneBuildOutput
.
path
,
buildMode:
mode
,
// Relative paths show noise in the compiler https://github.com/dart-lang/sdk/issues/37978.
mainDartFile:
fs
.
path
.
absolute
(
targetFile
),
quiet:
true
,
bitcode:
true
,
reportTimings:
false
,
iosBuildArchs:
<
DarwinArch
>[
DarwinArch
.
armv7
,
DarwinArch
.
arm64
],
dartDefines:
dartDefines
,
);
const
String
appFrameworkName
=
'App.framework'
;
copyDirectorySync
(
iPhoneBuildOutput
.
childDirectory
(
appFrameworkName
),
destinationAppFrameworkDirectory
);
status
.
stop
();
const
String
appFrameworkName
=
'App.framework'
;
copyDirectorySync
(
iPhoneBuildOutput
.
childDirectory
(
appFrameworkName
),
destinationAppFrameworkDirectory
);
}
finally
{
status
.
stop
();
}
}
Future
<
void
>
_producePlugins
(
...
...
@@ -346,92 +377,111 @@ class BuildIOSFrameworkCommand extends BuildSubCommand {
Directory
outputDirectory
,
)
async
{
final
Status
status
=
logger
.
startProgress
(
' ├─Building plugins...'
,
timeout:
timeoutConfiguration
.
slowOperation
);
List
<
String
>
pluginsBuildCommand
=
<
String
>[
'xcrun'
,
'xcodebuild'
,
'-alltargets'
,
'-sdk'
,
'iphoneos'
,
'-configuration'
,
xcodeBuildConfiguration
,
'SYMROOT=
${iPhoneBuildOutput.path}
'
,
'ONLY_ACTIVE_ARCH=NO'
// No device targeted, so build all valid architectures.
];
try
{
List
<
String
>
pluginsBuildCommand
=
<
String
>[
'xcrun'
,
'xcodebuild'
,
'-alltargets'
,
'-sdk'
,
'iphoneos'
,
'-configuration'
,
xcodeBuildConfiguration
,
'SYMROOT=
${iPhoneBuildOutput.path}
'
,
'ONLY_ACTIVE_ARCH=NO'
// No device targeted, so build all valid architectures.
];
await
processUtils
.
run
(
pluginsBuildCommand
,
workingDirectory:
_project
.
ios
.
hostAppRoot
.
childDirectory
(
'Pods'
).
path
,
allowReentrantFlutter:
false
,
);
RunResult
buildPluginsResult
=
processUtils
.
runSync
(
pluginsBuildCommand
,
workingDirectory:
_project
.
ios
.
hostAppRoot
.
childDirectory
(
'Pods'
).
path
,
allowReentrantFlutter:
false
,
);
pluginsBuildCommand
=
<
String
>[
'xcrun'
,
'xcodebuild'
,
'-alltargets'
,
'-sdk'
,
'iphonesimulator'
,
'-configuration'
,
xcodeBuildConfiguration
,
'SYMROOT=
${simulatorBuildOutput.path}
'
,
'ARCHS=x86_64'
,
'ONLY_ACTIVE_ARCH=NO'
// No device targeted, so build all valid architectures.
];
if
(
buildPluginsResult
.
exitCode
!=
0
)
{
throwToolExit
(
'Unable to build plugin frameworks:
${buildPluginsResult.stderr}
'
);
}
await
processUtils
.
run
(
pluginsBuildCommand
,
workingDirectory:
_project
.
ios
.
hostAppRoot
.
childDirectory
(
'Pods'
).
path
,
allowReentrantFlutter:
false
,
);
pluginsBuildCommand
=
<
String
>[
'xcrun'
,
'xcodebuild'
,
'-alltargets'
,
'-sdk'
,
'iphonesimulator'
,
'-configuration'
,
xcodeBuildConfiguration
,
'SYMROOT=
${simulatorBuildOutput.path}
'
,
'ARCHS=x86_64'
,
'ONLY_ACTIVE_ARCH=NO'
// No device targeted, so build all valid architectures.
];
final
Directory
iPhoneBuildConfiguration
=
iPhoneBuildOutput
.
childDirectory
(
'
$xcodeBuildConfiguration
-iphoneos'
);
final
Directory
simulatorBuildConfiguration
=
simulatorBuildOutput
.
childDirectory
(
'
$xcodeBuildConfiguration
-iphonesimulator'
);
for
(
Directory
builtProduct
in
iPhoneBuildConfiguration
.
listSync
(
followLinks:
false
).
whereType
<
Directory
>())
{
for
(
FileSystemEntity
podProduct
in
builtProduct
.
listSync
(
followLinks:
false
))
{
final
String
podFrameworkName
=
podProduct
.
basename
;
if
(
fs
.
path
.
extension
(
podFrameworkName
)
==
'.framework'
)
{
final
String
binaryName
=
fs
.
path
.
basenameWithoutExtension
(
podFrameworkName
);
if
(
boolArg
(
'universal'
))
{
copyDirectorySync
(
podProduct
as
Directory
,
modeDirectory
.
childDirectory
(
podFrameworkName
));
final
List
<
String
>
lipoCommand
=
<
String
>[
'xcrun'
,
'lipo'
,
'-create'
,
fs
.
path
.
join
(
podProduct
.
path
,
binaryName
),
simulatorBuildConfiguration
.
childDirectory
(
binaryName
).
childDirectory
(
podFrameworkName
).
childFile
(
binaryName
).
path
,
'-output'
,
modeDirectory
.
childDirectory
(
podFrameworkName
).
childFile
(
binaryName
).
path
];
await
processUtils
.
run
(
lipoCommand
,
workingDirectory:
outputDirectory
.
path
,
allowReentrantFlutter:
false
,
);
}
buildPluginsResult
=
processUtils
.
runSync
(
pluginsBuildCommand
,
workingDirectory:
_project
.
ios
.
hostAppRoot
.
childDirectory
(
'Pods'
).
path
,
allowReentrantFlutter:
false
,
);
if
(
boolArg
(
'xcframework'
))
{
final
List
<
String
>
xcframeworkCommand
=
<
String
>[
'xcrun'
,
'xcodebuild'
,
'-create-xcframework'
,
'-framework'
,
podProduct
.
path
,
'-framework'
,
simulatorBuildConfiguration
.
childDirectory
(
binaryName
).
childDirectory
(
podFrameworkName
).
path
,
'-output'
,
modeDirectory
.
childFile
(
'
$binaryName
.xcframework'
).
path
];
await
processUtils
.
run
(
xcframeworkCommand
,
workingDirectory:
outputDirectory
.
path
,
allowReentrantFlutter:
false
,
);
if
(
buildPluginsResult
.
exitCode
!=
0
)
{
throwToolExit
(
'Unable to build plugin frameworks for simulator:
${buildPluginsResult.stderr}
'
);
}
final
Directory
iPhoneBuildConfiguration
=
iPhoneBuildOutput
.
childDirectory
(
'
$xcodeBuildConfiguration
-iphoneos'
);
final
Directory
simulatorBuildConfiguration
=
simulatorBuildOutput
.
childDirectory
(
'
$xcodeBuildConfiguration
-iphonesimulator'
);
for
(
Directory
builtProduct
in
iPhoneBuildConfiguration
.
listSync
(
followLinks:
false
).
whereType
<
Directory
>())
{
for
(
FileSystemEntity
podProduct
in
builtProduct
.
listSync
(
followLinks:
false
))
{
final
String
podFrameworkName
=
podProduct
.
basename
;
if
(
fs
.
path
.
extension
(
podFrameworkName
)
==
'.framework'
)
{
final
String
binaryName
=
fs
.
path
.
basenameWithoutExtension
(
podFrameworkName
);
if
(
boolArg
(
'universal'
))
{
copyDirectorySync
(
podProduct
as
Directory
,
modeDirectory
.
childDirectory
(
podFrameworkName
));
final
List
<
String
>
lipoCommand
=
<
String
>[
'xcrun'
,
'lipo'
,
'-create'
,
fs
.
path
.
join
(
podProduct
.
path
,
binaryName
),
simulatorBuildConfiguration
.
childDirectory
(
binaryName
).
childDirectory
(
podFrameworkName
).
childFile
(
binaryName
).
path
,
'-output'
,
modeDirectory
.
childDirectory
(
podFrameworkName
).
childFile
(
binaryName
).
path
];
final
RunResult
pluginsLipoResult
=
processUtils
.
runSync
(
lipoCommand
,
workingDirectory:
outputDirectory
.
path
,
allowReentrantFlutter:
false
,
);
if
(
pluginsLipoResult
.
exitCode
!=
0
)
{
throwToolExit
(
'Unable to create universal
$binaryName
.framework:
${buildPluginsResult.stderr}
'
);
}
}
if
(
boolArg
(
'xcframework'
))
{
final
List
<
String
>
xcframeworkCommand
=
<
String
>[
'xcrun'
,
'xcodebuild'
,
'-create-xcframework'
,
'-framework'
,
podProduct
.
path
,
'-framework'
,
simulatorBuildConfiguration
.
childDirectory
(
binaryName
).
childDirectory
(
podFrameworkName
).
path
,
'-output'
,
modeDirectory
.
childFile
(
'
$binaryName
.xcframework'
).
path
];
final
RunResult
xcframeworkResult
=
processUtils
.
runSync
(
xcframeworkCommand
,
workingDirectory:
outputDirectory
.
path
,
allowReentrantFlutter:
false
,
);
if
(
xcframeworkResult
.
exitCode
!=
0
)
{
throwToolExit
(
'Unable to create
$binaryName
.xcframework:
${xcframeworkResult.stderr}
'
);
}
}
}
}
}
}
finally
{
status
.
stop
();
}
status
.
stop
();
}
}
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