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
922eea87
Unverified
Commit
922eea87
authored
Jul 20, 2022
by
Lau Ching Jun
Committed by
GitHub
Jul 20, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dart registrant location (#107967)
parent
6ea83ed5
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
385 additions
and
214 deletions
+385
-214
compile.dart
packages/flutter_tools/lib/src/compile.dart
+29
-24
devfs.dart
packages/flutter_tools/lib/src/devfs.dart
+2
-0
devfs_web.dart
packages/flutter_tools/lib/src/isolated/devfs_web.dart
+2
-0
resident_runner.dart
packages/flutter_tools/lib/src/resident_runner.dart
+1
-0
run_hot.dart
packages/flutter_tools/lib/src/run_hot.dart
+1
-0
compile_incremental_test.dart
...er_tools/test/general.shard/compile_incremental_test.dart
+38
-0
devfs_test.dart
packages/flutter_tools/test/general.shard/devfs_test.dart
+1
-1
resident_runner_test.dart
...lutter_tools/test/general.shard/resident_runner_test.dart
+2
-0
resident_web_runner_test.dart
...er_tools/test/general.shard/resident_web_runner_test.dart
+307
-189
test_compiler_test.dart
...ter_tools/test/general.shard/test/test_compiler_test.dart
+1
-0
devfs_web_test.dart
.../flutter_tools/test/general.shard/web/devfs_web_test.dart
+1
-0
No files found.
packages/flutter_tools/lib/src/compile.dart
View file @
922eea87
...
...
@@ -276,6 +276,13 @@ class KernelCompiler {
?
buildDir
?.
parent
.
childFile
(
'dart_plugin_registrant.dart'
)
:
null
;
String
?
dartPluginRegistrantUri
;
if
(
dartPluginRegistrant
!=
null
&&
dartPluginRegistrant
.
existsSync
())
{
final
Uri
dartPluginRegistrantFileUri
=
dartPluginRegistrant
.
uri
;
dartPluginRegistrantUri
=
packageConfig
.
toPackageUri
(
dartPluginRegistrantFileUri
)?.
toString
()
??
toMultiRootPath
(
dartPluginRegistrantFileUri
,
_fileSystemScheme
,
_fileSystemRoots
,
_fileSystem
.
path
.
separator
==
r'\'
);
}
final
List
<
String
>
command
=
<
String
>[
engineDartPath
,
'--disable-dart-dev'
,
...
...
@@ -323,12 +330,12 @@ class KernelCompiler {
'--platform'
,
platformDill
,
],
if
(
dartPluginRegistrant
!=
null
&&
dartPluginRegistrant
.
existsSync
()
)
...<
String
>[
if
(
dartPluginRegistrant
Uri
!=
null
)
...<
String
>[
'--source'
,
dartPluginRegistrant
.
path
,
dartPluginRegistrant
Uri
,
'--source'
,
'package:flutter/src/dart_plugin_registrant.dart'
,
'-Dflutter.dart_plugin_registrant=
$
{dartPluginRegistrant.uri}
'
,
'-Dflutter.dart_plugin_registrant=
$
dartPluginRegistrantUri
'
,
],
// See: https://github.com/flutter/flutter/issues/103994
'--verbosity=error'
,
...
...
@@ -375,7 +382,7 @@ class _RecompileRequest extends _CompilationRequest {
this
.
outputPath
,
this
.
packageConfig
,
this
.
suppressErrors
,
{
this
.
additionalSource
}
{
this
.
additionalSource
Uri
}
);
Uri
mainUri
;
...
...
@@ -383,7 +390,7 @@ class _RecompileRequest extends _CompilationRequest {
String
outputPath
;
PackageConfig
packageConfig
;
bool
suppressErrors
;
final
String
?
additionalSource
;
final
Uri
?
additionalSourceUri
;
@override
Future
<
CompilerOutput
?>
_run
(
DefaultResidentCompiler
compiler
)
async
=>
...
...
@@ -499,6 +506,7 @@ abstract class ResidentCompiler {
String
?
projectRootPath
,
bool
suppressErrors
=
false
,
bool
checkDartPluginRegistry
=
false
,
File
?
dartPluginRegistrant
,
});
Future
<
CompilerOutput
?>
compileExpression
(
...
...
@@ -642,6 +650,7 @@ class DefaultResidentCompiler implements ResidentCompiler {
required
PackageConfig
packageConfig
,
bool
suppressErrors
=
false
,
bool
checkDartPluginRegistry
=
false
,
File
?
dartPluginRegistrant
,
String
?
projectRootPath
,
FileSystem
?
fs
,
})
async
{
...
...
@@ -649,20 +658,10 @@ class DefaultResidentCompiler implements ResidentCompiler {
if
(!
_controller
.
hasListener
)
{
_controller
.
stream
.
listen
(
_handleCompilationRequest
);
}
String
?
additionalSource
;
Uri
?
additionalSourceUri
;
// `dart_plugin_registrant.dart` contains the Dart plugin registry.
if
(
checkDartPluginRegistry
&&
projectRootPath
!=
null
&&
fs
!=
null
)
{
final
File
dartPluginRegistrantDart
=
fs
.
file
(
fs
.
path
.
join
(
projectRootPath
,
'.dart_tool'
,
'flutter_build'
,
'dart_plugin_registrant.dart'
,
),
);
if
(
dartPluginRegistrantDart
!=
null
&&
dartPluginRegistrantDart
.
existsSync
())
{
additionalSource
=
dartPluginRegistrantDart
.
path
;
}
if
(
checkDartPluginRegistry
&&
dartPluginRegistrant
!=
null
&&
dartPluginRegistrant
.
existsSync
())
{
additionalSourceUri
=
dartPluginRegistrant
.
uri
;
}
final
Completer
<
CompilerOutput
?>
completer
=
Completer
<
CompilerOutput
?>();
_controller
.
add
(
_RecompileRequest
(
...
...
@@ -672,7 +671,7 @@ class DefaultResidentCompiler implements ResidentCompiler {
outputPath
,
packageConfig
,
suppressErrors
,
additionalSource
:
additionalSource
,
additionalSource
Uri:
additionalSourceUri
,
));
return
completer
.
future
;
}
...
...
@@ -685,9 +684,15 @@ class DefaultResidentCompiler implements ResidentCompiler {
final
String
mainUri
=
request
.
packageConfig
.
toPackageUri
(
request
.
mainUri
)?.
toString
()
??
toMultiRootPath
(
request
.
mainUri
,
fileSystemScheme
,
fileSystemRoots
,
_platform
.
isWindows
);
String
?
additionalSourceUri
;
if
(
request
.
additionalSourceUri
!=
null
)
{
additionalSourceUri
=
request
.
packageConfig
.
toPackageUri
(
request
.
additionalSourceUri
!)?.
toString
()
??
toMultiRootPath
(
request
.
additionalSourceUri
!,
fileSystemScheme
,
fileSystemRoots
,
_platform
.
isWindows
);
}
final
Process
?
server
=
_server
;
if
(
server
==
null
)
{
return
_compile
(
mainUri
,
request
.
outputPath
,
additionalSource
:
request
.
additionalSource
);
return
_compile
(
mainUri
,
request
.
outputPath
,
additionalSource
Uri:
additionalSourceUri
);
}
final
String
inputKey
=
Uuid
().
generateV4
();
...
...
@@ -733,7 +738,7 @@ class DefaultResidentCompiler implements ResidentCompiler {
Future
<
CompilerOutput
?>
_compile
(
String
scriptUri
,
String
?
outputPath
,
{
String
?
additionalSource
}
{
String
?
additionalSource
Uri
}
)
async
{
final
String
frontendServer
=
_artifacts
.
getArtifactPath
(
Artifact
.
frontendServerSnapshotForEngineDartSdk
...
...
@@ -786,12 +791,12 @@ class DefaultResidentCompiler implements ResidentCompiler {
initializeFromDill
!,
],
if
(
assumeInitializeFromDillUpToDate
)
'--assume-initialize-from-dill-up-to-date'
,
if
(
additionalSource
!=
null
)
...<
String
>[
if
(
additionalSource
Uri
!=
null
)
...<
String
>[
'--source'
,
additionalSource
,
additionalSource
Uri
,
'--source'
,
'package:flutter/src/dart_plugin_registrant.dart'
,
'-Dflutter.dart_plugin_registrant=
$
{Uri.file(additionalSource)}
'
,
'-Dflutter.dart_plugin_registrant=
$
additionalSourceUri
'
,
],
if
(
platformDill
!=
null
)
...<
String
>[
'--platform'
,
...
...
packages/flutter_tools/lib/src/devfs.dart
View file @
922eea87
...
...
@@ -581,6 +581,7 @@ class DevFS {
bool
bundleFirstUpload
=
false
,
bool
fullRestart
=
false
,
String
?
projectRootPath
,
File
?
dartPluginRegistrant
,
})
async
{
assert
(
trackWidgetCreation
!=
null
);
assert
(
generator
!=
null
);
...
...
@@ -610,6 +611,7 @@ class DevFS {
projectRootPath:
projectRootPath
,
packageConfig:
packageConfig
,
checkDartPluginRegistry:
true
,
// The entry point is assumed not to have changed.
dartPluginRegistrant:
dartPluginRegistrant
,
).
then
((
CompilerOutput
?
result
)
{
compileTimer
.
stop
();
return
result
;
...
...
packages/flutter_tools/lib/src/isolated/devfs_web.dart
View file @
922eea87
...
...
@@ -799,6 +799,7 @@ class WebDevFS implements DevFS {
bool
bundleFirstUpload
=
false
,
bool
fullRestart
=
false
,
String
?
projectRootPath
,
File
?
dartPluginRegistrant
,
})
async
{
assert
(
trackWidgetCreation
!=
null
);
assert
(
generator
!=
null
);
...
...
@@ -866,6 +867,7 @@ class WebDevFS implements DevFS {
packageConfig:
packageConfig
,
projectRootPath:
projectRootPath
,
fs:
globals
.
fs
,
dartPluginRegistrant:
dartPluginRegistrant
,
);
if
(
compilerOutput
==
null
||
compilerOutput
.
errorCount
>
0
)
{
return
UpdateFSReport
();
...
...
packages/flutter_tools/lib/src/resident_runner.dart
View file @
922eea87
...
...
@@ -563,6 +563,7 @@ class FlutterDevice {
invalidatedFiles:
invalidatedFiles
,
packageConfig:
packageConfig
,
devFSWriter:
devFSWriter
,
dartPluginRegistrant:
FlutterProject
.
current
().
dartPluginRegistrant
,
);
}
on
DevFSException
{
devFSStatus
.
cancel
();
...
...
packages/flutter_tools/lib/src/run_hot.dart
View file @
922eea87
...
...
@@ -373,6 +373,7 @@ class HotRunner extends ResidentRunner {
// should only be displayed once.
suppressErrors:
applicationBinary
==
null
,
checkDartPluginRegistry:
true
,
dartPluginRegistrant:
FlutterProject
.
current
().
dartPluginRegistrant
,
outputPath:
dillOutputPath
,
packageConfig:
debuggingOptions
.
buildInfo
.
packageConfig
,
projectRootPath:
FlutterProject
.
current
().
directory
.
absolute
.
path
,
...
...
packages/flutter_tools/test/general.shard/compile_incremental_test.dart
View file @
922eea87
...
...
@@ -4,6 +4,7 @@
import
'dart:async'
;
import
'package:file/file.dart'
;
import
'package:file/memory.dart'
;
import
'package:flutter_tools/src/artifacts.dart'
;
import
'package:flutter_tools/src/base/async_guard.dart'
;
...
...
@@ -394,6 +395,43 @@ void main() {
'line2
\n
line3
\n
'
));
});
testWithoutContext
(
'incremental compile with dartPluginRegistrant'
,
()
async
{
fakeProcessManager
.
addCommand
(
FakeCommand
(
command:
const
<
String
>[
...
frontendServerCommand
,
'--filesystem-root'
,
'/foo/bar/fizz'
,
'--filesystem-scheme'
,
'scheme'
,
'--source'
,
'some/dir/plugin_registrant.dart'
,
'--source'
,
'package:flutter/src/dart_plugin_registrant.dart'
,
'-Dflutter.dart_plugin_registrant=some/dir/plugin_registrant.dart'
,
'--verbosity=error'
,
],
stdout:
'result abc
\n
line1
\n
line2
\n
abc
\n
abc /path/to/main.dart.dill 0'
,
stdin:
frontendServerStdIn
,
));
final
MemoryFileSystem
fs
=
MemoryFileSystem
();
final
File
dartPluginRegistrant
=
fs
.
file
(
'some/dir/plugin_registrant.dart'
)..
createSync
(
recursive:
true
);
final
CompilerOutput
?
output
=
await
generatorWithScheme
.
recompile
(
Uri
.
parse
(
'file:///foo/bar/fizz/main.dart'
),
null
/* invalidatedFiles */
,
outputPath:
'/build/'
,
packageConfig:
PackageConfig
.
empty
,
fs:
fs
,
projectRootPath:
''
,
checkDartPluginRegistry:
true
,
dartPluginRegistrant:
dartPluginRegistrant
,
);
expect
(
frontendServerStdIn
.
getAndClear
(),
'compile scheme:///main.dart
\n
'
);
expect
(
testLogger
.
errorText
,
equals
(
'line1
\n
line2
\n
'
));
expect
(
output
?.
outputFilename
,
equals
(
'/path/to/main.dart.dill'
));
expect
(
fakeProcessManager
,
hasNoRemainingExpectations
);
});
}
Future
<
void
>
_recompile
(
...
...
packages/flutter_tools/test/general.shard/devfs_test.dart
View file @
922eea87
...
...
@@ -581,7 +581,7 @@ class FakeResidentCompiler extends Fake implements ResidentCompiler {
Future
<
CompilerOutput
>
Function
(
Uri
mainUri
,
List
<
Uri
>?
invalidatedFiles
)?
onRecompile
;
@override
Future
<
CompilerOutput
>
recompile
(
Uri
mainUri
,
List
<
Uri
>?
invalidatedFiles
,
{
String
?
outputPath
,
PackageConfig
?
packageConfig
,
String
?
projectRootPath
,
FileSystem
?
fs
,
bool
suppressErrors
=
false
,
bool
checkDartPluginRegistry
=
false
})
{
Future
<
CompilerOutput
>
recompile
(
Uri
mainUri
,
List
<
Uri
>?
invalidatedFiles
,
{
String
?
outputPath
,
PackageConfig
?
packageConfig
,
String
?
projectRootPath
,
FileSystem
?
fs
,
bool
suppressErrors
=
false
,
bool
checkDartPluginRegistry
=
false
,
File
?
dartPluginRegistrant
})
{
return
onRecompile
?.
call
(
mainUri
,
invalidatedFiles
)
??
Future
<
CompilerOutput
>.
value
(
const
CompilerOutput
(
''
,
1
,
<
Uri
>[]));
}
...
...
packages/flutter_tools/test/general.shard/resident_runner_test.dart
View file @
922eea87
...
...
@@ -2464,6 +2464,7 @@ class FakeResidentCompiler extends Fake implements ResidentCompiler {
@required
FileSystem
fs
,
bool
suppressErrors
=
false
,
bool
checkDartPluginRegistry
=
false
,
File
dartPluginRegistrant
,
})
async
{
didSuppressErrors
=
suppressErrors
;
return
nextOutput
??
const
CompilerOutput
(
'foo.dill'
,
0
,
<
Uri
>[]);
...
...
@@ -2623,6 +2624,7 @@ class FakeDevFS extends Fake implements DevFS {
bool
bundleFirstUpload
=
false
,
bool
fullRestart
=
false
,
String
projectRootPath
,
File
dartPluginRegistrant
,
})
async
{
return
nextUpdateReport
;
}
...
...
packages/flutter_tools/test/general.shard/resident_web_runner_test.dart
View file @
922eea87
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/general.shard/test/test_compiler_test.dart
View file @
922eea87
...
...
@@ -200,6 +200,7 @@ class FakeResidentCompiler extends Fake implements ResidentCompiler {
FileSystem
?
fs
,
bool
suppressErrors
=
false
,
bool
checkDartPluginRegistry
=
false
,
File
?
dartPluginRegistrant
,
})
async
{
if
(
compilerOutput
!=
null
)
{
fileSystem
!.
file
(
compilerOutput
!.
outputFilename
).
createSync
(
recursive:
true
);
...
...
packages/flutter_tools/test/general.shard/web/devfs_web_test.dart
View file @
922eea87
...
...
@@ -1120,6 +1120,7 @@ class FakeResidentCompiler extends Fake implements ResidentCompiler {
FileSystem
fs
,
bool
suppressErrors
=
false
,
bool
checkDartPluginRegistry
=
false
,
File
dartPluginRegistrant
,
})
async
{
return
output
;
}
...
...
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