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
a476a08e
Unverified
Commit
a476a08e
authored
Apr 22, 2019
by
Jonah Williams
Committed by
GitHub
Apr 22, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
check if project exists before regenerating platform specific tooling (#31342)
parent
1200ae33
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
48 additions
and
23 deletions
+48
-23
create.dart
packages/flutter_tools/lib/src/commands/create.dart
+2
-2
inject_plugins.dart
packages/flutter_tools/lib/src/commands/inject_plugins.dart
+2
-2
make_host_app_editable.dart
...lutter_tools/lib/src/commands/make_host_app_editable.dart
+1
-1
packages.dart
packages/flutter_tools/lib/src/commands/packages.dart
+2
-2
plugins.dart
packages/flutter_tools/lib/src/plugins.dart
+24
-10
project.dart
packages/flutter_tools/lib/src/project.dart
+16
-5
flutter_command.dart
packages/flutter_tools/lib/src/runner/flutter_command.dart
+1
-1
No files found.
packages/flutter_tools/lib/src/commands/create.dart
View file @
a476a08e
...
...
@@ -443,7 +443,7 @@ To edit platform code in an IDE see https://flutter.dev/developing-packages/#edi
offline:
argResults
[
'offline'
],
);
final
FlutterProject
project
=
await
FlutterProject
.
fromDirectory
(
directory
);
await
project
.
ensureReadyForPlatformSpecificTooling
();
await
project
.
ensureReadyForPlatformSpecificTooling
(
checkProjects:
false
);
}
return
generatedCount
;
}
...
...
@@ -510,7 +510,7 @@ To edit platform code in an IDE see https://flutter.dev/developing-packages/#edi
if
(
argResults
[
'pub'
])
{
await
pubGet
(
context:
PubContext
.
create
,
directory:
directory
.
path
,
offline:
argResults
[
'offline'
]);
await
project
.
ensureReadyForPlatformSpecificTooling
();
await
project
.
ensureReadyForPlatformSpecificTooling
(
checkProjects:
false
);
}
gradle
.
updateLocalProperties
(
project:
project
,
requireAndroidSdk:
false
);
...
...
packages/flutter_tools/lib/src/commands/inject_plugins.dart
View file @
a476a08e
...
...
@@ -29,8 +29,8 @@ class InjectPluginsCommand extends FlutterCommand {
@override
Future
<
FlutterCommandResult
>
runCommand
()
async
{
final
FlutterProject
project
=
await
FlutterProject
.
current
();
refreshPluginsList
(
project
);
await
injectPlugins
(
project
);
refreshPluginsList
(
project
,
checkProjects:
true
);
await
injectPlugins
(
project
,
checkProjects:
true
);
final
bool
result
=
hasPlugins
(
project
);
if
(
result
)
{
printStatus
(
'GeneratedPluginRegistrants successfully written.'
);
...
...
packages/flutter_tools/lib/src/commands/make_host_app_editable.dart
View file @
a476a08e
...
...
@@ -43,7 +43,7 @@ class MakeHostAppEditableCommand extends FlutterCommand {
@override
Future
<
FlutterCommandResult
>
runCommand
()
async
{
await
_project
.
ensureReadyForPlatformSpecificTooling
();
await
_project
.
ensureReadyForPlatformSpecificTooling
(
checkProjects:
false
);
final
bool
isAndroidRequested
=
argResults
[
'android'
];
final
bool
isIOSRequested
=
argResults
[
'ios'
];
...
...
packages/flutter_tools/lib/src/commands/packages.dart
View file @
a476a08e
...
...
@@ -94,13 +94,13 @@ class PackagesGetCommand extends FlutterCommand {
await
_runPubGet
(
target
);
final
FlutterProject
rootProject
=
await
FlutterProject
.
fromPath
(
target
);
await
rootProject
.
ensureReadyForPlatformSpecificTooling
();
await
rootProject
.
ensureReadyForPlatformSpecificTooling
(
checkProjects:
true
);
// Get/upgrade packages in example app as well
if
(
rootProject
.
hasExampleApp
)
{
final
FlutterProject
exampleProject
=
rootProject
.
example
;
await
_runPubGet
(
exampleProject
.
directory
.
path
);
await
exampleProject
.
ensureReadyForPlatformSpecificTooling
();
await
exampleProject
.
ensureReadyForPlatformSpecificTooling
(
checkProjects:
true
);
}
return
null
;
...
...
packages/flutter_tools/lib/src/plugins.dart
View file @
a476a08e
...
...
@@ -98,8 +98,9 @@ bool _writeFlutterPluginsList(FlutterProject project, List<Plugin> plugins) {
if
(
pluginManifest
.
isNotEmpty
)
{
pluginsFile
.
writeAsStringSync
(
'
$pluginManifest
\n
'
,
flush:
true
);
}
else
{
if
(
pluginsFile
.
existsSync
())
if
(
pluginsFile
.
existsSync
())
{
pluginsFile
.
deleteSync
();
}
}
final
String
newContents
=
_readFlutterPluginsList
(
project
);
return
oldContents
!=
newContents
;
...
...
@@ -282,31 +283,44 @@ Future<void> _writeIOSPluginRegistrant(FlutterProject project, List<Plugin> plug
/// Rewrites the `.flutter-plugins` file of [project] based on the plugin
/// dependencies declared in `pubspec.yaml`.
///
/// If `checkProjects` is true, then plugins are only injected into directories
/// which already exist.
///
/// Assumes `pub get` has been executed since last change to `pubspec.yaml`.
void
refreshPluginsList
(
FlutterProject
project
)
{
void
refreshPluginsList
(
FlutterProject
project
,
{
bool
checkProjects
=
false
}
)
{
final
List
<
Plugin
>
plugins
=
findPlugins
(
project
);
final
bool
changed
=
_writeFlutterPluginsList
(
project
,
plugins
);
if
(
changed
)
if
(
changed
)
{
if
(
checkProjects
&&
!
project
.
ios
.
existsSync
())
{
return
;
}
cocoaPods
.
invalidatePodInstallOutput
(
project
.
ios
);
}
}
/// Injects plugins found in `pubspec.yaml` into the platform-specific projects.
///
/// If `checkProjects` is true, then plugins are only injected into directories
/// which already exist.
///
/// Assumes [refreshPluginsList] has been called since last change to `pubspec.yaml`.
Future
<
void
>
injectPlugins
(
FlutterProject
project
)
async
{
Future
<
void
>
injectPlugins
(
FlutterProject
project
,
{
bool
checkProjects
=
false
}
)
async
{
final
List
<
Plugin
>
plugins
=
findPlugins
(
project
);
await
_writeAndroidPluginRegistrant
(
project
,
plugins
);
await
_writeIOSPluginRegistrant
(
project
,
plugins
);
if
(!
project
.
isModule
&&
project
.
ios
.
hostAppRoot
.
existsSync
())
{
final
IosProject
iosProject
=
IosProject
.
fromFlutter
(
project
);
if
((
checkProjects
&&
project
.
android
.
existsSync
())
||
!
checkProjects
)
{
await
_writeAndroidPluginRegistrant
(
project
,
plugins
);
}
if
((
checkProjects
&&
project
.
ios
.
existsSync
())
||
!
checkProjects
)
{
await
_writeIOSPluginRegistrant
(
project
,
plugins
);
}
if
(!
project
.
isModule
&&
((
project
.
ios
.
hostAppRoot
.
existsSync
()
&&
checkProjects
)
||
!
checkProjects
))
{
final
CocoaPods
cocoaPods
=
CocoaPods
();
if
(
plugins
.
isNotEmpty
)
{
cocoaPods
.
setupPodfile
(
project
.
ios
);
}
/// The user may have a custom maintained Podfile that they're running `pod install`
/// on themselves.
else
if
(
iosProject
.
podfile
.
existsSync
()
&&
iosProject
.
podfileLock
.
existsSync
())
{
cocoaPods
.
addPodsDependencyToFlutterXcconfig
(
iosProject
);
else
if
(
project
.
ios
.
podfile
.
existsSync
()
&&
project
.
ios
.
podfileLock
.
existsSync
())
{
cocoaPods
.
addPodsDependencyToFlutterXcconfig
(
project
.
ios
);
}
}
}
...
...
packages/flutter_tools/lib/src/project.dart
View file @
a476a08e
...
...
@@ -158,16 +158,21 @@ class FlutterProject {
/// Generates project files necessary to make Gradle builds work on Android
/// and CocoaPods+Xcode work on iOS, for app and module projects only.
Future
<
void
>
ensureReadyForPlatformSpecificTooling
()
async
{
if
(!
directory
.
existsSync
()
||
hasExampleApp
)
Future
<
void
>
ensureReadyForPlatformSpecificTooling
(
{
bool
checkProjects
=
false
}
)
async
{
if
(!
directory
.
existsSync
()
||
hasExampleApp
)
{
return
;
}
refreshPluginsList
(
this
);
await
android
.
ensureReadyForPlatformSpecificTooling
();
await
ios
.
ensureReadyForPlatformSpecificTooling
();
if
((
android
.
existsSync
()
&&
checkProjects
)
||
!
checkProjects
)
{
await
android
.
ensureReadyForPlatformSpecificTooling
();
}
if
((
ios
.
existsSync
()
&&
checkProjects
)
||
!
checkProjects
)
{
await
ios
.
ensureReadyForPlatformSpecificTooling
();
}
if
(
flutterWebEnabled
)
{
await
web
.
ensureReadyForPlatformSpecificTooling
();
}
await
injectPlugins
(
this
);
await
injectPlugins
(
this
,
checkProjects:
checkProjects
);
}
/// Return the set of builders used by this package.
...
...
@@ -203,6 +208,8 @@ class IosProject {
Directory get _ephemeralDirectory => parent.directory.childDirectory('
.
ios
');
Directory get _editableDirectory => parent.directory.childDirectory('
ios
');
bool existsSync() => parent.isModule || _editableDirectory.existsSync();
/// This parent folder of `Runner.xcodeproj`.
Directory get hostAppRoot {
if (!isModule || _editableDirectory.existsSync())
...
...
@@ -381,6 +388,8 @@ class AndroidProject {
return
_ephemeralDirectory
;
}
bool
existsSync
()
=>
parent
.
isModule
||
_flutterLibGradleRoot
.
existsSync
();
/// The Gradle root directory of the Android wrapping of Flutter and plugins.
/// This is the same as [hostAppGradleRoot] except when the project is
/// a Flutter module with an editable host app.
...
...
@@ -486,6 +495,8 @@ class WebProject {
final
FlutterProject
parent
;
bool
existsSync
()
=>
parent
.
directory
.
childDirectory
(
'web'
).
existsSync
();
Future
<
void
>
ensureReadyForPlatformSpecificTooling
()
async
{
/// Generate index.html in build/web. Eventually we could support
/// a custom html under the web sub directory.
...
...
packages/flutter_tools/lib/src/runner/flutter_command.dart
View file @
a476a08e
...
...
@@ -475,7 +475,7 @@ abstract class FlutterCommand extends Command<void> {
if
(
shouldRunPub
)
{
await
pubGet
(
context:
PubContext
.
getVerifyContext
(
name
));
final
FlutterProject
project
=
await
FlutterProject
.
current
();
await
project
.
ensureReadyForPlatformSpecificTooling
();
await
project
.
ensureReadyForPlatformSpecificTooling
(
checkProjects:
true
);
}
setupApplicationPackages
();
...
...
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