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
84bc2382
Unverified
Commit
84bc2382
authored
Apr 23, 2021
by
Jonah Williams
Committed by
GitHub
Apr 23, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] do not check for pubspec.yaml in packages forward command (#81059)
parent
307e3819
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
35 deletions
+59
-35
packages.dart
packages/flutter_tools/lib/src/commands/packages.dart
+33
-35
packages_test.dart
...er_tools/test/commands.shard/permeable/packages_test.dart
+26
-0
No files found.
packages/flutter_tools/lib/src/commands/packages.dart
View file @
84bc2382
...
...
@@ -23,7 +23,6 @@ import '../runner/flutter_command.dart';
class
PackagesCommand
extends
FlutterCommand
{
PackagesCommand
()
{
addSubcommand
(
PackagesGetCommand
(
'get'
,
false
));
//addSubcommand(PackagesGetCommand('upgrade', true));
addSubcommand
(
PackagesInteractiveGetCommand
(
'upgrade'
,
'Upgrade the current package
\'
s dependencies to latest versions.'
));
addSubcommand
(
PackagesInteractiveGetCommand
(
'add'
,
'Add a dependency to pubspec.yaml.'
));
addSubcommand
(
PackagesInteractiveGetCommand
(
'remove'
,
'Removes a dependency from the current package.'
));
...
...
@@ -271,9 +270,7 @@ class PackagesPassthroughCommand extends FlutterCommand {
}
class
PackagesInteractiveGetCommand
extends
FlutterCommand
{
PackagesInteractiveGetCommand
(
this
.
_commandName
,
this
.
_description
)
{
requiresPubspecYaml
();
}
PackagesInteractiveGetCommand
(
this
.
_commandName
,
this
.
_description
);
@override
ArgParser
argParser
=
ArgParser
.
allowAnything
();
...
...
@@ -298,10 +295,9 @@ class PackagesInteractiveGetCommand extends FlutterCommand {
@override
Future
<
FlutterCommandResult
>
runCommand
()
async
{
List
<
String
>
rest
=
argResults
.
rest
;
final
bool
isHelp
=
rest
.
contains
(
'-h'
)
||
rest
.
contains
(
'--help'
);
String
target
;
if
(
rest
.
length
==
1
&&
(
rest
[
0
].
contains
(
'/'
)
||
rest
[
0
].
contains
(
r'\'
)))
{
if
(
rest
.
length
==
1
&&
(
rest
[
0
].
contains
(
'/'
)
||
rest
[
0
].
contains
(
r'\'
)))
{
// HACK: Supporting flutter specific behavior where you can pass a
// folder to the command.
target
=
findProjectRoot
(
globals
.
fs
,
rest
[
0
]);
...
...
@@ -309,43 +305,45 @@ class PackagesInteractiveGetCommand extends FlutterCommand {
}
else
{
target
=
findProjectRoot
(
globals
.
fs
);
}
if
(
target
==
null
)
{
throwToolExit
(
'Expected to find project root in '
'current working directory.'
);
}
final
FlutterProject
flutterProject
=
FlutterProject
.
fromDirectory
(
globals
.
fs
.
directory
(
target
));
if
(
flutterProject
.
manifest
.
generateSyntheticPackage
)
{
final
Environment
environment
=
Environment
(
artifacts:
globals
.
artifacts
,
logger:
globals
.
logger
,
cacheDir:
globals
.
cache
.
getRoot
(),
engineVersion:
globals
.
flutterVersion
.
engineRevision
,
fileSystem:
globals
.
fs
,
flutterRootDir:
globals
.
fs
.
directory
(
Cache
.
flutterRoot
),
outputDir:
globals
.
fs
.
directory
(
getBuildDirectory
()),
processManager:
globals
.
processManager
,
platform:
globals
.
platform
,
projectDir:
flutterProject
.
directory
,
);
await
generateLocalizationsSyntheticPackage
(
environment:
environment
,
buildSystem:
globals
.
buildSystem
,
);
FlutterProject
flutterProject
;
if
(!
isHelp
)
{
if
(
target
==
null
)
{
throwToolExit
(
'Expected to find project root in current working directory.'
);
}
flutterProject
=
FlutterProject
.
fromDirectory
(
globals
.
fs
.
directory
(
target
));
if
(
flutterProject
.
manifest
.
generateSyntheticPackage
)
{
final
Environment
environment
=
Environment
(
artifacts:
globals
.
artifacts
,
logger:
globals
.
logger
,
cacheDir:
globals
.
cache
.
getRoot
(),
engineVersion:
globals
.
flutterVersion
.
engineRevision
,
fileSystem:
globals
.
fs
,
flutterRootDir:
globals
.
fs
.
directory
(
Cache
.
flutterRoot
),
outputDir:
globals
.
fs
.
directory
(
getBuildDirectory
()),
processManager:
globals
.
processManager
,
platform:
globals
.
platform
,
projectDir:
flutterProject
.
directory
,
);
await
generateLocalizationsSyntheticPackage
(
environment:
environment
,
buildSystem:
globals
.
buildSystem
,
);
}
}
final
List
<
String
>
subArgs
=
rest
.
toList
()
..
removeWhere
((
String
arg
)
=>
arg
==
'--'
);
final
List
<
String
>
subArgs
=
rest
.
toList
()..
removeWhere
((
String
arg
)
=>
arg
==
'--'
);
await
pub
.
interactively
(
<
String
>[
name
,
...
subArgs
],
directory:
target
,
stdio:
globals
.
stdio
,
touchesPackageConfig:
true
,
generateSyntheticPackage:
flutterProject
.
manifest
.
generateSyntheticPackag
e
,
touchesPackageConfig:
!
isHelp
,
generateSyntheticPackage:
flutterProject
?.
manifest
?.
generateSyntheticPackage
??
fals
e
,
);
await
flutterProject
.
regeneratePlatformSpecificTooling
();
await
flutterProject
?
.
regeneratePlatformSpecificTooling
();
return
FlutterCommandResult
.
success
();
}
}
packages/flutter_tools/test/commands.shard/permeable/packages_test.dart
View file @
84bc2382
...
...
@@ -525,5 +525,31 @@ void main() {
platform:
globals
.
platform
,
),
});
testUsingContext
(
'upgrade does not check for pubspec.yaml if -h/--help is passed'
,
()
async
{
Cache
.
flutterRoot
=
''
;
processManager
.
addCommand
(
FakeCommand
(
command:
const
<
String
>[
'/bin/cache/dart-sdk/bin/pub'
,
'upgrade'
,
'-h'
],
stdin:
IOSink
(
StreamController
<
List
<
int
>>().
sink
),
),
);
await
createTestCommandRunner
(
PackagesCommand
()).
run
(<
String
>[
'pub'
,
'upgrade'
,
'-h'
]);
expect
(
processManager
,
hasNoRemainingExpectations
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
Platform:
()
=>
FakePlatform
(
operatingSystem:
'linux'
,
environment:
<
String
,
String
>{}),
ProcessManager:
()
=>
processManager
,
Stdio:
()
=>
mockStdio
,
Pub:
()
=>
Pub
(
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
processManager:
globals
.
processManager
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
),
});
});
}
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