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
1ae0a76c
Commit
1ae0a76c
authored
May 23, 2016
by
Devon Carew
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
warn when flutter doesn't match the pubspec version (#4109)
parent
4962656b
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
43 additions
and
16 deletions
+43
-16
package_map.dart
packages/flutter_tools/lib/src/dart/package_map.dart
+1
-1
flx.dart
packages/flutter_tools/lib/src/flx.dart
+1
-1
flutter_command.dart
packages/flutter_tools/lib/src/runner/flutter_command.dart
+1
-1
flutter_command_runner.dart
.../flutter_tools/lib/src/runner/flutter_command_runner.dart
+38
-11
services.dart
packages/flutter_tools/lib/src/services.dart
+1
-1
flutter_platform.dart
packages/flutter_tools/lib/src/test/flutter_platform.dart
+1
-1
No files found.
packages/flutter_tools/lib/src/package_map.dart
→
packages/flutter_tools/lib/src/
dart/
package_map.dart
View file @
1ae0a76c
...
...
@@ -7,7 +7,7 @@ import 'dart:io';
import
'package:package_config/packages_file.dart'
as
packages_file
;
import
'package:path/path.dart'
as
path
;
const
String
_kPackages
=
'.packages'
;
const
String
kPackagesFileName
=
'.packages'
;
Map
<
String
,
Uri
>
_parse
(
String
packagesPath
)
{
List
<
int
>
source
=
new
File
(
packagesPath
).
readAsBytesSync
();
...
...
packages/flutter_tools/lib/src/flx.dart
View file @
1ae0a76c
...
...
@@ -15,8 +15,8 @@ import 'package:yaml/yaml.dart';
import
'base/file_system.dart'
show
ensureDirectoryExists
;
import
'base/process.dart'
;
import
'cache.dart'
;
import
'dart/package_map.dart'
;
import
'globals.dart'
;
import
'package_map.dart'
;
import
'toolchain.dart'
;
import
'zip.dart'
;
...
...
packages/flutter_tools/lib/src/runner/flutter_command.dart
View file @
1ae0a76c
...
...
@@ -9,11 +9,11 @@ import 'package:args/command_runner.dart';
import
'../application_package.dart'
;
import
'../build_info.dart'
;
import
'../dart/package_map.dart'
;
import
'../dart/pub.dart'
;
import
'../device.dart'
;
import
'../flx.dart'
as
flx
;
import
'../globals.dart'
;
import
'../package_map.dart'
;
import
'../usage.dart'
;
import
'flutter_command_runner.dart'
;
...
...
packages/flutter_tools/lib/src/runner/flutter_command_runner.dart
View file @
1ae0a76c
...
...
@@ -14,8 +14,8 @@ import '../base/context.dart';
import
'../base/logger.dart'
;
import
'../base/process.dart'
;
import
'../cache.dart'
;
import
'../dart/package_map.dart'
;
import
'../globals.dart'
;
import
'../package_map.dart'
;
import
'../toolchain.dart'
;
import
'../version.dart'
;
...
...
@@ -50,10 +50,10 @@ class FlutterCommandRunner extends CommandRunner {
help:
'Suppress analytics reporting when this command runs.'
);
String
packagesHelp
;
if
(
FileSystemEntity
.
isFileSync
(
'.packages'
))
packagesHelp
=
'
\n
(defaults to "
.packages
")'
;
if
(
FileSystemEntity
.
isFileSync
(
kPackagesFileName
))
packagesHelp
=
'
\n
(defaults to "
$kPackagesFileName
")'
;
else
packagesHelp
=
'
\n
(required, since the current directory does not contain a "
.packages
" file)'
;
packagesHelp
=
'
\n
(required, since the current directory does not contain a "
$kPackagesFileName
" file)'
;
argParser
.
addOption
(
'packages'
,
hide:
!
verboseHelp
,
help:
'Path to your ".packages" file.
$packagesHelp
'
);
...
...
@@ -139,10 +139,11 @@ class FlutterCommandRunner extends CommandRunner {
if
(
globalResults
[
'suppress-analytics'
])
flutterUsage
.
suppressAnalytics
=
true
;
_checkFlutterCopy
();
if
(!
_checkFlutterCopy
())
return
new
Future
<
int
>.
value
(
1
);
PackageMap
.
instance
=
new
PackageMap
(
path
.
normalize
(
path
.
absolute
(
globalResults
.
wasParsed
(
'packages'
)
?
globalResults
[
'packages'
]
:
'.packages'
globalResults
.
wasParsed
(
'packages'
)
?
globalResults
[
'packages'
]
:
kPackagesFileName
)));
// See if the user specified a specific device.
...
...
@@ -258,18 +259,20 @@ class FlutterCommandRunner extends CommandRunner {
.
toList
();
}
/// Check that the Flutter being run is the one we're expecting.
void
_checkFlutterCopy
()
{
bool
_checkFlutterCopy
()
{
// If the current directory is contained by a flutter repo, check that it's
// the same flutter that is currently running.
String
directory
=
path
.
normalize
(
path
.
absolute
(
Directory
.
current
.
path
));
// Check if the cwd is a flutter dir.
while
(
directory
.
isNotEmpty
)
{
if
(
_isDirectoryFlutterRepo
(
directory
))
{
if
(
directory
!=
Cache
.
flutterRoot
)
{
// Warn, but continue execution.
printError
(
'Warning
: the active Flutter is not the one from the current directory.
\n
'
'
A
ctive Flutter :
${Cache.flutterRoot}
\n
'
'
C
urrent directory:
$directory
\n
'
'Warning
- the active Flutter is not the one from the current directory:
\n
'
'
a
ctive Flutter :
${Cache.flutterRoot}
\n
'
'
c
urrent directory:
$directory
\n
'
);
}
...
...
@@ -281,6 +284,30 @@ class FlutterCommandRunner extends CommandRunner {
break
;
directory
=
parent
;
}
// Check that the flutter running is that same as the one referenced in the pubspec.
if
(
FileSystemEntity
.
isFileSync
(
kPackagesFileName
))
{
PackageMap
packageMap
=
new
PackageMap
(
kPackagesFileName
);
Uri
flutterUri
=
packageMap
.
map
[
'flutter'
];
if
(
flutterUri
!=
null
&&
(
flutterUri
.
scheme
==
'file'
||
flutterUri
.
scheme
==
''
))
{
// .../flutter/packages/flutter/lib
Uri
rootUri
=
flutterUri
.
resolve
(
'../../..'
);
String
flutterPath
=
path
.
normalize
(
new
File
.
fromUri
(
rootUri
).
absolute
.
path
);
if
(
flutterPath
!=
Cache
.
flutterRoot
)
{
// Warn and exit the app.
printError
(
'Warning - the active Flutter is different from the one referenced in your pubspec:
\n
'
' active Flutter :
${Cache.flutterRoot}
\n
'
' pubspec reference:
$flutterPath
'
);
return
false
;
}
}
}
return
true
;
}
// Check if `bin/flutter` and `bin/cache/engine.stamp` exist.
...
...
packages/flutter_tools/lib/src/services.dart
View file @
1ae0a76c
...
...
@@ -9,8 +9,8 @@ import 'dart:io';
import
'package:path/path.dart'
as
path
;
import
'package:yaml/yaml.dart'
;
import
'dart/package_map.dart'
;
import
'globals.dart'
;
import
'package_map.dart'
;
const
String
_kFlutterManifestPath
=
'flutter.yaml'
;
const
String
_kFlutterServicesManifestPath
=
'flutter_services.yaml'
;
...
...
packages/flutter_tools/lib/src/test/flutter_platform.dart
View file @
1ae0a76c
...
...
@@ -14,7 +14,7 @@ import 'package:test/src/backend/test_platform.dart'; // ignore: implementation_
import
'package:test/src/runner/plugin/platform.dart'
;
// ignore: implementation_imports
import
'package:test/src/runner/plugin/hack_register_platform.dart'
as
hack
;
// ignore: implementation_imports
import
'../package_map.dart'
;
import
'../
dart/
package_map.dart'
;
final
String
_kSkyShell
=
Platform
.
environment
[
'SKY_SHELL'
];
const
String
_kHost
=
'127.0.0.1'
;
...
...
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