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
583db838
Unverified
Commit
583db838
authored
Oct 16, 2020
by
Lau Ching Jun
Committed by
GitHub
Oct 16, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
request.mainUri should be fileUri (#68329)
parent
198e40c9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
70 additions
and
7 deletions
+70
-7
compile.dart
packages/flutter_tools/lib/src/compile.dart
+1
-1
compile_incremental_test.dart
...er_tools/test/general.shard/compile_incremental_test.dart
+69
-6
No files found.
packages/flutter_tools/lib/src/compile.dart
View file @
583db838
...
...
@@ -600,7 +600,7 @@ class DefaultResidentCompiler implements ResidentCompiler {
message
=
fileUri
.
toString
();
}
else
{
message
=
request
.
packageConfig
.
toPackageUri
(
fileUri
)?.
toString
()
??
toMultiRootPath
(
request
.
main
Uri
,
fileSystemScheme
,
fileSystemRoots
,
_platform
.
isWindows
);
toMultiRootPath
(
file
Uri
,
fileSystemScheme
,
fileSystemRoots
,
_platform
.
isWindows
);
}
_server
.
stdin
.
writeln
(
message
);
_logger
.
printTrace
(
message
.
toString
());
...
...
packages/flutter_tools/test/general.shard/compile_incremental_test.dart
View file @
583db838
...
...
@@ -199,14 +199,70 @@ void main() {
await
_recompile
(
streamController
,
generatorWithScheme
,
mockFrontendServerStdIn
,
'result abc
\n
line1
\n
line2
\n
abc
\n
abc /path/to/main.dart.dill 0
\n
'
,
mainUri:
Uri
.
parse
(
'file:///foo/bar/fizz/main.dart'
),
expectedUri:
'scheme:///main.dart'
);
expected
Main
Uri:
'scheme:///main.dart'
);
await
_accept
(
streamController
,
generatorWithScheme
,
mockFrontendServerStdIn
,
r'^accept\n$'
);
await
_recompile
(
streamController
,
generatorWithScheme
,
mockFrontendServerStdIn
,
'result abc
\n
line1
\n
line2
\n
abc
\n
abc /path/to/main.dart.dill 0
\n
'
,
mainUri:
Uri
.
parse
(
'file:///foo/bar/fizz/main.dart'
),
expectedUri:
'scheme:///main.dart'
);
expectedMainUri:
'scheme:///main.dart'
);
// No sources returned from reject command.
await
_reject
(
streamController
,
generatorWithScheme
,
mockFrontendServerStdIn
,
'result abc
\n
abc
\n
'
,
r'^reject\n$'
);
verifyNoMoreInteractions
(
mockFrontendServerStdIn
);
expect
(
mockFrontendServerStdIn
.
getAndClear
(),
isEmpty
);
expect
(
testLogger
.
errorText
,
equals
(
'line0
\n
line1
\n
'
'line1
\n
line2
\n
'
'line1
\n
line2
\n
'
));
});
testWithoutContext
(
'incremental compile and recompile non-entrypoint file with filesystem scheme'
,
()
async
{
final
Uri
mainUri
=
Uri
.
parse
(
'file:///foo/bar/fizz/main.dart'
);
const
String
expectedMainUri
=
'scheme:///main.dart'
;
final
List
<
Uri
>
updatedUris
=
<
Uri
>[
mainUri
,
Uri
.
parse
(
'file:///foo/bar/fizz/other.dart'
),
];
const
List
<
String
>
expectedUpdatedUris
=
<
String
>[
expectedMainUri
,
'scheme:///other.dart'
,
];
final
StreamController
<
List
<
int
>>
streamController
=
StreamController
<
List
<
int
>>();
when
(
mockFrontendServer
.
stdout
)
.
thenAnswer
((
Invocation
invocation
)
=>
streamController
.
stream
);
streamController
.
add
(
utf8
.
encode
(
'result abc
\n
line0
\n
line1
\n
abc
\n
abc /path/to/main.dart.dill 0
\n
'
));
await
generatorWithScheme
.
recompile
(
Uri
.
parse
(
'file:///foo/bar/fizz/main.dart'
),
null
,
/* invalidatedFiles */
outputPath:
'/build/'
,
packageConfig:
PackageConfig
.
empty
,
);
expect
(
mockFrontendServerStdIn
.
getAndClear
(),
'compile scheme:///main.dart
\n
'
);
// No accept or reject commands should be issued until we
// send recompile request.
await
_accept
(
streamController
,
generatorWithScheme
,
mockFrontendServerStdIn
,
''
);
await
_reject
(
streamController
,
generatorWithScheme
,
mockFrontendServerStdIn
,
''
,
''
);
await
_recompile
(
streamController
,
generatorWithScheme
,
mockFrontendServerStdIn
,
'result abc
\n
line1
\n
line2
\n
abc
\n
abc /path/to/main.dart.dill 0
\n
'
,
mainUri:
mainUri
,
expectedMainUri:
expectedMainUri
,
updatedUris:
updatedUris
,
expectedUpdatedUris:
expectedUpdatedUris
);
await
_accept
(
streamController
,
generatorWithScheme
,
mockFrontendServerStdIn
,
r'^accept\n$'
);
await
_recompile
(
streamController
,
generatorWithScheme
,
mockFrontendServerStdIn
,
'result abc
\n
line1
\n
line2
\n
abc
\n
abc /path/to/main.dart.dill 0
\n
'
,
mainUri:
mainUri
,
expectedMainUri:
expectedMainUri
,
updatedUris:
updatedUris
,
expectedUpdatedUris:
expectedUpdatedUris
);
// No sources returned from reject command.
await
_reject
(
streamController
,
generatorWithScheme
,
mockFrontendServerStdIn
,
'result abc
\n
abc
\n
'
,
r'^reject\n$'
);
...
...
@@ -291,9 +347,13 @@ Future<void> _recompile(
String
mockCompilerOutput
,
{
bool
suppressErrors
=
false
,
Uri
mainUri
,
String
expectedUri
=
'/path/to/main.dart'
,
String
expectedMainUri
=
'/path/to/main.dart'
,
List
<
Uri
>
updatedUris
,
List
<
String
>
expectedUpdatedUris
,
})
async
{
mainUri
??=
Uri
.
parse
(
'/path/to/main.dart'
);
updatedUris
??=
<
Uri
>[
mainUri
];
expectedUpdatedUris
??=
<
String
>[
expectedMainUri
];
// Put content into the output stream after generator.recompile gets
// going few lines below, resets completer.
...
...
@@ -302,7 +362,7 @@ Future<void> _recompile(
});
final
CompilerOutput
output
=
await
generator
.
recompile
(
mainUri
,
<
Uri
>[
mainUri
]
,
updatedUris
,
outputPath:
'/build/'
,
packageConfig:
PackageConfig
.
empty
,
suppressErrors:
suppressErrors
,
...
...
@@ -313,8 +373,11 @@ Future<void> _recompile(
final
List
<
String
>
parts
=
commands
.
split
(
whitespace
);
// Test that uuid matches at beginning and end.
expect
(
parts
[
2
],
equals
(
parts
[
4
]));
expect
(
parts
[
1
],
equals
(
expectedUri
));
expect
(
parts
[
2
],
equals
(
parts
[
3
+
updatedUris
.
length
]));
expect
(
parts
[
1
],
equals
(
expectedMainUri
));
for
(
int
i
=
0
;
i
<
expectedUpdatedUris
.
length
;
i
++)
{
expect
(
parts
[
3
+
i
],
equals
(
expectedUpdatedUris
[
i
]));
}
mockFrontendServerStdIn
.
stdInWrites
.
clear
();
}
...
...
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