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
7bed378e
Unverified
Commit
7bed378e
authored
Mar 15, 2019
by
Jonah Williams
Committed by
GitHub
Mar 15, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only run codegen at start of flutter_test (#29171)
parent
b74b9603
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
47 additions
and
14 deletions
+47
-14
test.dart
dev/bots/test.dart
+7
-0
codegen.dart
packages/flutter_tools/lib/src/codegen.dart
+17
-9
test.dart
packages/flutter_tools/lib/src/commands/test.dart
+15
-0
compile.dart
packages/flutter_tools/lib/src/compile.dart
+5
-3
flutter_platform.dart
packages/flutter_tools/lib/src/test/flutter_platform.dart
+3
-2
No files found.
dev/bots/test.dart
View file @
7bed378e
...
...
@@ -317,6 +317,10 @@ Future<void> _runTests() async {
// with --track-widget-creation.
await
_runFlutterTest
(
path
.
join
(
flutterRoot
,
'examples'
,
'flutter_gallery'
),
options:
<
String
>[
'--track-widget-creation'
],
tableData:
bigqueryApi
?.
tabledata
);
await
_runFlutterTest
(
path
.
join
(
flutterRoot
,
'examples'
,
'catalog'
),
tableData:
bigqueryApi
?.
tabledata
);
// Smoke test for code generation.
await
_runFlutterTest
(
path
.
join
(
flutterRoot
,
'dev'
,
'integration_tests'
,
'codegen'
),
tableData:
bigqueryApi
?.
tabledata
,
environment:
<
String
,
String
>{
'FLUTTER_EXPERIMENTAL_BUILD'
:
'true'
,
});
print
(
'
${bold}
DONE: All tests successful.
$reset
'
);
}
...
...
@@ -581,6 +585,7 @@ Future<void> _runFlutterTest(String workingDirectory, {
bool
skip
=
false
,
Duration
timeout
=
_kLongTimeout
,
bq
.
TabledataResourceApi
tableData
,
Map
<
String
,
String
>
environment
,
})
async
{
final
List
<
String
>
args
=
<
String
>[
'test'
]..
addAll
(
options
);
if
(
flutterTestArgs
!=
null
&&
flutterTestArgs
.
isNotEmpty
)
...
...
@@ -612,6 +617,7 @@ Future<void> _runFlutterTest(String workingDirectory, {
printOutput:
printOutput
,
skip:
skip
,
timeout:
timeout
,
environment:
environment
,
);
}
...
...
@@ -624,6 +630,7 @@ Future<void> _runFlutterTest(String workingDirectory, {
expectNonZeroExit:
expectFailure
,
timeout:
timeout
,
beforeExit:
formatter
.
finish
,
environment:
environment
,
);
await
_processTestOutput
(
formatter
,
testOutput
,
tableData
);
}
else
{
...
...
packages/flutter_tools/lib/src/codegen.dart
View file @
7bed378e
...
...
@@ -161,22 +161,19 @@ class CodeGeneratingResidentCompiler implements ResidentCompiler {
/// Creates a new [ResidentCompiler] and configures a [BuildDaemonClient] to
/// run builds.
static
Future
<
CodeGeneratingResidentCompiler
>
create
({
///
/// If `runCold` is true, then no codegen daemon will be created. Instead the
/// compiler will only be initialized with the correct configuration for
/// codegen mode.
static
Future
<
ResidentCompiler
>
create
({
@required
FlutterProject
flutterProject
,
bool
trackWidgetCreation
=
false
,
CompilerMessageConsumer
compilerMessageConsumer
=
printError
,
bool
unsafePackageSerialization
=
false
,
String
outputPath
,
String
initializeFromDill
,
bool
runCold
=
false
,
})
async
{
final
CodegenDaemon
codegenDaemon
=
await
codeGenerator
.
daemon
(
flutterProject
);
codegenDaemon
.
startBuild
();
final
CodegenStatus
status
=
await
codegenDaemon
.
buildResults
.
firstWhere
((
CodegenStatus
status
)
{
return
status
==
CodegenStatus
.
Succeeded
||
status
==
CodegenStatus
.
Failed
;
});
if
(
status
==
CodegenStatus
.
Failed
)
{
printError
(
'Code generation failed, build may have compile errors.'
);
}
final
ResidentCompiler
residentCompiler
=
ResidentCompiler
(
artifacts
.
getArtifactPath
(
Artifact
.
flutterPatchedSdkPath
),
trackWidgetCreation:
trackWidgetCreation
,
...
...
@@ -191,6 +188,17 @@ class CodeGeneratingResidentCompiler implements ResidentCompiler {
// Pass an invalid file name to prevent frontend_server from initializing from dill.
initializeFromDill:
'none_file'
,
);
if
(
runCold
)
{
return
residentCompiler
;
}
final
CodegenDaemon
codegenDaemon
=
await
codeGenerator
.
daemon
(
flutterProject
);
codegenDaemon
.
startBuild
();
final
CodegenStatus
status
=
await
codegenDaemon
.
buildResults
.
firstWhere
((
CodegenStatus
status
)
{
return
status
==
CodegenStatus
.
Succeeded
||
status
==
CodegenStatus
.
Failed
;
});
if
(
status
==
CodegenStatus
.
Failed
)
{
printError
(
'Code generation failed, build may have compile errors.'
);
}
return
CodeGeneratingResidentCompiler
.
_
(
residentCompiler
,
codegenDaemon
);
}
...
...
packages/flutter_tools/lib/src/commands/test.dart
View file @
7bed378e
...
...
@@ -9,6 +9,7 @@ import '../base/common.dart';
import
'../base/file_system.dart'
;
import
'../base/platform.dart'
;
import
'../cache.dart'
;
import
'../codegen.dart'
;
import
'../project.dart'
;
import
'../runner/flutter_command.dart'
;
import
'../test/coverage_collector.dart'
;
...
...
@@ -159,6 +160,20 @@ class TestCommand extends FlutterCommand {
Cache
.
releaseLockEarly
();
// Run builders once before all tests.
if
(
experimentalBuildEnabled
&&
await
flutterProject
.
hasBuilders
)
{
final
CodegenDaemon
codegenDaemon
=
await
codeGenerator
.
daemon
(
flutterProject
);
codegenDaemon
.
startBuild
();
await
for
(
CodegenStatus
status
in
codegenDaemon
.
buildResults
)
{
if
(
status
==
CodegenStatus
.
Succeeded
)
{
break
;
}
if
(
status
==
CodegenStatus
.
Failed
)
{
throwToolExit
(
'Code generation failed.'
);
}
}
}
final
int
result
=
await
runTests
(
files
,
workDir:
workDir
,
...
...
packages/flutter_tools/lib/src/compile.dart
View file @
7bed378e
...
...
@@ -500,13 +500,12 @@ class ResidentCompiler {
}
if
(
packagesFilePath
!=
null
)
{
command
.
addAll
(<
String
>[
'--packages'
,
packagesFilePath
]);
}
else
if
(
_packagesPath
!=
null
)
{
command
.
addAll
(<
String
>[
'--packages'
,
_packagesPath
]);
}
if
(
_trackWidgetCreation
)
{
command
.
add
(
'--track-widget-creation'
);
}
if
(
_packagesPath
!=
null
)
{
command
.
addAll
(<
String
>[
'--packages'
,
_packagesPath
]);
}
if
(
_fileSystemRoots
!=
null
)
{
for
(
String
root
in
_fileSystemRoots
)
{
command
.
addAll
(<
String
>[
'--filesystem-root'
,
root
]);
...
...
@@ -662,6 +661,9 @@ class ResidentCompiler {
}
}
}
if
(
platform
.
isWindows
&&
_fileSystemRoots
!=
null
&&
_fileSystemRoots
.
length
>
1
)
{
return
Uri
.
file
(
filename
,
windows:
platform
.
isWindows
).
toString
();
}
return
null
;
}
...
...
packages/flutter_tools/lib/src/test/flutter_platform.dart
View file @
7bed378e
...
...
@@ -274,9 +274,10 @@ class _Compiler {
return
CodeGeneratingResidentCompiler
.
create
(
flutterProject:
flutterProject
,
trackWidgetCreation:
trackWidgetCreation
,
initializeFromDill:
null
,
// TODO(jonahwilliams): investigate multi-root support in init from dill.
unsafePackageSerialization:
false
,
compilerMessageConsumer:
reportCompilerMessage
,
// We already ran codegen once at the start, we only need to
// configure builders.
runCold:
true
,
);
}
return
ResidentCompiler
(
...
...
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