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
4f298e67
Unverified
Commit
4f298e67
authored
Oct 08, 2018
by
matthew-carroll
Committed by
GitHub
Oct 08, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Publish make-host-app-editable command with CLI docs. (#22635)
Publish make-host-app-editable command with CLI docs.
parent
655bf6a2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
53 deletions
+32
-53
make_host_app_editable.dart
...lutter_tools/lib/src/commands/make_host_app_editable.dart
+32
-53
No files found.
packages/flutter_tools/lib/src/commands/make_host_app_editable.dart
View file @
4f298e67
...
...
@@ -3,43 +3,35 @@
// found in the LICENSE file.
import
'dart:async'
;
import
'package:meta/meta.dart'
;
import
'../base/common.dart'
;
import
'../project.dart'
;
import
'../runner/flutter_command.dart'
;
class
MakeHostAppEditableCommand
extends
FlutterCommand
{
MakeHostAppEditableCommand
()
{
addSubcommand
(
MakeHostAppEditableAndroidCommand
());
addSubcommand
(
MakeHostAppEditableIosCommand
());
}
@override
final
String
name
=
'make-host-app-editable'
;
@override
final
String
description
=
'Commands for making host apps editable within a Flutter project'
;
@override
bool
get
hidden
=>
true
;
@override
Future
<
FlutterCommandResult
>
runCommand
()
async
=>
null
;
}
abstract
class
MakeHostAppEditableSubCommand
extends
FlutterCommand
{
MakeHostAppEditableSubCommand
()
{
requiresPubspecYaml
();
argParser
.
addFlag
(
'ios'
,
help:
'Whether to make this project
\'
s iOS app editable.'
,
negatable:
false
,
);
argParser
.
addFlag
(
'android'
,
help:
'Whether ot make this project
\'
s Android app editable.'
,
negatable:
false
,
);
}
FlutterProject
_project
;
@override
@mustCallSuper
Future
<
FlutterCommandResult
>
runCommand
()
async
{
await
_project
.
ensureReadyForPlatformSpecificTooling
();
return
null
;
}
final
String
name
=
'make-host-app-editable'
;
@override
final
String
description
=
'Moves host apps from generated directories to non-generated directories so that they can be edited by developers.
\n\n
'
'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
Future
<
void
>
validateCommand
()
async
{
...
...
@@ -48,36 +40,23 @@ abstract class MakeHostAppEditableSubCommand extends FlutterCommand {
if
(!
_project
.
isApplication
)
throw
ToolExit
(
"Only projects created using 'flutter create -t application' can have their host apps made editable."
);
}
}
class
MakeHostAppEditableAndroidCommand
extends
MakeHostAppEditableSubCommand
{
@override
String
get
name
=>
'android'
;
@override
String
get
description
=>
'Make an Android host app editable within a Flutter project'
;
@override
Future
<
FlutterCommandResult
>
runCommand
()
async
{
await
super
.
runCommand
();
await
_project
.
android
.
makeHostAppEditable
();
return
null
;
}
}
class
MakeHostAppEditableIosCommand
extends
MakeHostAppEditableSubCommand
{
@override
String
get
name
=>
'ios'
;
@override
String
get
description
=>
'Make an iOS host app editable within a Flutter project'
;
@override
Future
<
FlutterCommandResult
>
runCommand
()
async
{
await
super
.
runCommand
();
await
_project
.
ios
.
makeHostAppEditable
();
Future
<
Null
>
runCommand
()
async
{
await
_project
.
ensureReadyForPlatformSpecificTooling
();
return
null
;
final
bool
isAndroidRequested
=
argResults
[
'android'
];
final
bool
isIOSRequested
=
argResults
[
'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
();
}
}
}
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