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
19eab105
Unverified
Commit
19eab105
authored
May 24, 2021
by
Jenn Magder
Committed by
GitHub
May 24, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate build_system, exceptions, and source to null safety (#83147)
parent
efdbe403
Changes
16
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
115 additions
and
132 deletions
+115
-132
executable.dart
packages/flutter_tools/lib/executable.dart
+1
-1
build_system.dart
...ages/flutter_tools/lib/src/build_system/build_system.dart
+71
-75
exceptions.dart
packages/flutter_tools/lib/src/build_system/exceptions.dart
+0
-2
source.dart
packages/flutter_tools/lib/src/build_system/source.dart
+7
-9
bundle.dart
packages/flutter_tools/lib/src/bundle.dart
+1
-1
build.dart
packages/flutter_tools/lib/src/commands/build.dart
+1
-1
build_ios_framework.dart
...s/flutter_tools/lib/src/commands/build_ios_framework.dart
+1
-1
packages.dart
packages/flutter_tools/lib/src/commands/packages.dart
+1
-1
globals.dart
packages/flutter_tools/lib/src/globals.dart
+0
-2
globals_null_migrated.dart
packages/flutter_tools/lib/src/globals_null_migrated.dart
+2
-0
resident_runner.dart
packages/flutter_tools/lib/src/resident_runner.dart
+1
-1
compile.dart
packages/flutter_tools/lib/src/web/compile.dart
+1
-1
build_system_test.dart
...ls/test/general.shard/build_system/build_system_test.dart
+16
-17
exceptions_test.dart
...ools/test/general.shard/build_system/exceptions_test.dart
+1
-7
build_test.dart
...flutter_tools/test/general.shard/commands/build_test.dart
+1
-1
test_build_system.dart
packages/flutter_tools/test/src/test_build_system.dart
+10
-12
No files found.
packages/flutter_tools/lib/executable.dart
View file @
19eab105
...
@@ -48,7 +48,7 @@ import 'src/commands/update_packages.dart';
...
@@ -48,7 +48,7 @@ import 'src/commands/update_packages.dart';
import
'src/commands/upgrade.dart'
;
import
'src/commands/upgrade.dart'
;
import
'src/devtools_launcher.dart'
;
import
'src/devtools_launcher.dart'
;
import
'src/features.dart'
;
import
'src/features.dart'
;
import
'src/globals.dart'
as
globals
;
import
'src/globals
_null_migrated
.dart'
as
globals
;
// Files in `isolated` are intentionally excluded from google3 tooling.
// Files in `isolated` are intentionally excluded from google3 tooling.
import
'src/isolated/mustache_template.dart'
;
import
'src/isolated/mustache_template.dart'
;
import
'src/isolated/resident_web_runner.dart'
;
import
'src/isolated/resident_web_runner.dart'
;
...
...
packages/flutter_tools/lib/src/build_system/build_system.dart
View file @
19eab105
...
@@ -2,8 +2,6 @@
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
// @dart = 2.8
import
'package:async/async.dart'
;
import
'package:async/async.dart'
;
import
'package:convert/convert.dart'
;
import
'package:convert/convert.dart'
;
import
'package:crypto/crypto.dart'
;
import
'package:crypto/crypto.dart'
;
...
@@ -40,7 +38,7 @@ class BuildSystemConfig {
...
@@ -40,7 +38,7 @@ class BuildSystemConfig {
/// The maximum number of concurrent tasks the build system will run.
/// The maximum number of concurrent tasks the build system will run.
///
///
/// If not provided, defaults to [platform.numberOfProcessors].
/// If not provided, defaults to [platform.numberOfProcessors].
final
int
resourcePoolSize
;
final
int
?
resourcePoolSize
;
}
}
/// A Target describes a single step during a flutter build.
/// A Target describes a single step during a flutter build.
...
@@ -322,18 +320,18 @@ class Environment {
...
@@ -322,18 +320,18 @@ class Environment {
///
///
/// [engineVersion] should be set to null for local engine builds.
/// [engineVersion] should be set to null for local engine builds.
factory
Environment
({
factory
Environment
({
@
required
Directory
projectDir
,
required
Directory
projectDir
,
@
required
Directory
outputDir
,
required
Directory
outputDir
,
@
required
Directory
cacheDir
,
required
Directory
cacheDir
,
@
required
Directory
flutterRootDir
,
required
Directory
flutterRootDir
,
@
required
FileSystem
fileSystem
,
required
FileSystem
fileSystem
,
@
required
Logger
logger
,
required
Logger
logger
,
@
required
Artifacts
artifacts
,
required
Artifacts
artifacts
,
@
required
ProcessManager
processManager
,
required
ProcessManager
processManager
,
@
required
Platform
platform
,
required
Platform
platform
,
@required
String
engineVersion
,
String
?
engineVersion
,
@
required
bool
generateDartPluginRegistry
,
required
bool
generateDartPluginRegistry
,
Directory
buildDir
,
Directory
?
buildDir
,
Map
<
String
,
String
>
defines
=
const
<
String
,
String
>{},
Map
<
String
,
String
>
defines
=
const
<
String
,
String
>{},
Map
<
String
,
String
>
inputs
=
const
<
String
,
String
>{},
Map
<
String
,
String
>
inputs
=
const
<
String
,
String
>{},
})
{
})
{
...
@@ -382,20 +380,20 @@ class Environment {
...
@@ -382,20 +380,20 @@ class Environment {
/// Any directories not provided will fallback to a [testDirectory]
/// Any directories not provided will fallback to a [testDirectory]
@visibleForTesting
@visibleForTesting
factory
Environment
.
test
(
Directory
testDirectory
,
{
factory
Environment
.
test
(
Directory
testDirectory
,
{
Directory
projectDir
,
Directory
?
projectDir
,
Directory
outputDir
,
Directory
?
outputDir
,
Directory
cacheDir
,
Directory
?
cacheDir
,
Directory
flutterRootDir
,
Directory
?
flutterRootDir
,
Directory
buildDir
,
Directory
?
buildDir
,
Map
<
String
,
String
>
defines
=
const
<
String
,
String
>{},
Map
<
String
,
String
>
defines
=
const
<
String
,
String
>{},
Map
<
String
,
String
>
inputs
=
const
<
String
,
String
>{},
Map
<
String
,
String
>
inputs
=
const
<
String
,
String
>{},
String
engineVersion
,
String
?
engineVersion
,
Platform
platform
,
Platform
?
platform
,
bool
generateDartPluginRegistry
=
false
,
bool
generateDartPluginRegistry
=
false
,
@
required
FileSystem
fileSystem
,
required
FileSystem
fileSystem
,
@
required
Logger
logger
,
required
Logger
logger
,
@
required
Artifacts
artifacts
,
required
Artifacts
artifacts
,
@
required
ProcessManager
processManager
,
required
ProcessManager
processManager
,
})
{
})
{
return
Environment
(
return
Environment
(
projectDir:
projectDir
??
testDirectory
,
projectDir:
projectDir
??
testDirectory
,
...
@@ -416,21 +414,21 @@ class Environment {
...
@@ -416,21 +414,21 @@ class Environment {
}
}
Environment
.
_
({
Environment
.
_
({
@
required
this
.
outputDir
,
required
this
.
outputDir
,
@
required
this
.
projectDir
,
required
this
.
projectDir
,
@
required
this
.
buildDir
,
required
this
.
buildDir
,
@
required
this
.
rootBuildDir
,
required
this
.
rootBuildDir
,
@
required
this
.
cacheDir
,
required
this
.
cacheDir
,
@
required
this
.
defines
,
required
this
.
defines
,
@
required
this
.
flutterRootDir
,
required
this
.
flutterRootDir
,
@
required
this
.
processManager
,
required
this
.
processManager
,
@
required
this
.
platform
,
required
this
.
platform
,
@
required
this
.
logger
,
required
this
.
logger
,
@
required
this
.
fileSystem
,
required
this
.
fileSystem
,
@
required
this
.
artifacts
,
required
this
.
artifacts
,
@required
this
.
engineVersion
,
this
.
engineVersion
,
@
required
this
.
inputs
,
required
this
.
inputs
,
@
required
this
.
generateDartPluginRegistry
,
required
this
.
generateDartPluginRegistry
,
});
});
/// The [Source] value which is substituted with the path to [projectDir].
/// The [Source] value which is substituted with the path to [projectDir].
...
@@ -509,7 +507,7 @@ class Environment {
...
@@ -509,7 +507,7 @@ class Environment {
final
FileSystem
fileSystem
;
final
FileSystem
fileSystem
;
/// The version of the current engine, or `null` if built with a local engine.
/// The version of the current engine, or `null` if built with a local engine.
final
String
engineVersion
;
final
String
?
engineVersion
;
/// Whether to generate the Dart plugin registry.
/// Whether to generate the Dart plugin registry.
/// When [true], the main entrypoint is wrapped and the wrapper becomes
/// When [true], the main entrypoint is wrapped and the wrapper becomes
...
@@ -520,7 +518,7 @@ class Environment {
...
@@ -520,7 +518,7 @@ class Environment {
/// The result information from the build system.
/// The result information from the build system.
class
BuildResult
{
class
BuildResult
{
BuildResult
({
BuildResult
({
@
required
this
.
success
,
required
this
.
success
,
this
.
exceptions
=
const
<
String
,
ExceptionMeasurement
>{},
this
.
exceptions
=
const
<
String
,
ExceptionMeasurement
>{},
this
.
performance
=
const
<
String
,
PerformanceMeasurement
>{},
this
.
performance
=
const
<
String
,
PerformanceMeasurement
>{},
this
.
inputFiles
=
const
<
File
>[],
this
.
inputFiles
=
const
<
File
>[],
...
@@ -555,15 +553,15 @@ abstract class BuildSystem {
...
@@ -555,15 +553,15 @@ abstract class BuildSystem {
Future
<
BuildResult
>
buildIncremental
(
Future
<
BuildResult
>
buildIncremental
(
Target
target
,
Target
target
,
Environment
environment
,
Environment
environment
,
BuildResult
previousBuild
,
BuildResult
?
previousBuild
,
);
);
}
}
class
FlutterBuildSystem
extends
BuildSystem
{
class
FlutterBuildSystem
extends
BuildSystem
{
const
FlutterBuildSystem
({
const
FlutterBuildSystem
({
@
required
FileSystem
fileSystem
,
required
FileSystem
fileSystem
,
@
required
Platform
platform
,
required
Platform
platform
,
@
required
Logger
logger
,
required
Logger
logger
,
})
:
_fileSystem
=
fileSystem
,
})
:
_fileSystem
=
fileSystem
,
_platform
=
platform
,
_platform
=
platform
,
_logger
=
logger
;
_logger
=
logger
;
...
@@ -649,12 +647,12 @@ class FlutterBuildSystem extends BuildSystem {
...
@@ -649,12 +647,12 @@ class FlutterBuildSystem extends BuildSystem {
Future
<
BuildResult
>
buildIncremental
(
Future
<
BuildResult
>
buildIncremental
(
Target
target
,
Target
target
,
Environment
environment
,
Environment
environment
,
BuildResult
previousBuild
,
BuildResult
?
previousBuild
,
)
async
{
)
async
{
environment
.
buildDir
.
createSync
(
recursive:
true
);
environment
.
buildDir
.
createSync
(
recursive:
true
);
environment
.
outputDir
.
createSync
(
recursive:
true
);
environment
.
outputDir
.
createSync
(
recursive:
true
);
FileStore
fileCache
;
FileStore
?
fileCache
;
if
(
previousBuild
==
null
||
_incrementalFileStore
[
previousBuild
]
==
null
)
{
if
(
previousBuild
==
null
||
_incrementalFileStore
[
previousBuild
]
==
null
)
{
final
File
cacheFile
=
environment
.
buildDir
.
childFile
(
FileStore
.
kFileCache
);
final
File
cacheFile
=
environment
.
buildDir
.
childFile
(
FileStore
.
kFileCache
);
fileCache
=
FileStore
(
fileCache
=
FileStore
(
...
@@ -668,7 +666,7 @@ class FlutterBuildSystem extends BuildSystem {
...
@@ -668,7 +666,7 @@ class FlutterBuildSystem extends BuildSystem {
final
Node
node
=
target
.
_toNode
(
environment
);
final
Node
node
=
target
.
_toNode
(
environment
);
final
_BuildInstance
buildInstance
=
_BuildInstance
(
final
_BuildInstance
buildInstance
=
_BuildInstance
(
environment:
environment
,
environment:
environment
,
fileCache:
fileCache
,
fileCache:
fileCache
!
,
buildSystemConfig:
const
BuildSystemConfig
(),
buildSystemConfig:
const
BuildSystemConfig
(),
logger:
_logger
,
logger:
_logger
,
fileSystem:
_fileSystem
,
fileSystem:
_fileSystem
,
...
@@ -733,7 +731,7 @@ class FlutterBuildSystem extends BuildSystem {
...
@@ -733,7 +731,7 @@ class FlutterBuildSystem extends BuildSystem {
// edited .last_config or deleted .dart_tool.
// edited .last_config or deleted .dart_tool.
return
;
return
;
}
}
final
List
<
String
>
lastOutputs
=
(
json
.
decode
(
outputsFile
.
readAsStringSync
())
as
List
<
Object
>)
final
List
<
String
>
lastOutputs
=
(
json
.
decode
(
outputsFile
.
readAsStringSync
())
as
List
<
Object
?
>)
.
cast
<
String
>();
.
cast
<
String
>();
for
(
final
String
lastOutput
in
lastOutputs
)
{
for
(
final
String
lastOutput
in
lastOutputs
)
{
if
(!
currentOutputs
.
containsKey
(
lastOutput
))
{
if
(!
currentOutputs
.
containsKey
(
lastOutput
))
{
...
@@ -747,12 +745,12 @@ class FlutterBuildSystem extends BuildSystem {
...
@@ -747,12 +745,12 @@ class FlutterBuildSystem extends BuildSystem {
/// An active instance of a build.
/// An active instance of a build.
class
_BuildInstance
{
class
_BuildInstance
{
_BuildInstance
({
_BuildInstance
({
this
.
environment
,
required
this
.
environment
,
this
.
fileCache
,
required
this
.
fileCache
,
this
.
buildSystemConfig
,
required
this
.
buildSystemConfig
,
this
.
logger
,
required
this
.
logger
,
this
.
fileSystem
,
required
this
.
fileSystem
,
Platform
platform
,
Platform
?
platform
,
})
})
:
resourcePool
=
Pool
(
buildSystemConfig
.
resourcePoolSize
??
platform
?.
numberOfProcessors
??
1
);
:
resourcePool
=
Pool
(
buildSystemConfig
.
resourcePoolSize
??
platform
?.
numberOfProcessors
??
1
);
...
@@ -889,7 +887,7 @@ class ExceptionMeasurement {
...
@@ -889,7 +887,7 @@ class ExceptionMeasurement {
ExceptionMeasurement
(
this
.
target
,
this
.
exception
,
this
.
stackTrace
,
{
this
.
fatal
=
false
});
ExceptionMeasurement
(
this
.
target
,
this
.
exception
,
this
.
stackTrace
,
{
this
.
fatal
=
false
});
final
String
target
;
final
String
target
;
final
dynamic
exception
;
final
Object
?
exception
;
final
StackTrace
stackTrace
;
final
StackTrace
stackTrace
;
/// Whether this exception was a fatal build system error.
/// Whether this exception was a fatal build system error.
...
@@ -902,11 +900,11 @@ class ExceptionMeasurement {
...
@@ -902,11 +900,11 @@ class ExceptionMeasurement {
/// Helper class to collect measurement data.
/// Helper class to collect measurement data.
class
PerformanceMeasurement
{
class
PerformanceMeasurement
{
PerformanceMeasurement
({
PerformanceMeasurement
({
@
required
this
.
target
,
required
this
.
target
,
@
required
this
.
elapsedMilliseconds
,
required
this
.
elapsedMilliseconds
,
@
required
this
.
skipped
,
required
this
.
skipped
,
@
required
this
.
succeeded
,
required
this
.
succeeded
,
@
required
this
.
analyticsName
,
required
this
.
analyticsName
,
});
});
final
int
elapsedMilliseconds
;
final
int
elapsedMilliseconds
;
...
@@ -984,7 +982,7 @@ class Node {
...
@@ -984,7 +982,7 @@ class Node {
_dirty
=
true
;
_dirty
=
true
;
return
;
return
;
}
}
Map
<
String
,
Object
>
values
;
Map
<
String
,
Object
?>?
values
;
try
{
try
{
values
=
castStringKeyedMap
(
json
.
decode
(
content
));
values
=
castStringKeyedMap
(
json
.
decode
(
content
));
}
on
FormatException
{
}
on
FormatException
{
...
@@ -992,11 +990,11 @@ class Node {
...
@@ -992,11 +990,11 @@ class Node {
_dirty
=
true
;
_dirty
=
true
;
return
;
return
;
}
}
final
Object
inputs
=
values
[
'inputs'
];
final
Object
?
inputs
=
values
?
[
'inputs'
];
final
Object
outputs
=
values
[
'outputs'
];
final
Object
?
outputs
=
values
?
[
'outputs'
];
if
(
inputs
is
List
<
Object
>
&&
outputs
is
List
<
Object
>)
{
if
(
inputs
is
List
<
Object
?>
&&
outputs
is
List
<
Object
?
>)
{
inputs
?.
cast
<
String
>()?
.
forEach
(
previousInputs
.
add
);
inputs
.
cast
<
String
?>().
whereType
<
String
>()
.
forEach
(
previousInputs
.
add
);
outputs
?.
cast
<
String
>()?
.
forEach
(
previousOutputs
.
add
);
outputs
.
cast
<
String
?>().
whereType
<
String
>()
.
forEach
(
previousOutputs
.
add
);
}
else
{
}
else
{
// The json is malformed in some way.
// The json is malformed in some way.
_dirty
=
true
;
_dirty
=
true
;
...
@@ -1067,9 +1065,9 @@ class Node {
...
@@ -1067,9 +1065,9 @@ class Node {
}
}
final
String
absolutePath
=
file
.
path
;
final
String
absolutePath
=
file
.
path
;
final
String
previousAssetKey
=
fileStore
.
previousAssetKeys
[
absolutePath
];
final
String
?
previousAssetKey
=
fileStore
.
previousAssetKeys
[
absolutePath
];
if
(
fileStore
.
currentAssetKeys
.
containsKey
(
absolutePath
))
{
if
(
fileStore
.
currentAssetKeys
.
containsKey
(
absolutePath
))
{
final
String
currentHash
=
fileStore
.
currentAssetKeys
[
absolutePath
];
final
String
?
currentHash
=
fileStore
.
currentAssetKeys
[
absolutePath
];
if
(
currentHash
!=
previousAssetKey
)
{
if
(
currentHash
!=
previousAssetKey
)
{
final
InvalidatedReason
reason
=
_invalidate
(
InvalidatedReasonKind
.
inputChanged
);
final
InvalidatedReason
reason
=
_invalidate
(
InvalidatedReasonKind
.
inputChanged
);
reason
.
data
.
add
(
absolutePath
);
reason
.
data
.
add
(
absolutePath
);
...
@@ -1099,9 +1097,9 @@ class Node {
...
@@ -1099,9 +1097,9 @@ class Node {
continue
;
continue
;
}
}
final
String
absolutePath
=
file
.
path
;
final
String
absolutePath
=
file
.
path
;
final
String
previousHash
=
fileStore
.
previousAssetKeys
[
absolutePath
];
final
String
?
previousHash
=
fileStore
.
previousAssetKeys
[
absolutePath
];
if
(
fileStore
.
currentAssetKeys
.
containsKey
(
absolutePath
))
{
if
(
fileStore
.
currentAssetKeys
.
containsKey
(
absolutePath
))
{
final
String
currentHash
=
fileStore
.
currentAssetKeys
[
absolutePath
];
final
String
?
currentHash
=
fileStore
.
currentAssetKeys
[
absolutePath
];
if
(
currentHash
!=
previousHash
)
{
if
(
currentHash
!=
previousHash
)
{
final
InvalidatedReason
reason
=
_invalidate
(
InvalidatedReasonKind
.
outputChanged
);
final
InvalidatedReason
reason
=
_invalidate
(
InvalidatedReasonKind
.
outputChanged
);
reason
.
data
.
add
(
absolutePath
);
reason
.
data
.
add
(
absolutePath
);
...
@@ -1159,8 +1157,6 @@ class InvalidatedReason {
...
@@ -1159,8 +1157,6 @@ class InvalidatedReason {
case
InvalidatedReasonKind
.
outputSetChanged
:
case
InvalidatedReasonKind
.
outputSetChanged
:
return
'The following outputs were removed from the output set:
${data.join(',')}
'
;
return
'The following outputs were removed from the output set:
${data.join(',')}
'
;
}
}
assert
(
false
);
return
null
;
}
}
}
}
...
...
packages/flutter_tools/lib/src/build_system/exceptions.dart
View file @
19eab105
...
@@ -2,8 +2,6 @@
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
// @dart = 2.8
import
'../base/file_system.dart'
;
import
'../base/file_system.dart'
;
import
'build_system.dart'
;
import
'build_system.dart'
;
...
...
packages/flutter_tools/lib/src/build_system/source.dart
View file @
19eab105
...
@@ -2,8 +2,6 @@
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
// @dart = 2.8
import
'../artifacts.dart'
;
import
'../artifacts.dart'
;
import
'../base/file_system.dart'
;
import
'../base/file_system.dart'
;
import
'../build_info.dart'
;
import
'../build_info.dart'
;
...
@@ -76,7 +74,7 @@ class SourceVisitor implements ResolvedFiles {
...
@@ -76,7 +74,7 @@ class SourceVisitor implements ResolvedFiles {
.
replaceAllMapped
(
_separatorExpr
,
(
Match
match
)
=>
'
${match.group(1)}
\n
'
)
.
replaceAllMapped
(
_separatorExpr
,
(
Match
match
)
=>
'
${match.group(1)}
\n
'
)
.
split
(
'
\n
'
)
.
split
(
'
\n
'
)
// Expand escape sequences, so that '\ ', for example,ß becomes ' '
// Expand escape sequences, so that '\ ', for example,ß becomes ' '
.
map
<
String
>((
String
path
)
=>
path
.
replaceAllMapped
(
_escapeExpr
,
(
Match
match
)
=>
match
.
group
(
1
)).
trim
())
.
map
<
String
>((
String
path
)
=>
path
.
replaceAllMapped
(
_escapeExpr
,
(
Match
match
)
=>
match
.
group
(
1
)
!
).
trim
())
.
where
((
String
path
)
=>
path
.
isNotEmpty
)
.
where
((
String
path
)
=>
path
.
isNotEmpty
)
.
toSet
()
.
toSet
()
.
map
(
environment
.
fileSystem
.
file
);
.
map
(
environment
.
fileSystem
.
file
);
...
@@ -93,7 +91,7 @@ class SourceVisitor implements ResolvedFiles {
...
@@ -93,7 +91,7 @@ class SourceVisitor implements ResolvedFiles {
final
List
<
String
>
segments
=
<
String
>[];
final
List
<
String
>
segments
=
<
String
>[];
final
List
<
String
>
rawParts
=
pattern
.
split
(
'/'
);
final
List
<
String
>
rawParts
=
pattern
.
split
(
'/'
);
final
bool
hasWildcard
=
rawParts
.
last
.
contains
(
'*'
);
final
bool
hasWildcard
=
rawParts
.
last
.
contains
(
'*'
);
String
wildcardFile
;
String
?
wildcardFile
;
if
(
hasWildcard
)
{
if
(
hasWildcard
)
{
wildcardFile
=
rawParts
.
removeLast
();
wildcardFile
=
rawParts
.
removeLast
();
}
}
...
@@ -141,7 +139,7 @@ class SourceVisitor implements ResolvedFiles {
...
@@ -141,7 +139,7 @@ class SourceVisitor implements ResolvedFiles {
// example, `foo_*_.dart`. We want to match `foo_b_.dart` but not
// example, `foo_*_.dart`. We want to match `foo_b_.dart` but not
// `foo_.dart`. To do so, we first subtract the first section from the
// `foo_.dart`. To do so, we first subtract the first section from the
// string if the first segment matches.
// string if the first segment matches.
final
List
<
String
>
wildcardSegments
=
wildcardFile
.
split
(
'*'
)
;
final
List
<
String
>
wildcardSegments
=
wildcardFile
?.
split
(
'*'
)
??
<
String
>[]
;
if
(
wildcardSegments
.
length
>
2
)
{
if
(
wildcardSegments
.
length
>
2
)
{
throw
InvalidPatternException
(
pattern
);
throw
InvalidPatternException
(
pattern
);
}
}
...
@@ -171,7 +169,7 @@ class SourceVisitor implements ResolvedFiles {
...
@@ -171,7 +169,7 @@ class SourceVisitor implements ResolvedFiles {
/// To increase the performance of builds that use a known revision of Flutter,
/// To increase the performance of builds that use a known revision of Flutter,
/// these are updated to point towards the engine.version file instead of
/// these are updated to point towards the engine.version file instead of
/// the artifact itself.
/// the artifact itself.
void
visitArtifact
(
Artifact
artifact
,
TargetPlatform
platform
,
BuildMode
mode
)
{
void
visitArtifact
(
Artifact
artifact
,
TargetPlatform
?
platform
,
BuildMode
?
mode
)
{
// This is not a local engine.
// This is not a local engine.
if
(
environment
.
engineVersion
!=
null
)
{
if
(
environment
.
engineVersion
!=
null
)
{
sources
.
add
(
environment
.
flutterRootDir
sources
.
add
(
environment
.
flutterRootDir
...
@@ -232,7 +230,7 @@ abstract class Source {
...
@@ -232,7 +230,7 @@ abstract class Source {
/// The source is provided by an [Artifact].
/// The source is provided by an [Artifact].
///
///
/// If [artifact] points to a directory then all child files are included.
/// If [artifact] points to a directory then all child files are included.
const
factory
Source
.
artifact
(
Artifact
artifact
,
{
TargetPlatform
platform
,
BuildMode
mode
})
=
_ArtifactSource
;
const
factory
Source
.
artifact
(
Artifact
artifact
,
{
TargetPlatform
?
platform
,
BuildMode
?
mode
})
=
_ArtifactSource
;
/// The source is provided by an [HostArtifact].
/// The source is provided by an [HostArtifact].
///
///
...
@@ -269,8 +267,8 @@ class _ArtifactSource implements Source {
...
@@ -269,8 +267,8 @@ class _ArtifactSource implements Source {
const
_ArtifactSource
(
this
.
artifact
,
{
this
.
platform
,
this
.
mode
});
const
_ArtifactSource
(
this
.
artifact
,
{
this
.
platform
,
this
.
mode
});
final
Artifact
artifact
;
final
Artifact
artifact
;
final
TargetPlatform
platform
;
final
TargetPlatform
?
platform
;
final
BuildMode
mode
;
final
BuildMode
?
mode
;
@override
@override
void
accept
(
SourceVisitor
visitor
)
=>
visitor
.
visitArtifact
(
artifact
,
platform
,
mode
);
void
accept
(
SourceVisitor
visitor
)
=>
visitor
.
visitArtifact
(
artifact
,
platform
,
mode
);
...
...
packages/flutter_tools/lib/src/bundle.dart
View file @
19eab105
...
@@ -21,7 +21,7 @@ import 'build_system/targets/common.dart';
...
@@ -21,7 +21,7 @@ import 'build_system/targets/common.dart';
import
'cache.dart'
;
import
'cache.dart'
;
import
'convert.dart'
;
import
'convert.dart'
;
import
'devfs.dart'
;
import
'devfs.dart'
;
import
'globals.dart'
as
globals
;
import
'globals
_null_migrated
.dart'
as
globals
;
import
'project.dart'
;
import
'project.dart'
;
String
get
defaultMainPath
=>
globals
.
fs
.
path
.
join
(
'lib'
,
'main.dart'
);
String
get
defaultMainPath
=>
globals
.
fs
.
path
.
join
(
'lib'
,
'main.dart'
);
...
...
packages/flutter_tools/lib/src/commands/build.dart
View file @
19eab105
...
@@ -10,7 +10,7 @@ import '../build_info.dart';
...
@@ -10,7 +10,7 @@ import '../build_info.dart';
import
'../commands/build_linux.dart'
;
import
'../commands/build_linux.dart'
;
import
'../commands/build_macos.dart'
;
import
'../commands/build_macos.dart'
;
import
'../commands/build_windows.dart'
;
import
'../commands/build_windows.dart'
;
import
'../globals.dart'
as
globals
;
import
'../globals
_null_migrated
.dart'
as
globals
;
import
'../runner/flutter_command.dart'
;
import
'../runner/flutter_command.dart'
;
import
'build_aar.dart'
;
import
'build_aar.dart'
;
import
'build_apk.dart'
;
import
'build_apk.dart'
;
...
...
packages/flutter_tools/lib/src/commands/build_ios_framework.dart
View file @
19eab105
...
@@ -18,7 +18,7 @@ import '../build_system/build_system.dart';
...
@@ -18,7 +18,7 @@ import '../build_system/build_system.dart';
import
'../build_system/targets/ios.dart'
;
import
'../build_system/targets/ios.dart'
;
import
'../cache.dart'
;
import
'../cache.dart'
;
import
'../flutter_plugins.dart'
;
import
'../flutter_plugins.dart'
;
import
'../globals.dart'
as
globals
;
import
'../globals
_null_migrated
.dart'
as
globals
;
import
'../macos/cocoapod_utils.dart'
;
import
'../macos/cocoapod_utils.dart'
;
import
'../project.dart'
;
import
'../project.dart'
;
import
'../runner/flutter_command.dart'
show
DevelopmentArtifact
,
FlutterCommandResult
;
import
'../runner/flutter_command.dart'
show
DevelopmentArtifact
,
FlutterCommandResult
;
...
...
packages/flutter_tools/lib/src/commands/packages.dart
View file @
19eab105
...
@@ -14,7 +14,7 @@ import '../cache.dart';
...
@@ -14,7 +14,7 @@ import '../cache.dart';
import
'../dart/generate_synthetic_packages.dart'
;
import
'../dart/generate_synthetic_packages.dart'
;
import
'../dart/pub.dart'
;
import
'../dart/pub.dart'
;
import
'../flutter_plugins.dart'
;
import
'../flutter_plugins.dart'
;
import
'../globals.dart'
as
globals
;
import
'../globals
_null_migrated
.dart'
as
globals
;
import
'../plugins.dart'
;
import
'../plugins.dart'
;
import
'../project.dart'
;
import
'../project.dart'
;
import
'../reporting/reporting.dart'
;
import
'../reporting/reporting.dart'
;
...
...
packages/flutter_tools/lib/src/globals.dart
View file @
19eab105
...
@@ -6,7 +6,6 @@
...
@@ -6,7 +6,6 @@
import
'android/gradle_utils.dart'
;
import
'android/gradle_utils.dart'
;
import
'base/context.dart'
;
import
'base/context.dart'
;
import
'build_system/build_system.dart'
;
import
'device.dart'
;
import
'device.dart'
;
import
'doctor.dart'
;
import
'doctor.dart'
;
import
'fuchsia/fuchsia_sdk.dart'
;
import
'fuchsia/fuchsia_sdk.dart'
;
...
@@ -21,7 +20,6 @@ import 'runner/local_engine.dart';
...
@@ -21,7 +20,6 @@ import 'runner/local_engine.dart';
export
'globals_null_migrated.dart'
;
export
'globals_null_migrated.dart'
;
BuildSystem
get
buildSystem
=>
context
.
get
<
BuildSystem
>();
CrashReporter
get
crashReporter
=>
context
.
get
<
CrashReporter
>();
CrashReporter
get
crashReporter
=>
context
.
get
<
CrashReporter
>();
Doctor
get
doctor
=>
context
.
get
<
Doctor
>();
Doctor
get
doctor
=>
context
.
get
<
Doctor
>();
DeviceManager
get
deviceManager
=>
context
.
get
<
DeviceManager
>();
DeviceManager
get
deviceManager
=>
context
.
get
<
DeviceManager
>();
...
...
packages/flutter_tools/lib/src/globals_null_migrated.dart
View file @
19eab105
...
@@ -23,6 +23,7 @@ import 'base/template.dart';
...
@@ -23,6 +23,7 @@ import 'base/template.dart';
import
'base/terminal.dart'
;
import
'base/terminal.dart'
;
import
'base/time.dart'
;
import
'base/time.dart'
;
import
'base/user_messages.dart'
;
import
'base/user_messages.dart'
;
import
'build_system/build_system.dart'
;
import
'cache.dart'
;
import
'cache.dart'
;
import
'ios/ios_workflow.dart'
;
import
'ios/ios_workflow.dart'
;
import
'ios/plist_parser.dart'
;
import
'ios/plist_parser.dart'
;
...
@@ -33,6 +34,7 @@ import 'reporting/reporting.dart';
...
@@ -33,6 +34,7 @@ import 'reporting/reporting.dart';
import
'version.dart'
;
import
'version.dart'
;
Artifacts
?
get
artifacts
=>
context
.
get
<
Artifacts
>();
Artifacts
?
get
artifacts
=>
context
.
get
<
Artifacts
>();
BuildSystem
?
get
buildSystem
=>
context
.
get
<
BuildSystem
>();
Cache
get
cache
=>
context
.
get
<
Cache
>()!;
Cache
get
cache
=>
context
.
get
<
Cache
>()!;
Config
get
config
=>
context
.
get
<
Config
>()!;
Config
get
config
=>
context
.
get
<
Config
>()!;
HttpClientFactory
?
get
httpClientFactory
=>
context
.
get
<
HttpClientFactory
>();
HttpClientFactory
?
get
httpClientFactory
=>
context
.
get
<
HttpClientFactory
>();
...
...
packages/flutter_tools/lib/src/resident_runner.dart
View file @
19eab105
...
@@ -35,7 +35,7 @@ import 'convert.dart';
...
@@ -35,7 +35,7 @@ import 'convert.dart';
import
'devfs.dart'
;
import
'devfs.dart'
;
import
'device.dart'
;
import
'device.dart'
;
import
'features.dart'
;
import
'features.dart'
;
import
'globals.dart'
as
globals
;
import
'globals
_null_migrated
.dart'
as
globals
;
import
'project.dart'
;
import
'project.dart'
;
import
'resident_devtools_handler.dart'
;
import
'resident_devtools_handler.dart'
;
import
'run_cold.dart'
;
import
'run_cold.dart'
;
...
...
packages/flutter_tools/lib/src/web/compile.dart
View file @
19eab105
...
@@ -13,7 +13,7 @@ import '../build_system/build_system.dart';
...
@@ -13,7 +13,7 @@ import '../build_system/build_system.dart';
import
'../build_system/targets/web.dart'
;
import
'../build_system/targets/web.dart'
;
import
'../cache.dart'
;
import
'../cache.dart'
;
import
'../flutter_plugins.dart'
;
import
'../flutter_plugins.dart'
;
import
'../globals.dart'
as
globals
;
import
'../globals
_null_migrated
.dart'
as
globals
;
import
'../platform_plugins.dart'
;
import
'../platform_plugins.dart'
;
import
'../plugins.dart'
;
import
'../plugins.dart'
;
import
'../project.dart'
;
import
'../project.dart'
;
...
...
packages/flutter_tools/test/general.shard/build_system/build_system_test.dart
View file @
19eab105
...
@@ -2,8 +2,6 @@
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
// @dart = 2.8
import
'dart:async'
;
import
'dart:async'
;
import
'package:file/memory.dart'
;
import
'package:file/memory.dart'
;
...
@@ -21,15 +19,15 @@ import '../../src/common.dart';
...
@@ -21,15 +19,15 @@ import '../../src/common.dart';
import
'../../src/fake_process_manager.dart'
;
import
'../../src/fake_process_manager.dart'
;
void
main
(
)
{
void
main
(
)
{
FileSystem
fileSystem
;
late
FileSystem
fileSystem
;
Environment
environment
;
late
Environment
environment
;
Target
fooTarget
;
late
Target
fooTarget
;
Target
barTarget
;
late
Target
barTarget
;
Target
fizzTarget
;
late
Target
fizzTarget
;
Target
sharedTarget
;
late
Target
sharedTarget
;
int
fooInvocations
;
late
int
fooInvocations
;
int
barInvocations
;
late
int
barInvocations
;
int
shared
;
late
int
shared
;
setUp
(()
{
setUp
(()
{
fileSystem
=
MemoryFileSystem
.
test
();
fileSystem
=
MemoryFileSystem
.
test
();
...
@@ -136,7 +134,7 @@ void main() {
...
@@ -136,7 +134,7 @@ void main() {
expect
(
stampFile
,
exists
);
expect
(
stampFile
,
exists
);
final
Map
<
String
,
dynamic
>
stampContents
=
castStringKeyedMap
(
final
Map
<
String
,
Object
?>?
stampContents
=
castStringKeyedMap
(
json
.
decode
(
stampFile
.
readAsStringSync
()));
json
.
decode
(
stampFile
.
readAsStringSync
()));
expect
(
stampContents
,
containsPair
(
'inputs'
,
<
Object
>[
'/foo.dart'
]));
expect
(
stampContents
,
containsPair
(
'inputs'
,
<
Object
>[
'/foo.dart'
]));
...
@@ -312,7 +310,7 @@ void main() {
...
@@ -312,7 +310,7 @@ void main() {
testWithoutContext
(
'Can describe itself with JSON output'
,
()
{
testWithoutContext
(
'Can describe itself with JSON output'
,
()
{
environment
.
buildDir
.
createSync
(
recursive:
true
);
environment
.
buildDir
.
createSync
(
recursive:
true
);
expect
(
fooTarget
.
toJson
(
environment
),
<
String
,
dynamic
>{
expect
(
fooTarget
.
toJson
(
environment
),
<
String
,
Object
?
>{
'inputs'
:
<
Object
>[
'inputs'
:
<
Object
>[
'/foo.dart'
,
'/foo.dart'
,
],
],
...
@@ -685,7 +683,7 @@ void main() {
...
@@ -685,7 +683,7 @@ void main() {
}
}
BuildSystem
setUpBuildSystem
(
FileSystem
fileSystem
,
[
FakePlatform
platform
])
{
BuildSystem
setUpBuildSystem
(
FileSystem
fileSystem
,
[
FakePlatform
?
platform
])
{
return
FlutterBuildSystem
(
return
FlutterBuildSystem
(
fileSystem:
fileSystem
,
fileSystem:
fileSystem
,
logger:
BufferLogger
.
test
(),
logger:
BufferLogger
.
test
(),
...
@@ -694,16 +692,17 @@ BuildSystem setUpBuildSystem(FileSystem fileSystem, [FakePlatform platform]) {
...
@@ -694,16 +692,17 @@ BuildSystem setUpBuildSystem(FileSystem fileSystem, [FakePlatform platform]) {
}
}
class
TestTarget
extends
Target
{
class
TestTarget
extends
Target
{
TestTarget
([
this
.
_build
,
this
.
_canSkip
]);
TestTarget
([
Future
<
void
>
Function
(
Environment
environment
)?
build
,
this
.
_canSkip
])
:
_build
=
build
??
((
Environment
environment
)
async
{});
final
Future
<
void
>
Function
(
Environment
environment
)
_build
;
final
Future
<
void
>
Function
(
Environment
environment
)
_build
;
final
bool
Function
(
Environment
environment
)
_canSkip
;
final
bool
Function
(
Environment
environment
)
?
_canSkip
;
@override
@override
bool
canSkip
(
Environment
environment
)
{
bool
canSkip
(
Environment
environment
)
{
if
(
_canSkip
!=
null
)
{
if
(
_canSkip
!=
null
)
{
return
_canSkip
(
environment
);
return
_canSkip
!
(
environment
);
}
}
return
super
.
canSkip
(
environment
);
return
super
.
canSkip
(
environment
);
}
}
...
...
packages/flutter_tools/test/general.shard/build_system/exceptions_test.dart
View file @
19eab105
...
@@ -2,8 +2,6 @@
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
// @dart = 2.8
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/build_system/build_system.dart'
;
import
'package:flutter_tools/src/build_system/build_system.dart'
;
import
'package:flutter_tools/src/build_system/exceptions.dart'
;
import
'package:flutter_tools/src/build_system/exceptions.dart'
;
...
@@ -65,12 +63,8 @@ void main() {
...
@@ -65,12 +63,8 @@ void main() {
}
}
class
TestTarget
extends
Target
{
class
TestTarget
extends
Target
{
TestTarget
([
this
.
_build
]);
final
Future
<
void
>
Function
(
Environment
environment
)
_build
;
@override
@override
Future
<
void
>
build
(
Environment
environment
)
=>
_build
(
environment
);
Future
<
void
>
build
(
Environment
environment
)
async
{}
@override
@override
List
<
Target
>
dependencies
=
<
Target
>[];
List
<
Target
>
dependencies
=
<
Target
>[];
...
...
packages/flutter_tools/test/general.shard/commands/build_test.dart
View file @
19eab105
...
@@ -18,7 +18,7 @@ import 'package:flutter_tools/src/commands/build_linux.dart';
...
@@ -18,7 +18,7 @@ import 'package:flutter_tools/src/commands/build_linux.dart';
import
'package:flutter_tools/src/commands/build_macos.dart'
;
import
'package:flutter_tools/src/commands/build_macos.dart'
;
import
'package:flutter_tools/src/commands/build_web.dart'
;
import
'package:flutter_tools/src/commands/build_web.dart'
;
import
'package:flutter_tools/src/commands/build_windows.dart'
;
import
'package:flutter_tools/src/commands/build_windows.dart'
;
import
'package:flutter_tools/src/globals.dart'
as
globals
;
import
'package:flutter_tools/src/globals
_null_migrated
.dart'
as
globals
;
import
'package:flutter_tools/src/runner/flutter_command.dart'
;
import
'package:flutter_tools/src/runner/flutter_command.dart'
;
import
'../../src/common.dart'
;
import
'../../src/common.dart'
;
...
...
packages/flutter_tools/test/src/test_build_system.dart
View file @
19eab105
...
@@ -2,8 +2,6 @@
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
// @dart = 2.8
import
'dart:async'
;
import
'dart:async'
;
import
'package:flutter_tools/src/build_system/build_system.dart'
;
import
'package:flutter_tools/src/build_system/build_system.dart'
;
...
@@ -28,21 +26,21 @@ class TestBuildSystem implements BuildSystem {
...
@@ -28,21 +26,21 @@ class TestBuildSystem implements BuildSystem {
_onRun
=
null
;
_onRun
=
null
;
final
List
<
BuildResult
>
_results
;
final
List
<
BuildResult
>
_results
;
final
BuildResult
_singleResult
;
final
BuildResult
?
_singleResult
;
final
dynamic
_exception
;
final
Object
?
_exception
;
final
void
Function
(
Target
target
,
Environment
environment
)
_onRun
;
final
void
Function
(
Target
target
,
Environment
environment
)
?
_onRun
;
int
_nextResult
=
0
;
int
_nextResult
=
0
;
@override
@override
Future
<
BuildResult
>
build
(
Target
target
,
Environment
environment
,
{
BuildSystemConfig
buildSystemConfig
=
const
BuildSystemConfig
()})
async
{
Future
<
BuildResult
>
build
(
Target
target
,
Environment
environment
,
{
BuildSystemConfig
buildSystemConfig
=
const
BuildSystemConfig
()})
async
{
if
(
_onRun
!=
null
)
{
if
(
_onRun
!=
null
)
{
_onRun
(
target
,
environment
);
_onRun
?.
call
(
target
,
environment
);
}
}
if
(
_exception
!=
null
)
{
if
(
_exception
!=
null
)
{
throw
_exception
;
throw
_exception
!
;
}
}
if
(
_singleResult
!=
null
)
{
if
(
_singleResult
!=
null
)
{
return
_singleResult
;
return
_singleResult
!
;
}
}
if
(
_nextResult
>=
_results
.
length
)
{
if
(
_nextResult
>=
_results
.
length
)
{
throw
StateError
(
'Unexpected build request of
${target.name}
'
);
throw
StateError
(
'Unexpected build request of
${target.name}
'
);
...
@@ -51,15 +49,15 @@ class TestBuildSystem implements BuildSystem {
...
@@ -51,15 +49,15 @@ class TestBuildSystem implements BuildSystem {
}
}
@override
@override
Future
<
BuildResult
>
buildIncremental
(
Target
target
,
Environment
environment
,
BuildResult
previousBuild
)
async
{
Future
<
BuildResult
>
buildIncremental
(
Target
target
,
Environment
environment
,
BuildResult
?
previousBuild
)
async
{
if
(
_onRun
!=
null
)
{
if
(
_onRun
!=
null
)
{
_onRun
(
target
,
environment
);
_onRun
?.
call
(
target
,
environment
);
}
}
if
(
_exception
!=
null
)
{
if
(
_exception
!=
null
)
{
throw
_exception
;
throw
_exception
!
;
}
}
if
(
_singleResult
!=
null
)
{
if
(
_singleResult
!=
null
)
{
return
_singleResult
;
return
_singleResult
!
;
}
}
if
(
_nextResult
>=
_results
.
length
)
{
if
(
_nextResult
>=
_results
.
length
)
{
throw
StateError
(
'Unexpected buildIncremental request of
${target.name}
'
);
throw
StateError
(
'Unexpected buildIncremental request of
${target.name}
'
);
...
...
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