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
b3fa6eb6
Unverified
Commit
b3fa6eb6
authored
Mar 16, 2021
by
Jenn Magder
Committed by
GitHub
Mar 16, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Download platform artifacts from assemble if needed (#78272)
parent
2584afd7
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
32 deletions
+45
-32
assemble.dart
packages/flutter_tools/lib/src/commands/assemble.dart
+21
-5
flutter_command.dart
packages/flutter_tools/lib/src/runner/flutter_command.dart
+3
-24
assemble_test.dart
...ter_tools/test/commands.shard/hermetic/assemble_test.dart
+21
-3
No files found.
packages/flutter_tools/lib/src/commands/assemble.dart
View file @
b3fa6eb6
...
...
@@ -147,9 +147,8 @@ class AssembleCommand extends FlutterCommand {
return
const
<
CustomDimensions
,
String
>{};
}
try
{
final
Environment
localEnvironment
=
createEnvironment
();
return
<
CustomDimensions
,
String
>{
CustomDimensions
.
commandBuildBundleTargetPlatform
:
localEnvironment
.
defines
[
'TargetPlatform'
],
CustomDimensions
.
commandBuildBundleTargetPlatform
:
environment
.
defines
[
kTargetPlatform
],
CustomDimensions
.
commandBuildBundleIsModule
:
'
${flutterProject.isModule}
'
,
};
}
on
Exception
{
...
...
@@ -158,6 +157,21 @@ class AssembleCommand extends FlutterCommand {
return
const
<
CustomDimensions
,
String
>{};
}
@override
Future
<
Set
<
DevelopmentArtifact
>>
get
requiredArtifacts
async
{
final
String
platform
=
environment
.
defines
[
kTargetPlatform
];
if
(
platform
==
null
)
{
return
super
.
requiredArtifacts
;
}
final
TargetPlatform
targetPlatform
=
getTargetPlatformForName
(
platform
);
final
DevelopmentArtifact
artifact
=
artifactFromTargetPlatform
(
targetPlatform
);
if
(
artifact
!=
null
)
{
return
<
DevelopmentArtifact
>{
artifact
};
}
return
super
.
requiredArtifacts
;
}
/// The target(s) we are building.
List
<
Target
>
createTargets
()
{
if
(
argResults
.
rest
.
isEmpty
)
{
...
...
@@ -197,6 +211,9 @@ class AssembleCommand extends FlutterCommand {
return
false
;
}
Environment
get
environment
=>
_environment
??=
createEnvironment
();
Environment
_environment
;
/// The environmental configuration for a build invocation.
Environment
createEnvironment
()
{
final
FlutterProject
flutterProject
=
FlutterProject
.
current
();
...
...
@@ -259,7 +276,6 @@ class AssembleCommand extends FlutterCommand {
@override
Future
<
FlutterCommandResult
>
runCommand
()
async
{
final
Environment
env
=
createEnvironment
();
final
List
<
Target
>
targets
=
createTargets
();
final
List
<
Target
>
nonDeferredTargets
=
<
Target
>[];
final
List
<
Target
>
deferredTargets
=
<
AndroidAotDeferredComponentsBundle
>[];
...
...
@@ -271,7 +287,7 @@ class AssembleCommand extends FlutterCommand {
}
}
Target
target
;
final
List
<
String
>
decodedDefines
=
decodeDartDefines
(
env
.
defines
,
kDartDefines
);
final
List
<
String
>
decodedDefines
=
decodeDartDefines
(
env
ironment
.
defines
,
kDartDefines
);
if
(
FlutterProject
.
current
().
manifest
.
deferredComponents
!=
null
&&
decodedDefines
.
contains
(
'validate-deferred-components=true'
)
&&
deferredTargets
.
isNotEmpty
...
...
@@ -289,7 +305,7 @@ class AssembleCommand extends FlutterCommand {
}
final
BuildResult
result
=
await
_buildSystem
.
build
(
target
,
env
,
env
ironment
,
buildSystemConfig:
BuildSystemConfig
(
resourcePoolSize:
argResults
.
wasParsed
(
'resource-pool-size'
)
?
int
.
tryParse
(
stringArg
(
'resource-pool-size'
))
...
...
packages/flutter_tools/lib/src/runner/flutter_command.dart
View file @
b3fa6eb6
...
...
@@ -1365,7 +1365,7 @@ mixin DeviceBasedDevelopmentArtifacts on FlutterCommand {
};
for
(
final
Device
device
in
devices
)
{
final
TargetPlatform
targetPlatform
=
await
device
.
targetPlatform
;
final
DevelopmentArtifact
developmentArtifact
=
_
artifactFromTargetPlatform
(
targetPlatform
);
final
DevelopmentArtifact
developmentArtifact
=
artifactFromTargetPlatform
(
targetPlatform
);
if
(
developmentArtifact
!=
null
)
{
artifacts
.
add
(
developmentArtifact
);
}
...
...
@@ -1374,31 +1374,10 @@ mixin DeviceBasedDevelopmentArtifacts on FlutterCommand {
}
}
/// A mixin which applies an implementation of [requiredArtifacts] that only
/// downloads artifacts corresponding to a target device.
mixin
TargetPlatformBasedDevelopmentArtifacts
on
FlutterCommand
{
@override
Future
<
Set
<
DevelopmentArtifact
>>
get
requiredArtifacts
async
{
// If there is no specified target device, fallback to the default
// configuration.
final
String
rawTargetPlatform
=
stringArg
(
'target-platform'
);
final
TargetPlatform
targetPlatform
=
getTargetPlatformForName
(
rawTargetPlatform
);
if
(
targetPlatform
==
null
)
{
return
super
.
requiredArtifacts
;
}
final
Set
<
DevelopmentArtifact
>
artifacts
=
<
DevelopmentArtifact
>{};
final
DevelopmentArtifact
developmentArtifact
=
_artifactFromTargetPlatform
(
targetPlatform
);
if
(
developmentArtifact
!=
null
)
{
artifacts
.
add
(
developmentArtifact
);
}
return
artifacts
;
}
}
// Returns the development artifact for the target platform, or null
// if none is supported
DevelopmentArtifact
_artifactFromTargetPlatform
(
TargetPlatform
targetPlatform
)
{
@protected
DevelopmentArtifact
artifactFromTargetPlatform
(
TargetPlatform
targetPlatform
)
{
switch
(
targetPlatform
)
{
case
TargetPlatform
.
android
:
case
TargetPlatform
.
android_arm
:
...
...
packages/flutter_tools/test/commands.shard/hermetic/assemble_test.dart
View file @
b3fa6eb6
...
...
@@ -13,6 +13,7 @@ import 'package:flutter_tools/src/build_system/build_system.dart';
import
'package:flutter_tools/src/cache.dart'
;
import
'package:flutter_tools/src/commands/assemble.dart'
;
import
'package:flutter_tools/src/convert.dart'
;
import
'package:flutter_tools/src/features.dart'
;
import
'package:flutter_tools/src/globals.dart'
as
globals
;
import
'../../src/common.dart'
;
...
...
@@ -54,18 +55,35 @@ void main() {
});
testUsingContext
(
'flutter assemble can parse inputs'
,
()
async
{
final
CommandRunner
<
void
>
commandRunner
=
createTestCommandRunner
(
AssembleCommand
(
final
AssembleCommand
command
=
AssembleCommand
(
buildSystem:
TestBuildSystem
.
all
(
BuildResult
(
success:
true
),
(
Target
target
,
Environment
environment
)
{
expect
(
environment
.
inputs
,
containsPair
(
'Foo'
,
'Bar.txt'
));
})
)
);
}));
final
CommandRunner
<
void
>
commandRunner
=
createTestCommandRunner
(
command
);
await
commandRunner
.
run
(<
String
>[
'assemble'
,
'-o Output'
,
'-iFoo=Bar.txt'
,
'debug_macos_bundle_flutter_assets'
]);
expect
(
testLogger
.
traceText
,
contains
(
'build succeeded.'
));
expect
(
await
command
.
requiredArtifacts
,
isEmpty
);
},
overrides:
<
Type
,
Generator
>{
Cache:
()
=>
Cache
.
test
(
processManager:
FakeProcessManager
.
any
()),
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
testUsingContext
(
'flutter assemble sets required artifacts from target platform'
,
()
async
{
final
AssembleCommand
command
=
AssembleCommand
(
buildSystem:
TestBuildSystem
.
all
(
BuildResult
(
success:
true
)));
final
CommandRunner
<
void
>
commandRunner
=
createTestCommandRunner
(
command
);
await
commandRunner
.
run
(<
String
>[
'assemble'
,
'-o Output'
,
'-dTargetPlatform=darwin-x64'
,
'debug_macos_bundle_flutter_assets'
]);
expect
(
await
command
.
requiredArtifacts
,
<
DevelopmentArtifact
>{
DevelopmentArtifact
.
macOS
,
});
},
overrides:
<
Type
,
Generator
>{
Cache:
()
=>
Cache
.
test
(
processManager:
FakeProcessManager
.
any
()),
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
FeatureFlags:
()
=>
TestFeatureFlags
(
isMacOSEnabled:
true
),
});
testUsingContext
(
'flutter assemble throws ToolExit if not provided with output'
,
()
async
{
...
...
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