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
b63cb441
Unverified
Commit
b63cb441
authored
Sep 02, 2019
by
Emmanuel Garcia
Committed by
GitHub
Sep 02, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use new Maven artifacts from Gradle (#39157)
parent
d30e4228
Changes
15
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
582 additions
and
326 deletions
+582
-326
gradle_plugin_light_apk_test.dart
dev/devicelab/bin/tasks/gradle_plugin_light_apk_test.dart
+0
-2
build.gradle
examples/platform_view/android/app/build.gradle
+2
-2
flutter.gradle
packages/flutter_tools/gradle/flutter.gradle
+136
-176
resolve_dependencies.gradle
packages/flutter_tools/gradle/resolve_dependencies.gradle
+64
-0
executable.dart
packages/flutter_tools/lib/executable.dart
+1
-1
cache.dart
packages/flutter_tools/lib/src/cache.dart
+183
-77
build_aar.dart
packages/flutter_tools/lib/src/commands/build_aar.dart
+1
-7
build_apk.dart
packages/flutter_tools/lib/src/commands/build_apk.dart
+1
-7
doctor.dart
packages/flutter_tools/lib/src/commands/doctor.dart
+1
-1
precache.dart
packages/flutter_tools/lib/src/commands/precache.dart
+16
-2
flutter_command.dart
packages/flutter_tools/lib/src/runner/flutter_command.dart
+1
-1
build.gradle.tmpl
...module/android/host_app_common/app.tmpl/build.gradle.tmpl
+2
-2
cache_test.dart
packages/flutter_tools/test/general.shard/cache_test.dart
+84
-33
precache_test.dart
...tter_tools/test/general.shard/commands/precache_test.dart
+88
-13
run_test.dart
...s/flutter_tools/test/general.shard/commands/run_test.dart
+2
-2
No files found.
dev/devicelab/bin/tasks/gradle_plugin_light_apk_test.dart
View file @
b63cb441
...
...
@@ -52,7 +52,6 @@ Future<void> main() async {
'assets/flutter_assets/isolate_snapshot_data'
,
'assets/flutter_assets/kernel_blob.bin'
,
'assets/flutter_assets/vm_snapshot_data'
,
'lib/armeabi-v7a/libflutter.so'
,
// Debug mode intentionally includes `x86` and `x86_64`.
'lib/x86/libflutter.so'
,
'lib/x86_64/libflutter.so'
,
...
...
@@ -79,7 +78,6 @@ Future<void> main() async {
'assets/flutter_assets/isolate_snapshot_data'
,
'assets/flutter_assets/kernel_blob.bin'
,
'assets/flutter_assets/vm_snapshot_data'
,
'lib/armeabi-v7a/libflutter.so'
,
// Debug mode intentionally includes `x86` and `x86_64`.
'lib/x86/libflutter.so'
,
'lib/x86_64/libflutter.so'
,
...
...
examples/platform_view/android/app/build.gradle
View file @
b63cb441
...
...
@@ -57,6 +57,6 @@ dependencies {
testImplementation
'junit:junit:4.12'
androidTestImplementation
'com.android.support.test:runner:1.0.2'
androidTestImplementation
'com.android.support.test.espresso:espresso-core:3.0.2'
implementation
'com.android.support:appcompat-v7:2
6.1
.0'
implementation
'com.android.support:design:2
6.1
.0'
implementation
'com.android.support:appcompat-v7:2
8.0
.0'
implementation
'com.android.support:design:2
8.0
.0'
}
packages/flutter_tools/gradle/flutter.gradle
View file @
b63cb441
This diff is collapsed.
Click to expand it.
packages/flutter_tools/gradle/resolve_dependencies.gradle
0 → 100644
View file @
b63cb441
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
//
// This script is used to warm the Gradle cache by downloading the Flutter dependencies
// used during the build. This script is invoked when `flutter precache` is run.
//
// Command:
// gradle -b <flutter-sdk>packages/flutter_tools/gradle/resolve_dependencies.gradle
// resolveDependencies
//
// This way, Gradle can run with the `--offline` flag later on to eliminate any
// network request during the build process.
//
// This includes:
// 1. The embedding
// 2. libflutter.so
import
java.nio.file.Paths
repositories
{
google
()
jcenter
()
maven
{
url
"http://download.flutter.io"
}
}
File
flutterRoot
=
projectDir
.
parentFile
.
parentFile
.
parentFile
assert
flutterRoot
.
isDirectory
()
String
engineVersion
=
Paths
.
get
(
flutterRoot
.
absolutePath
,
"bin"
,
"internal"
,
"engine.version"
)
.
toFile
().
text
.
trim
()
configurations
{
flutterRelease
.
extendsFrom
releaseImplementation
flutterDebug
.
extendsFrom
debugImplementation
flutterProfile
.
extendsFrom
debugImplementation
}
dependencies
{
flutterRelease
"io.flutter:flutter_embedding_release:1.0.0-$engineVersion"
flutterRelease
"io.flutter:armeabi_v7a_release:1.0.0-$engineVersion"
flutterRelease
"io.flutter:arm64_v8a_release:1.0.0-$engineVersion"
flutterProfile
"io.flutter:flutter_embedding_profile:1.0.0-$engineVersion"
flutterProfile
"io.flutter:armeabi_v7a_profile:1.0.0-$engineVersion"
flutterProfile
"io.flutter:arm64_v8a_profile:1.0.0-$engineVersion"
flutterDebug
"io.flutter:flutter_embedding_debug:1.0.0-$engineVersion"
flutterDebug
"io.flutter:armeabi_v7a_debug:1.0.0-$engineVersion"
flutterDebug
"io.flutter:arm64_v8a_debug:1.0.0-$engineVersion"
flutterDebug
"io.flutter:x86_debug:1.0.0-$engineVersion"
flutterDebug
"io.flutter:x86_64_debug:1.0.0-$engineVersion"
}
task
resolveDependencies
{
configurations
.
each
{
configuration
->
if
(
configuration
.
name
.
startsWith
(
"flutter"
))
{
configuration
.
resolve
()
}
}
}
packages/flutter_tools/lib/executable.dart
View file @
b63cb441
...
...
@@ -84,7 +84,7 @@ Future<void> main(List<String> args) async {
LogsCommand
(),
MakeHostAppEditableCommand
(),
PackagesCommand
(),
PrecacheCommand
(),
PrecacheCommand
(
verboseHelp:
verboseHelp
),
RunCommand
(
verboseHelp:
verboseHelp
),
ScreenshotCommand
(),
ShellCompletionCommand
(),
...
...
packages/flutter_tools/lib/src/cache.dart
View file @
b63cb441
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/commands/build_aar.dart
View file @
b63cb441
...
...
@@ -9,7 +9,7 @@ import '../base/os.dart';
import
'../build_info.dart'
;
import
'../project.dart'
;
import
'../reporting/reporting.dart'
;
import
'../runner/flutter_command.dart'
show
DevelopmentArtifact
,
FlutterCommandResult
;
import
'../runner/flutter_command.dart'
show
FlutterCommandResult
;
import
'build.dart'
;
class
BuildAarCommand
extends
BuildSubCommand
{
...
...
@@ -52,12 +52,6 @@ class BuildAarCommand extends BuildSubCommand {
return
usage
;
}
@override
Future
<
Set
<
DevelopmentArtifact
>>
get
requiredArtifacts
async
=>
const
<
DevelopmentArtifact
>{
DevelopmentArtifact
.
universal
,
DevelopmentArtifact
.
android
,
};
@override
final
String
description
=
'Build a repository containing an AAR and a POM file.
\n\n
'
'The POM file is used to include the dependencies that the AAR was compiled against.
\n\n
'
...
...
packages/flutter_tools/lib/src/commands/build_apk.dart
View file @
b63cb441
...
...
@@ -10,7 +10,7 @@ import '../build_info.dart';
import
'../globals.dart'
;
import
'../project.dart'
;
import
'../reporting/reporting.dart'
;
import
'../runner/flutter_command.dart'
show
DevelopmentArtifact
,
FlutterCommandResult
;
import
'../runner/flutter_command.dart'
show
FlutterCommandResult
;
import
'build.dart'
;
class
BuildApkCommand
extends
BuildSubCommand
{
...
...
@@ -68,12 +68,6 @@ class BuildApkCommand extends BuildSubCommand {
return
usage
;
}
@override
Future
<
Set
<
DevelopmentArtifact
>>
get
requiredArtifacts
async
=>
const
<
DevelopmentArtifact
>{
DevelopmentArtifact
.
universal
,
DevelopmentArtifact
.
android
,
};
@override
Future
<
FlutterCommandResult
>
runCommand
()
async
{
final
BuildInfo
buildInfo
=
getBuildInfo
();
...
...
packages/flutter_tools/lib/src/commands/doctor.dart
View file @
b63cb441
...
...
@@ -37,7 +37,7 @@ class DoctorCommand extends FlutterCommand {
// This is required because we use gen_snapshot to check if the host
// machine can execute the provided artifacts. See `_genSnapshotRuns`
// in `doctor.dart`.
DevelopmentArtifact
.
android
,
DevelopmentArtifact
.
android
GenSnapshot
,
};
}
...
...
packages/flutter_tools/lib/src/commands/precache.dart
View file @
b63cb441
...
...
@@ -10,13 +10,23 @@ import '../runner/flutter_command.dart';
import
'../version.dart'
;
class
PrecacheCommand
extends
FlutterCommand
{
PrecacheCommand
()
{
PrecacheCommand
(
{
bool
verboseHelp
=
false
}
)
{
argParser
.
addFlag
(
'all-platforms'
,
abbr:
'a'
,
negatable:
false
,
help:
'Precache artifacts for all host platforms.'
);
argParser
.
addFlag
(
'force'
,
abbr:
'f'
,
negatable:
false
,
help:
'Force downloading of artifacts.'
);
argParser
.
addFlag
(
'android'
,
negatable:
true
,
defaultsTo:
true
,
help:
'Precache artifacts for Android development.'
);
help:
'Precache artifacts for Android development.'
,
hide:
verboseHelp
);
argParser
.
addFlag
(
'android_gen_snapshot'
,
negatable:
true
,
defaultsTo:
true
,
help:
'Precache gen_snapshot for Android development.'
,
hide:
!
verboseHelp
);
argParser
.
addFlag
(
'android_maven'
,
negatable:
true
,
defaultsTo:
true
,
help:
'Precache Gradle dependencies for Android development.'
,
hide:
!
verboseHelp
);
argParser
.
addFlag
(
'android_internal_build'
,
negatable:
true
,
defaultsTo:
false
,
help:
'Precache dependencies for internal Android development.'
,
hide:
!
verboseHelp
);
argParser
.
addFlag
(
'ios'
,
negatable:
true
,
defaultsTo:
true
,
help:
'Precache artifacts for iOS development.'
);
argParser
.
addFlag
(
'web'
,
negatable:
true
,
defaultsTo:
false
,
...
...
@@ -58,6 +68,10 @@ class PrecacheCommand extends FlutterCommand {
if
(
argResults
[
artifact
.
name
])
{
requiredArtifacts
.
add
(
artifact
);
}
// The `android` flag expands to android_gen_snapshot, android_maven, android_internal_build.
if
(
artifact
.
name
.
startsWith
(
'android_'
)
&&
argResults
[
'android'
])
{
requiredArtifacts
.
add
(
artifact
);
}
}
final
bool
forceUpdate
=
argResults
[
'force'
];
if
(
forceUpdate
||
!
cache
.
isUpToDate
())
{
...
...
packages/flutter_tools/lib/src/runner/flutter_command.dart
View file @
b63cb441
...
...
@@ -644,7 +644,7 @@ DevelopmentArtifact _artifactFromTargetPlatform(TargetPlatform targetPlatform) {
case
TargetPlatform
.
android_arm64
:
case
TargetPlatform
.
android_x64
:
case
TargetPlatform
.
android_x86
:
return
DevelopmentArtifact
.
android
;
return
DevelopmentArtifact
.
android
GenSnapshot
;
case
TargetPlatform
.
web_javascript
:
return
DevelopmentArtifact
.
web
;
case
TargetPlatform
.
ios
:
...
...
packages/flutter_tools/templates/module/android/host_app_common/app.tmpl/build.gradle.tmpl
View file @
b63cb441
...
...
@@ -47,9 +47,9 @@ dependencies {
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
{{/androidX}}
{{^androidX}}
implementation 'com.android.support:appcompat-v7:2
7.1.1
'
implementation 'com.android.support:appcompat-v7:2
8.0.0
'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:design:2
7.1.1
'
implementation 'com.android.support:design:2
8.0.0
'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
{{/androidX}}
...
...
packages/flutter_tools/test/general.shard/cache_test.dart
View file @
b63cb441
...
...
@@ -8,8 +8,10 @@ import 'package:file_testing/file_testing.dart';
import
'package:meta/meta.dart'
;
import
'package:mockito/mockito.dart'
;
import
'package:platform/platform.dart'
;
import
'package:process/process.dart'
;
import
'package:flutter_tools/src/base/common.dart'
;
import
'package:flutter_tools/src/base/io.dart'
;
import
'package:flutter_tools/src/cache.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/io.dart'
show
InternetAddress
,
SocketException
;
...
...
@@ -136,18 +138,30 @@ void main() {
when
(
artifact1
.
isUpToDate
()).
thenReturn
(
true
);
when
(
artifact2
.
isUpToDate
()).
thenReturn
(
false
);
final
Cache
cache
=
Cache
(
artifacts:
<
CachedArtifact
>[
artifact1
,
artifact2
]);
await
cache
.
updateAll
(<
DevelopmentArtifact
>{});
verifyNever
(
artifact1
.
update
(<
DevelopmentArtifact
>{}));
verify
(
artifact2
.
update
(<
DevelopmentArtifact
>{}));
await
cache
.
updateAll
(<
DevelopmentArtifact
>{
null
,
});
verifyNever
(
artifact1
.
update
());
verify
(
artifact2
.
update
());
});
testUsingContext
(
'getter dyLdLibEntry concatenates the output of each artifact
\'
s dyLdLibEntry getter'
,
()
async
{
final
CachedArtifact
artifact1
=
MockCachedArtifact
();
final
CachedArtifact
artifact2
=
MockCachedArtifact
();
final
CachedArtifact
artifact3
=
MockCachedArtifact
();
when
(
artifact1
.
dyLdLibPath
).
thenReturn
(
'/path/to/alpha:/path/to/beta'
);
when
(
artifact2
.
dyLdLibPath
).
thenReturn
(
'/path/to/gamma:/path/to/delta:/path/to/epsilon'
);
when
(
artifact3
.
dyLdLibPath
).
thenReturn
(
''
);
// Empty output
final
IosUsbArtifacts
artifact1
=
MockIosUsbArtifacts
();
final
IosUsbArtifacts
artifact2
=
MockIosUsbArtifacts
();
final
IosUsbArtifacts
artifact3
=
MockIosUsbArtifacts
();
when
(
artifact1
.
environment
)
.
thenReturn
(<
String
,
String
>{
'DYLD_LIBRARY_PATH'
:
'/path/to/alpha:/path/to/beta'
,
});
when
(
artifact2
.
environment
)
.
thenReturn
(<
String
,
String
>{
'DYLD_LIBRARY_PATH'
:
'/path/to/gamma:/path/to/delta:/path/to/epsilon'
,
});
when
(
artifact3
.
environment
)
.
thenReturn
(<
String
,
String
>{
'DYLD_LIBRARY_PATH'
:
''
,
});
final
Cache
cache
=
Cache
(
artifacts:
<
CachedArtifact
>[
artifact1
,
artifact2
,
artifact3
]);
expect
(
cache
.
dyLdLibEntry
.
key
,
'DYLD_LIBRARY_PATH'
);
expect
(
cache
.
dyLdLibEntry
.
value
,
...
...
@@ -163,18 +177,20 @@ void main() {
when
(
artifact2
.
isUpToDate
()).
thenReturn
(
false
);
final
MockInternetAddress
address
=
MockInternetAddress
();
when
(
address
.
host
).
thenReturn
(
'storage.googleapis.com'
);
when
(
artifact1
.
update
(
<
DevelopmentArtifact
>{}
)).
thenThrow
(
SocketException
(
when
(
artifact1
.
update
()).
thenThrow
(
SocketException
(
'Connection reset by peer'
,
address:
address
,
));
final
Cache
cache
=
Cache
(
artifacts:
<
CachedArtifact
>[
artifact1
,
artifact2
]);
try
{
await
cache
.
updateAll
(<
DevelopmentArtifact
>{});
await
cache
.
updateAll
(<
DevelopmentArtifact
>{
null
,
});
fail
(
'Mock thrown exception expected'
);
}
catch
(
e
)
{
verify
(
artifact1
.
update
(
<
DevelopmentArtifact
>{}
));
verify
(
artifact1
.
update
());
// Don't continue when retrieval fails.
verifyNever
(
artifact2
.
update
(
<
DevelopmentArtifact
>{}
));
verifyNever
(
artifact2
.
update
());
expect
(
testLogger
.
errorText
,
contains
(
'https://flutter.dev/community/china'
),
...
...
@@ -226,6 +242,7 @@ void main() {
binaryDirs:
<
List
<
String
>>[
<
String
>[
'bin_dir'
,
'unused_url_path'
],
],
requiredArtifacts:
DevelopmentArtifact
.
universal
,
);
await
artifact
.
updateInner
();
final
Directory
dir
=
memoryFileSystem
.
systemTempDirectory
...
...
@@ -244,25 +261,56 @@ void main() {
});
});
testUsingContext
(
'throws tool exit on fs exception'
,
()
async
{
final
FakeCachedArtifact
fakeCachedArtifact
=
FakeCachedArtifact
(
cache:
MockCache
(),
requiredArtifacts:
<
DevelopmentArtifact
>{
DevelopmentArtifact
.
android
,
}
);
final
Directory
mockDirectory
=
MockDirectory
();
when
(
fakeCachedArtifact
.
cache
.
getArtifactDirectory
(
any
))
.
thenReturn
(
mockDirectory
);
when
(
mockDirectory
.
existsSync
()).
thenReturn
(
false
);
when
(
mockDirectory
.
createSync
(
recursive:
true
))
.
thenThrow
(
const
FileSystemException
());
expect
(()
=>
fakeCachedArtifact
.
update
(<
DevelopmentArtifact
>{
DevelopmentArtifact
.
android
,
}),
throwsA
(
isInstanceOf
<
ToolExit
>()));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
(),
group
(
'AndroidMavenArtifacts'
,
()
{
MemoryFileSystem
memoryFileSystem
;
MockProcessManager
processManager
;
MockCache
mockCache
;
MockProcess
mockProcess
;
setUp
(()
{
memoryFileSystem
=
MemoryFileSystem
();
processManager
=
MockProcessManager
();
mockCache
=
MockCache
();
mockProcess
=
MockProcess
();
});
test
(
'development artifact'
,
()
async
{
final
AndroidMavenArtifacts
mavenArtifacts
=
AndroidMavenArtifacts
();
expect
(
mavenArtifacts
.
developmentArtifact
,
DevelopmentArtifact
.
androidMaven
);
});
testUsingContext
(
'update'
,
()
async
{
final
AndroidMavenArtifacts
mavenArtifacts
=
AndroidMavenArtifacts
();
expect
(
mavenArtifacts
.
isUpToDate
(),
isFalse
);
final
Directory
gradleWrapperDir
=
fs
.
systemTempDirectory
.
createTempSync
(
'gradle_wrapper.'
);
when
(
mockCache
.
getArtifactDirectory
(
'gradle_wrapper'
)).
thenReturn
(
gradleWrapperDir
);
fs
.
directory
(
gradleWrapperDir
.
childDirectory
(
'gradle'
).
childDirectory
(
'wrapper'
))
.
createSync
(
recursive:
true
);
fs
.
file
(
fs
.
path
.
join
(
gradleWrapperDir
.
path
,
'gradlew'
)).
writeAsStringSync
(
'irrelevant'
);
fs
.
file
(
fs
.
path
.
join
(
gradleWrapperDir
.
path
,
'gradlew.bat'
)).
writeAsStringSync
(
'irrelevant'
);
when
(
processManager
.
start
(
any
))
.
thenAnswer
((
Invocation
invocation
){
final
List
<
String
>
args
=
invocation
.
positionalArguments
[
0
];
expect
(
args
.
length
,
6
);
expect
(
args
[
1
],
'-b'
);
expect
(
args
[
2
].
endsWith
(
'resolve_dependencies.gradle'
),
isTrue
);
expect
(
args
[
5
],
'resolveDependencies'
);
return
Future
<
Process
>.
value
(
mockProcess
);
});
when
(
mockProcess
.
exitCode
).
thenAnswer
((
_
)
async
=>
0
);
await
mavenArtifacts
.
update
();
expect
(
mavenArtifacts
.
isUpToDate
(),
isFalse
);
},
overrides:
<
Type
,
Generator
>{
Cache:
()=>
mockCache
,
FileSystem:
()
=>
memoryFileSystem
,
ProcessManager:
()
=>
processManager
,
});
});
}
...
...
@@ -270,7 +318,7 @@ class FakeCachedArtifact extends EngineCachedArtifact {
FakeCachedArtifact
({
String
stampName
=
'STAMP'
,
@required
Cache
cache
,
Set
<
DevelopmentArtifact
>
requiredArtifacts
=
const
<
DevelopmentArtifact
>{}
,
DevelopmentArtifact
requiredArtifacts
,
this
.
binaryDirs
=
const
<
List
<
String
>>[],
this
.
licenseDirs
=
const
<
String
>[],
this
.
packageDirs
=
const
<
String
>[],
...
...
@@ -290,12 +338,15 @@ class FakeCachedArtifact extends EngineCachedArtifact {
List
<
String
>
getPackageDirs
()
=>
packageDirs
;
}
class
MockProcessManager
extends
Mock
implements
ProcessManager
{}
class
MockProcess
extends
Mock
implements
Process
{}
class
MockFileSystem
extends
Mock
implements
FileSystem
{}
class
MockFile
extends
Mock
implements
File
{}
class
MockDirectory
extends
Mock
implements
Directory
{}
class
MockRandomAccessFile
extends
Mock
implements
RandomAccessFile
{}
class
MockCachedArtifact
extends
Mock
implements
CachedArtifact
{}
class
MockIosUsbArtifacts
extends
Mock
implements
IosUsbArtifacts
{}
class
MockInternetAddress
extends
Mock
implements
InternetAddress
{}
class
MockCache
extends
Mock
implements
Cache
{}
class
MockOperatingSystemUtils
extends
Mock
implements
OperatingSystemUtils
{}
packages/flutter_tools/test/general.shard/commands/precache_test.dart
View file @
b63cb441
...
...
@@ -27,12 +27,24 @@ void main() {
final
PrecacheCommand
command
=
PrecacheCommand
();
applyMocksToCommand
(
command
);
await
createTestCommandRunner
(
command
).
run
(
const
<
String
>[
'precache'
,
'--ios'
,
'--android'
,
'--web'
,
'--macos'
,
'--linux'
,
'--windows'
,
'--fuchsia'
,
'--flutter_runner'
]
const
<
String
>[
'precache'
,
'--ios'
,
'--android'
,
'--web'
,
'--macos'
,
'--linux'
,
'--windows'
,
'--fuchsia'
,
'--flutter_runner'
,
]
);
expect
(
artifacts
,
unorderedEquals
(<
DevelopmentArtifact
>{
DevelopmentArtifact
.
universal
,
DevelopmentArtifact
.
iOS
,
DevelopmentArtifact
.
android
,
DevelopmentArtifact
.
androidGenSnapshot
,
DevelopmentArtifact
.
androidMaven
,
DevelopmentArtifact
.
androidInternalBuild
,
DevelopmentArtifact
.
web
,
DevelopmentArtifact
.
macOS
,
DevelopmentArtifact
.
linux
,
...
...
@@ -44,6 +56,54 @@ void main() {
Cache:
()
=>
cache
,
});
testUsingContext
(
'Expands android artifacts when the android flag is used'
,
()
async
{
// Release lock between test cases.
Cache
.
releaseLockEarly
();
final
PrecacheCommand
command
=
PrecacheCommand
();
applyMocksToCommand
(
command
);
await
createTestCommandRunner
(
command
).
run
(
const
<
String
>[
'precache'
,
'--no-ios'
,
'--android'
,
]
);
expect
(
artifacts
,
unorderedEquals
(<
DevelopmentArtifact
>{
DevelopmentArtifact
.
universal
,
DevelopmentArtifact
.
androidGenSnapshot
,
DevelopmentArtifact
.
androidMaven
,
DevelopmentArtifact
.
androidInternalBuild
,
}));
},
overrides:
<
Type
,
Generator
>{
Cache:
()
=>
cache
,
});
testUsingContext
(
'Adds artifact flags to requested android artifacts'
,
()
async
{
// Release lock between test cases.
Cache
.
releaseLockEarly
();
final
PrecacheCommand
command
=
PrecacheCommand
();
applyMocksToCommand
(
command
);
await
createTestCommandRunner
(
command
).
run
(
const
<
String
>[
'precache'
,
'--no-ios'
,
'--android_gen_snapshot'
,
'--android_maven'
,
'--android_internal_build'
,
]
);
expect
(
artifacts
,
unorderedEquals
(<
DevelopmentArtifact
>{
DevelopmentArtifact
.
universal
,
DevelopmentArtifact
.
androidGenSnapshot
,
DevelopmentArtifact
.
androidMaven
,
DevelopmentArtifact
.
androidInternalBuild
,
}));
},
overrides:
<
Type
,
Generator
>{
Cache:
()
=>
cache
,
});
final
MockFlutterVersion
flutterVersion
=
MockFlutterVersion
();
when
(
flutterVersion
.
isMaster
).
thenReturn
(
false
);
...
...
@@ -53,18 +113,31 @@ void main() {
final
PrecacheCommand
command
=
PrecacheCommand
();
applyMocksToCommand
(
command
);
await
createTestCommandRunner
(
command
).
run
(
const
<
String
>[
'precache'
,
'--ios'
,
'--android'
,
'--web'
,
'--macos'
,
'--linux'
,
'--windows'
,
'--fuchsia'
,
'--flutter_runner'
]
const
<
String
>[
'precache'
,
'--ios'
,
'--android_gen_snapshot'
,
'--android_maven'
,
'--android_internal_build'
,
'--web'
,
'--macos'
,
'--linux'
,
'--windows'
,
'--fuchsia'
,
'--flutter_runner'
,
]
);
expect
(
artifacts
,
unorderedEquals
(<
DevelopmentArtifact
>{
DevelopmentArtifact
.
universal
,
DevelopmentArtifact
.
iOS
,
DevelopmentArtifact
.
android
,
}));
expect
(
artifacts
,
unorderedEquals
(<
DevelopmentArtifact
>{
DevelopmentArtifact
.
universal
,
DevelopmentArtifact
.
iOS
,
DevelopmentArtifact
.
androidGenSnapshot
,
DevelopmentArtifact
.
androidMaven
,
DevelopmentArtifact
.
androidInternalBuild
,
}));
},
overrides:
<
Type
,
Generator
>{
Cache:
()
=>
cache
,
FlutterVersion:
()
=>
flutterVersion
,
});
testUsingContext
(
'Downloads artifacts when --force is provided'
,
()
async
{
when
(
cache
.
isUpToDate
()).
thenReturn
(
true
);
// Release lock between test cases.
...
...
@@ -73,10 +146,12 @@ void main() {
applyMocksToCommand
(
command
);
await
createTestCommandRunner
(
command
).
run
(
const
<
String
>[
'precache'
,
'--force'
]);
expect
(
artifacts
,
unorderedEquals
(<
DevelopmentArtifact
>{
DevelopmentArtifact
.
universal
,
DevelopmentArtifact
.
iOS
,
DevelopmentArtifact
.
android
,
}));
DevelopmentArtifact
.
universal
,
DevelopmentArtifact
.
iOS
,
DevelopmentArtifact
.
androidGenSnapshot
,
DevelopmentArtifact
.
androidMaven
,
DevelopmentArtifact
.
androidInternalBuild
,
}));
},
overrides:
<
Type
,
Generator
>{
Cache:
()
=>
cache
,
FlutterVersion:
()
=>
flutterVersion
,
...
...
packages/flutter_tools/test/general.shard/commands/run_test.dart
View file @
b63cb441
...
...
@@ -138,7 +138,7 @@ void main() {
expect
(
await
RunCommand
().
requiredArtifacts
,
unorderedEquals
(<
DevelopmentArtifact
>{
DevelopmentArtifact
.
universal
,
DevelopmentArtifact
.
android
,
DevelopmentArtifact
.
android
GenSnapshot
,
}));
when
(
mockDeviceManager
.
getDevices
()).
thenAnswer
((
Invocation
invocation
)
{
...
...
@@ -162,7 +162,7 @@ void main() {
expect
(
await
RunCommand
().
requiredArtifacts
,
unorderedEquals
(<
DevelopmentArtifact
>{
DevelopmentArtifact
.
universal
,
DevelopmentArtifact
.
iOS
,
DevelopmentArtifact
.
android
,
DevelopmentArtifact
.
android
GenSnapshot
,
}));
when
(
mockDeviceManager
.
getDevices
()).
thenAnswer
((
Invocation
invocation
)
{
...
...
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