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
d081364d
Unverified
Commit
d081364d
authored
Apr 10, 2020
by
Jonah Williams
Committed by
GitHub
Apr 10, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] remove indirection around App.framework production (#53853)
parent
7ceed973
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
33 deletions
+64
-33
build.dart
packages/flutter_tools/lib/src/commands/build.dart
+2
-2
build_ios_framework.dart
...s/flutter_tools/lib/src/commands/build_ios_framework.dart
+52
-21
build_ios_framework_test.dart
...est/commands.shard/hermetic/build_ios_framework_test.dart
+10
-10
No files found.
packages/flutter_tools/lib/src/commands/build.dart
View file @
d081364d
...
...
@@ -4,11 +4,11 @@
import
'dart:async'
;
import
'../aot.dart'
;
import
'../bundle.dart'
;
import
'../commands/build_linux.dart'
;
import
'../commands/build_macos.dart'
;
import
'../commands/build_windows.dart'
;
import
'../globals.dart'
as
globals
;
import
'../runner/flutter_command.dart'
;
import
'build_aar.dart'
;
import
'build_aot.dart'
;
...
...
@@ -28,7 +28,7 @@ class BuildCommand extends FlutterCommand {
addSubcommand
(
BuildAotCommand
());
addSubcommand
(
BuildIOSCommand
());
addSubcommand
(
BuildIOSFrameworkCommand
(
aotBuilder:
AotBuilder
()
,
buildSystem:
globals
.
buildSystem
,
bundleBuilder:
BundleBuilder
(),
));
addSubcommand
(
BuildBundleCommand
(
verboseHelp:
verboseHelp
));
...
...
packages/flutter_tools/lib/src/commands/build_ios_framework.dart
View file @
d081364d
...
...
@@ -8,7 +8,6 @@ import 'package:file/file.dart';
import
'package:meta/meta.dart'
;
import
'package:platform/platform.dart'
;
import
'../aot.dart'
;
import
'../artifacts.dart'
;
import
'../base/common.dart'
;
import
'../base/file_system.dart'
;
...
...
@@ -16,9 +15,13 @@ import '../base/logger.dart';
import
'../base/process.dart'
;
import
'../base/utils.dart'
;
import
'../build_info.dart'
;
import
'../build_system/build_system.dart'
;
import
'../build_system/targets/dart.dart'
;
import
'../build_system/targets/icon_tree_shaker.dart'
;
import
'../build_system/targets/ios.dart'
;
import
'../bundle.dart'
;
import
'../cache.dart'
;
import
'../convert.dart'
;
import
'../globals.dart'
as
globals
;
import
'../macos/cocoapod_utils.dart'
;
import
'../macos/xcode.dart'
;
...
...
@@ -35,12 +38,12 @@ import 'build.dart';
class
BuildIOSFrameworkCommand
extends
BuildSubCommand
{
BuildIOSFrameworkCommand
({
FlutterVersion
flutterVersion
,
// Instantiating FlutterVersion kicks off networking, so delay until it's needed, but allow test injection.
@required
AotBuilder
aotBuilder
,
@required
BundleBuilder
bundleBuilder
,
@required
BuildSystem
buildSystem
,
Cache
cache
,
Platform
platform
})
:
_flutterVersion
=
flutterVersion
,
_
aotBuilder
=
aotBuilder
,
_
buildSystem
=
buildSystem
,
_bundleBuilder
=
bundleBuilder
,
_injectedCache
=
cache
,
_injectedPlatform
=
platform
{
...
...
@@ -95,8 +98,9 @@ class BuildIOSFrameworkCommand extends BuildSubCommand {
);
}
final
AotBuilder
_aotBuilder
;
final
BundleBuilder
_bundleBuilder
;
final
BuildSystem
_buildSystem
;
BuildSystem
get
buildSystem
=>
_buildSystem
??
globals
.
buildSystem
;
Cache
get
_cache
=>
_injectedCache
??
globals
.
cache
;
final
Cache
_injectedCache
;
...
...
@@ -367,15 +371,17 @@ end
final Status status = globals.logger.startProgress(
'
├─
Assembling
Flutter
resources
for
App
.
framework
...
', timeout: timeoutConfiguration.slowOperation);
try {
if (buildInfo.mode == BuildMode.debug) {
await _bundleBuilder.build(
platform: TargetPlatform.ios,
buildInfo: buildInfo,
// Relative paths show noise in the compiler https://github.com/dart-lang/sdk/issues/37978.
mainPath: globals.fs.path.absolute(targetFile),
assetDirPath: destinationAppFrameworkDirectory.childDirectory('
flutter_assets
').path,
precompiledSnapshot: buildInfo.mode != BuildMode.debug,
treeShakeIcons: boolArg('
tree
-
shake
-
icons
')
);
platform: TargetPlatform.ios,
buildInfo: buildInfo,
// Relative paths show noise in the compiler https://github.com/dart-lang/sdk/issues/37978.
mainPath: globals.fs.path.absolute(targetFile),
assetDirPath: destinationAppFrameworkDirectory.childDirectory('
flutter_assets
').path,
precompiledSnapshot: buildInfo.mode != BuildMode.debug,
treeShakeIcons: boolArg('
tree
-
shake
-
icons
')
);
}
} finally {
status.stop();
}
...
...
@@ -429,16 +435,41 @@ end
timeout: timeoutConfiguration.slowOperation,
);
try {
await _aotBuilder.build(
platform: TargetPlatform.ios,
outputPath: destinationDirectory.path,
buildInfo: buildInfo,
// Relative paths show noise in the compiler https://github.com/dart-lang/sdk/issues/37978.
mainDartFile: globals.fs.path.absolute(targetFile),
quiet: true,
bitcode: true,
iosBuildArchs: <DarwinArch>[DarwinArch.armv7, DarwinArch.arm64],
final Target target = buildInfo.isRelease
? const ReleaseIosApplicationBundle()
: const ProfileIosApplicationBundle();
final Environment environment = Environment(
projectDir: globals.fs.currentDirectory,
outputDir: destinationDirectory,
buildDir: _project.dartTool.childDirectory('
flutter_build
'),
cacheDir: null,
flutterRootDir: globals.fs.directory(Cache.flutterRoot),
defines: <String, String>{
kTargetFile: targetFile,
kBuildMode: getNameForBuildMode(buildInfo.mode),
kTargetPlatform: getNameForTargetPlatform(TargetPlatform.ios),
kIconTreeShakerFlag: buildInfo.treeShakeIcons.toString(),
kDartDefines: jsonEncode(buildInfo.dartDefines),
kBitcodeFlag: '
true
',
if (buildInfo?.extraGenSnapshotOptions?.isNotEmpty ?? false)
kExtraGenSnapshotOptions: buildInfo.extraGenSnapshotOptions.join('
,
'),
if (buildInfo?.extraFrontEndOptions?.isNotEmpty ?? false)
kExtraFrontEndOptions: buildInfo.extraFrontEndOptions.join('
,
'),
kIosArchs: <DarwinArch>[DarwinArch.armv7, DarwinArch.arm64]
.map(getNameForDarwinArch).join('
'),
},
artifacts: globals.artifacts,
fileSystem: globals.fs,
logger: globals.logger,
processManager: globals.processManager,
);
final BuildResult result = await buildSystem.build(target, environment);
if (!result.success) {
for (final ExceptionMeasurement measurement in result.exceptions.values) {
globals.printError(measurement.exception.toString());
}
throwToolExit('
The
aot
build
failed
.
');
}
} finally {
status.stop();
}
...
...
packages/flutter_tools/test/commands.shard/hermetic/build_ios_framework_test.dart
View file @
d081364d
...
...
@@ -5,8 +5,8 @@
import
'dart:io'
;
import
'package:file/memory.dart'
;
import
'package:flutter_tools/src/aot.dart'
;
import
'package:flutter_tools/src/build_info.dart'
;
import
'package:flutter_tools/src/build_system/build_system.dart'
;
import
'package:flutter_tools/src/bundle.dart'
;
import
'package:flutter_tools/src/cache.dart'
;
import
'package:flutter_tools/src/commands/build_ios_framework.dart'
;
...
...
@@ -64,7 +64,7 @@ void main() {
when
(
mockFlutterVersion
.
frameworkVersion
).
thenReturn
(
frameworkVersion
);
final
BuildIOSFrameworkCommand
command
=
BuildIOSFrameworkCommand
(
aotBuilder:
MockAotBuilder
(),
buildSystem:
MockBuildSystem
(),
bundleBuilder:
MockBundleBuilder
(),
platform:
fakePlatform
,
flutterVersion:
mockFlutterVersion
,
...
...
@@ -89,7 +89,7 @@ void main() {
when
(
mockGitTagVersion
.
commits
).
thenReturn
(
2
);
final
BuildIOSFrameworkCommand
command
=
BuildIOSFrameworkCommand
(
aotBuilder:
MockAotBuilder
(),
buildSystem:
MockBuildSystem
(),
bundleBuilder:
MockBundleBuilder
(),
platform:
fakePlatform
,
flutterVersion:
mockFlutterVersion
,
...
...
@@ -111,7 +111,7 @@ void main() {
when
(
mockGitTagVersion
.
commits
).
thenReturn
(
0
);
final
BuildIOSFrameworkCommand
command
=
BuildIOSFrameworkCommand
(
aotBuilder:
MockAotBuilder
(),
buildSystem:
MockBuildSystem
(),
bundleBuilder:
MockBundleBuilder
(),
platform:
fakePlatform
,
flutterVersion:
mockFlutterVersion
,
...
...
@@ -149,7 +149,7 @@ void main() {
testUsingContext
(
'created when forced'
,
()
async
{
final
BuildIOSFrameworkCommand
command
=
BuildIOSFrameworkCommand
(
aotBuilder:
MockAotBuilder
(),
buildSystem:
MockBuildSystem
(),
bundleBuilder:
MockBundleBuilder
(),
platform:
fakePlatform
,
flutterVersion:
mockFlutterVersion
,
...
...
@@ -172,7 +172,7 @@ void main() {
testUsingContext
(
'contains license and version'
,
()
async
{
final
BuildIOSFrameworkCommand
command
=
BuildIOSFrameworkCommand
(
aotBuilder:
MockAotBuilder
(),
buildSystem:
MockBuildSystem
(),
bundleBuilder:
MockBundleBuilder
(),
platform:
fakePlatform
,
flutterVersion:
mockFlutterVersion
,
...
...
@@ -192,7 +192,7 @@ void main() {
testUsingContext
(
'debug URL'
,
()
async
{
final
BuildIOSFrameworkCommand
command
=
BuildIOSFrameworkCommand
(
aotBuilder:
MockAotBuilder
(),
buildSystem:
MockBuildSystem
(),
bundleBuilder:
MockBundleBuilder
(),
platform:
fakePlatform
,
flutterVersion:
mockFlutterVersion
,
...
...
@@ -210,7 +210,7 @@ void main() {
testUsingContext
(
'profile URL'
,
()
async
{
final
BuildIOSFrameworkCommand
command
=
BuildIOSFrameworkCommand
(
aotBuilder:
MockAotBuilder
(),
buildSystem:
MockBuildSystem
(),
bundleBuilder:
MockBundleBuilder
(),
platform:
fakePlatform
,
flutterVersion:
mockFlutterVersion
,
...
...
@@ -228,7 +228,7 @@ void main() {
testUsingContext
(
'release URL'
,
()
async
{
final
BuildIOSFrameworkCommand
command
=
BuildIOSFrameworkCommand
(
aotBuilder:
MockAotBuilder
(),
buildSystem:
MockBuildSystem
(),
bundleBuilder:
MockBundleBuilder
(),
platform:
fakePlatform
,
flutterVersion:
mockFlutterVersion
,
...
...
@@ -252,5 +252,5 @@ void main() {
class
MockFlutterVersion
extends
Mock
implements
FlutterVersion
{}
class
MockGitTagVersion
extends
Mock
implements
GitTagVersion
{}
class
MockCache
extends
Mock
implements
Cache
{}
class
Mock
AotBuilder
extends
Mock
implements
AotBuilder
{}
class
Mock
BuildSystem
extends
Mock
implements
BuildSystem
{}
class
MockBundleBuilder
extends
Mock
implements
BundleBuilder
{}
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