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
4bd9bcd7
Unverified
Commit
4bd9bcd7
authored
May 03, 2023
by
Kevin Moore
Committed by
GitHub
May 03, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tool: DRY up DepfileService (#125922)
parent
f704c689
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
38 additions
and
120 deletions
+38
-120
build_system.dart
...ages/flutter_tools/lib/src/build_system/build_system.dart
+6
-0
android.dart
...s/flutter_tools/lib/src/build_system/targets/android.dart
+4
-20
assets.dart
...es/flutter_tools/lib/src/build_system/targets/assets.dart
+1
-5
common.dart
...es/flutter_tools/lib/src/build_system/targets/common.dart
+1
-5
deferred_components.dart
...ols/lib/src/build_system/targets/deferred_components.dart
+1
-5
ios.dart
packages/flutter_tools/lib/src/build_system/targets/ios.dart
+1
-5
linux.dart
...ges/flutter_tools/lib/src/build_system/targets/linux.dart
+2
-10
localizations.dart
...ter_tools/lib/src/build_system/targets/localizations.dart
+1
-5
macos.dart
...ges/flutter_tools/lib/src/build_system/targets/macos.dart
+1
-5
web.dart
packages/flutter_tools/lib/src/build_system/targets/web.dart
+6
-16
windows.dart
...s/flutter_tools/lib/src/build_system/targets/windows.dart
+2
-10
bundle_builder.dart
packages/flutter_tools/lib/src/bundle_builder.dart
+1
-5
assemble.dart
packages/flutter_tools/lib/src/commands/assemble.dart
+7
-11
assets_test.dart
.../test/general.shard/build_system/targets/assets_test.dart
+1
-5
web_test.dart
...ols/test/general.shard/build_system/targets/web_test.dart
+1
-6
windows_test.dart
...test/general.shard/build_system/targets/windows_test.dart
+2
-7
No files found.
packages/flutter_tools/lib/src/build_system/build_system.dart
View file @
4bd9bcd7
...
...
@@ -18,6 +18,7 @@ import '../base/utils.dart';
import
'../cache.dart'
;
import
'../convert.dart'
;
import
'../reporting/reporting.dart'
;
import
'depfile.dart'
;
import
'exceptions.dart'
;
import
'file_store.dart'
;
import
'source.dart'
;
...
...
@@ -524,6 +525,11 @@ class Environment {
/// When [true], the main entrypoint is wrapped and the wrapper becomes
/// the new entrypoint.
final
bool
generateDartPluginRegistry
;
late
final
DepfileService
depFileService
=
DepfileService
(
logger:
logger
,
fileSystem:
fileSystem
,
);
}
/// The result information from the build system.
...
...
packages/flutter_tools/lib/src/build_system/targets/android.dart
View file @
4bd9bcd7
...
...
@@ -69,11 +69,7 @@ abstract class AndroidAssetBundle extends Target {
buildMode:
buildMode
,
shaderTarget:
ShaderTarget
.
impellerAndroid
,
);
final
DepfileService
depfileService
=
DepfileService
(
fileSystem:
environment
.
fileSystem
,
logger:
environment
.
logger
,
);
depfileService
.
writeToFile
(
environment
.
depFileService
.
writeToFile
(
assetDepfile
,
environment
.
buildDir
.
childFile
(
'flutter_assets.d'
),
);
...
...
@@ -264,11 +260,7 @@ class AndroidAot extends AotElfBase {
outputs
.
add
(
environment
.
fileSystem
.
file
(
unit
.
path
));
}
}
final
DepfileService
depfileService
=
DepfileService
(
fileSystem:
environment
.
fileSystem
,
logger:
environment
.
logger
,
);
depfileService
.
writeToFile
(
environment
.
depFileService
.
writeToFile
(
Depfile
(<
File
>[],
outputs
),
environment
.
buildDir
.
childFile
(
'flutter_
$name
.d'
),
writeEmpty:
true
,
...
...
@@ -351,11 +343,7 @@ class AndroidAotBundle extends Target {
inputs
.
add
(
manifestFile
);
outputs
.
add
(
destinationFile
);
}
final
DepfileService
depfileService
=
DepfileService
(
fileSystem:
environment
.
fileSystem
,
logger:
environment
.
logger
,
);
depfileService
.
writeToFile
(
environment
.
depFileService
.
writeToFile
(
Depfile
(
inputs
,
outputs
),
environment
.
buildDir
.
childFile
(
'flutter_
$name
.d'
),
writeEmpty:
true
,
...
...
@@ -433,11 +421,7 @@ class AndroidAotDeferredComponentsBundle extends Target {
libDepfile
.
inputs
.
add
(
manifestFile
);
}
final
DepfileService
depfileService
=
DepfileService
(
fileSystem:
environment
.
fileSystem
,
logger:
environment
.
logger
,
);
depfileService
.
writeToFile
(
environment
.
depFileService
.
writeToFile
(
libDepfile
,
environment
.
buildDir
.
childFile
(
'flutter_
$name
.d'
),
writeEmpty:
true
,
...
...
packages/flutter_tools/lib/src/build_system/targets/assets.dart
View file @
4bd9bcd7
...
...
@@ -323,11 +323,7 @@ class CopyAssets extends Target {
targetPlatform:
TargetPlatform
.
android
,
shaderTarget:
ShaderTarget
.
sksl
,
);
final
DepfileService
depfileService
=
DepfileService
(
fileSystem:
environment
.
fileSystem
,
logger:
environment
.
logger
,
);
depfileService
.
writeToFile
(
environment
.
depFileService
.
writeToFile
(
depfile
,
environment
.
buildDir
.
childFile
(
'flutter_assets.d'
),
);
...
...
packages/flutter_tools/lib/src/build_system/targets/common.dart
View file @
4bd9bcd7
...
...
@@ -77,11 +77,7 @@ class CopyFlutterBundle extends Target {
buildMode:
buildMode
,
shaderTarget:
ShaderTarget
.
sksl
,
);
final
DepfileService
depfileService
=
DepfileService
(
fileSystem:
environment
.
fileSystem
,
logger:
environment
.
logger
,
);
depfileService
.
writeToFile
(
environment
.
depFileService
.
writeToFile
(
assetDepfile
,
environment
.
buildDir
.
childFile
(
'flutter_assets.d'
),
);
...
...
packages/flutter_tools/lib/src/build_system/targets/deferred_components.dart
View file @
4bd9bcd7
...
...
@@ -74,10 +74,6 @@ class DeferredComponentsGenSnapshotValidatorTarget extends Target {
@override
Future
<
void
>
build
(
Environment
environment
)
async
{
final
DepfileService
depfileService
=
DepfileService
(
fileSystem:
environment
.
fileSystem
,
logger:
environment
.
logger
,
);
validator
=
DeferredComponentsGenSnapshotValidator
(
environment
,
title:
title
,
...
...
@@ -100,7 +96,7 @@ class DeferredComponentsGenSnapshotValidatorTarget extends Target {
validator
!.
handleResults
();
depf
ileService
.
writeToFile
(
environment
.
depF
ileService
.
writeToFile
(
Depfile
(
validator
!.
inputs
,
validator
!.
outputs
),
environment
.
buildDir
.
childFile
(
'flutter_
$name
.d'
),
);
...
...
packages/flutter_tools/lib/src/build_system/targets/ios.dart
View file @
4bd9bcd7
...
...
@@ -526,11 +526,7 @@ abstract class IosAssetBundle extends Target {
flutterProject
.
ios
.
appFrameworkInfoPlist
,
],
);
final
DepfileService
depfileService
=
DepfileService
(
fileSystem:
environment
.
fileSystem
,
logger:
environment
.
logger
,
);
depfileService
.
writeToFile
(
environment
.
depFileService
.
writeToFile
(
assetDepfile
,
environment
.
buildDir
.
childFile
(
'flutter_assets.d'
),
);
...
...
packages/flutter_tools/lib/src/build_system/targets/linux.dart
View file @
4bd9bcd7
...
...
@@ -84,11 +84,7 @@ class UnpackLinux extends Target {
platform:
targetPlatform
,
)
);
final
DepfileService
depfileService
=
DepfileService
(
fileSystem:
environment
.
fileSystem
,
logger:
environment
.
logger
,
);
depfileService
.
writeToFile
(
environment
.
depFileService
.
writeToFile
(
depfile
,
environment
.
buildDir
.
childFile
(
_kLinuxDepfile
),
);
...
...
@@ -147,11 +143,7 @@ abstract class BundleLinuxAssets extends Target {
},
shaderTarget:
ShaderTarget
.
sksl
,
);
final
DepfileService
depfileService
=
DepfileService
(
fileSystem:
environment
.
fileSystem
,
logger:
environment
.
logger
,
);
depfileService
.
writeToFile
(
environment
.
depFileService
.
writeToFile
(
depfile
,
environment
.
buildDir
.
childFile
(
'flutter_assets.d'
),
);
...
...
packages/flutter_tools/lib/src/build_system/targets/localizations.dart
View file @
4bd9bcd7
...
...
@@ -57,10 +57,6 @@ class GenerateLocalizationsTarget extends Target {
logger:
environment
.
logger
,
defaultArbDir:
defaultArbDir
,
);
final
DepfileService
depfileService
=
DepfileService
(
logger:
environment
.
logger
,
fileSystem:
environment
.
fileSystem
,
);
generateLocalizations
(
logger:
environment
.
logger
,
options:
options
,
...
...
@@ -87,7 +83,7 @@ class GenerateLocalizationsTarget extends Target {
environment
.
fileSystem
.
file
(
outputFile
),
],
);
depf
ileService
.
writeToFile
(
environment
.
depF
ileService
.
writeToFile
(
depfile
,
environment
.
buildDir
.
childFile
(
'gen_localizations.d'
),
);
...
...
packages/flutter_tools/lib/src/build_system/targets/macos.dart
View file @
4bd9bcd7
...
...
@@ -419,11 +419,7 @@ abstract class MacOSBundleFlutterAssets extends Target {
targetPlatform:
TargetPlatform
.
darwin
,
shaderTarget:
ShaderTarget
.
sksl
,
);
final
DepfileService
depfileService
=
DepfileService
(
fileSystem:
environment
.
fileSystem
,
logger:
environment
.
logger
,
);
depfileService
.
writeToFile
(
environment
.
depFileService
.
writeToFile
(
assetDepfile
,
environment
.
buildDir
.
childFile
(
'flutter_assets.d'
),
);
...
...
packages/flutter_tools/lib/src/build_system/targets/web.dart
View file @
4bd9bcd7
...
...
@@ -218,16 +218,13 @@ class Dart2JSTarget extends Dart2WebTarget {
'
${dart2jsDeps.path}
'
);
return
;
}
final
DepfileService
depfileService
=
DepfileService
(
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
);
final
Depfile
depfile
=
depfileService
.
parseDart2js
(
final
DepfileService
depFileService
=
environment
.
depFileService
;
final
Depfile
depFile
=
depFileService
.
parseDart2js
(
environment
.
buildDir
.
childFile
(
'app.dill.deps'
),
outputJSFile
,
);
dep
f
ileService
.
writeToFile
(
dep
f
ile
,
dep
F
ileService
.
writeToFile
(
dep
F
ile
,
environment
.
buildDir
.
childFile
(
'dart2js.d'
),
);
}
...
...
@@ -409,10 +406,7 @@ class WebReleaseBundle extends Target {
targetPlatform:
TargetPlatform
.
web_javascript
,
shaderTarget:
ShaderTarget
.
sksl
,
);
final
DepfileService
depfileService
=
DepfileService
(
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
);
final
DepfileService
depfileService
=
environment
.
depFileService
;
depfileService
.
writeToFile
(
depfile
,
environment
.
buildDir
.
childFile
(
'flutter_assets.d'
),
...
...
@@ -627,11 +621,7 @@ class WebServiceWorker extends Target {
);
serviceWorkerFile
.
writeAsStringSync
(
serviceWorker
);
final
DepfileService
depfileService
=
DepfileService
(
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
);
depfileService
.
writeToFile
(
environment
.
depFileService
.
writeToFile
(
depfile
,
environment
.
buildDir
.
childFile
(
'service_worker.d'
),
);
...
...
packages/flutter_tools/lib/src/build_system/targets/windows.dart
View file @
4bd9bcd7
...
...
@@ -88,11 +88,7 @@ class UnpackWindows extends Target {
platform:
TargetPlatform
.
windows_x64
)
);
final
DepfileService
depfileService
=
DepfileService
(
fileSystem:
environment
.
fileSystem
,
logger:
environment
.
logger
,
);
depfileService
.
writeToFile
(
environment
.
depFileService
.
writeToFile
(
depfile
,
environment
.
buildDir
.
childFile
(
_kWindowsDepfile
),
);
...
...
@@ -145,11 +141,7 @@ abstract class BundleWindowsAssets extends Target {
targetPlatform:
TargetPlatform
.
windows_x64
,
shaderTarget:
ShaderTarget
.
sksl
,
);
final
DepfileService
depfileService
=
DepfileService
(
fileSystem:
environment
.
fileSystem
,
logger:
environment
.
logger
,
);
depfileService
.
writeToFile
(
environment
.
depFileService
.
writeToFile
(
depfile
,
environment
.
buildDir
.
childFile
(
'flutter_assets.d'
),
);
...
...
packages/flutter_tools/lib/src/bundle_builder.dart
View file @
4bd9bcd7
...
...
@@ -90,11 +90,7 @@ class BundleBuilder {
if
(!
outputDepfile
.
parent
.
existsSync
())
{
outputDepfile
.
parent
.
createSync
(
recursive:
true
);
}
final
DepfileService
depfileService
=
DepfileService
(
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
);
depfileService
.
writeToFile
(
depfile
,
outputDepfile
);
environment
.
depFileService
.
writeToFile
(
depfile
,
outputDepfile
);
// Work around for flutter_tester placing kernel artifacts in odd places.
if
(
applicationKernelFilePath
!=
null
)
{
...
...
packages/flutter_tools/lib/src/commands/assemble.dart
View file @
4bd9bcd7
...
...
@@ -140,7 +140,7 @@ class AssembleCommand extends FlutterCommand {
final
FlutterProject
flutterProject
=
FlutterProject
.
current
();
try
{
return
CustomDimensions
(
commandBuildBundleTargetPlatform:
environment
.
defines
[
kTargetPlatform
],
commandBuildBundleTargetPlatform:
_
environment
.
defines
[
kTargetPlatform
],
commandBuildBundleIsModule:
flutterProject
.
isModule
,
);
}
on
Exception
{
...
...
@@ -151,7 +151,7 @@ class AssembleCommand extends FlutterCommand {
@override
Future
<
Set
<
DevelopmentArtifact
>>
get
requiredArtifacts
async
{
final
String
?
platform
=
environment
.
defines
[
kTargetPlatform
];
final
String
?
platform
=
_
environment
.
defines
[
kTargetPlatform
];
if
(
platform
==
null
)
{
return
super
.
requiredArtifacts
;
}
...
...
@@ -204,10 +204,10 @@ class AssembleCommand extends FlutterCommand {
return
false
;
}
late
final
Environment
environment
=
createEnvironment
();
late
final
Environment
_environment
=
_
createEnvironment
();
/// The environmental configuration for a build invocation.
Environment
createEnvironment
()
{
Environment
_
createEnvironment
()
{
final
FlutterProject
flutterProject
=
FlutterProject
.
current
();
String
?
output
=
stringArg
(
'output'
);
if
(
output
==
null
)
{
...
...
@@ -289,7 +289,7 @@ class AssembleCommand extends FlutterCommand {
Target
?
target
;
List
<
String
>
decodedDefines
;
try
{
decodedDefines
=
decodeDartDefines
(
environment
.
defines
,
kDartDefines
);
decodedDefines
=
decodeDartDefines
(
_
environment
.
defines
,
kDartDefines
);
}
on
FormatException
{
throwToolExit
(
'Error parsing assemble command: your generated configuration may be out of date. '
...
...
@@ -314,7 +314,7 @@ class AssembleCommand extends FlutterCommand {
final
ArgResults
argumentResults
=
argResults
!;
final
BuildResult
result
=
await
_buildSystem
.
build
(
target
!,
environment
,
_
environment
,
buildSystemConfig:
BuildSystemConfig
(
resourcePoolSize:
argumentResults
.
wasParsed
(
'resource-pool-size'
)
?
int
.
tryParse
(
stringArg
(
'resource-pool-size'
)!)
...
...
@@ -346,11 +346,7 @@ class AssembleCommand extends FlutterCommand {
if
(
argumentResults
.
wasParsed
(
'depfile'
))
{
final
File
depfileFile
=
globals
.
fs
.
file
(
stringArg
(
'depfile'
));
final
Depfile
depfile
=
Depfile
(
result
.
inputFiles
,
result
.
outputFiles
);
final
DepfileService
depfileService
=
DepfileService
(
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
);
depfileService
.
writeToFile
(
depfile
,
globals
.
fs
.
file
(
depfileFile
));
_environment
.
depFileService
.
writeToFile
(
depfile
,
globals
.
fs
.
file
(
depfileFile
));
}
return
FlutterCommandResult
.
success
();
}
...
...
packages/flutter_tools/test/general.shard/build_system/targets/assets_test.dart
View file @
4bd9bcd7
...
...
@@ -67,11 +67,7 @@ flutter:
expect
(
depfile
,
exists
);
final
DepfileService
depfileService
=
DepfileService
(
logger:
BufferLogger
.
test
(),
fileSystem:
fileSystem
,
);
final
Depfile
dependencies
=
depfileService
.
parse
(
depfile
);
final
Depfile
dependencies
=
environment
.
depFileService
.
parse
(
depfile
);
expect
(
dependencies
.
inputs
.
firstWhereOrNull
((
File
file
)
=>
file
.
path
==
'/bar/LICENSE'
),
...
...
packages/flutter_tools/test/general.shard/build_system/targets/web_test.dart
View file @
4bd9bcd7
...
...
@@ -39,7 +39,6 @@ void main() {
operatingSystem:
'windows'
,
environment:
<
String
,
String
>{},
);
late
DepfileService
depfileService
;
setUp
(()
{
testbed
=
Testbed
(
setup:
()
{
...
...
@@ -61,10 +60,6 @@ void main() {
logger:
globals
.
logger
,
fileSystem:
globals
.
fs
,
);
depfileService
=
DepfileService
(
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
);
environment
.
buildDir
.
createSync
(
recursive:
true
);
},
overrides:
<
Type
,
Generator
>{
Platform:
()
=>
linux
,
...
...
@@ -573,7 +568,7 @@ void main() {
await
Dart2JSTarget
(
WebRendererMode
.
auto
).
build
(
environment
);
expect
(
environment
.
buildDir
.
childFile
(
'dart2js.d'
),
exists
);
final
Depfile
depfile
=
depf
ileService
.
parse
(
environment
.
buildDir
.
childFile
(
'dart2js.d'
));
final
Depfile
depfile
=
environment
.
depF
ileService
.
parse
(
environment
.
buildDir
.
childFile
(
'dart2js.d'
));
expect
(
depfile
.
inputs
.
single
.
path
,
globals
.
fs
.
path
.
absolute
(
'a.dart'
));
expect
(
depfile
.
outputs
.
single
.
path
,
...
...
packages/flutter_tools/test/general.shard/build_system/targets/windows_test.dart
View file @
4bd9bcd7
...
...
@@ -9,7 +9,6 @@ import 'package:flutter_tools/src/base/file_system.dart';
import
'package:flutter_tools/src/base/logger.dart'
;
import
'package:flutter_tools/src/build_info.dart'
;
import
'package:flutter_tools/src/build_system/build_system.dart'
;
import
'package:flutter_tools/src/build_system/depfile.dart'
;
import
'package:flutter_tools/src/build_system/targets/common.dart'
;
import
'package:flutter_tools/src/build_system/targets/windows.dart'
;
import
'package:flutter_tools/src/convert.dart'
;
...
...
@@ -31,10 +30,6 @@ void main() {
kBuildMode:
'debug'
,
},
);
final
DepfileService
depfileService
=
DepfileService
(
logger:
BufferLogger
.
test
(),
fileSystem:
fileSystem
,
);
environment
.
buildDir
.
createSync
(
recursive:
true
);
final
String
windowsDesktopPath
=
artifacts
.
getArtifactPath
(
Artifact
.
windowsDesktopPath
,
platform:
TargetPlatform
.
windows_x64
,
mode:
BuildMode
.
debug
);
...
...
@@ -83,9 +78,9 @@ void main() {
// Depfile is created correctly.
expect
(
outputDepfile
,
exists
);
final
List
<
String
>
inputPaths
=
depf
ileService
.
parse
(
outputDepfile
)
final
List
<
String
>
inputPaths
=
environment
.
depF
ileService
.
parse
(
outputDepfile
)
.
inputs
.
map
((
File
file
)
=>
file
.
path
).
toList
();
final
List
<
String
>
outputPaths
=
depf
ileService
.
parse
(
outputDepfile
)
final
List
<
String
>
outputPaths
=
environment
.
depF
ileService
.
parse
(
outputDepfile
)
.
outputs
.
map
((
File
file
)
=>
file
.
path
).
toList
();
// Depfile has expected sources.
...
...
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