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
8df0d686
Unverified
Commit
8df0d686
authored
Apr 22, 2020
by
Jonah Williams
Committed by
GitHub
Apr 22, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] remove globals from pub (#55412)
parent
cbc121e3
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
731 additions
and
342 deletions
+731
-342
packages.dart
packages/flutter_tools/lib/src/commands/packages.dart
+3
-3
context_runner.dart
packages/flutter_tools/lib/src/context_runner.dart
+8
-1
pub.dart
packages/flutter_tools/lib/src/dart/pub.dart
+157
-121
events.dart
packages/flutter_tools/lib/src/reporting/events.dart
+2
-1
analyze_continuously_test.dart
...st/commands.shard/hermetic/analyze_continuously_test.dart
+19
-2
create_test.dart
...tter_tools/test/commands.shard/permeable/create_test.dart
+152
-19
packages_test.dart
...er_tools/test/commands.shard/permeable/packages_test.dart
+184
-23
pub_get_test.dart
...s/flutter_tools/test/general.shard/dart/pub_get_test.dart
+203
-171
throwing_pub.dart
packages/flutter_tools/test/src/throwing_pub.dart
+3
-1
No files found.
packages/flutter_tools/lib/src/commands/packages.dart
View file @
8df0d686
...
...
@@ -205,7 +205,7 @@ class PackagesPublishCommand extends FlutterCommand {
if
(
boolArg
(
'force'
))
'--force'
,
];
Cache
.
releaseLockEarly
();
await
pub
.
interactively
(<
String
>[
'publish'
,
...
args
]);
await
pub
.
interactively
(<
String
>[
'publish'
,
...
args
]
,
stdio:
globals
.
stdio
);
return
FlutterCommandResult
.
success
();
}
}
...
...
@@ -236,7 +236,7 @@ class PackagesForwardCommand extends FlutterCommand {
@override
Future
<
FlutterCommandResult
>
runCommand
()
async
{
Cache
.
releaseLockEarly
();
await
pub
.
interactively
(<
String
>[
_commandName
,
...
argResults
.
rest
]);
await
pub
.
interactively
(<
String
>[
_commandName
,
...
argResults
.
rest
]
,
stdio:
globals
.
stdio
);
return
FlutterCommandResult
.
success
();
}
...
...
@@ -264,7 +264,7 @@ class PackagesPassthroughCommand extends FlutterCommand {
@override
Future
<
FlutterCommandResult
>
runCommand
()
async
{
Cache
.
releaseLockEarly
();
await
pub
.
interactively
(
argResults
.
rest
);
await
pub
.
interactively
(
argResults
.
rest
,
stdio:
globals
.
stdio
);
return
FlutterCommandResult
.
success
();
}
}
packages/flutter_tools/lib/src/context_runner.dart
View file @
8df0d686
...
...
@@ -167,7 +167,14 @@ Future<T> runInContext<T>(
processManager:
globals
.
processManager
,
logger:
globals
.
logger
,
),
Pub:
()
=>
const
Pub
(),
Pub:
()
=>
Pub
(
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
processManager:
globals
.
processManager
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
usage:
globals
.
flutterUsage
,
),
ShutdownHooks:
()
=>
ShutdownHooks
(
logger:
globals
.
logger
),
Signals:
()
=>
Signals
(),
Stdio:
()
=>
Stdio
(),
...
...
packages/flutter_tools/lib/src/dart/pub.dart
View file @
8df0d686
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/reporting/events.dart
View file @
8df0d686
...
...
@@ -129,7 +129,8 @@ class PubResultEvent extends UsageEvent {
PubResultEvent
({
@required
String
context
,
@required
String
result
,
})
:
super
(
'pub-result'
,
context
,
label:
result
,
flutterUsage:
globals
.
flutterUsage
);
@required
Usage
usage
,
})
:
super
(
'pub-result'
,
context
,
label:
result
,
flutterUsage:
usage
);
}
/// An event that reports something about a build.
...
...
packages/flutter_tools/test/commands.shard/hermetic/analyze_continuously_test.dart
View file @
8df0d686
...
...
@@ -15,6 +15,7 @@ import 'package:flutter_tools/src/dart/sdk.dart';
import
'package:flutter_tools/src/runner/flutter_command_runner.dart'
;
import
'package:platform/platform.dart'
;
import
'package:process/process.dart'
;
import
'package:flutter_tools/src/globals.dart'
as
globals
;
import
'../../src/common.dart'
;
import
'../../src/context.dart'
;
...
...
@@ -65,7 +66,15 @@ void main() {
testUsingContext
(
'AnalysisServer success'
,
()
async
{
_createSampleProject
(
tempDir
);
await
const
Pub
().
get
(
context:
PubContext
.
flutterTests
,
directory:
tempDir
.
path
);
final
Pub
pub
=
Pub
(
fileSystem:
fileSystem
,
logger:
logger
,
processManager:
processManager
,
platform:
const
LocalPlatform
(),
botDetector:
globals
.
botDetector
,
usage:
globals
.
flutterUsage
,
);
await
pub
.
get
(
context:
PubContext
.
flutterTests
,
directory:
tempDir
.
path
);
server
=
AnalysisServer
(
dartSdkPath
,
<
String
>[
tempDir
.
path
],
fileSystem:
fileSystem
,
...
...
@@ -90,7 +99,15 @@ void main() {
testUsingContext
(
'AnalysisServer errors'
,
()
async
{
_createSampleProject
(
tempDir
,
brokenCode:
true
);
await
const
Pub
().
get
(
context:
PubContext
.
flutterTests
,
directory:
tempDir
.
path
);
final
Pub
pub
=
Pub
(
fileSystem:
fileSystem
,
logger:
logger
,
processManager:
processManager
,
platform:
const
LocalPlatform
(),
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
);
await
pub
.
get
(
context:
PubContext
.
flutterTests
,
directory:
tempDir
.
path
);
server
=
AnalysisServer
(
dartSdkPath
,
<
String
>[
tempDir
.
path
],
fileSystem:
fileSystem
,
...
...
packages/flutter_tools/test/commands.shard/permeable/create_test.dart
View file @
8df0d686
...
...
@@ -86,7 +86,14 @@ void main() {
);
return
_runFlutterTest
(
projectDir
);
},
overrides:
<
Type
,
Generator
>{
Pub:
()
=>
const
Pub
(),
Pub:
()
=>
Pub
(
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
processManager:
globals
.
processManager
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
),
});
testUsingContext
(
'can create a default project if empty directory exists'
,
()
async
{
...
...
@@ -104,7 +111,14 @@ void main() {
],
);
},
overrides:
<
Type
,
Generator
>{
Pub:
()
=>
const
Pub
(),
Pub:
()
=>
Pub
(
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
processManager:
globals
.
processManager
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
),
});
testUsingContext
(
'creates a module project correctly'
,
()
async
{
...
...
@@ -126,7 +140,14 @@ void main() {
]);
return
_runFlutterTest
(
projectDir
);
},
overrides:
<
Type
,
Generator
>{
Pub:
()
=>
const
Pub
(),
Pub:
()
=>
Pub
(
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
processManager:
globals
.
processManager
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
),
});
testUsingContext
(
'cannot create a project if non-empty non-project directory exists with .metadata'
,
()
async
{
...
...
@@ -144,7 +165,14 @@ void main() {
]),
throwsToolExit
(
message:
'Sorry, unable to detect the type of project to recreate'
));
},
overrides:
<
Type
,
Generator
>{
Pub:
()
=>
const
Pub
(),
Pub:
()
=>
Pub
(
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
processManager:
globals
.
processManager
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
),
...
noColorTerminalOverride
,
});
...
...
@@ -170,7 +198,14 @@ void main() {
],
);
},
overrides:
<
Type
,
Generator
>{
Pub:
()
=>
const
Pub
(),
Pub:
()
=>
Pub
(
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
processManager:
globals
.
processManager
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
),
});
testUsingContext
(
'detects and recreates an app project correctly'
,
()
async
{
...
...
@@ -195,7 +230,14 @@ void main() {
],
);
},
overrides:
<
Type
,
Generator
>{
Pub:
()
=>
const
Pub
(),
Pub:
()
=>
Pub
(
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
processManager:
globals
.
processManager
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
),
});
testUsingContext
(
'detects and recreates a plugin project correctly'
,
()
async
{
...
...
@@ -220,7 +262,14 @@ void main() {
],
);
},
overrides:
<
Type
,
Generator
>{
Pub:
()
=>
const
Pub
(),
Pub:
()
=>
Pub
(
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
processManager:
globals
.
processManager
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
),
});
testUsingContext
(
'detects and recreates a package project correctly'
,
()
async
{
...
...
@@ -251,7 +300,14 @@ void main() {
],
);
},
overrides:
<
Type
,
Generator
>{
Pub:
()
=>
const
Pub
(),
Pub:
()
=>
Pub
(
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
processManager:
globals
.
processManager
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
),
});
testUsingContext
(
'kotlin/swift legacy app project'
,
()
async
{
...
...
@@ -273,7 +329,14 @@ void main() {
],
);
},
overrides:
<
Type
,
Generator
>{
Pub:
()
=>
const
Pub
(),
Pub:
()
=>
Pub
(
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
processManager:
globals
.
processManager
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
),
});
testUsingContext
(
'can create a package project'
,
()
async
{
...
...
@@ -303,7 +366,14 @@ void main() {
);
return
_runFlutterTest
(
projectDir
);
},
overrides:
<
Type
,
Generator
>{
Pub:
()
=>
const
Pub
(),
Pub:
()
=>
Pub
(
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
processManager:
globals
.
processManager
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
),
});
testUsingContext
(
'can create a plugin project'
,
()
async
{
...
...
@@ -325,7 +395,14 @@ void main() {
);
return
_runFlutterTest
(
projectDir
.
childDirectory
(
'example'
));
},
overrides:
<
Type
,
Generator
>{
Pub:
()
=>
const
Pub
(),
Pub:
()
=>
Pub
(
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
processManager:
globals
.
processManager
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
),
});
testUsingContext
(
'plugin example app depends on plugin'
,
()
async
{
...
...
@@ -344,7 +421,14 @@ void main() {
final
PathDependency
pathDependency
=
pubspec
.
dependencies
[
pluginName
]
as
PathDependency
;
expect
(
pathDependency
.
path
,
'../'
);
},
overrides:
<
Type
,
Generator
>{
Pub:
()
=>
const
Pub
(),
Pub:
()
=>
Pub
(
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
processManager:
globals
.
processManager
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
),
});
testUsingContext
(
'kotlin/swift plugin project'
,
()
async
{
...
...
@@ -429,7 +513,14 @@ void main() {
<
String
>[
'lib/main.dart'
],
);
},
overrides:
<
Type
,
Generator
>{
Pub:
()
=>
const
Pub
(),
Pub:
()
=>
Pub
(
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
processManager:
globals
.
processManager
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
),
});
testUsingContext
(
'module project with pub'
,
()
async
{
...
...
@@ -464,7 +555,14 @@ void main() {
'.android/Flutter/src/main/java/io/flutter/facade/Flutter.java'
,
]);
},
overrides:
<
Type
,
Generator
>{
Pub:
()
=>
const
Pub
(),
Pub:
()
=>
Pub
(
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
processManager:
globals
.
processManager
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
),
});
...
...
@@ -1038,7 +1136,14 @@ void main() {
],
);
},
overrides:
<
Type
,
Generator
>{
Pub:
()
=>
const
Pub
(),
Pub:
()
=>
Pub
(
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
processManager:
globals
.
processManager
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
),
});
testUsingContext
(
'can re-gen module .ios/ folder, reusing custom org'
,
()
async
{
...
...
@@ -1055,7 +1160,14 @@ void main() {
'com.bar.foo.flutterProject'
,
);
},
overrides:
<
Type
,
Generator
>{
Pub:
()
=>
const
Pub
(),
Pub:
()
=>
Pub
(
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
processManager:
globals
.
processManager
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
),
});
testUsingContext
(
'can re-gen app android/ folder, reusing custom org'
,
()
async
{
...
...
@@ -1210,7 +1322,14 @@ void main() {
],
);
},
overrides:
<
Type
,
Generator
>{
Pub:
()
=>
const
Pub
(),
Pub:
()
=>
Pub
(
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
processManager:
globals
.
processManager
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
),
});
testUsingContext
(
...
...
@@ -1227,7 +1346,14 @@ void main() {
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
loggingProcessManager
,
Pub:
()
=>
const
Pub
(),
Pub:
()
=>
Pub
(
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
processManager:
globals
.
processManager
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
),
},
);
...
...
@@ -1245,7 +1371,14 @@ void main() {
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
loggingProcessManager
,
Pub:
()
=>
const
Pub
(),
Pub:
()
=>
Pub
(
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
processManager:
globals
.
processManager
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
),
},
);
...
...
packages/flutter_tools/test/commands.shard/permeable/packages_test.dart
View file @
8df0d686
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/general.shard/dart/pub_get_test.dart
View file @
8df0d686
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/src/throwing_pub.dart
View file @
8df0d686
...
...
@@ -4,7 +4,9 @@
import
'dart:async'
;
import
'package:flutter_tools/src/base/io.dart'
;
import
'package:flutter_tools/src/dart/pub.dart'
;
import
'package:meta/meta.dart'
;
class
ThrowingPub
implements
Pub
{
@override
...
...
@@ -34,7 +36,7 @@ class ThrowingPub implements Pub {
}
@override
Future
<
void
>
interactively
(
List
<
String
>
arguments
,
{
String
directory
})
{
Future
<
void
>
interactively
(
List
<
String
>
arguments
,
{
String
directory
,
@required
Stdio
stdio
,
})
{
throw
UnsupportedError
(
'Attempted to invoke pub during test.'
);
}
}
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