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
70c651b0
Unverified
Commit
70c651b0
authored
Mar 24, 2020
by
Jenn Magder
Committed by
GitHub
Mar 24, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move BuildSystem to globals (#53139)
parent
0b321e67
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
19 additions
and
20 deletions
+19
-20
aot.dart
packages/flutter_tools/lib/src/aot.dart
+1
-1
build_system.dart
...ages/flutter_tools/lib/src/build_system/build_system.dart
+0
-4
bundle.dart
packages/flutter_tools/lib/src/bundle.dart
+1
-1
assemble.dart
packages/flutter_tools/lib/src/commands/assemble.dart
+1
-1
globals.dart
packages/flutter_tools/lib/src/globals.dart
+2
-0
compile.dart
packages/flutter_tools/lib/src/web/compile.dart
+1
-1
assemble_test.dart
...ter_tools/test/commands.shard/hermetic/assemble_test.dart
+7
-7
build_web_test.dart
...er_tools/test/commands.shard/hermetic/build_web_test.dart
+2
-1
build_bundle_test.dart
...ools/test/commands.shard/permeable/build_bundle_test.dart
+1
-1
bundle_shim_test.dart
...es/flutter_tools/test/general.shard/bundle_shim_test.dart
+2
-2
build_aot_test.dart
...ter_tools/test/general.shard/commands/build_aot_test.dart
+1
-1
No files found.
packages/flutter_tools/lib/src/aot.dart
View file @
70c651b0
...
...
@@ -97,7 +97,7 @@ class AotBuilder {
kIosArchs:
iosBuildArchs
.
map
(
getNameForDarwinArch
).
join
(
' '
)
}
);
final
BuildResult
result
=
await
buildSystem
.
build
(
target
,
environment
);
final
BuildResult
result
=
await
globals
.
buildSystem
.
build
(
target
,
environment
);
status
?.
stop
();
if
(!
result
.
success
)
{
...
...
packages/flutter_tools/lib/src/build_system/build_system.dart
View file @
70c651b0
...
...
@@ -10,7 +10,6 @@ import 'package:crypto/crypto.dart';
import
'package:meta/meta.dart'
;
import
'package:pool/pool.dart'
;
import
'../base/context.dart'
;
import
'../base/file_system.dart'
;
import
'../base/utils.dart'
;
import
'../cache.dart'
;
...
...
@@ -22,9 +21,6 @@ import 'source.dart';
export
'source.dart'
;
/// The [BuildSystem] instance.
BuildSystem
get
buildSystem
=>
context
.
get
<
BuildSystem
>();
/// A reasonable amount of files to open at the same time.
///
/// This number is somewhat arbitrary - it is difficult to detect whether
...
...
packages/flutter_tools/lib/src/bundle.dart
View file @
70c651b0
...
...
@@ -136,7 +136,7 @@ Future<void> buildWithAssemble({
final
Target
target
=
buildMode
==
BuildMode
.
debug
?
const
CopyFlutterBundle
()
:
const
ReleaseCopyFlutterBundle
();
final
BuildResult
result
=
await
buildSystem
.
build
(
target
,
environment
);
final
BuildResult
result
=
await
globals
.
buildSystem
.
build
(
target
,
environment
);
if
(!
result
.
success
)
{
for
(
final
ExceptionMeasurement
measurement
in
result
.
exceptions
.
values
)
{
...
...
packages/flutter_tools/lib/src/commands/assemble.dart
View file @
70c651b0
...
...
@@ -177,7 +177,7 @@ class AssembleCommand extends FlutterCommand {
Future
<
FlutterCommandResult
>
runCommand
()
async
{
final
List
<
Target
>
targets
=
this
.
targets
;
final
Target
target
=
targets
.
length
==
1
?
targets
.
single
:
_CompositeTarget
(
targets
);
final
BuildResult
result
=
await
buildSystem
.
build
(
target
,
environment
,
buildSystemConfig:
BuildSystemConfig
(
final
BuildResult
result
=
await
globals
.
buildSystem
.
build
(
target
,
environment
,
buildSystemConfig:
BuildSystemConfig
(
resourcePoolSize:
argResults
.
wasParsed
(
'resource-pool-size'
)
?
int
.
tryParse
(
stringArg
(
'resource-pool-size'
))
:
null
,
...
...
packages/flutter_tools/lib/src/globals.dart
View file @
70c651b0
...
...
@@ -20,6 +20,7 @@ import 'base/os.dart';
import
'base/template.dart'
;
import
'base/terminal.dart'
;
import
'base/user_messages.dart'
;
import
'build_system/build_system.dart'
;
import
'cache.dart'
;
import
'fuchsia/fuchsia_sdk.dart'
;
import
'ios/ios_deploy.dart'
;
...
...
@@ -34,6 +35,7 @@ import 'version.dart';
import
'web/chrome.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
>();
Logger
get
logger
=>
context
.
get
<
Logger
>();
...
...
packages/flutter_tools/lib/src/web/compile.dart
View file @
70c651b0
...
...
@@ -38,7 +38,7 @@ Future<void> buildWeb(
final
Status
status
=
globals
.
logger
.
startProgress
(
'Compiling
$target
for the Web...'
,
timeout:
null
);
final
Stopwatch
sw
=
Stopwatch
()..
start
();
try
{
final
BuildResult
result
=
await
buildSystem
.
build
(
const
WebServiceWorker
(),
Environment
.
test
(
final
BuildResult
result
=
await
globals
.
buildSystem
.
build
(
const
WebServiceWorker
(),
Environment
.
test
(
globals
.
fs
.
currentDirectory
,
outputDir:
globals
.
fs
.
directory
(
getWebBuildDirectory
()),
buildDir:
flutterProject
.
directory
...
...
packages/flutter_tools/test/commands.shard/hermetic/assemble_test.dart
View file @
70c651b0
...
...
@@ -24,7 +24,7 @@ void main() {
});
testbed
.
test
(
'Can run a build'
,
()
async
{
when
(
buildSystem
.
build
(
any
,
any
,
buildSystemConfig:
anyNamed
(
'buildSystemConfig'
)))
when
(
globals
.
buildSystem
.
build
(
any
,
any
,
buildSystemConfig:
anyNamed
(
'buildSystemConfig'
)))
.
thenAnswer
((
Invocation
invocation
)
async
{
return
BuildResult
(
success:
true
);
});
...
...
@@ -35,7 +35,7 @@ void main() {
});
testbed
.
test
(
'Can parse defines whose values contain ='
,
()
async
{
when
(
buildSystem
.
build
(
any
,
any
,
buildSystemConfig:
anyNamed
(
'buildSystemConfig'
)))
when
(
globals
.
buildSystem
.
build
(
any
,
any
,
buildSystemConfig:
anyNamed
(
'buildSystemConfig'
)))
.
thenAnswer
((
Invocation
invocation
)
async
{
expect
((
invocation
.
positionalArguments
[
1
]
as
Environment
).
defines
,
containsPair
(
'FooBar'
,
'fizz=2'
));
return
BuildResult
(
success:
true
);
...
...
@@ -47,7 +47,7 @@ void main() {
});
testbed
.
test
(
'Throws ToolExit if not provided with output'
,
()
async
{
when
(
buildSystem
.
build
(
any
,
any
,
buildSystemConfig:
anyNamed
(
'buildSystemConfig'
)))
when
(
globals
.
buildSystem
.
build
(
any
,
any
,
buildSystemConfig:
anyNamed
(
'buildSystemConfig'
)))
.
thenAnswer
((
Invocation
invocation
)
async
{
return
BuildResult
(
success:
true
);
});
...
...
@@ -58,7 +58,7 @@ void main() {
});
testbed
.
test
(
'Throws ToolExit if called with non-existent rule'
,
()
async
{
when
(
buildSystem
.
build
(
any
,
any
,
buildSystemConfig:
anyNamed
(
'buildSystemConfig'
)))
when
(
globals
.
buildSystem
.
build
(
any
,
any
,
buildSystemConfig:
anyNamed
(
'buildSystemConfig'
)))
.
thenAnswer
((
Invocation
invocation
)
async
{
return
BuildResult
(
success:
true
);
});
...
...
@@ -70,7 +70,7 @@ void main() {
testbed
.
test
(
'Does not log stack traces during build failure'
,
()
async
{
final
StackTrace
testStackTrace
=
StackTrace
.
current
;
when
(
buildSystem
.
build
(
any
,
any
,
buildSystemConfig:
anyNamed
(
'buildSystemConfig'
)))
when
(
globals
.
buildSystem
.
build
(
any
,
any
,
buildSystemConfig:
anyNamed
(
'buildSystemConfig'
)))
.
thenAnswer
((
Invocation
invocation
)
async
{
return
BuildResult
(
success:
false
,
exceptions:
<
String
,
ExceptionMeasurement
>{
'hello'
:
ExceptionMeasurement
(
'hello'
,
'bar'
,
testStackTrace
),
...
...
@@ -85,7 +85,7 @@ void main() {
});
testbed
.
test
(
'Only writes input and output files when the values change'
,
()
async
{
when
(
buildSystem
.
build
(
any
,
any
,
buildSystemConfig:
anyNamed
(
'buildSystemConfig'
)))
when
(
globals
.
buildSystem
.
build
(
any
,
any
,
buildSystemConfig:
anyNamed
(
'buildSystemConfig'
)))
.
thenAnswer
((
Invocation
invocation
)
async
{
return
BuildResult
(
success:
true
,
...
...
@@ -122,7 +122,7 @@ void main() {
expect
(
inputs
.
lastModifiedSync
(),
theDistantPast
);
expect
(
outputs
.
lastModifiedSync
(),
theDistantPast
);
when
(
buildSystem
.
build
(
any
,
any
,
buildSystemConfig:
anyNamed
(
'buildSystemConfig'
)))
when
(
globals
.
buildSystem
.
build
(
any
,
any
,
buildSystemConfig:
anyNamed
(
'buildSystemConfig'
)))
.
thenAnswer
((
Invocation
invocation
)
async
{
return
BuildResult
(
success:
true
,
...
...
packages/flutter_tools/test/commands.shard/hermetic/build_web_test.dart
View file @
70c651b0
...
...
@@ -15,6 +15,7 @@ import 'package:flutter_tools/src/commands/build_web.dart';
import
'package:flutter_tools/src/dart/pub.dart'
;
import
'package:flutter_tools/src/device.dart'
;
import
'package:flutter_tools/src/features.dart'
;
import
'package:flutter_tools/src/globals.dart'
as
globals
;
import
'package:flutter_tools/src/project.dart'
;
import
'package:flutter_tools/src/build_runner/resident_web_runner.dart'
;
import
'package:flutter_tools/src/web/compile.dart'
;
...
...
@@ -169,7 +170,7 @@ class UrlLauncherPlugin {}
// Process calls. We're not testing that these invocations are correct because
// that is covered in targets/web_test.dart.
when
(
buildSystem
.
build
(
any
,
any
)).
thenAnswer
((
Invocation
invocation
)
async
{
when
(
globals
.
buildSystem
.
build
(
any
,
any
)).
thenAnswer
((
Invocation
invocation
)
async
{
return
BuildResult
(
success:
true
);
});
await
runner
.
run
(<
String
>[
'build'
,
'web'
]);
...
...
packages/flutter_tools/test/commands.shard/permeable/build_bundle_test.dart
View file @
70c651b0
...
...
@@ -212,7 +212,7 @@ void main() {
globals
.
fs
.
file
(
'pubspec.yaml'
).
createSync
();
globals
.
fs
.
file
(
'.packages'
).
createSync
();
final
CommandRunner
<
void
>
runner
=
createTestCommandRunner
(
BuildBundleCommand
());
when
(
buildSystem
.
build
(
any
,
any
)).
thenAnswer
((
Invocation
invocation
)
async
{
when
(
globals
.
buildSystem
.
build
(
any
,
any
)).
thenAnswer
((
Invocation
invocation
)
async
{
final
Environment
environment
=
invocation
.
positionalArguments
[
1
]
as
Environment
;
expect
(
environment
.
defines
,
<
String
,
String
>{
kTargetFile:
globals
.
fs
.
path
.
join
(
'lib'
,
'main.dart'
),
...
...
packages/flutter_tools/test/general.shard/bundle_shim_test.dart
View file @
70c651b0
...
...
@@ -23,7 +23,7 @@ void main() {
});
test
(
'Copies assets to expected directory after building'
,
()
=>
testbed
.
run
(()
async
{
when
(
buildSystem
.
build
(
any
,
any
)).
thenAnswer
((
Invocation
invocation
)
async
{
when
(
globals
.
buildSystem
.
build
(
any
,
any
)).
thenAnswer
((
Invocation
invocation
)
async
{
final
Environment
environment
=
invocation
.
positionalArguments
[
1
]
as
Environment
;
environment
.
outputDir
.
childFile
(
'kernel_blob.bin'
).
createSync
(
recursive:
true
);
environment
.
outputDir
.
childFile
(
'isolate_snapshot_data'
).
createSync
();
...
...
@@ -47,7 +47,7 @@ void main() {
}));
test
(
'Handles build system failure'
,
()
=>
testbed
.
run
(()
{
when
(
buildSystem
.
build
(
any
,
any
)).
thenAnswer
((
Invocation
_
)
async
{
when
(
globals
.
buildSystem
.
build
(
any
,
any
)).
thenAnswer
((
Invocation
_
)
async
{
return
BuildResult
(
success:
false
,
exceptions:
<
String
,
ExceptionMeasurement
>{},
...
...
packages/flutter_tools/test/general.shard/commands/build_aot_test.dart
View file @
70c651b0
...
...
@@ -111,7 +111,7 @@ void main() {
testUsingContext
(
'build aot outputs timing info'
,
()
async
{
globals
.
fs
.
file
(
'.dart_tool/flutter_build/cce09742720db17ffec62331bd7e42d5/app.so'
)
.
createSync
(
recursive:
true
);
when
(
buildSystem
.
build
(
any
,
any
))
when
(
globals
.
buildSystem
.
build
(
any
,
any
))
.
thenAnswer
((
Invocation
invocation
)
async
{
return
BuildResult
(
success:
true
,
performance:
<
String
,
PerformanceMeasurement
>{
'kernel_snapshot'
:
PerformanceMeasurement
(
...
...
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