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
ad9476dc
Unverified
Commit
ad9476dc
authored
Jan 15, 2020
by
Jonah Williams
Committed by
GitHub
Jan 15, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] Remove context from Artifacts class (#48776)
parent
3e634112
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
424 additions
and
293 deletions
+424
-293
fuchsia_attach.dart
packages/flutter_tools/bin/fuchsia_attach.dart
+5
-1
artifacts.dart
packages/flutter_tools/lib/src/artifacts.dart
+142
-90
cache.dart
packages/flutter_tools/lib/src/cache.dart
+37
-19
context_runner.dart
packages/flutter_tools/lib/src/context_runner.dart
+10
-2
gradle_test.dart
...flutter_tools/test/general.shard/android/gradle_test.dart
+69
-66
artifacts_test.dart
...ages/flutter_tools/test/general.shard/artifacts_test.dart
+118
-108
build_aot_test.dart
...ter_tools/test/general.shard/commands/build_aot_test.dart
+43
-7
No files found.
packages/flutter_tools/bin/fuchsia_attach.dart
View file @
ad9476dc
...
...
@@ -108,7 +108,11 @@ Future<void> main(List<String> args) async {
DeviceManager:
()
=>
_FuchsiaDeviceManager
(),
FuchsiaArtifacts:
()
=>
FuchsiaArtifacts
(
sshConfig:
sshConfig
,
devFinder:
devFinder
),
Artifacts:
()
=>
OverrideArtifacts
(
parent:
CachedArtifacts
(),
parent:
CachedArtifacts
(
fileSystem:
globals
.
fs
,
cache:
globals
.
cache
,
platform:
globals
.
platform
,
),
frontendServer:
frontendServer
,
engineDartBinary:
dartSdk
,
platformKernelDill:
platformKernelDill
,
...
...
packages/flutter_tools/lib/src/artifacts.dart
View file @
ad9476dc
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/cache.dart
View file @
ad9476dc
...
...
@@ -5,6 +5,7 @@
import
'dart:async'
;
import
'package:meta/meta.dart'
;
import
'package:platform/platform.dart'
;
import
'android/gradle_utils.dart'
;
import
'base/common.dart'
;
...
...
@@ -89,7 +90,19 @@ class DevelopmentArtifact {
class
Cache
{
/// [rootOverride] is configurable for testing.
/// [artifacts] is configurable for testing.
Cache
({
Directory
rootOverride
,
List
<
ArtifactSet
>
artifacts
})
:
_rootOverride
=
rootOverride
{
Cache
({
Directory
rootOverride
,
List
<
ArtifactSet
>
artifacts
,
// TODO(jonahwilliams): make required once migrated to context-free.
Logger
logger
,
FileSystem
fileSystem
,
Platform
platform
,
OperatingSystemUtils
osUtils
,
})
:
_rootOverride
=
rootOverride
,
_logger
=
logger
??
globals
.
logger
,
_fileSystem
=
fileSystem
??
globals
.
fs
,
_platform
=
platform
??
globals
.
platform
,
_osUtils
=
osUtils
??
os
{
if
(
artifacts
==
null
)
{
_artifacts
.
add
(
MaterialFonts
(
this
));
...
...
@@ -116,6 +129,11 @@ class Cache {
}
}
final
Logger
_logger
;
final
Platform
_platform
;
final
FileSystem
_fileSystem
;
final
OperatingSystemUtils
_osUtils
;
static
const
List
<
String
>
_hostsBlockedInChina
=
<
String
>
[
'storage.googleapis.com'
,
];
...
...
@@ -217,7 +235,7 @@ class Cache {
if
(
_dartSdkVersion
==
null
)
{
// Make the version string more customer-friendly.
// Changes '2.1.0-dev.8.0.flutter-4312ae32' to '2.1.0 (build 2.1.0-dev.8.0 4312ae32)'
final
String
justVersion
=
globals
.
platform
.
version
.
split
(
' '
)[
0
];
final
String
justVersion
=
_
platform
.
version
.
split
(
' '
)[
0
];
_dartSdkVersion
=
justVersion
.
replaceFirstMapped
(
RegExp
(
r'(\d+\.\d+\.\d+)(.+)'
),
(
Match
match
)
{
final
String
noFlutter
=
match
[
2
].
replaceAll
(
'.flutter-'
,
' '
);
return
'
${match[1]}
(build
${match[1]}$noFlutter
)'
;
...
...
@@ -234,7 +252,7 @@ class Cache {
String
_engineRevision
;
String
get
storageBaseUrl
{
final
String
overrideUrl
=
globals
.
platform
.
environment
[
'FLUTTER_STORAGE_BASE_URL'
];
final
String
overrideUrl
=
_
platform
.
environment
[
'FLUTTER_STORAGE_BASE_URL'
];
if
(
overrideUrl
==
null
)
{
return
'https://storage.googleapis.com'
;
}
...
...
@@ -254,7 +272,7 @@ class Cache {
if
(
_hasWarnedAboutStorageOverride
)
{
return
;
}
globals
.
logger
.
printStatus
(
_
logger
.
printStatus
(
'Flutter assets will be downloaded from
$overrideUrl
. Make sure you trust this source!'
,
emphasis:
true
,
);
...
...
@@ -264,18 +282,18 @@ class Cache {
/// Return the top-level directory in the cache; this is `bin/cache`.
Directory
getRoot
()
{
if
(
_rootOverride
!=
null
)
{
return
globals
.
fs
.
directory
(
globals
.
fs
.
path
.
join
(
_rootOverride
.
path
,
'bin'
,
'cache'
));
return
_fileSystem
.
directory
(
_fileSystem
.
path
.
join
(
_rootOverride
.
path
,
'bin'
,
'cache'
));
}
else
{
return
globals
.
fs
.
directory
(
globals
.
fs
.
path
.
join
(
flutterRoot
,
'bin'
,
'cache'
));
return
_fileSystem
.
directory
(
_fileSystem
.
path
.
join
(
flutterRoot
,
'bin'
,
'cache'
));
}
}
/// Return a directory in the cache dir. For `pkg`, this will return `bin/cache/pkg`.
Directory
getCacheDir
(
String
name
)
{
final
Directory
dir
=
globals
.
fs
.
directory
(
globals
.
fs
.
path
.
join
(
getRoot
().
path
,
name
));
final
Directory
dir
=
_fileSystem
.
directory
(
_fileSystem
.
path
.
join
(
getRoot
().
path
,
name
));
if
(!
dir
.
existsSync
())
{
dir
.
createSync
(
recursive:
true
);
o
s
.
chmod
(
dir
,
'755'
);
_osUtil
s
.
chmod
(
dir
,
'755'
);
}
return
dir
;
}
...
...
@@ -287,7 +305,7 @@ class Cache {
Directory
getCacheArtifacts
()
=>
getCacheDir
(
'artifacts'
);
/// Location of LICENSE file.
File
getLicenseFile
()
=>
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
flutterRoot
,
'LICENSE'
));
File
getLicenseFile
()
=>
_fileSystem
.
file
(
_fileSystem
.
path
.
join
(
flutterRoot
,
'LICENSE'
));
/// Get a named directory from with the cache's artifact directory; for example,
/// `material_fonts` would return `bin/cache/artifacts/material_fonts`.
...
...
@@ -323,7 +341,7 @@ class Cache {
}
String
getVersionFor
(
String
artifactName
)
{
final
File
versionFile
=
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
final
File
versionFile
=
_fileSystem
.
file
(
globals
.
fs
.
path
.
join
(
_rootOverride
?.
path
??
flutterRoot
,
'bin'
,
'internal'
,
'
$artifactName
.version'
));
return
versionFile
.
existsSync
()
?
versionFile
.
readAsStringSync
().
trim
()
:
null
;
...
...
@@ -339,7 +357,7 @@ class Cache {
}
File
getStampFileFor
(
String
artifactName
)
{
return
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
getRoot
().
path
,
'
$artifactName
.stamp'
));
return
_fileSystem
.
file
(
_fileSystem
.
path
.
join
(
getRoot
().
path
,
'
$artifactName
.stamp'
));
}
/// Returns `true` if either [entity] is older than the tools stamp or if
...
...
@@ -358,13 +376,13 @@ class Cache {
final
Uri
url
=
Uri
.
parse
(
urlStr
);
final
Directory
thirdPartyDir
=
getArtifactDirectory
(
'third_party'
);
final
Directory
serviceDir
=
globals
.
fs
.
directory
(
globals
.
fs
.
path
.
join
(
thirdPartyDir
.
path
,
serviceName
));
final
Directory
serviceDir
=
_fileSystem
.
directory
(
_fileSystem
.
path
.
join
(
thirdPartyDir
.
path
,
serviceName
));
if
(!
serviceDir
.
existsSync
())
{
serviceDir
.
createSync
(
recursive:
true
);
o
s
.
chmod
(
serviceDir
,
'755'
);
_osUtil
s
.
chmod
(
serviceDir
,
'755'
);
}
final
File
cachedFile
=
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
serviceDir
.
path
,
url
.
pathSegments
.
last
));
final
File
cachedFile
=
_fileSystem
.
file
(
_fileSystem
.
path
.
join
(
serviceDir
.
path
,
url
.
pathSegments
.
last
));
if
(!
cachedFile
.
existsSync
())
{
try
{
await
_downloadFile
(
url
,
cachedFile
);
...
...
@@ -383,7 +401,7 @@ class Cache {
}
for
(
final
ArtifactSet
artifact
in
_artifacts
)
{
if
(!
requiredArtifacts
.
contains
(
artifact
.
developmentArtifact
))
{
globals
.
printTrace
(
'Artifact
$artifact
is not required, skipping update.'
);
_logger
.
printTrace
(
'Artifact
$artifact
is not required, skipping update.'
);
continue
;
}
if
(
artifact
.
isUpToDate
())
{
...
...
@@ -393,7 +411,7 @@ class Cache {
await
artifact
.
update
();
}
on
SocketException
catch
(
e
)
{
if
(
_hostsBlockedInChina
.
contains
(
e
.
address
?.
host
))
{
globals
.
printError
(
_logger
.
printError
(
'Failed to retrieve Flutter tool dependencies:
${e.message}
.
\n
'
'If you
\'
re in China, please see this page: '
'https://flutter.dev/community/china'
,
...
...
@@ -409,15 +427,15 @@ class Cache {
String
engineVersion
,
bool
includeAllPlatforms
=
true
,
})
async
{
final
bool
includeAllPlatformsState
=
globals
.
cache
.
includeAllPlatforms
;
final
bool
includeAllPlatformsState
=
this
.
includeAllPlatforms
;
bool
allAvailible
=
true
;
globals
.
cache
.
includeAllPlatforms
=
includeAllPlatforms
;
this
.
includeAllPlatforms
=
includeAllPlatforms
;
for
(
final
ArtifactSet
cachedArtifact
in
_artifacts
)
{
if
(
cachedArtifact
is
EngineCachedArtifact
)
{
allAvailible
&=
await
cachedArtifact
.
checkForArtifacts
(
engineVersion
);
}
}
globals
.
cache
.
includeAllPlatforms
=
includeAllPlatformsState
;
this
.
includeAllPlatforms
=
includeAllPlatformsState
;
return
allAvailible
;
}
}
...
...
packages/flutter_tools/lib/src/context_runner.dart
View file @
ad9476dc
...
...
@@ -72,10 +72,18 @@ Future<T> runInContext<T>(
AndroidValidator:
()
=>
AndroidValidator
(),
AndroidWorkflow:
()
=>
AndroidWorkflow
(),
ApplicationPackageFactory:
()
=>
ApplicationPackageFactory
(),
Artifacts:
()
=>
CachedArtifacts
(),
Artifacts:
()
=>
CachedArtifacts
(
fileSystem:
globals
.
fs
,
cache:
globals
.
cache
,
platform:
globals
.
platform
,
),
AssetBundleFactory:
()
=>
AssetBundleFactory
.
defaultInstance
,
BuildSystem:
()
=>
const
BuildSystem
(),
Cache:
()
=>
Cache
(),
Cache:
()
=>
Cache
(
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
platform:
globals
.
platform
,
),
ChromeLauncher:
()
=>
const
ChromeLauncher
(),
CocoaPods:
()
=>
CocoaPods
(),
CocoaPodsValidator:
()
=>
const
CocoaPodsValidator
(),
...
...
packages/flutter_tools/test/general.shard/android/gradle_test.dart
View file @
ad9476dc
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/general.shard/artifacts_test.dart
View file @
ad9476dc
...
...
@@ -3,138 +3,148 @@
// found in the LICENSE file.
import
'package:file/memory.dart'
;
import
'package:flutter_tools/src/base/logger.dart'
;
import
'package:flutter_tools/src/base/os.dart'
;
import
'package:mockito/mockito.dart'
;
import
'package:platform/platform.dart'
;
import
'package:flutter_tools/src/artifacts.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/build_info.dart'
;
import
'package:flutter_tools/src/cache.dart'
;
import
'package:flutter_tools/src/globals.dart'
as
globals
;
import
'../src/common.dart'
;
import
'../src/context.dart'
;
void
main
(
)
{
group
(
'Artifacts'
,
()
{
MemoryFileSystem
memoryFileSystem
;
Directory
tempDir
;
group
(
'CachedArtifacts'
,
()
{
CachedArtifacts
artifacts
;
Cache
cache
;
FileSystem
fileSystem
;
Platform
platform
;
setUp
(()
{
memoryFileSystem
=
MemoryFileSystem
();
tempDir
=
memoryFileSystem
.
systemTempDirectory
.
createTempSync
(
'flutter_artifacts_test.'
);
fileSystem
=
MemoryFileSystem
();
final
Directory
cacheRoot
=
fileSystem
.
directory
(
'root'
)
..
createSync
();
platform
=
FakePlatform
(
operatingSystem:
'linux'
);
cache
=
Cache
(
rootOverride:
cacheRoot
,
fileSystem:
fileSystem
,
platform:
platform
,
logger:
MockLogger
(),
osUtils:
MockOperatingSystemUtils
(),
);
artifacts
=
CachedArtifacts
(
fileSystem:
fileSystem
,
cache:
cache
,
platform:
platform
,
);
});
tearDown
(()
{
tryToDelete
(
tempDir
);
testWithoutContext
(
'getArtifactPath'
,
()
{
expect
(
artifacts
.
getArtifactPath
(
Artifact
.
flutterFramework
,
platform:
TargetPlatform
.
ios
,
mode:
BuildMode
.
release
),
fileSystem
.
path
.
join
(
'root'
,
'bin'
,
'cache'
,
'artifacts'
,
'engine'
,
'ios-release'
,
'Flutter.framework'
),
);
expect
(
artifacts
.
getArtifactPath
(
Artifact
.
flutterTester
),
fileSystem
.
path
.
join
(
'root'
,
'bin'
,
'cache'
,
'artifacts'
,
'engine'
,
'linux-x64'
,
'flutter_tester'
),
);
});
group
(
'CachedArtifacts'
,
()
{
CachedArtifacts
artifacts
;
setUp
(()
{
artifacts
=
CachedArtifacts
();
});
testUsingContext
(
'getArtifactPath'
,
()
{
expect
(
artifacts
.
getArtifactPath
(
Artifact
.
flutterFramework
,
platform:
TargetPlatform
.
ios
,
mode:
BuildMode
.
release
),
globals
.
fs
.
path
.
join
(
tempDir
.
path
,
'bin'
,
'cache'
,
'artifacts'
,
'engine'
,
'ios-release'
,
'Flutter.framework'
),
);
expect
(
artifacts
.
getArtifactPath
(
Artifact
.
flutterTester
),
globals
.
fs
.
path
.
join
(
tempDir
.
path
,
'bin'
,
'cache'
,
'artifacts'
,
'engine'
,
'linux-x64'
,
'flutter_tester'
),
);
},
overrides:
<
Type
,
Generator
>{
Cache:
()
=>
Cache
(
rootOverride:
tempDir
),
FileSystem:
()
=>
memoryFileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
Platform:
()
=>
FakePlatform
(
operatingSystem:
'linux'
),
});
testUsingContext
(
'getEngineType'
,
()
{
expect
(
artifacts
.
getEngineType
(
TargetPlatform
.
android_arm
,
BuildMode
.
debug
),
'android-arm'
,
);
expect
(
artifacts
.
getEngineType
(
TargetPlatform
.
ios
,
BuildMode
.
release
),
'ios-release'
,
);
expect
(
artifacts
.
getEngineType
(
TargetPlatform
.
darwin_x64
),
'darwin-x64'
,
);
},
overrides:
<
Type
,
Generator
>{
Cache:
()
=>
Cache
(
rootOverride:
tempDir
),
FileSystem:
()
=>
memoryFileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
Platform:
()
=>
FakePlatform
(
operatingSystem:
'linux'
),
});
testWithoutContext
(
'getEngineType'
,
()
{
expect
(
artifacts
.
getEngineType
(
TargetPlatform
.
android_arm
,
BuildMode
.
debug
),
'android-arm'
,
);
expect
(
artifacts
.
getEngineType
(
TargetPlatform
.
ios
,
BuildMode
.
release
),
'ios-release'
,
);
expect
(
artifacts
.
getEngineType
(
TargetPlatform
.
darwin_x64
),
'darwin-x64'
,
);
});
});
group
(
'LocalEngineArtifacts'
,
()
{
LocalEngineArtifacts
artifacts
;
group
(
'LocalEngineArtifacts'
,
()
{
LocalEngineArtifacts
artifacts
;
Cache
cache
;
FileSystem
fileSystem
;
Platform
platform
;
setUp
(()
{
artifacts
=
LocalEngineArtifacts
(
tempDir
.
path
,
memoryFileSystem
.
path
.
join
(
tempDir
.
path
,
'out'
,
'android_debug_unopt'
),
memoryFileSystem
.
path
.
join
(
tempDir
.
path
,
'out'
,
'host_debug_unopt'
),
);
});
setUp
(()
{
fileSystem
=
MemoryFileSystem
();
final
Directory
cacheRoot
=
fileSystem
.
directory
(
'root'
)
..
createSync
();
platform
=
FakePlatform
(
operatingSystem:
'linux'
);
cache
=
Cache
(
rootOverride:
cacheRoot
,
fileSystem:
fileSystem
,
platform:
platform
,
logger:
MockLogger
(),
osUtils:
MockOperatingSystemUtils
(),
);
artifacts
=
LocalEngineArtifacts
(
fileSystem
.
currentDirectory
.
path
,
fileSystem
.
path
.
join
(
fileSystem
.
currentDirectory
.
path
,
'out'
,
'android_debug_unopt'
),
fileSystem
.
path
.
join
(
fileSystem
.
currentDirectory
.
path
,
'out'
,
'host_debug_unopt'
),
cache:
cache
,
fileSystem:
fileSystem
,
platform:
platform
,
processManager:
FakeProcessManager
.
any
(),
);
});
testUsingContext
(
'getArtifactPath'
,
()
{
expect
(
artifacts
.
getArtifactPath
(
Artifact
.
flutterFramework
,
platform:
TargetPlatform
.
ios
,
mode:
BuildMode
.
release
),
globals
.
fs
.
path
.
join
(
tempDir
.
path
,
'out'
,
'android_debug_unopt'
,
'Flutter.framework'
),
);
expect
(
artifacts
.
getArtifactPath
(
Artifact
.
flutterTester
),
globals
.
fs
.
path
.
join
(
tempDir
.
path
,
'out'
,
'android_debug_unopt'
,
'flutter_tester'
),
);
expect
(
artifacts
.
getArtifactPath
(
Artifact
.
engineDartSdkPath
),
globals
.
fs
.
path
.
join
(
tempDir
.
path
,
'out'
,
'host_debug_unopt'
,
'dart-sdk'
),
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
memoryFileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
Platform:
()
=>
FakePlatform
(
operatingSystem:
'linux'
),
});
testWithoutContext
(
'getArtifactPath'
,
()
{
expect
(
artifacts
.
getArtifactPath
(
Artifact
.
flutterFramework
,
platform:
TargetPlatform
.
ios
,
mode:
BuildMode
.
release
),
fileSystem
.
path
.
join
(
'/out'
,
'android_debug_unopt'
,
'Flutter.framework'
),
);
expect
(
artifacts
.
getArtifactPath
(
Artifact
.
flutterTester
),
fileSystem
.
path
.
join
(
'/out'
,
'android_debug_unopt'
,
'flutter_tester'
),
);
expect
(
artifacts
.
getArtifactPath
(
Artifact
.
engineDartSdkPath
),
fileSystem
.
path
.
join
(
'/out'
,
'host_debug_unopt'
,
'dart-sdk'
),
);
});
testUsingContext
(
'getEngineType'
,
()
{
expect
(
artifacts
.
getEngineType
(
TargetPlatform
.
android_arm
,
BuildMode
.
debug
),
'android_debug_unopt'
,
);
expect
(
artifacts
.
getEngineType
(
TargetPlatform
.
ios
,
BuildMode
.
release
),
'android_debug_unopt'
,
);
expect
(
artifacts
.
getEngineType
(
TargetPlatform
.
darwin_x64
),
'android_debug_unopt'
,
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
memoryFileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
Platform:
()
=>
FakePlatform
(
operatingSystem:
'linux'
),
});
testWithoutContext
(
'getEngineType'
,
()
{
expect
(
artifacts
.
getEngineType
(
TargetPlatform
.
android_arm
,
BuildMode
.
debug
),
'android_debug_unopt'
,
);
expect
(
artifacts
.
getEngineType
(
TargetPlatform
.
ios
,
BuildMode
.
release
),
'android_debug_unopt'
,
);
expect
(
artifacts
.
getEngineType
(
TargetPlatform
.
darwin_x64
),
'android_debug_unopt'
,
);
});
testUsingContext
(
'Looks up dart.exe on windows platforms'
,
()
async
{
expect
(
artifacts
.
getArtifactPath
(
Artifact
.
engineDartBinary
),
contains
(
'.exe'
));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
memoryFileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
Platform:
()
=>
FakePlatform
(
operatingSystem:
'windows'
),
});
testWithoutContext
(
'Looks up dart.exe on windows platforms'
,
()
async
{
artifacts
=
LocalEngineArtifacts
(
fileSystem
.
currentDirectory
.
path
,
fileSystem
.
path
.
join
(
fileSystem
.
currentDirectory
.
path
,
'out'
,
'android_debug_unopt'
),
fileSystem
.
path
.
join
(
fileSystem
.
currentDirectory
.
path
,
'out'
,
'host_debug_unopt'
),
cache:
cache
,
fileSystem:
fileSystem
,
platform:
FakePlatform
(
operatingSystem:
'windows'
),
processManager:
FakeProcessManager
.
any
(),
);
expect
(
artifacts
.
getArtifactPath
(
Artifact
.
engineDartBinary
),
contains
(
'.exe'
));
});
testUsingContext
(
'Looks up dart on linux platforms'
,
()
async
{
expect
(
artifacts
.
getArtifactPath
(
Artifact
.
engineDartBinary
),
isNot
(
contains
(
'.exe'
)));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
memoryFileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
Platform:
()
=>
FakePlatform
(
operatingSystem:
'linux'
),
});
testWithoutContext
(
'Looks up dart on linux platforms'
,
()
async
{
expect
(
artifacts
.
getArtifactPath
(
Artifact
.
engineDartBinary
),
isNot
(
contains
(
'.exe'
)));
});
});
}
class
MockLogger
extends
Mock
implements
Logger
{}
class
MockOperatingSystemUtils
extends
Mock
implements
OperatingSystemUtils
{}
packages/flutter_tools/test/general.shard/commands/build_aot_test.dart
View file @
ad9476dc
...
...
@@ -12,6 +12,7 @@ import 'package:flutter_tools/src/ios/plist_parser.dart';
import
'package:flutter_tools/src/macos/xcode.dart'
;
import
'package:mockito/mockito.dart'
;
import
'package:process/process.dart'
;
import
'package:flutter_tools/src/globals.dart'
as
globals
;
import
'../../src/common.dart'
;
import
'../../src/context.dart'
;
...
...
@@ -36,7 +37,12 @@ void main() {
equals
(
'Flutter.framework not found at ios_profile/Flutter.framework'
),
);
},
overrides:
<
Type
,
Generator
>{
Artifacts:
()
=>
LocalEngineArtifacts
(
'/engine'
,
'ios_profile'
,
'host_profile'
),
Artifacts:
()
=>
LocalEngineArtifacts
(
'/engine'
,
'ios_profile'
,
'host_profile'
,
fileSystem:
memoryFileSystem
,
cache:
globals
.
cache
,
platform:
globals
.
platform
,
processManager:
mockProcessManager
,
),
FileSystem:
()
=>
memoryFileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
...
...
@@ -60,7 +66,12 @@ void main() {
'Expected a string like "Apple (LLVM|clang) #.#.# (clang-####.#.##.#)".'
),
);
},
overrides:
<
Type
,
Generator
>{
Artifacts:
()
=>
LocalEngineArtifacts
(
'/engine'
,
'ios_profile'
,
'host_profile'
),
Artifacts:
()
=>
LocalEngineArtifacts
(
'/engine'
,
'ios_profile'
,
'host_profile'
,
fileSystem:
memoryFileSystem
,
cache:
globals
.
cache
,
platform:
globals
.
platform
,
processManager:
mockProcessManager
,
),
FileSystem:
()
=>
memoryFileSystem
,
ProcessManager:
()
=>
mockProcessManager
,
Xcode:
()
=>
mockXcode
,
...
...
@@ -83,7 +94,12 @@ void main() {
await
validateBitcode
(
BuildMode
.
profile
,
TargetPlatform
.
ios
);
},
overrides:
<
Type
,
Generator
>{
Artifacts:
()
=>
LocalEngineArtifacts
(
'/engine'
,
'ios_profile'
,
'host_profile'
),
Artifacts:
()
=>
LocalEngineArtifacts
(
'/engine'
,
'ios_profile'
,
'host_profile'
,
fileSystem:
memoryFileSystem
,
cache:
globals
.
cache
,
platform:
globals
.
platform
,
processManager:
mockProcessManager
,
),
FileSystem:
()
=>
memoryFileSystem
,
ProcessManager:
()
=>
mockProcessManager
,
Xcode:
()
=>
mockXcode
,
...
...
@@ -105,7 +121,12 @@ void main() {
await
validateBitcode
(
BuildMode
.
profile
,
TargetPlatform
.
ios
);
},
overrides:
<
Type
,
Generator
>{
Artifacts:
()
=>
LocalEngineArtifacts
(
'/engine'
,
'ios_profile'
,
'host_profile'
),
Artifacts:
()
=>
LocalEngineArtifacts
(
'/engine'
,
'ios_profile'
,
'host_profile'
,
fileSystem:
memoryFileSystem
,
cache:
globals
.
cache
,
platform:
globals
.
platform
,
processManager:
mockProcessManager
,
),
FileSystem:
()
=>
memoryFileSystem
,
ProcessManager:
()
=>
mockProcessManager
,
Xcode:
()
=>
mockXcode
,
...
...
@@ -133,7 +154,12 @@ void main() {
'of Xcode to at least 10.0.1.'
),
);
},
overrides:
<
Type
,
Generator
>{
Artifacts:
()
=>
LocalEngineArtifacts
(
'/engine'
,
'ios_profile'
,
'host_profile'
),
Artifacts:
()
=>
LocalEngineArtifacts
(
'/engine'
,
'ios_profile'
,
'host_profile'
,
fileSystem:
memoryFileSystem
,
cache:
globals
.
cache
,
platform:
globals
.
platform
,
processManager:
mockProcessManager
,
),
FileSystem:
()
=>
memoryFileSystem
,
ProcessManager:
()
=>
mockProcessManager
,
Xcode:
()
=>
mockXcode
,
...
...
@@ -157,7 +183,12 @@ void main() {
expect
(
testLogger
.
statusText
,
''
);
},
overrides:
<
Type
,
Generator
>{
Artifacts:
()
=>
LocalEngineArtifacts
(
'/engine'
,
'ios_profile'
,
'host_profile'
),
Artifacts:
()
=>
LocalEngineArtifacts
(
'/engine'
,
'ios_profile'
,
'host_profile'
,
fileSystem:
memoryFileSystem
,
cache:
globals
.
cache
,
platform:
globals
.
platform
,
processManager:
mockProcessManager
,
),
FileSystem:
()
=>
memoryFileSystem
,
ProcessManager:
()
=>
mockProcessManager
,
Xcode:
()
=>
mockXcode
,
...
...
@@ -181,7 +212,12 @@ void main() {
expect
(
testLogger
.
statusText
,
''
);
},
overrides:
<
Type
,
Generator
>{
Artifacts:
()
=>
LocalEngineArtifacts
(
'/engine'
,
'ios_profile'
,
'host_profile'
),
Artifacts:
()
=>
LocalEngineArtifacts
(
'/engine'
,
'ios_profile'
,
'host_profile'
,
fileSystem:
memoryFileSystem
,
cache:
globals
.
cache
,
platform:
globals
.
platform
,
processManager:
mockProcessManager
,
),
FileSystem:
()
=>
memoryFileSystem
,
ProcessManager:
()
=>
mockProcessManager
,
Xcode:
()
=>
mockXcode
,
...
...
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