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
43afac1e
Unverified
Commit
43afac1e
authored
Jul 24, 2023
by
Christopher Fujino
Committed by
GitHub
Jul 24, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduce usage of testUsingContext (#131078)
Part of
https://github.com/flutter/flutter/issues/47161
parent
f2ba0a2b
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
79 additions
and
104 deletions
+79
-104
cmake.dart
packages/flutter_tools/lib/src/cmake.dart
+13
-11
build_linux.dart
packages/flutter_tools/lib/src/commands/build_linux.dart
+5
-1
build_linux.dart
packages/flutter_tools/lib/src/linux/build_linux.dart
+12
-11
linux_device.dart
packages/flutter_tools/lib/src/linux/linux_device.dart
+3
-0
events.dart
packages/flutter_tools/lib/src/reporting/events.dart
+3
-1
run_hot.dart
packages/flutter_tools/lib/src/run_hot.dart
+4
-0
build_windows.dart
packages/flutter_tools/lib/src/windows/build_windows.dart
+1
-1
cmake_test.dart
packages/flutter_tools/test/general.shard/cmake_test.dart
+32
-77
hot_test.dart
packages/flutter_tools/test/general.shard/hot_test.dart
+1
-0
run_hot_test.dart
packages/flutter_tools/test/general.shard/run_hot_test.dart
+5
-2
No files found.
packages/flutter_tools/lib/src/cmake.dart
View file @
43afac1e
...
...
@@ -4,9 +4,9 @@
import
'package:pub_semver/pub_semver.dart'
;
import
'base/logger.dart'
;
import
'build_info.dart'
;
import
'cmake_project.dart'
;
import
'globals.dart'
as
globals
;
/// Extracts the `BINARY_NAME` from a project's CMake file.
///
...
...
@@ -41,12 +41,12 @@ String _determineVersionString(CmakeBasedProject project, BuildInfo buildInfo) {
:
buildName
;
}
Version
_determineVersion
(
CmakeBasedProject
project
,
BuildInfo
buildInfo
)
{
Version
_determineVersion
(
CmakeBasedProject
project
,
BuildInfo
buildInfo
,
Logger
logger
)
{
final
String
version
=
_determineVersionString
(
project
,
buildInfo
);
try
{
return
Version
.
parse
(
version
);
}
on
FormatException
{
globals
.
printWarning
(
'Warning: could not parse version
$version
, defaulting to 1.0.0.'
);
logger
.
printWarning
(
'Warning: could not parse version
$version
, defaulting to 1.0.0.'
);
return
Version
(
1
,
0
,
0
);
}
...
...
@@ -74,25 +74,27 @@ void writeGeneratedCmakeConfig(
String
flutterRoot
,
CmakeBasedProject
project
,
BuildInfo
buildInfo
,
Map
<
String
,
String
>
environment
)
{
Map
<
String
,
String
>
environment
,
Logger
logger
,
)
{
// Only a limited set of variables are needed by the CMake files themselves,
// the rest are put into a list to pass to the re-entrant build step.
final
String
escapedFlutterRoot
=
_escapeBackslashes
(
flutterRoot
);
final
String
escapedProjectDir
=
_escapeBackslashes
(
project
.
parent
.
directory
.
path
);
final
Version
version
=
_determineVersion
(
project
,
buildInfo
);
final
Version
version
=
_determineVersion
(
project
,
buildInfo
,
logger
);
final
int
?
buildVersion
=
_tryDetermineBuildVersion
(
version
);
// Since complex Dart build identifiers cannot be converted into integers,
// different Dart versions may be converted into the same Windows numeric version.
// Warn the user as some Windows installers, like MSI, don't update files if their versions are equal.
if
(
buildVersion
==
null
&&
project
is
WindowsProject
)
{
final
String
buildIdentifier
=
version
.
build
.
join
(
'.'
);
globals
.
printWarning
(
'Warning: build identifier
$buildIdentifier
in version
$version
is not numeric '
'and cannot be converted into a Windows build version number. Defaulting to 0.
\n
'
'This may cause issues with Windows installers.'
);
final
String
buildIdentifier
=
version
.
build
.
join
(
'.'
);
logger
.
printWarning
(
'Warning: build identifier
$buildIdentifier
in version
$version
is not numeric '
'and cannot be converted into a Windows build version number. Defaulting to 0.
\n
'
'This may cause issues with Windows installers.'
);
}
final
StringBuffer
buffer
=
StringBuffer
(
'''
...
...
packages/flutter_tools/lib/src/commands/build_linux.dart
View file @
43afac1e
...
...
@@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'../base/analyze_size.dart'
;
import
'../base/common.dart'
;
import
'../base/logger.dart'
;
import
'../base/os.dart'
;
import
'../build_info.dart'
;
import
'../cache.dart'
;
...
...
@@ -83,18 +85,20 @@ class BuildLinuxCommand extends BuildSubCommand {
'Cross-build from Linux x64 host to Linux arm64 target is not currently supported.'
);
}
displayNullSafetyMode
(
buildInfo
);
final
Logger
logger
=
globals
.
logger
;
await
buildLinux
(
flutterProject
.
linux
,
buildInfo
,
target:
targetFile
,
sizeAnalyzer:
SizeAnalyzer
(
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
logger:
logger
,
flutterUsage:
globals
.
flutterUsage
,
),
needCrossBuild:
needCrossBuild
,
targetPlatform:
targetPlatform
,
targetSysroot:
stringArg
(
'target-sysroot'
)!,
logger:
logger
,
);
return
FlutterCommandResult
.
success
();
}
...
...
packages/flutter_tools/lib/src/linux/build_linux.dart
View file @
43afac1e
...
...
@@ -29,12 +29,13 @@ final RegExp errorMatcher = RegExp(r'(?:(?:.*:\d+:\d+|clang):\s)?(fatal\s)?(?:er
Future
<
void
>
buildLinux
(
LinuxProject
linuxProject
,
BuildInfo
buildInfo
,
{
String
?
target
,
SizeAnalyzer
?
sizeAnalyzer
,
bool
needCrossBuild
=
false
,
required
TargetPlatform
targetPlatform
,
String
targetSysroot
=
'/'
,
})
async
{
String
?
target
,
SizeAnalyzer
?
sizeAnalyzer
,
bool
needCrossBuild
=
false
,
required
TargetPlatform
targetPlatform
,
String
targetSysroot
=
'/'
,
required
Logger
logger
,
})
async
{
target
??=
'lib/main.dart'
;
if
(!
linuxProject
.
cmakeFile
.
existsSync
())
{
throwToolExit
(
'No Linux desktop project configured. See '
...
...
@@ -43,7 +44,7 @@ Future<void> buildLinux(
}
final
List
<
ProjectMigrator
>
migrators
=
<
ProjectMigrator
>[
CmakeCustomCommandMigration
(
linuxProject
,
globals
.
logger
),
CmakeCustomCommandMigration
(
linuxProject
,
logger
),
];
final
ProjectMigration
migration
=
ProjectMigration
(
migrators
);
...
...
@@ -59,11 +60,11 @@ Future<void> buildLinux(
environmentConfig
[
'FLUTTER_ENGINE'
]
=
globals
.
fs
.
path
.
dirname
(
globals
.
fs
.
path
.
dirname
(
engineOutPath
));
environmentConfig
[
'LOCAL_ENGINE'
]
=
localEngineInfo
.
localEngineName
;
}
writeGeneratedCmakeConfig
(
Cache
.
flutterRoot
!,
linuxProject
,
buildInfo
,
environmentConfig
);
writeGeneratedCmakeConfig
(
Cache
.
flutterRoot
!,
linuxProject
,
buildInfo
,
environmentConfig
,
logger
);
createPluginSymlinks
(
linuxProject
.
parent
);
final
Status
status
=
globals
.
logger
.
startProgress
(
final
Status
status
=
logger
.
startProgress
(
'Building Linux application...'
,
);
try
{
...
...
@@ -97,13 +98,13 @@ Future<void> buildLinux(
.
childDirectory
(
'.flutter-devtools'
),
'linux-code-size-analysis'
,
'json'
,
)..
writeAsStringSync
(
jsonEncode
(
output
));
// This message is used as a sentinel in analyze_apk_size_test.dart
globals
.
printStatus
(
logger
.
printStatus
(
'A summary of your Linux bundle analysis can be found at:
${outputFile.path}
'
,
);
// DevTools expects a file path relative to the .flutter-devtools/ dir.
final
String
relativeAppSizePath
=
outputFile
.
path
.
split
(
'.flutter-devtools/'
).
last
.
trim
();
globals
.
printStatus
(
logger
.
printStatus
(
'
\n
To analyze your app size in Dart DevTools, run the following command:
\n
'
'dart devtools --appSizeBase=
$relativeAppSizePath
'
);
...
...
packages/flutter_tools/lib/src/linux/linux_device.dart
View file @
43afac1e
...
...
@@ -25,6 +25,7 @@ class LinuxDevice extends DesktopDevice {
required
FileSystem
fileSystem
,
required
OperatingSystemUtils
operatingSystemUtils
,
})
:
_operatingSystemUtils
=
operatingSystemUtils
,
_logger
=
logger
,
super
(
'linux'
,
platformType:
PlatformType
.
linux
,
...
...
@@ -36,6 +37,7 @@ class LinuxDevice extends DesktopDevice {
);
final
OperatingSystemUtils
_operatingSystemUtils
;
final
Logger
_logger
;
@override
bool
isSupported
()
=>
true
;
...
...
@@ -66,6 +68,7 @@ class LinuxDevice extends DesktopDevice {
buildInfo
,
target:
mainPath
,
targetPlatform:
await
targetPlatform
,
logger:
_logger
,
);
}
...
...
packages/flutter_tools/lib/src/reporting/events.dart
View file @
43afac1e
...
...
@@ -54,7 +54,9 @@ class HotEvent extends UsageEvent {
this
.
scannedSourcesCount
,
this
.
reassembleTimeInMs
,
this
.
reloadVMTimeInMs
,
})
:
super
(
'hot'
,
parameter
,
flutterUsage:
globals
.
flutterUsage
);
// TODO(fujino): make this required
Usage
?
usage
,
})
:
super
(
'hot'
,
parameter
,
flutterUsage:
usage
??
globals
.
flutterUsage
);
final
String
?
reason
;
final
String
targetPlatform
;
...
...
packages/flutter_tools/lib/src/run_hot.dart
View file @
43afac1e
...
...
@@ -950,6 +950,7 @@ class HotRunner extends ResidentRunner {
sdkName
,
emulator
,
reason
,
globals
.
flutterUsage
,
);
if
(
result
.
code
!=
0
)
{
return
result
;
...
...
@@ -1172,6 +1173,7 @@ typedef ReloadSourcesHelper = Future<OperationResult> Function(
String
?
sdkName
,
bool
?
emulator
,
String
?
reason
,
Usage
usage
,
);
@visibleForTesting
...
...
@@ -1184,6 +1186,7 @@ Future<OperationResult> defaultReloadSourcesHelper(
String
?
sdkName
,
bool
?
emulator
,
String
?
reason
,
Usage
usage
,
)
async
{
final
Stopwatch
vmReloadTimer
=
Stopwatch
()..
start
();
const
String
entryPath
=
'main.dart.incremental.dill'
;
...
...
@@ -1223,6 +1226,7 @@ Future<OperationResult> defaultReloadSourcesHelper(
fullRestart:
false
,
reason:
reason
,
fastReassemble:
false
,
usage:
usage
,
).
send
();
// Reset devFS lastCompileTime to ensure the file will still be marked
// as dirty on subsequent reloads.
...
...
packages/flutter_tools/lib/src/windows/build_windows.dart
View file @
43afac1e
...
...
@@ -242,7 +242,7 @@ void _writeGeneratedFlutterConfig(
environment
[
'FLUTTER_ENGINE'
]
=
globals
.
fs
.
path
.
dirname
(
globals
.
fs
.
path
.
dirname
(
engineOutPath
));
environment
[
'LOCAL_ENGINE'
]
=
localEngineInfo
.
localEngineName
;
}
writeGeneratedCmakeConfig
(
Cache
.
flutterRoot
!,
windowsProject
,
buildInfo
,
environment
);
writeGeneratedCmakeConfig
(
Cache
.
flutterRoot
!,
windowsProject
,
buildInfo
,
environment
,
globals
.
logger
);
}
// Works around the Visual Studio 17.1.0 CMake bug described in
...
...
packages/flutter_tools/test/general.shard/cmake_test.dart
View file @
43afac1e
...
...
@@ -11,23 +11,20 @@ import 'package:flutter_tools/src/cmake.dart';
import
'package:flutter_tools/src/project.dart'
;
import
'../src/common.dart'
;
import
'../src/context.dart'
;
const
String
_kTestFlutterRoot
=
'/flutter'
;
const
String
_kTestWindowsFlutterRoot
=
r'C:\flutter'
;
void
main
(
)
{
late
FileSystem
fileSystem
;
late
ProcessManager
processManager
;
late
BufferLogger
logger
;
setUp
(()
{
processManager
=
FakeProcessManager
.
any
();
fileSystem
=
MemoryFileSystem
.
test
();
logger
=
BufferLogger
.
test
();
});
test
Using
Context
(
'parses executable name from cmake file'
,
()
async
{
test
Without
Context
(
'parses executable name from cmake file'
,
()
async
{
final
FlutterProject
project
=
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
);
final
CmakeBasedProject
cmakeProject
=
_FakeProject
.
fromFlutter
(
project
);
...
...
@@ -38,24 +35,18 @@ void main() {
final
String
?
name
=
getCmakeExecutableName
(
cmakeProject
);
expect
(
name
,
'hello'
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
processManager
,
});
test
Using
Context
(
'defaults executable name to null if cmake config does not exist'
,
()
async
{
test
Without
Context
(
'defaults executable name to null if cmake config does not exist'
,
()
async
{
final
FlutterProject
project
=
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
);
final
CmakeBasedProject
cmakeProject
=
_FakeProject
.
fromFlutter
(
project
);
final
String
?
name
=
getCmakeExecutableName
(
cmakeProject
);
expect
(
name
,
isNull
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
processManager
,
});
test
Using
Context
(
'generates config'
,
()
async
{
test
Without
Context
(
'generates config'
,
()
async
{
final
FlutterProject
project
=
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
);
final
CmakeBasedProject
cmakeProject
=
_FakeProject
.
fromFlutter
(
project
);
const
BuildInfo
buildInfo
=
BuildInfo
(
BuildMode
.
release
,
null
,
treeShakeIcons:
false
);
...
...
@@ -66,6 +57,7 @@ void main() {
cmakeProject
,
buildInfo
,
environment
,
logger
,
);
final
File
cmakeConfig
=
cmakeProject
.
generatedCmakeConfigFile
;
...
...
@@ -91,12 +83,9 @@ void main() {
r' "PROJECT_DIR=/"'
,
r')'
,
]));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
processManager
,
});
test
Using
Context
(
'config escapes backslashes'
,
()
async
{
test
Without
Context
(
'config escapes backslashes'
,
()
async
{
fileSystem
=
MemoryFileSystem
.
test
(
style:
FileSystemStyle
.
windows
);
final
FlutterProject
project
=
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
);
...
...
@@ -112,6 +101,7 @@ void main() {
cmakeProject
,
buildInfo
,
environment
,
logger
,
);
final
File
cmakeConfig
=
cmakeProject
.
generatedCmakeConfigFile
;
...
...
@@ -138,12 +128,9 @@ void main() {
r' "TEST=hello\\world"'
,
r')'
,
]));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
processManager
,
});
test
Using
Context
(
'generated config uses pubspec version'
,
()
async
{
test
Without
Context
(
'generated config uses pubspec version'
,
()
async
{
fileSystem
.
file
(
'pubspec.yaml'
)
..
createSync
()
..
writeAsStringSync
(
'version: 1.2.3+4'
);
...
...
@@ -158,6 +145,7 @@ void main() {
cmakeProject
,
buildInfo
,
environment
,
logger
,
);
final
File
cmakeConfig
=
cmakeProject
.
generatedCmakeConfigFile
;
...
...
@@ -173,12 +161,9 @@ void main() {
'set(FLUTTER_VERSION_PATCH 3 PARENT_SCOPE)'
,
'set(FLUTTER_VERSION_BUILD 4 PARENT_SCOPE)'
,
]));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
processManager
,
});
test
Using
Context
(
'generated config uses build name'
,
()
async
{
test
Without
Context
(
'generated config uses build name'
,
()
async
{
final
FlutterProject
project
=
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
);
final
CmakeBasedProject
cmakeProject
=
_FakeProject
.
fromFlutter
(
project
);
const
BuildInfo
buildInfo
=
BuildInfo
(
...
...
@@ -194,6 +179,7 @@ void main() {
cmakeProject
,
buildInfo
,
environment
,
logger
,
);
final
File
cmakeConfig
=
cmakeProject
.
generatedCmakeConfigFile
;
...
...
@@ -209,12 +195,9 @@ void main() {
'set(FLUTTER_VERSION_PATCH 3 PARENT_SCOPE)'
,
'set(FLUTTER_VERSION_BUILD 0 PARENT_SCOPE)'
,
]));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
processManager
,
});
test
Using
Context
(
'generated config uses build number'
,
()
async
{
test
Without
Context
(
'generated config uses build number'
,
()
async
{
final
FlutterProject
project
=
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
);
final
CmakeBasedProject
cmakeProject
=
_FakeProject
.
fromFlutter
(
project
);
const
BuildInfo
buildInfo
=
BuildInfo
(
...
...
@@ -230,6 +213,7 @@ void main() {
cmakeProject
,
buildInfo
,
environment
,
logger
,
);
final
File
cmakeConfig
=
cmakeProject
.
generatedCmakeConfigFile
;
...
...
@@ -245,12 +229,9 @@ void main() {
'set(FLUTTER_VERSION_PATCH 0 PARENT_SCOPE)'
,
'set(FLUTTER_VERSION_BUILD 4 PARENT_SCOPE)'
,
]));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
processManager
,
});
test
Using
Context
(
'generated config uses build name and build number'
,
()
async
{
test
Without
Context
(
'generated config uses build name and build number'
,
()
async
{
final
FlutterProject
project
=
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
);
final
CmakeBasedProject
cmakeProject
=
_FakeProject
.
fromFlutter
(
project
);
const
BuildInfo
buildInfo
=
BuildInfo
(
...
...
@@ -267,6 +248,7 @@ void main() {
cmakeProject
,
buildInfo
,
environment
,
logger
,
);
final
File
cmakeConfig
=
cmakeProject
.
generatedCmakeConfigFile
;
...
...
@@ -282,12 +264,9 @@ void main() {
'set(FLUTTER_VERSION_PATCH 3 PARENT_SCOPE)'
,
'set(FLUTTER_VERSION_BUILD 4 PARENT_SCOPE)'
,
]));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
processManager
,
});
test
Using
Context
(
'generated config uses build name over pubspec version'
,
()
async
{
test
Without
Context
(
'generated config uses build name over pubspec version'
,
()
async
{
fileSystem
.
file
(
'pubspec.yaml'
)
..
createSync
()
..
writeAsStringSync
(
'version: 9.9.9+9'
);
...
...
@@ -307,6 +286,7 @@ void main() {
cmakeProject
,
buildInfo
,
environment
,
logger
,
);
final
File
cmakeConfig
=
cmakeProject
.
generatedCmakeConfigFile
;
...
...
@@ -322,12 +302,9 @@ void main() {
'set(FLUTTER_VERSION_PATCH 3 PARENT_SCOPE)'
,
'set(FLUTTER_VERSION_BUILD 0 PARENT_SCOPE)'
,
]));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
processManager
,
});
test
Using
Context
(
'generated config uses build number over pubspec version'
,
()
async
{
test
Without
Context
(
'generated config uses build number over pubspec version'
,
()
async
{
fileSystem
.
file
(
'pubspec.yaml'
)
..
createSync
()
..
writeAsStringSync
(
'version: 1.2.3+4'
);
...
...
@@ -347,6 +324,7 @@ void main() {
cmakeProject
,
buildInfo
,
environment
,
logger
,
);
final
File
cmakeConfig
=
cmakeProject
.
generatedCmakeConfigFile
;
...
...
@@ -362,12 +340,9 @@ void main() {
'set(FLUTTER_VERSION_PATCH 3 PARENT_SCOPE)'
,
'set(FLUTTER_VERSION_BUILD 5 PARENT_SCOPE)'
,
]));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
processManager
,
});
test
Using
Context
(
'generated config uses build name and build number over pubspec version'
,
()
async
{
test
Without
Context
(
'generated config uses build name and build number over pubspec version'
,
()
async
{
fileSystem
.
file
(
'pubspec.yaml'
)
..
createSync
()
..
writeAsStringSync
(
'version: 9.9.9+9'
);
...
...
@@ -388,6 +363,7 @@ void main() {
cmakeProject
,
buildInfo
,
environment
,
logger
,
);
final
File
cmakeConfig
=
cmakeProject
.
generatedCmakeConfigFile
;
...
...
@@ -403,12 +379,9 @@ void main() {
'set(FLUTTER_VERSION_PATCH 3 PARENT_SCOPE)'
,
'set(FLUTTER_VERSION_BUILD 4 PARENT_SCOPE)'
,
]));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
processManager
,
});
test
Using
Context
(
'generated config ignores invalid build name'
,
()
async
{
test
Without
Context
(
'generated config ignores invalid build name'
,
()
async
{
final
FlutterProject
project
=
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
);
final
CmakeBasedProject
cmakeProject
=
_FakeProject
.
fromFlutter
(
project
);
const
BuildInfo
buildInfo
=
BuildInfo
(
...
...
@@ -424,6 +397,7 @@ void main() {
cmakeProject
,
buildInfo
,
environment
,
logger
,
);
final
File
cmakeConfig
=
cmakeProject
.
generatedCmakeConfigFile
;
...
...
@@ -441,13 +415,9 @@ void main() {
]));
expect
(
logger
.
warningText
,
contains
(
'Warning: could not parse version hello.world, defaulting to 1.0.0.'
));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
processManager
,
Logger:
()
=>
logger
,
});
test
Using
Context
(
'generated config ignores invalid build number'
,
()
async
{
test
Without
Context
(
'generated config ignores invalid build number'
,
()
async
{
final
FlutterProject
project
=
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
);
final
CmakeBasedProject
cmakeProject
=
_FakeProject
.
fromFlutter
(
project
);
const
BuildInfo
buildInfo
=
BuildInfo
(
...
...
@@ -464,6 +434,7 @@ void main() {
cmakeProject
,
buildInfo
,
environment
,
logger
,
);
final
File
cmakeConfig
=
cmakeProject
.
generatedCmakeConfigFile
;
...
...
@@ -481,13 +452,9 @@ void main() {
]));
expect
(
logger
.
warningText
,
contains
(
'Warning: could not parse version 1.2.3+foo_bar, defaulting to 1.0.0.'
));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
processManager
,
Logger:
()
=>
logger
,
});
test
Using
Context
(
'generated config handles non-numeric build number'
,
()
async
{
test
Without
Context
(
'generated config handles non-numeric build number'
,
()
async
{
final
FlutterProject
project
=
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
);
final
CmakeBasedProject
cmakeProject
=
_FakeProject
.
fromFlutter
(
project
);
const
BuildInfo
buildInfo
=
BuildInfo
(
...
...
@@ -504,6 +471,7 @@ void main() {
cmakeProject
,
buildInfo
,
environment
,
logger
,
);
expect
(
logger
.
warningText
,
isEmpty
);
...
...
@@ -521,13 +489,9 @@ void main() {
'set(FLUTTER_VERSION_PATCH 3 PARENT_SCOPE)'
,
'set(FLUTTER_VERSION_BUILD 0 PARENT_SCOPE)'
,
]));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
processManager
,
Logger:
()
=>
logger
,
});
test
Using
Context
(
'generated config handles complex build number'
,
()
async
{
test
Without
Context
(
'generated config handles complex build number'
,
()
async
{
final
FlutterProject
project
=
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
);
final
CmakeBasedProject
cmakeProject
=
_FakeProject
.
fromFlutter
(
project
);
const
BuildInfo
buildInfo
=
BuildInfo
(
...
...
@@ -544,6 +508,7 @@ void main() {
cmakeProject
,
buildInfo
,
environment
,
logger
,
);
expect
(
logger
.
warningText
,
isEmpty
);
...
...
@@ -561,13 +526,9 @@ void main() {
'set(FLUTTER_VERSION_PATCH 3 PARENT_SCOPE)'
,
'set(FLUTTER_VERSION_BUILD 0 PARENT_SCOPE)'
,
]));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
processManager
,
Logger:
()
=>
logger
,
});
test
Using
Context
(
'generated config warns on Windows project with non-numeric build number'
,
()
async
{
test
Without
Context
(
'generated config warns on Windows project with non-numeric build number'
,
()
async
{
final
FlutterProject
project
=
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
);
final
CmakeBasedProject
cmakeProject
=
WindowsProject
.
fromFlutter
(
project
);
const
BuildInfo
buildInfo
=
BuildInfo
(
...
...
@@ -584,6 +545,7 @@ void main() {
cmakeProject
,
buildInfo
,
environment
,
logger
,
);
expect
(
logger
.
warningText
,
contains
(
...
...
@@ -605,13 +567,9 @@ void main() {
'set(FLUTTER_VERSION_PATCH 3 PARENT_SCOPE)'
,
'set(FLUTTER_VERSION_BUILD 0 PARENT_SCOPE)'
,
]));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
processManager
,
Logger:
()
=>
logger
,
});
test
Using
Context
(
'generated config warns on Windows project with complex build number'
,
()
async
{
test
Without
Context
(
'generated config warns on Windows project with complex build number'
,
()
async
{
final
FlutterProject
project
=
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
);
final
CmakeBasedProject
cmakeProject
=
WindowsProject
.
fromFlutter
(
project
);
const
BuildInfo
buildInfo
=
BuildInfo
(
...
...
@@ -628,6 +586,7 @@ void main() {
cmakeProject
,
buildInfo
,
environment
,
logger
,
);
expect
(
logger
.
warningText
,
contains
(
...
...
@@ -649,10 +608,6 @@ void main() {
'set(FLUTTER_VERSION_PATCH 3 PARENT_SCOPE)'
,
'set(FLUTTER_VERSION_BUILD 0 PARENT_SCOPE)'
,
]));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
processManager
,
Logger:
()
=>
logger
,
});
}
...
...
packages/flutter_tools/test/general.shard/hot_test.dart
View file @
43afac1e
...
...
@@ -366,6 +366,7 @@ void main() {
String
?
sdkName
,
bool
?
emulator
,
String
?
reason
,
Usage
usage
,
)
async
{
firstReloadDetails
[
'finalLibraryCount'
]
=
2
;
firstReloadDetails
[
'receivedLibraryCount'
]
=
3
;
...
...
packages/flutter_tools/test/general.shard/run_hot_test.dart
View file @
43afac1e
...
...
@@ -3,16 +3,18 @@
// found in the LICENSE file.
import
'package:flutter_tools/src/devfs.dart'
;
import
'package:flutter_tools/src/reporting/reporting.dart'
;
import
'package:flutter_tools/src/resident_runner.dart'
;
import
'package:flutter_tools/src/run_hot.dart'
;
import
'package:flutter_tools/src/vmservice.dart'
;
import
'package:test/fake.dart'
;
import
'package:vm_service/vm_service.dart'
as
vm_service
;
import
'../src/context.dart'
;
//import '../src/context.dart';
import
'../src/common.dart'
;
void
main
(
)
{
test
Using
Context
(
'defaultReloadSourcesHelper() handles empty DeviceReloadReports)'
,
()
{
test
Without
Context
(
'defaultReloadSourcesHelper() handles empty DeviceReloadReports)'
,
()
{
defaultReloadSourcesHelper
(
_FakeHotRunner
(),
<
FlutterDevice
?>[
_FakeFlutterDevice
()],
...
...
@@ -22,6 +24,7 @@ void main() {
'flutter-sdk'
,
false
,
'test-reason'
,
TestUsage
(),
);
});
}
...
...
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