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
222c2cb0
Unverified
Commit
222c2cb0
authored
Jun 11, 2020
by
Jenn Magder
Committed by
GitHub
Jun 11, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Deprecate make-host-app-editable (#59217)
parent
3fc364cf
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
34 deletions
+50
-34
make_host_app_editable.dart
...lutter_tools/lib/src/commands/make_host_app_editable.dart
+3
-30
flutter_command.dart
packages/flutter_tools/lib/src/runner/flutter_command.dart
+17
-0
flutter_command_test.dart
...tools/test/general.shard/runner/flutter_command_test.dart
+24
-3
command_output_test.dart
...ter_tools/test/integration.shard/command_output_test.dart
+6
-1
No files found.
packages/flutter_tools/lib/src/commands/make_host_app_editable.dart
View file @
222c2cb0
...
@@ -3,8 +3,6 @@
...
@@ -3,8 +3,6 @@
// found in the LICENSE file.
// found in the LICENSE file.
import
'dart:async'
;
import
'dart:async'
;
import
'../base/common.dart'
;
import
'../project.dart'
;
import
'../runner/flutter_command.dart'
;
import
'../runner/flutter_command.dart'
;
class
MakeHostAppEditableCommand
extends
FlutterCommand
{
class
MakeHostAppEditableCommand
extends
FlutterCommand
{
...
@@ -23,43 +21,18 @@ class MakeHostAppEditableCommand extends FlutterCommand {
...
@@ -23,43 +21,18 @@ class MakeHostAppEditableCommand extends FlutterCommand {
);
);
}
}
FlutterProject
_project
;
@override
@override
final
String
name
=
'make-host-app-editable'
;
final
String
name
=
'make-host-app-editable'
;
@override
@override
final
String
description
=
'Moves host apps from generated directories to non-generated directories so that they can be edited by developers.
\n\n
'
bool
get
deprecated
=>
true
;
'Use flags to specify which host app to make editable. If no flags are provided then all host apps will be made editable.
\n\n
'
'Once a host app is made editable, that host app cannot be regenerated by Flutter and it will not receive future template changes.'
;
@override
@override
Future
<
void
>
validateCommand
()
async
{
final
String
description
=
'Moves host apps from generated directories to non-generated directories so that they can be edited by developers.'
;
await
super
.
validateCommand
();
_project
=
FlutterProject
.
current
();
if
(!
_project
.
isModule
)
{
throw
ToolExit
(
"Only projects created using 'flutter create -t module' can have their host apps made editable."
);
}
}
@override
@override
Future
<
FlutterCommandResult
>
runCommand
()
async
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
await
_project
.
ensureReadyForPlatformSpecificTooling
(
checkProjects:
false
);
// Deprecated. No-op.
final
bool
isAndroidRequested
=
boolArg
(
'android'
);
final
bool
isIOSRequested
=
boolArg
(
'ios'
);
if
(
isAndroidRequested
==
isIOSRequested
)
{
// No flags provided, or both flags provided. Make Android and iOS host
// apps editable.
await
_project
.
android
.
makeHostAppEditable
();
await
_project
.
ios
.
makeHostAppEditable
();
}
else
if
(
isAndroidRequested
)
{
await
_project
.
android
.
makeHostAppEditable
();
}
else
if
(
isIOSRequested
)
{
await
_project
.
ios
.
makeHostAppEditable
();
}
return
FlutterCommandResult
.
success
();
return
FlutterCommandResult
.
success
();
}
}
}
}
packages/flutter_tools/lib/src/runner/flutter_command.dart
View file @
222c2cb0
...
@@ -15,6 +15,7 @@ import '../base/common.dart';
...
@@ -15,6 +15,7 @@ import '../base/common.dart';
import
'../base/context.dart'
;
import
'../base/context.dart'
;
import
'../base/io.dart'
as
io
;
import
'../base/io.dart'
as
io
;
import
'../base/signals.dart'
;
import
'../base/signals.dart'
;
import
'../base/terminal.dart'
;
import
'../base/user_messages.dart'
;
import
'../base/user_messages.dart'
;
import
'../base/utils.dart'
;
import
'../base/utils.dart'
;
import
'../build_info.dart'
;
import
'../build_info.dart'
;
...
@@ -150,6 +151,11 @@ abstract class FlutterCommand extends Command<void> {
...
@@ -150,6 +151,11 @@ abstract class FlutterCommand extends Command<void> {
bool
get
shouldUpdateCache
=>
true
;
bool
get
shouldUpdateCache
=>
true
;
bool
get
deprecated
=>
false
;
@override
bool
get
hidden
=>
deprecated
;
bool
_excludeDebug
=
false
;
bool
_excludeDebug
=
false
;
BuildMode
_defaultBuildMode
;
BuildMode
_defaultBuildMode
;
...
@@ -715,6 +721,7 @@ abstract class FlutterCommand extends Command<void> {
...
@@ -715,6 +721,7 @@ abstract class FlutterCommand extends Command<void> {
body:
()
async
{
body:
()
async
{
// Prints the welcome message if needed.
// Prints the welcome message if needed.
globals
.
flutterUsage
.
printWelcome
();
globals
.
flutterUsage
.
printWelcome
();
_printDeprecationWarning
();
final
String
commandPath
=
await
usagePath
;
final
String
commandPath
=
await
usagePath
;
_registerSignalHandlers
(
commandPath
,
startTime
);
_registerSignalHandlers
(
commandPath
,
startTime
);
FlutterCommandResult
commandResult
=
FlutterCommandResult
.
fail
();
FlutterCommandResult
commandResult
=
FlutterCommandResult
.
fail
();
...
@@ -729,6 +736,14 @@ abstract class FlutterCommand extends Command<void> {
...
@@ -729,6 +736,14 @@ abstract class FlutterCommand extends Command<void> {
);
);
}
}
void
_printDeprecationWarning
()
{
if
(
deprecated
)
{
globals
.
printStatus
(
'
$warningMark
The "
$name
" command is deprecated and '
'will be removed in a future version of Flutter.'
);
globals
.
printStatus
(
''
);
}
}
void
_registerSignalHandlers
(
String
commandPath
,
DateTime
startTime
)
{
void
_registerSignalHandlers
(
String
commandPath
,
DateTime
startTime
)
{
final
SignalHandler
handler
=
(
io
.
ProcessSignal
s
)
{
final
SignalHandler
handler
=
(
io
.
ProcessSignal
s
)
{
Cache
.
releaseLock
();
Cache
.
releaseLock
();
...
@@ -948,6 +963,8 @@ abstract class FlutterCommand extends Command<void> {
...
@@ -948,6 +963,8 @@ abstract class FlutterCommand extends Command<void> {
description
.
length
+
2
,
description
.
length
+
2
,
);
);
final
String
help
=
<
String
>[
final
String
help
=
<
String
>[
if
(
deprecated
)
'
$warningMark
Deprecated. This command will be removed in a future version of Flutter.'
,
description
,
description
,
''
,
''
,
'Global options:'
,
'Global options:'
,
...
...
packages/flutter_tools/test/general.shard/runner/flutter_command_test.dart
View file @
222c2cb0
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
import
'dart:async'
;
import
'dart:async'
;
import
'dart:io'
as
io
;
import
'dart:io'
as
io
;
import
'package:args/command_runner.dart'
;
import
'package:flutter_tools/src/base/common.dart'
;
import
'package:flutter_tools/src/base/common.dart'
;
import
'package:flutter_tools/src/base/error_handling_file_system.dart'
;
import
'package:flutter_tools/src/base/error_handling_file_system.dart'
;
import
'package:flutter_tools/src/base/io.dart'
;
import
'package:flutter_tools/src/base/io.dart'
;
...
@@ -43,7 +44,7 @@ void main() {
...
@@ -43,7 +44,7 @@ void main() {
});
});
testUsingContext
(
'help text contains global options'
,
()
{
testUsingContext
(
'help text contains global options'
,
()
{
final
Fake
Command
fake
=
Fake
Command
();
final
Fake
DeprecatedCommand
fake
=
FakeDeprecated
Command
();
createTestCommandRunner
(
fake
);
createTestCommandRunner
(
fake
);
expect
(
fake
.
usage
,
contains
(
'Global options:
\n
'
));
expect
(
fake
.
usage
,
contains
(
'Global options:
\n
'
));
});
});
...
@@ -52,6 +53,8 @@ void main() {
...
@@ -52,6 +53,8 @@ void main() {
final
DummyFlutterCommand
flutterCommand
=
DummyFlutterCommand
(
shouldUpdateCache:
false
);
final
DummyFlutterCommand
flutterCommand
=
DummyFlutterCommand
(
shouldUpdateCache:
false
);
await
flutterCommand
.
run
();
await
flutterCommand
.
run
();
verifyZeroInteractions
(
cache
);
verifyZeroInteractions
(
cache
);
expect
(
flutterCommand
.
deprecated
,
isFalse
);
expect
(
flutterCommand
.
hidden
,
isFalse
);
},
},
overrides:
<
Type
,
Generator
>{
overrides:
<
Type
,
Generator
>{
Cache:
()
=>
cache
,
Cache:
()
=>
cache
,
...
@@ -73,6 +76,21 @@ void main() {
...
@@ -73,6 +76,21 @@ void main() {
Cache:
()
=>
cache
,
Cache:
()
=>
cache
,
});
});
testUsingContext
(
'deprecated command should warn'
,
()
async
{
final
FakeDeprecatedCommand
flutterCommand
=
FakeDeprecatedCommand
();
final
CommandRunner
<
void
>
runner
=
createTestCommandRunner
(
flutterCommand
);
await
runner
.
run
(<
String
>[
'deprecated'
]);
expect
(
testLogger
.
statusText
,
contains
(
'The "deprecated" command is deprecated and will be removed in '
'a future version of Flutter.'
));
expect
(
flutterCommand
.
usage
,
contains
(
'Deprecated. This command will be removed in a future version '
'of Flutter.'
));
expect
(
flutterCommand
.
deprecated
,
isTrue
);
expect
(
flutterCommand
.
hidden
,
isTrue
);
});
testUsingContext
(
'uses the error handling file system'
,
()
async
{
testUsingContext
(
'uses the error handling file system'
,
()
async
{
final
DummyFlutterCommand
flutterCommand
=
DummyFlutterCommand
(
final
DummyFlutterCommand
flutterCommand
=
DummyFlutterCommand
(
commandFunction:
()
async
{
commandFunction:
()
async
{
...
@@ -429,12 +447,15 @@ void main() {
...
@@ -429,12 +447,15 @@ void main() {
});
});
}
}
class
FakeCommand
extends
FlutterCommand
{
class
Fake
Deprecated
Command
extends
FlutterCommand
{
@override
@override
String
get
description
=>
'A fake command'
;
String
get
description
=>
'A fake command'
;
@override
@override
String
get
name
=>
'fake'
;
String
get
name
=>
'deprecated'
;
@override
bool
get
deprecated
=>
true
;
@override
@override
Future
<
FlutterCommandResult
>
runCommand
()
async
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
...
...
packages/flutter_tools/test/integration.shard/command_output_test.dart
View file @
222c2cb0
...
@@ -9,7 +9,7 @@ import 'package:process/process.dart';
...
@@ -9,7 +9,7 @@ import 'package:process/process.dart';
import
'../src/common.dart'
;
import
'../src/common.dart'
;
void
main
(
)
{
void
main
(
)
{
test
(
'All development tools are hidden and help text is not verbose'
,
()
async
{
test
(
'All development tools a
nd deprecated commands a
re hidden and help text is not verbose'
,
()
async
{
final
String
flutterBin
=
globals
.
fs
.
path
.
join
(
getFlutterRoot
(),
'bin'
,
'flutter'
);
final
String
flutterBin
=
globals
.
fs
.
path
.
join
(
getFlutterRoot
(),
'bin'
,
'flutter'
);
final
ProcessResult
result
=
await
const
LocalProcessManager
().
run
(<
String
>[
final
ProcessResult
result
=
await
const
LocalProcessManager
().
run
(<
String
>[
flutterBin
,
flutterBin
,
...
@@ -17,9 +17,14 @@ void main() {
...
@@ -17,9 +17,14 @@ void main() {
'-v'
,
'-v'
,
]);
]);
// Development tools.
expect
(
result
.
stdout
,
isNot
(
contains
(
'ide-config'
)));
expect
(
result
.
stdout
,
isNot
(
contains
(
'ide-config'
)));
expect
(
result
.
stdout
,
isNot
(
contains
(
'update-packages'
)));
expect
(
result
.
stdout
,
isNot
(
contains
(
'update-packages'
)));
expect
(
result
.
stdout
,
isNot
(
contains
(
'inject-plugins'
)));
expect
(
result
.
stdout
,
isNot
(
contains
(
'inject-plugins'
)));
// Deprecated.
expect
(
result
.
stdout
,
isNot
(
contains
(
'make-host-app-editable'
)));
// Only printed by verbose tool.
// Only printed by verbose tool.
expect
(
result
.
stdout
,
isNot
(
contains
(
'exiting with code 0'
)));
expect
(
result
.
stdout
,
isNot
(
contains
(
'exiting with code 0'
)));
});
});
...
...
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