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
Expand all
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';
import
'src/commands/upgrade.dart'
;
import
'src/devtools_launcher.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.
import
'src/isolated/mustache_template.dart'
;
import
'src/isolated/resident_web_runner.dart'
;
...
...
packages/flutter_tools/lib/src/build_system/build_system.dart
View file @
19eab105
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/build_system/exceptions.dart
View file @
19eab105
...
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import
'../base/file_system.dart'
;
import
'build_system.dart'
;
...
...
packages/flutter_tools/lib/src/build_system/source.dart
View file @
19eab105
...
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import
'../artifacts.dart'
;
import
'../base/file_system.dart'
;
import
'../build_info.dart'
;
...
...
@@ -76,7 +74,7 @@ class SourceVisitor implements ResolvedFiles {
.
replaceAllMapped
(
_separatorExpr
,
(
Match
match
)
=>
'
${match.group(1)}
\n
'
)
.
split
(
'
\n
'
)
// 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
)
.
toSet
()
.
map
(
environment
.
fileSystem
.
file
);
...
...
@@ -93,7 +91,7 @@ class SourceVisitor implements ResolvedFiles {
final
List
<
String
>
segments
=
<
String
>[];
final
List
<
String
>
rawParts
=
pattern
.
split
(
'/'
);
final
bool
hasWildcard
=
rawParts
.
last
.
contains
(
'*'
);
String
wildcardFile
;
String
?
wildcardFile
;
if
(
hasWildcard
)
{
wildcardFile
=
rawParts
.
removeLast
();
}
...
...
@@ -141,7 +139,7 @@ class SourceVisitor implements ResolvedFiles {
// 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
// string if the first segment matches.
final
List
<
String
>
wildcardSegments
=
wildcardFile
.
split
(
'*'
)
;
final
List
<
String
>
wildcardSegments
=
wildcardFile
?.
split
(
'*'
)
??
<
String
>[]
;
if
(
wildcardSegments
.
length
>
2
)
{
throw
InvalidPatternException
(
pattern
);
}
...
...
@@ -171,7 +169,7 @@ class SourceVisitor implements ResolvedFiles {
/// 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
/// 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.
if
(
environment
.
engineVersion
!=
null
)
{
sources
.
add
(
environment
.
flutterRootDir
...
...
@@ -232,7 +230,7 @@ abstract class Source {
/// The source is provided by an [Artifact].
///
/// 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].
///
...
...
@@ -269,8 +267,8 @@ class _ArtifactSource implements Source {
const
_ArtifactSource
(
this
.
artifact
,
{
this
.
platform
,
this
.
mode
});
final
Artifact
artifact
;
final
TargetPlatform
platform
;
final
BuildMode
mode
;
final
TargetPlatform
?
platform
;
final
BuildMode
?
mode
;
@override
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';
import
'cache.dart'
;
import
'convert.dart'
;
import
'devfs.dart'
;
import
'globals.dart'
as
globals
;
import
'globals
_null_migrated
.dart'
as
globals
;
import
'project.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';
import
'../commands/build_linux.dart'
;
import
'../commands/build_macos.dart'
;
import
'../commands/build_windows.dart'
;
import
'../globals.dart'
as
globals
;
import
'../globals
_null_migrated
.dart'
as
globals
;
import
'../runner/flutter_command.dart'
;
import
'build_aar.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';
import
'../build_system/targets/ios.dart'
;
import
'../cache.dart'
;
import
'../flutter_plugins.dart'
;
import
'../globals.dart'
as
globals
;
import
'../globals
_null_migrated
.dart'
as
globals
;
import
'../macos/cocoapod_utils.dart'
;
import
'../project.dart'
;
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';
import
'../dart/generate_synthetic_packages.dart'
;
import
'../dart/pub.dart'
;
import
'../flutter_plugins.dart'
;
import
'../globals.dart'
as
globals
;
import
'../globals
_null_migrated
.dart'
as
globals
;
import
'../plugins.dart'
;
import
'../project.dart'
;
import
'../reporting/reporting.dart'
;
...
...
packages/flutter_tools/lib/src/globals.dart
View file @
19eab105
...
...
@@ -6,7 +6,6 @@
import
'android/gradle_utils.dart'
;
import
'base/context.dart'
;
import
'build_system/build_system.dart'
;
import
'device.dart'
;
import
'doctor.dart'
;
import
'fuchsia/fuchsia_sdk.dart'
;
...
...
@@ -21,7 +20,6 @@ import 'runner/local_engine.dart';
export
'globals_null_migrated.dart'
;
BuildSystem
get
buildSystem
=>
context
.
get
<
BuildSystem
>();
CrashReporter
get
crashReporter
=>
context
.
get
<
CrashReporter
>();
Doctor
get
doctor
=>
context
.
get
<
Doctor
>();
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';
import
'base/terminal.dart'
;
import
'base/time.dart'
;
import
'base/user_messages.dart'
;
import
'build_system/build_system.dart'
;
import
'cache.dart'
;
import
'ios/ios_workflow.dart'
;
import
'ios/plist_parser.dart'
;
...
...
@@ -33,6 +34,7 @@ import 'reporting/reporting.dart';
import
'version.dart'
;
Artifacts
?
get
artifacts
=>
context
.
get
<
Artifacts
>();
BuildSystem
?
get
buildSystem
=>
context
.
get
<
BuildSystem
>();
Cache
get
cache
=>
context
.
get
<
Cache
>()!;
Config
get
config
=>
context
.
get
<
Config
>()!;
HttpClientFactory
?
get
httpClientFactory
=>
context
.
get
<
HttpClientFactory
>();
...
...
packages/flutter_tools/lib/src/resident_runner.dart
View file @
19eab105
...
...
@@ -35,7 +35,7 @@ import 'convert.dart';
import
'devfs.dart'
;
import
'device.dart'
;
import
'features.dart'
;
import
'globals.dart'
as
globals
;
import
'globals
_null_migrated
.dart'
as
globals
;
import
'project.dart'
;
import
'resident_devtools_handler.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';
import
'../build_system/targets/web.dart'
;
import
'../cache.dart'
;
import
'../flutter_plugins.dart'
;
import
'../globals.dart'
as
globals
;
import
'../globals
_null_migrated
.dart'
as
globals
;
import
'../platform_plugins.dart'
;
import
'../plugins.dart'
;
import
'../project.dart'
;
...
...
packages/flutter_tools/test/general.shard/build_system/build_system_test.dart
View file @
19eab105
...
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import
'dart:async'
;
import
'package:file/memory.dart'
;
...
...
@@ -21,15 +19,15 @@ import '../../src/common.dart';
import
'../../src/fake_process_manager.dart'
;
void
main
(
)
{
FileSystem
fileSystem
;
Environment
environment
;
Target
fooTarget
;
Target
barTarget
;
Target
fizzTarget
;
Target
sharedTarget
;
int
fooInvocations
;
int
barInvocations
;
int
shared
;
late
FileSystem
fileSystem
;
late
Environment
environment
;
late
Target
fooTarget
;
late
Target
barTarget
;
late
Target
fizzTarget
;
late
Target
sharedTarget
;
late
int
fooInvocations
;
late
int
barInvocations
;
late
int
shared
;
setUp
(()
{
fileSystem
=
MemoryFileSystem
.
test
();
...
...
@@ -136,7 +134,7 @@ void main() {
expect
(
stampFile
,
exists
);
final
Map
<
String
,
dynamic
>
stampContents
=
castStringKeyedMap
(
final
Map
<
String
,
Object
?>?
stampContents
=
castStringKeyedMap
(
json
.
decode
(
stampFile
.
readAsStringSync
()));
expect
(
stampContents
,
containsPair
(
'inputs'
,
<
Object
>[
'/foo.dart'
]));
...
...
@@ -312,7 +310,7 @@ void main() {
testWithoutContext
(
'Can describe itself with JSON output'
,
()
{
environment
.
buildDir
.
createSync
(
recursive:
true
);
expect
(
fooTarget
.
toJson
(
environment
),
<
String
,
dynamic
>{
expect
(
fooTarget
.
toJson
(
environment
),
<
String
,
Object
?
>{
'inputs'
:
<
Object
>[
'/foo.dart'
,
],
...
...
@@ -685,7 +683,7 @@ void main() {
}
BuildSystem
setUpBuildSystem
(
FileSystem
fileSystem
,
[
FakePlatform
platform
])
{
BuildSystem
setUpBuildSystem
(
FileSystem
fileSystem
,
[
FakePlatform
?
platform
])
{
return
FlutterBuildSystem
(
fileSystem:
fileSystem
,
logger:
BufferLogger
.
test
(),
...
...
@@ -694,16 +692,17 @@ BuildSystem setUpBuildSystem(FileSystem fileSystem, [FakePlatform platform]) {
}
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
bool
Function
(
Environment
environment
)
_canSkip
;
final
bool
Function
(
Environment
environment
)
?
_canSkip
;
@override
bool
canSkip
(
Environment
environment
)
{
if
(
_canSkip
!=
null
)
{
return
_canSkip
(
environment
);
return
_canSkip
!
(
environment
);
}
return
super
.
canSkip
(
environment
);
}
...
...
packages/flutter_tools/test/general.shard/build_system/exceptions_test.dart
View file @
19eab105
...
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
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/exceptions.dart'
;
...
...
@@ -65,12 +63,8 @@ void main() {
}
class
TestTarget
extends
Target
{
TestTarget
([
this
.
_build
]);
final
Future
<
void
>
Function
(
Environment
environment
)
_build
;
@override
Future
<
void
>
build
(
Environment
environment
)
=>
_build
(
environment
);
Future
<
void
>
build
(
Environment
environment
)
async
{}
@override
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';
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_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
'../../src/common.dart'
;
...
...
packages/flutter_tools/test/src/test_build_system.dart
View file @
19eab105
...
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import
'dart:async'
;
import
'package:flutter_tools/src/build_system/build_system.dart'
;
...
...
@@ -28,21 +26,21 @@ class TestBuildSystem implements BuildSystem {
_onRun
=
null
;
final
List
<
BuildResult
>
_results
;
final
BuildResult
_singleResult
;
final
dynamic
_exception
;
final
void
Function
(
Target
target
,
Environment
environment
)
_onRun
;
final
BuildResult
?
_singleResult
;
final
Object
?
_exception
;
final
void
Function
(
Target
target
,
Environment
environment
)
?
_onRun
;
int
_nextResult
=
0
;
@override
Future
<
BuildResult
>
build
(
Target
target
,
Environment
environment
,
{
BuildSystemConfig
buildSystemConfig
=
const
BuildSystemConfig
()})
async
{
if
(
_onRun
!=
null
)
{
_onRun
(
target
,
environment
);
_onRun
?.
call
(
target
,
environment
);
}
if
(
_exception
!=
null
)
{
throw
_exception
;
throw
_exception
!
;
}
if
(
_singleResult
!=
null
)
{
return
_singleResult
;
return
_singleResult
!
;
}
if
(
_nextResult
>=
_results
.
length
)
{
throw
StateError
(
'Unexpected build request of
${target.name}
'
);
...
...
@@ -51,15 +49,15 @@ class TestBuildSystem implements BuildSystem {
}
@override
Future
<
BuildResult
>
buildIncremental
(
Target
target
,
Environment
environment
,
BuildResult
previousBuild
)
async
{
Future
<
BuildResult
>
buildIncremental
(
Target
target
,
Environment
environment
,
BuildResult
?
previousBuild
)
async
{
if
(
_onRun
!=
null
)
{
_onRun
(
target
,
environment
);
_onRun
?.
call
(
target
,
environment
);
}
if
(
_exception
!=
null
)
{
throw
_exception
;
throw
_exception
!
;
}
if
(
_singleResult
!=
null
)
{
return
_singleResult
;
return
_singleResult
!
;
}
if
(
_nextResult
>=
_results
.
length
)
{
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