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
7feb7ddd
Unverified
Commit
7feb7ddd
authored
Jan 27, 2020
by
Jenn Magder
Committed by
GitHub
Jan 27, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Inject platform into build ios-framework command (#49463)
parent
92a7cd42
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
95 additions
and
43 deletions
+95
-43
build.dart
packages/flutter_tools/lib/src/commands/build.dart
+9
-2
build_ios_framework.dart
...s/flutter_tools/lib/src/commands/build_ios_framework.dart
+27
-18
build_ios_framework_test.dart
...est/commands.shard/hermetic/build_ios_framework_test.dart
+59
-23
No files found.
packages/flutter_tools/lib/src/commands/build.dart
View file @
7feb7ddd
...
...
@@ -4,10 +4,12 @@
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'
;
...
...
@@ -26,7 +28,12 @@ class BuildCommand extends FlutterCommand {
addSubcommand
(
BuildAppBundleCommand
(
verboseHelp:
verboseHelp
));
addSubcommand
(
BuildAotCommand
(
verboseHelp:
verboseHelp
));
addSubcommand
(
BuildIOSCommand
());
addSubcommand
(
BuildIOSFrameworkCommand
());
addSubcommand
(
BuildIOSFrameworkCommand
(
aotBuilder:
AotBuilder
(),
bundleBuilder:
BundleBuilder
(),
cache:
globals
.
cache
,
platform:
globals
.
platform
,
));
addSubcommand
(
BuildBundleCommand
(
verboseHelp:
verboseHelp
));
addSubcommand
(
BuildWebCommand
());
addSubcommand
(
BuildMacosCommand
());
...
...
packages/flutter_tools/lib/src/commands/build_ios_framework.dart
View file @
7feb7ddd
...
...
@@ -6,6 +6,7 @@ import 'dart:async';
import
'package:file/file.dart'
;
import
'package:meta/meta.dart'
;
import
'package:platform/platform.dart'
;
import
'../aot.dart'
;
import
'../application_package.dart'
;
...
...
@@ -33,7 +34,17 @@ import 'build.dart';
/// be integrated into plain Xcode projects without using or other package
/// managers.
class
BuildIOSFrameworkCommand
extends
BuildSubCommand
{
BuildIOSFrameworkCommand
({
this
.
aotBuilder
,
this
.
bundleBuilder
,
this
.
flutterVersion
,
this
.
cache
})
{
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
Cache
cache
,
@required
Platform
platform
})
:
_flutterVersion
=
flutterVersion
,
_aotBuilder
=
aotBuilder
,
_bundleBuilder
=
bundleBuilder
,
_cache
=
cache
,
_platform
=
platform
{
usesTargetOption
();
usesFlavorOption
();
usesPubOption
();
...
...
@@ -76,10 +87,12 @@ class BuildIOSFrameworkCommand extends BuildSubCommand {
);
}
AotBuilder
aotBuilder
;
BundleBuilder
bundleBuilder
;
FlutterVersion
flutterVersion
;
Cache
cache
;
final
AotBuilder
_aotBuilder
;
final
BundleBuilder
_bundleBuilder
;
final
Cache
_cache
;
final
Platform
_platform
;
FlutterVersion
_flutterVersion
;
@override
final
String
name
=
'ios-framework'
;
...
...
@@ -120,7 +133,7 @@ class BuildIOSFrameworkCommand extends BuildSubCommand {
throwToolExit
(
'Building frameworks for iOS is only supported from a module.'
);
}
if
(!
globals
.
platform
.
isMacOS
)
{
if
(!
_
platform
.
isMacOS
)
{
throwToolExit
(
'Building frameworks for iOS is only supported on the Mac.'
);
}
...
...
@@ -154,10 +167,6 @@ class BuildIOSFrameworkCommand extends BuildSubCommand {
final
Directory
outputDirectory
=
globals
.
fs
.
directory
(
globals
.
fs
.
path
.
absolute
(
globals
.
fs
.
path
.
normalize
(
outputArgument
)));
aotBuilder
??=
AotBuilder
();
bundleBuilder
??=
BundleBuilder
();
cache
??=
globals
.
cache
;
for
(
final
BuildMode
mode
in
buildModes
)
{
globals
.
printStatus
(
'Building frameworks for
$iosProject
in
${getNameForBuildMode(mode)}
mode...'
);
final
String
xcodeBuildConfiguration
=
toTitleCase
(
getNameForBuildMode
(
mode
));
...
...
@@ -171,7 +180,7 @@ class BuildIOSFrameworkCommand extends BuildSubCommand {
if
(
boolArg
(
'cocoapods'
))
{
// FlutterVersion.instance kicks off git processing which can sometimes fail, so don't try it until needed.
flutterVersion
??=
FlutterVersion
.
instance
;
_
flutterVersion
??=
FlutterVersion
.
instance
;
produceFlutterPodspec
(
mode
,
modeDirectory
);
}
else
{
// Copy Flutter.framework.
...
...
@@ -213,10 +222,10 @@ class BuildIOSFrameworkCommand extends BuildSubCommand {
void
produceFlutterPodspec
(
BuildMode
mode
,
Directory
modeDirectory
)
{
final
Status
status
=
globals
.
logger
.
startProgress
(
' ├─Creating Flutter.podspec...'
,
timeout:
timeoutConfiguration
.
fastOperation
);
try
{
final
GitTagVersion
gitTagVersion
=
flutterVersion
.
gitTagVersion
;
final
GitTagVersion
gitTagVersion
=
_
flutterVersion
.
gitTagVersion
;
if
(
gitTagVersion
.
x
==
null
||
gitTagVersion
.
y
==
null
||
gitTagVersion
.
z
==
null
||
gitTagVersion
.
commits
!=
0
)
{
throwToolExit
(
'--cocoapods is only supported on the dev, beta, or stable channels. Detected version is
${flutterVersion.frameworkVersion}
'
);
'--cocoapods is only supported on the dev, beta, or stable channels. Detected version is
${
_
flutterVersion.frameworkVersion}
'
);
}
// Podspecs use semantic versioning, which don't support hotfixes.
...
...
@@ -225,7 +234,7 @@ class BuildIOSFrameworkCommand extends BuildSubCommand {
// new artifacts when the source URL changes.
final
int
minorHotfixVersion
=
gitTagVersion
.
z
*
100
+
(
gitTagVersion
.
hotfix
??
0
);
final
File
license
=
cache
.
getLicenseFile
();
final
File
license
=
_
cache
.
getLicenseFile
();
if
(!
license
.
existsSync
())
{
throwToolExit
(
'Could not find license at
${license.path}
'
);
}
...
...
@@ -235,7 +244,7 @@ class BuildIOSFrameworkCommand extends BuildSubCommand {
final
String
podspecContents
=
'''
Pod::Spec.new do |s|
s.name = '
Flutter
'
s.version = '
$
{
gitTagVersion
.
x
}.
$
{
gitTagVersion
.
y
}.
$minorHotfixVersion
' #
${flutterVersion.frameworkVersion}
s.version = '
$
{
gitTagVersion
.
x
}.
$
{
gitTagVersion
.
y
}.
$minorHotfixVersion
' #
${
_
flutterVersion.frameworkVersion}
s.summary = '
Flutter
Engine
Framework
'
s.description = <<-DESC
Flutter is Google’s UI toolkit for building beautiful, natively compiled applications for mobile, web, and desktop from a single codebase.
...
...
@@ -248,7 +257,7 @@ $licenseSource
LICENSE
}
s
.
author
=
{
'Flutter Dev Team'
=>
'flutter-dev@googlegroups.com'
}
s
.
source
=
{
:
http
=>
'
${
cache.storageBaseUrl}
/flutter_infra/flutter/
${
cache.engineRevision}
/
$artifactsMode
/artifacts.zip'
}
s
.
source
=
{
:
http
=>
'
${
_cache.storageBaseUrl}
/flutter_infra/flutter/
${_
cache.engineRevision}
/
$artifactsMode
/artifacts.zip'
}
s
.
documentation_url
=
'https://flutter.dev/docs'
s
.
platform
=
:
ios
,
'8.0'
s
.
vendored_frameworks
=
'Flutter.framework'
...
...
@@ -347,7 +356,7 @@ end
final Status status = globals.logger.startProgress(
'
├─
Assembling
Flutter
resources
for
App
.
framework
...
', timeout: timeoutConfiguration.slowOperation);
try {
await bundleBuilder.build(
await
_
bundleBuilder.build(
platform: TargetPlatform.ios,
buildMode: mode,
// Relative paths show noise in the compiler https://github.com/dart-lang/sdk/issues/37978.
...
...
@@ -408,7 +417,7 @@ end
timeout: timeoutConfiguration.slowOperation,
);
try {
await aotBuilder.build(
await
_
aotBuilder.build(
platform: TargetPlatform.ios,
outputPath: destinationDirectory.path,
buildMode: mode,
...
...
packages/flutter_tools/test/commands.shard/hermetic/build_ios_framework_test.dart
View file @
7feb7ddd
...
...
@@ -5,41 +5,54 @@
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/bundle.dart'
;
import
'package:flutter_tools/src/cache.dart'
;
import
'package:flutter_tools/src/commands/build_ios_framework.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/version.dart'
;
import
'package:flutter_tools/src/globals.dart'
as
globals
;
import
'package:mockito/mockito.dart'
;
import
'package:platform/platform.dart'
;
import
'../../src/common.dart'
;
import
'../../src/context.dart'
;
void
main
(
)
{
group
(
'build ios-framework'
,
()
{
MemoryFileSystem
memoryFileSystem
;
MockFlutterVersion
mockFlutterVersion
;
MockGitTagVersion
mockGitTagVersion
;
MockCache
mockCache
;
Directory
outputDirectory
;
FakePlatform
fakePlatform
;
setUpAll
(()
{
Cache
.
disableLocking
();
});
setUp
(()
{
memoryFileSystem
=
MemoryFileSystem
();
mockFlutterVersion
=
MockFlutterVersion
();
mockGitTagVersion
=
MockGitTagVersion
();
mockCache
=
MockCache
();
fakePlatform
=
FakePlatform
()..
operatingSystem
=
'macos'
;
when
(
mockFlutterVersion
.
gitTagVersion
).
thenReturn
(
mockGitTagVersion
);
outputDirectory
=
globals
.
fs
.
systemTempDirectory
.
createTempSync
(
'flutter_build_ios_framework_test_output.'
)
.
childDirectory
(
'Debug'
)
..
createSync
();
});
group
(
'podspec'
,
()
{
MemoryFileSystem
memoryFileSystem
;
MockFlutterVersion
mockFlutterVersion
;
MockGitTagVersion
mockGitTagVersion
;
MockCache
mockCache
;
Directory
outputDirectory
;
const
String
storageBaseUrl
=
'https://fake.googleapis.com'
;
const
String
engineRevision
=
'0123456789abcdef'
;
File
licenseFile
;
setUp
(()
{
memoryFileSystem
=
MemoryFileSystem
();
mockFlutterVersion
=
MockFlutterVersion
();
mockGitTagVersion
=
MockGitTagVersion
();
mockCache
=
MockCache
();
when
(
mockFlutterVersion
.
gitTagVersion
).
thenReturn
(
mockGitTagVersion
);
outputDirectory
=
globals
.
fs
.
systemTempDirectory
.
createTempSync
(
'flutter_build_ios_framework_test_output.'
)
.
childDirectory
(
'Debug'
)
..
createSync
();
when
(
mockCache
.
storageBaseUrl
).
thenReturn
(
storageBaseUrl
);
when
(
mockCache
.
engineRevision
).
thenReturn
(
engineRevision
);
licenseFile
=
memoryFileSystem
.
file
(
'LICENSE'
);
...
...
@@ -51,6 +64,9 @@ void main() {
when
(
mockFlutterVersion
.
frameworkVersion
).
thenReturn
(
frameworkVersion
);
final
BuildIOSFrameworkCommand
command
=
BuildIOSFrameworkCommand
(
aotBuilder:
MockAotBuilder
(),
bundleBuilder:
MockBundleBuilder
(),
platform:
fakePlatform
,
flutterVersion:
mockFlutterVersion
,
cache:
mockCache
);
...
...
@@ -73,6 +89,9 @@ void main() {
when
(
mockGitTagVersion
.
commits
).
thenReturn
(
2
);
final
BuildIOSFrameworkCommand
command
=
BuildIOSFrameworkCommand
(
aotBuilder:
MockAotBuilder
(),
bundleBuilder:
MockBundleBuilder
(),
platform:
fakePlatform
,
flutterVersion:
mockFlutterVersion
,
cache:
mockCache
);
...
...
@@ -92,6 +111,9 @@ void main() {
when
(
mockGitTagVersion
.
commits
).
thenReturn
(
0
);
final
BuildIOSFrameworkCommand
command
=
BuildIOSFrameworkCommand
(
aotBuilder:
MockAotBuilder
(),
bundleBuilder:
MockBundleBuilder
(),
platform:
fakePlatform
,
flutterVersion:
mockFlutterVersion
,
cache:
mockCache
);
...
...
@@ -123,8 +145,11 @@ void main() {
testUsingContext
(
'contains license and version'
,
()
async
{
final
BuildIOSFrameworkCommand
command
=
BuildIOSFrameworkCommand
(
flutterVersion:
mockFlutterVersion
,
cache:
mockCache
aotBuilder:
MockAotBuilder
(),
bundleBuilder:
MockBundleBuilder
(),
platform:
fakePlatform
,
flutterVersion:
mockFlutterVersion
,
cache:
mockCache
);
command
.
produceFlutterPodspec
(
BuildMode
.
debug
,
outputDirectory
);
...
...
@@ -140,8 +165,11 @@ void main() {
testUsingContext
(
'debug URL'
,
()
async
{
final
BuildIOSFrameworkCommand
command
=
BuildIOSFrameworkCommand
(
flutterVersion:
mockFlutterVersion
,
cache:
mockCache
aotBuilder:
MockAotBuilder
(),
bundleBuilder:
MockBundleBuilder
(),
platform:
fakePlatform
,
flutterVersion:
mockFlutterVersion
,
cache:
mockCache
);
command
.
produceFlutterPodspec
(
BuildMode
.
debug
,
outputDirectory
);
...
...
@@ -155,8 +183,11 @@ void main() {
testUsingContext
(
'profile URL'
,
()
async
{
final
BuildIOSFrameworkCommand
command
=
BuildIOSFrameworkCommand
(
flutterVersion:
mockFlutterVersion
,
cache:
mockCache
aotBuilder:
MockAotBuilder
(),
bundleBuilder:
MockBundleBuilder
(),
platform:
fakePlatform
,
flutterVersion:
mockFlutterVersion
,
cache:
mockCache
);
command
.
produceFlutterPodspec
(
BuildMode
.
profile
,
outputDirectory
);
...
...
@@ -170,8 +201,11 @@ void main() {
testUsingContext
(
'release URL'
,
()
async
{
final
BuildIOSFrameworkCommand
command
=
BuildIOSFrameworkCommand
(
flutterVersion:
mockFlutterVersion
,
cache:
mockCache
aotBuilder:
MockAotBuilder
(),
bundleBuilder:
MockBundleBuilder
(),
platform:
fakePlatform
,
flutterVersion:
mockFlutterVersion
,
cache:
mockCache
);
command
.
produceFlutterPodspec
(
BuildMode
.
release
,
outputDirectory
);
...
...
@@ -190,3 +224,5 @@ void main() {
class
MockFlutterVersion
extends
Mock
implements
FlutterVersion
{}
class
MockGitTagVersion
extends
Mock
implements
GitTagVersion
{}
class
MockCache
extends
Mock
implements
Cache
{}
class
MockAotBuilder
extends
Mock
implements
AotBuilder
{}
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