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
e5846d96
Unverified
Commit
e5846d96
authored
Dec 14, 2017
by
Michael Goderbauer
Committed by
GitHub
Dec 14, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Verify that committed GeneratedPluginRegistrant are up-to-date (#13541)
parent
998bf194
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
216 additions
and
3 deletions
+216
-3
.gitignore
.gitignore
+0
-3
test.dart
dev/bots/test.dart
+61
-0
GeneratedPluginRegistrant.java
...in/java/io/flutter/plugins/GeneratedPluginRegistrant.java
+12
-0
GeneratedPluginRegistrant.java
...in/java/io/flutter/plugins/GeneratedPluginRegistrant.java
+12
-0
GeneratedPluginRegistrant.java
...in/java/io/flutter/plugins/GeneratedPluginRegistrant.java
+12
-0
GeneratedPluginRegistrant.java
...in/java/io/flutter/plugins/GeneratedPluginRegistrant.java
+12
-0
GeneratedPluginRegistrant.java
...in/java/io/flutter/plugins/GeneratedPluginRegistrant.java
+12
-0
GeneratedPluginRegistrant.java
...in/java/io/flutter/plugins/GeneratedPluginRegistrant.java
+12
-0
GeneratedPluginRegistrant.java
...in/java/io/flutter/plugins/GeneratedPluginRegistrant.java
+12
-0
GeneratedPluginRegistrant.java
...in/java/io/flutter/plugins/GeneratedPluginRegistrant.java
+23
-0
GeneratedPluginRegistrant.java
...in/java/io/flutter/plugins/GeneratedPluginRegistrant.java
+12
-0
executable.dart
packages/flutter_tools/lib/executable.dart
+2
-0
inject_plugins.dart
packages/flutter_tools/lib/src/commands/inject_plugins.dart
+34
-0
No files found.
.gitignore
View file @
e5846d96
...
...
@@ -41,7 +41,6 @@ unlinked.ds
unlinked_spec.ds
# Android related
**/android/**/GeneratedPluginRegistrant.java
**/android/**/gradle-wrapper.jar
**/android/.gradle
**/android/captures/
...
...
@@ -60,8 +59,6 @@ unlinked_spec.ds
**/ios/**/.tags*
**/ios/**/.vagrant/
**/ios/**/DerivedData/
**/ios/**/GeneratedPluginRegistrant.h
**/ios/**/GeneratedPluginRegistrant.m
**/ios/**/Icon?
**/ios/**/Pods/
**/ios/**/profile
...
...
dev/bots/test.dart
View file @
e5846d96
...
...
@@ -87,6 +87,7 @@ Future<Null> _verifyInternationalizations() async {
}
Future
<
Null
>
_analyzeRepo
()
async
{
await
_verifyGeneratedPluginRegistrants
(
flutterRoot
);
await
_verifyNoBadImports
(
flutterRoot
);
await
_verifyInternationalizations
();
...
...
@@ -477,3 +478,63 @@ void _printProgress(String action, String workingDir, String command) {
const
String
arrow
=
'⏩'
;
print
(
'
$arrow
$action
: cd
$cyan$workingDir$reset
;
$yellow$command$reset
'
);
}
Future
<
Null
>
_verifyGeneratedPluginRegistrants
(
String
flutterRoot
)
async
{
final
Directory
flutterRootDir
=
new
Directory
(
flutterRoot
);
final
Map
<
String
,
List
<
File
>>
packageToRegistrants
=
<
String
,
List
<
File
>>{};
for
(
FileSystemEntity
entity
in
flutterRootDir
.
listSync
(
recursive:
true
))
{
if
(
entity
is
!
File
)
continue
;
if
(
_isGeneratedPluginRegistrant
(
entity
))
{
final
String
package
=
_getPackageFor
(
entity
,
flutterRootDir
);
final
List
<
File
>
registrants
=
packageToRegistrants
.
putIfAbsent
(
package
,
()
=>
<
File
>[]);
registrants
.
add
(
entity
);
}
}
final
Set
<
String
>
outOfDate
=
new
Set
<
String
>();
for
(
String
package
in
packageToRegistrants
.
keys
)
{
final
Map
<
File
,
String
>
fileToContent
=
new
Map
<
File
,
String
>.
fromIterable
(
packageToRegistrants
[
package
],
key:
(
File
f
)
=>
f
,
value:
(
File
f
)
=>
f
.
readAsStringSync
(),
);
await
_runCommand
(
flutter
,
<
String
>[
'inject-plugins'
],
workingDirectory:
package
,
printOutput:
false
,
);
for
(
File
registrant
in
fileToContent
.
keys
)
{
if
(
registrant
.
readAsStringSync
()
!=
fileToContent
[
registrant
])
{
outOfDate
.
add
(
registrant
.
path
);
}
}
}
if
(
outOfDate
.
isNotEmpty
)
{
print
(
'
$red
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
$reset
'
);
print
(
'
${bold}
The following GeneratedPluginRegistrants are out of date:
$reset
'
);
for
(
String
registrant
in
outOfDate
)
{
print
(
' -
$registrant
'
);
}
print
(
'
$red
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
$reset
'
);
exit
(
1
);
}
}
String
_getPackageFor
(
File
entity
,
Directory
flutterRootDir
)
{
for
(
Directory
dir
=
entity
.
parent
;
dir
!=
flutterRootDir
;
dir
=
dir
.
parent
)
{
if
(
new
File
(
path
.
join
(
dir
.
path
,
'pubspec.yaml'
)).
existsSync
())
{
return
dir
.
path
;
}
}
throw
new
ArgumentError
(
'
$entity
is not within a dart package.'
);
}
bool
_isGeneratedPluginRegistrant
(
File
file
)
{
final
String
filename
=
path
.
basename
(
file
.
path
);
return
filename
==
'GeneratedPluginRegistrant.java'
||
filename
==
'GeneratedPluginRegistrant.h'
||
filename
==
'GeneratedPluginRegistrant.m'
;
}
dev/integration_tests/channels/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java
View file @
e5846d96
...
...
@@ -7,5 +7,17 @@ import io.flutter.plugin.common.PluginRegistry;
*/
public
final
class
GeneratedPluginRegistrant
{
public
static
void
registerWith
(
PluginRegistry
registry
)
{
if
(
alreadyRegisteredWith
(
registry
))
{
return
;
}
}
private
static
boolean
alreadyRegisteredWith
(
PluginRegistry
registry
)
{
final
String
key
=
GeneratedPluginRegistrant
.
class
.
getCanonicalName
();
if
(
registry
.
hasPlugin
(
key
))
{
return
true
;
}
registry
.
registrarFor
(
key
);
return
false
;
}
}
dev/integration_tests/ui/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java
View file @
e5846d96
...
...
@@ -7,5 +7,17 @@ import io.flutter.plugin.common.PluginRegistry;
*/
public
final
class
GeneratedPluginRegistrant
{
public
static
void
registerWith
(
PluginRegistry
registry
)
{
if
(
alreadyRegisteredWith
(
registry
))
{
return
;
}
}
private
static
boolean
alreadyRegisteredWith
(
PluginRegistry
registry
)
{
final
String
key
=
GeneratedPluginRegistrant
.
class
.
getCanonicalName
();
if
(
registry
.
hasPlugin
(
key
))
{
return
true
;
}
registry
.
registrarFor
(
key
);
return
false
;
}
}
dev/manual_tests/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java
View file @
e5846d96
...
...
@@ -7,5 +7,17 @@ import io.flutter.plugin.common.PluginRegistry;
*/
public
final
class
GeneratedPluginRegistrant
{
public
static
void
registerWith
(
PluginRegistry
registry
)
{
if
(
alreadyRegisteredWith
(
registry
))
{
return
;
}
}
private
static
boolean
alreadyRegisteredWith
(
PluginRegistry
registry
)
{
final
String
key
=
GeneratedPluginRegistrant
.
class
.
getCanonicalName
();
if
(
registry
.
hasPlugin
(
key
))
{
return
true
;
}
registry
.
registrarFor
(
key
);
return
false
;
}
}
examples/flutter_gallery/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java
View file @
e5846d96
...
...
@@ -11,9 +11,21 @@ import io.flutter.videoplayer.VideoPlayerPlugin;
*/
public
final
class
GeneratedPluginRegistrant
{
public
static
void
registerWith
(
PluginRegistry
registry
)
{
if
(
alreadyRegisteredWith
(
registry
))
{
return
;
}
ConnectivityPlugin
.
registerWith
(
registry
.
registrarFor
(
"io.flutter.plugins.connectivity.ConnectivityPlugin"
));
DeviceInfoPlugin
.
registerWith
(
registry
.
registrarFor
(
"io.flutter.plugins.deviceinfo.DeviceInfoPlugin"
));
UrlLauncherPlugin
.
registerWith
(
registry
.
registrarFor
(
"io.flutter.plugins.urllauncher.UrlLauncherPlugin"
));
VideoPlayerPlugin
.
registerWith
(
registry
.
registrarFor
(
"io.flutter.videoplayer.VideoPlayerPlugin"
));
}
private
static
boolean
alreadyRegisteredWith
(
PluginRegistry
registry
)
{
final
String
key
=
GeneratedPluginRegistrant
.
class
.
getCanonicalName
();
if
(
registry
.
hasPlugin
(
key
))
{
return
true
;
}
registry
.
registrarFor
(
key
);
return
false
;
}
}
examples/hello_world/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java
View file @
e5846d96
...
...
@@ -7,5 +7,17 @@ import io.flutter.plugin.common.PluginRegistry;
*/
public
final
class
GeneratedPluginRegistrant
{
public
static
void
registerWith
(
PluginRegistry
registry
)
{
if
(
alreadyRegisteredWith
(
registry
))
{
return
;
}
}
private
static
boolean
alreadyRegisteredWith
(
PluginRegistry
registry
)
{
final
String
key
=
GeneratedPluginRegistrant
.
class
.
getCanonicalName
();
if
(
registry
.
hasPlugin
(
key
))
{
return
true
;
}
registry
.
registrarFor
(
key
);
return
false
;
}
}
examples/layers/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java
View file @
e5846d96
...
...
@@ -7,5 +7,17 @@ import io.flutter.plugin.common.PluginRegistry;
*/
public
final
class
GeneratedPluginRegistrant
{
public
static
void
registerWith
(
PluginRegistry
registry
)
{
if
(
alreadyRegisteredWith
(
registry
))
{
return
;
}
}
private
static
boolean
alreadyRegisteredWith
(
PluginRegistry
registry
)
{
final
String
key
=
GeneratedPluginRegistrant
.
class
.
getCanonicalName
();
if
(
registry
.
hasPlugin
(
key
))
{
return
true
;
}
registry
.
registrarFor
(
key
);
return
false
;
}
}
examples/platform_channel/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java
View file @
e5846d96
...
...
@@ -7,5 +7,17 @@ import io.flutter.plugin.common.PluginRegistry;
*/
public
final
class
GeneratedPluginRegistrant
{
public
static
void
registerWith
(
PluginRegistry
registry
)
{
if
(
alreadyRegisteredWith
(
registry
))
{
return
;
}
}
private
static
boolean
alreadyRegisteredWith
(
PluginRegistry
registry
)
{
final
String
key
=
GeneratedPluginRegistrant
.
class
.
getCanonicalName
();
if
(
registry
.
hasPlugin
(
key
))
{
return
true
;
}
registry
.
registrarFor
(
key
);
return
false
;
}
}
examples/platform_view/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java
0 → 100644
View file @
e5846d96
package
io
.
flutter
.
plugins
;
import
io.flutter.plugin.common.PluginRegistry
;
/**
* Generated file. Do not edit.
*/
public
final
class
GeneratedPluginRegistrant
{
public
static
void
registerWith
(
PluginRegistry
registry
)
{
if
(
alreadyRegisteredWith
(
registry
))
{
return
;
}
}
private
static
boolean
alreadyRegisteredWith
(
PluginRegistry
registry
)
{
final
String
key
=
GeneratedPluginRegistrant
.
class
.
getCanonicalName
();
if
(
registry
.
hasPlugin
(
key
))
{
return
true
;
}
registry
.
registrarFor
(
key
);
return
false
;
}
}
examples/stocks/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java
View file @
e5846d96
...
...
@@ -7,5 +7,17 @@ import io.flutter.plugin.common.PluginRegistry;
*/
public
final
class
GeneratedPluginRegistrant
{
public
static
void
registerWith
(
PluginRegistry
registry
)
{
if
(
alreadyRegisteredWith
(
registry
))
{
return
;
}
}
private
static
boolean
alreadyRegisteredWith
(
PluginRegistry
registry
)
{
final
String
key
=
GeneratedPluginRegistrant
.
class
.
getCanonicalName
();
if
(
registry
.
hasPlugin
(
key
))
{
return
true
;
}
registry
.
registrarFor
(
key
);
return
false
;
}
}
packages/flutter_tools/lib/executable.dart
View file @
e5846d96
...
...
@@ -18,6 +18,7 @@ import 'src/commands/drive.dart';
import
'src/commands/format.dart'
;
import
'src/commands/fuchsia_reload.dart'
;
import
'src/commands/ide_config.dart'
;
import
'src/commands/inject_plugins.dart'
;
import
'src/commands/install.dart'
;
import
'src/commands/logs.dart'
;
import
'src/commands/packages.dart'
;
...
...
@@ -45,6 +46,7 @@ Future<Null> main(List<String> args) async {
new
BuildCommand
(
verboseHelp:
verboseHelp
),
new
ChannelCommand
(),
new
CleanCommand
(),
new
InjectPluginsCommand
(
hidden:
!
verboseHelp
),
new
ConfigCommand
(
verboseHelp:
verboseHelp
),
new
CreateCommand
(),
new
DaemonCommand
(
hidden:
!
verboseHelp
),
...
...
packages/flutter_tools/lib/src/commands/inject_plugins.dart
0 → 100644
View file @
e5846d96
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'dart:async'
;
import
'../globals.dart'
;
import
'../plugins.dart'
;
import
'../runner/flutter_command.dart'
;
class
InjectPluginsCommand
extends
FlutterCommand
{
InjectPluginsCommand
({
this
.
hidden
:
false
})
{
requiresPubspecYaml
();
}
@override
final
String
name
=
'inject-plugins'
;
@override
final
String
description
=
'Re-generates the GeneratedPluginRegistrants.'
;
@override
final
bool
hidden
;
@override
Future
<
Null
>
runCommand
()
async
{
final
bool
result
=
injectPlugins
();
if
(
result
)
{
printStatus
(
'GeneratedPluginRegistrants successfully written.'
);
}
else
{
printStatus
(
'This project does not use plugins, no GeneratedPluginRegistrants have been created.'
);
}
}
}
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