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
32846de9
Commit
32846de9
authored
May 12, 2016
by
Jason Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove ArtifactStore and move flutterRoot into Cache (#3883)
parent
42209575
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
63 additions
and
244 deletions
+63
-244
artifacts.dart
packages/flutter_tools/lib/src/artifacts.dart
+0
-193
cache.dart
packages/flutter_tools/lib/src/cache.dart
+15
-2
analyze.dart
packages/flutter_tools/lib/src/commands/analyze.dart
+5
-5
create.dart
packages/flutter_tools/lib/src/commands/create.dart
+2
-3
setup.dart
packages/flutter_tools/lib/src/commands/setup.dart
+2
-2
upgrade.dart
packages/flutter_tools/lib/src/commands/upgrade.dart
+6
-6
sdk.dart
packages/flutter_tools/lib/src/dart/sdk.dart
+2
-2
flx.dart
packages/flutter_tools/lib/src/flx.dart
+4
-4
mac.dart
packages/flutter_tools/lib/src/ios/mac.dart
+2
-2
setup_xcodeproj.dart
packages/flutter_tools/lib/src/ios/setup_xcodeproj.dart
+3
-3
flutter_command_runner.dart
.../flutter_tools/lib/src/runner/flutter_command_runner.dart
+10
-10
template.dart
packages/flutter_tools/lib/src/template.dart
+2
-2
version.dart
packages/flutter_tools/lib/src/version.dart
+4
-4
analytics_test.dart
packages/flutter_tools/test/analytics_test.dart
+2
-2
create_test.dart
packages/flutter_tools/test/create_test.dart
+4
-4
No files found.
packages/flutter_tools/lib/src/artifacts.dart
deleted
100644 → 0
View file @
42209575
// Copyright 2015 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:io'
;
import
'package:path/path.dart'
as
path
;
import
'build_info.dart'
;
import
'globals.dart'
;
enum
ArtifactType
{
snapshot
,
shell
,
mojo
,
androidClassesJar
,
androidIcuData
,
androidKeystore
,
androidLibSkyShell
,
}
class
Artifact
{
const
Artifact
.
_
({
this
.
name
,
this
.
fileName
,
this
.
type
,
this
.
hostPlatform
,
this
.
targetPlatform
});
final
String
name
;
final
String
fileName
;
final
ArtifactType
type
;
final
HostPlatform
hostPlatform
;
final
TargetPlatform
targetPlatform
;
String
get
platform
{
if
(
targetPlatform
!=
null
)
return
getNameForTargetPlatform
(
targetPlatform
);
if
(
hostPlatform
!=
null
)
return
getNameForHostPlatform
(
hostPlatform
);
assert
(
false
);
return
null
;
}
}
class
ArtifactStore
{
static
const
List
<
Artifact
>
knownArtifacts
=
const
<
Artifact
>[
// tester
const
Artifact
.
_
(
name:
'Flutter Tester'
,
fileName:
'sky_shell'
,
type:
ArtifactType
.
shell
,
targetPlatform:
TargetPlatform
.
linux_x64
),
// snapshotters
const
Artifact
.
_
(
name:
'Sky Snapshot'
,
fileName:
'sky_snapshot'
,
type:
ArtifactType
.
snapshot
,
hostPlatform:
HostPlatform
.
linux_x64
),
const
Artifact
.
_
(
name:
'Sky Snapshot'
,
fileName:
'sky_snapshot'
,
type:
ArtifactType
.
snapshot
,
hostPlatform:
HostPlatform
.
darwin_x64
),
// mojo
const
Artifact
.
_
(
name:
'Flutter for Mojo'
,
fileName:
'flutter.mojo'
,
type:
ArtifactType
.
mojo
,
targetPlatform:
TargetPlatform
.
android_arm
),
const
Artifact
.
_
(
name:
'Flutter for Mojo'
,
fileName:
'flutter.mojo'
,
type:
ArtifactType
.
mojo
,
targetPlatform:
TargetPlatform
.
linux_x64
),
// android-arm
const
Artifact
.
_
(
name:
'Compiled Java code'
,
fileName:
'classes.dex.jar'
,
type:
ArtifactType
.
androidClassesJar
,
targetPlatform:
TargetPlatform
.
android_arm
),
const
Artifact
.
_
(
name:
'ICU data table'
,
fileName:
'icudtl.dat'
,
type:
ArtifactType
.
androidIcuData
,
targetPlatform:
TargetPlatform
.
android_arm
),
const
Artifact
.
_
(
name:
'Key Store'
,
fileName:
'chromium-debug.keystore'
,
type:
ArtifactType
.
androidKeystore
,
targetPlatform:
TargetPlatform
.
android_arm
),
const
Artifact
.
_
(
name:
'Compiled C++ code'
,
fileName:
'libsky_shell.so'
,
type:
ArtifactType
.
androidLibSkyShell
,
targetPlatform:
TargetPlatform
.
android_arm
),
// android-x86
const
Artifact
.
_
(
name:
'Compiled Java code'
,
fileName:
'classes.dex.jar'
,
type:
ArtifactType
.
androidClassesJar
,
targetPlatform:
TargetPlatform
.
android_x64
),
const
Artifact
.
_
(
name:
'ICU data table'
,
fileName:
'icudtl.dat'
,
type:
ArtifactType
.
androidIcuData
,
targetPlatform:
TargetPlatform
.
android_x64
),
const
Artifact
.
_
(
name:
'Key Store'
,
fileName:
'chromium-debug.keystore'
,
type:
ArtifactType
.
androidKeystore
,
targetPlatform:
TargetPlatform
.
android_x64
),
const
Artifact
.
_
(
name:
'Compiled C++ code'
,
fileName:
'libsky_shell.so'
,
type:
ArtifactType
.
androidLibSkyShell
,
targetPlatform:
TargetPlatform
.
android_x64
),
];
static
Artifact
getArtifact
({
ArtifactType
type
,
HostPlatform
hostPlatform
,
TargetPlatform
targetPlatform
})
{
for
(
Artifact
artifact
in
ArtifactStore
.
knownArtifacts
)
{
if
(
type
!=
null
&&
type
!=
artifact
.
type
)
continue
;
if
(
hostPlatform
!=
null
&&
artifact
.
hostPlatform
!=
null
&&
hostPlatform
!=
artifact
.
hostPlatform
)
continue
;
if
(
targetPlatform
!=
null
&&
artifact
.
targetPlatform
!=
null
&&
targetPlatform
!=
artifact
.
targetPlatform
)
continue
;
return
artifact
;
}
return
null
;
}
// Initialized by FlutterCommandRunner on startup.
static
String
flutterRoot
;
static
String
_engineRevision
;
static
String
get
engineRevision
{
if
(
_engineRevision
==
null
)
{
File
revisionFile
=
new
File
(
path
.
join
(
flutterRoot
,
'bin'
,
'cache'
,
'engine.version'
));
if
(
revisionFile
.
existsSync
())
_engineRevision
=
revisionFile
.
readAsStringSync
().
trim
();
}
return
_engineRevision
;
}
static
Directory
_getBaseCacheDir
()
{
return
new
Directory
(
path
.
join
(
flutterRoot
,
'bin'
,
'cache'
,
'artifacts'
));
}
// TODO(devoncarew): There are 5 call-sites of this (run_mojo, build_apk, the
// test command, toolchain, setup_xcodeproj); move them over to using
// something from `cache.dart`.
static
String
getPath
(
Artifact
artifact
)
{
File
cachedFile
=
new
File
(
path
.
join
(
_getBaseCacheDir
().
path
,
'engine'
,
artifact
.
platform
,
artifact
.
fileName
)
);
if
(!
cachedFile
.
existsSync
())
{
printError
(
'File not found in the platform artifacts:
${cachedFile.path}
'
);
return
null
;
}
else
{
return
cachedFile
.
path
;
}
}
}
packages/flutter_tools/lib/src/cache.dart
View file @
32846de9
...
...
@@ -7,7 +7,6 @@ import 'dart:io';
import
'package:path/path.dart'
as
path
;
import
'artifacts.dart'
;
import
'base/context.dart'
;
import
'base/logger.dart'
;
import
'base/os.dart'
;
...
...
@@ -22,6 +21,20 @@ class Cache {
Directory
_rootOverride
;
// Initialized by FlutterCommandRunner on startup.
static
String
flutterRoot
;
static
String
_engineRevision
;
static
String
get
engineRevision
{
if
(
_engineRevision
==
null
)
{
File
revisionFile
=
new
File
(
path
.
join
(
flutterRoot
,
'bin'
,
'cache'
,
'engine.version'
));
if
(
revisionFile
.
existsSync
())
_engineRevision
=
revisionFile
.
readAsStringSync
().
trim
();
}
return
_engineRevision
;
}
static
Cache
get
instance
=>
context
[
Cache
]
??
(
context
[
Cache
]
=
new
Cache
());
/// Return the top-level directory in the cache; this is `bin/cache`.
...
...
@@ -29,7 +42,7 @@ class Cache {
if
(
_rootOverride
!=
null
)
return
new
Directory
(
path
.
join
(
_rootOverride
.
path
,
'bin'
,
'cache'
));
else
return
new
Directory
(
path
.
join
(
ArtifactStore
.
flutterRoot
,
'bin'
,
'cache'
));
return
new
Directory
(
path
.
join
(
flutterRoot
,
'bin'
,
'cache'
));
}
/// Return a directory in the cache dir. For `pkg`, this will return `bin/cache/pkg`.
...
...
packages/flutter_tools/lib/src/commands/analyze.dart
View file @
32846de9
...
...
@@ -10,8 +10,8 @@ import 'dart:io';
import
'package:path/path.dart'
as
path
;
import
'package:yaml/yaml.dart'
as
yaml
;
import
'../artifacts.dart'
;
import
'../base/utils.dart'
;
import
'../cache.dart'
;
import
'../dart/analysis.dart'
;
import
'../dart/sdk.dart'
;
import
'../globals.dart'
;
...
...
@@ -66,7 +66,7 @@ class AnalyzeCommand extends FlutterCommand {
List
<
String
>
flutterRootComponents
;
bool
isFlutterLibrary
(
String
filename
)
{
flutterRootComponents
??=
path
.
normalize
(
path
.
absolute
(
ArtifactStor
e
.
flutterRoot
)).
split
(
path
.
separator
);
flutterRootComponents
??=
path
.
normalize
(
path
.
absolute
(
Cach
e
.
flutterRoot
)).
split
(
path
.
separator
);
List
<
String
>
filenameComponents
=
path
.
normalize
(
path
.
absolute
(
filename
)).
split
(
path
.
separator
);
if
(
filenameComponents
.
length
<
flutterRootComponents
.
length
+
4
)
// the 4: 'packages', package_name, 'lib', file_name
return
false
;
...
...
@@ -195,7 +195,7 @@ class AnalyzeCommand extends FlutterCommand {
DriverOptions
options
=
new
DriverOptions
();
options
.
dartSdkPath
=
argResults
[
'dart-sdk'
];
options
.
packageMap
=
packages
;
options
.
analysisOptionsFile
=
path
.
join
(
ArtifactStor
e
.
flutterRoot
,
'packages'
,
'flutter_tools'
,
'flutter_analysis_options'
);
options
.
analysisOptionsFile
=
path
.
join
(
Cach
e
.
flutterRoot
,
'packages'
,
'flutter_tools'
,
'flutter_analysis_options'
);
AnalysisDriver
analyzer
=
new
AnalysisDriver
(
options
);
//TODO (pq): consider error handling
...
...
@@ -397,11 +397,11 @@ class PackageDependency {
}
bool
get
hasConflict
=>
values
.
length
>
1
;
bool
get
hasConflictAffectingFlutterRepo
{
assert
(
path
.
isAbsolute
(
ArtifactStor
e
.
flutterRoot
));
assert
(
path
.
isAbsolute
(
Cach
e
.
flutterRoot
));
for
(
List
<
String
>
targetSources
in
values
.
values
)
{
for
(
String
source
in
targetSources
)
{
assert
(
path
.
isAbsolute
(
source
));
if
(
path
.
isWithin
(
ArtifactStor
e
.
flutterRoot
,
source
))
if
(
path
.
isWithin
(
Cach
e
.
flutterRoot
,
source
))
return
true
;
}
}
...
...
packages/flutter_tools/lib/src/commands/create.dart
View file @
32846de9
...
...
@@ -8,7 +8,6 @@ import 'dart:io';
import
'package:path/path.dart'
as
path
;
import
'../android/android.dart'
as
android
;
import
'../artifacts.dart'
;
import
'../base/utils.dart'
;
import
'../cache.dart'
;
import
'../dart/pub.dart'
;
...
...
@@ -64,7 +63,7 @@ class CreateCommand extends FlutterCommand {
return
2
;
}
if
(
ArtifactStor
e
.
flutterRoot
==
null
)
{
if
(
Cach
e
.
flutterRoot
==
null
)
{
printError
(
'Neither the --flutter-root command line flag nor the FLUTTER_ROOT environment
\n
'
'variable was specified. Unable to find package:flutter.'
);
return
2
;
...
...
@@ -72,7 +71,7 @@ class CreateCommand extends FlutterCommand {
await
Cache
.
instance
.
updateAll
();
String
flutterRoot
=
path
.
absolute
(
ArtifactStor
e
.
flutterRoot
);
String
flutterRoot
=
path
.
absolute
(
Cach
e
.
flutterRoot
);
String
flutterPackagesDirectory
=
path
.
join
(
flutterRoot
,
'packages'
);
String
flutterPackagePath
=
path
.
join
(
flutterPackagesDirectory
,
'flutter'
);
...
...
packages/flutter_tools/lib/src/commands/setup.dart
View file @
32846de9
...
...
@@ -9,8 +9,8 @@ import 'package:path/path.dart' as path;
import
'../base/os.dart'
;
import
'../base/process.dart'
;
import
'../cache.dart'
;
import
'../doctor.dart'
;
import
'../artifacts.dart'
;
import
'../globals.dart'
;
import
'../runner/flutter_command.dart'
;
...
...
@@ -113,7 +113,7 @@ class SetupCommand extends FlutterCommand {
// dartlang:
// sdkLocation: "..."
String
flutterRoot
=
path
.
normalize
(
path
.
absolute
(
ArtifactStor
e
.
flutterRoot
));
String
flutterRoot
=
path
.
normalize
(
path
.
absolute
(
Cach
e
.
flutterRoot
));
String
sdkLocation
=
path
.
join
(
flutterRoot
,
'bin/cache/dart-sdk'
);
File
file
=
AtomValidator
.
getConfigFile
();
...
...
packages/flutter_tools/lib/src/commands/upgrade.dart
View file @
32846de9
...
...
@@ -5,9 +5,9 @@
import
'dart:async'
;
import
'dart:io'
;
import
'../artifacts.dart'
;
import
'../base/process.dart'
;
import
'../dart/pub.dart'
;
import
'../cache.dart'
;
import
'../globals.dart'
;
import
'../runner/flutter_command.dart'
;
import
'../version.dart'
;
...
...
@@ -27,17 +27,17 @@ class UpgradeCommand extends FlutterCommand {
try
{
runCheckedSync
(<
String
>[
'git'
,
'rev-parse'
,
'@{u}'
],
workingDirectory:
ArtifactStor
e
.
flutterRoot
);
],
workingDirectory:
Cach
e
.
flutterRoot
);
}
catch
(
e
)
{
printError
(
'Unable to upgrade Flutter: no upstream repository configured.'
);
return
1
;
}
printStatus
(
'Upgrading Flutter from
${
ArtifactStor
e.flutterRoot}
...'
);
printStatus
(
'Upgrading Flutter from
${
Cach
e.flutterRoot}
...'
);
int
code
=
await
runCommandAndStreamOutput
(
<
String
>[
'git'
,
'pull'
,
'--ff-only'
],
workingDirectory:
ArtifactStor
e
.
flutterRoot
,
workingDirectory:
Cach
e
.
flutterRoot
,
mapFunction:
(
String
line
)
=>
matchesGitLine
(
line
)
?
null
:
line
);
...
...
@@ -49,10 +49,10 @@ class UpgradeCommand extends FlutterCommand {
printStatus
(
'Upgrading engine...'
);
code
=
await
runCommandAndStreamOutput
(<
String
>[
'bin/flutter'
,
'--no-color'
,
'precache'
],
workingDirectory:
ArtifactStor
e
.
flutterRoot
);
],
workingDirectory:
Cach
e
.
flutterRoot
);
printStatus
(
''
);
printStatus
(
FlutterVersion
.
getVersion
(
ArtifactStor
e
.
flutterRoot
).
toString
());
printStatus
(
FlutterVersion
.
getVersion
(
Cach
e
.
flutterRoot
).
toString
());
if
(
FileSystemEntity
.
isFileSync
(
'pubspec.yaml'
))
{
printStatus
(
''
);
...
...
packages/flutter_tools/lib/src/dart/sdk.dart
View file @
32846de9
...
...
@@ -6,11 +6,11 @@ import 'dart:io';
import
'package:path/path.dart'
as
path
;
import
'../
artifacts
.dart'
;
import
'../
cache
.dart'
;
/// Locate the Dart SDK.
String
get
dartSdkPath
{
return
path
.
join
(
ArtifactStor
e
.
flutterRoot
,
'bin'
,
'cache'
,
'dart-sdk'
);
return
path
.
join
(
Cach
e
.
flutterRoot
,
'bin'
,
'cache'
,
'dart-sdk'
);
}
/// Return the platform specific name for the given Dart SDK binary. So, `pub`
...
...
packages/flutter_tools/lib/src/flx.dart
View file @
32846de9
...
...
@@ -12,9 +12,9 @@ import 'package:json_schema/json_schema.dart';
import
'package:path/path.dart'
as
path
;
import
'package:yaml/yaml.dart'
;
import
'artifacts.dart'
;
import
'base/file_system.dart'
show
ensureDirectoryExists
;
import
'base/process.dart'
;
import
'cache.dart'
;
import
'globals.dart'
;
import
'package_map.dart'
;
import
'toolchain.dart'
;
...
...
@@ -93,7 +93,7 @@ class _Asset {
}
Map
<
String
,
dynamic
>
_readMaterialFontsManifest
()
{
String
fontsPath
=
path
.
join
(
path
.
absolute
(
ArtifactStor
e
.
flutterRoot
),
String
fontsPath
=
path
.
join
(
path
.
absolute
(
Cach
e
.
flutterRoot
),
'packages'
,
'flutter_tools'
,
'schema'
,
'material_fonts.yaml'
);
return
loadYaml
(
new
File
(
fontsPath
).
readAsStringSync
());
...
...
@@ -112,7 +112,7 @@ List<_Asset> _getMaterialAssets(String fontSet) {
for
(
Map
<
String
,
dynamic
>
font
in
family
[
'fonts'
])
{
String
assetKey
=
font
[
'asset'
];
result
.
add
(
new
_Asset
(
base:
'
${
ArtifactStor
e.flutterRoot}
/bin/cache/artifacts/material_fonts'
,
base:
'
${
Cach
e.flutterRoot}
/bin/cache/artifacts/material_fonts'
,
source
:
path
.
basename
(
assetKey
),
relativePath:
assetKey
));
...
...
@@ -227,7 +227,7 @@ dynamic _loadManifest(String manifestPath) {
}
Future
<
int
>
_validateManifest
(
Object
manifest
)
async
{
String
schemaPath
=
path
.
join
(
path
.
absolute
(
ArtifactStor
e
.
flutterRoot
),
String
schemaPath
=
path
.
join
(
path
.
absolute
(
Cach
e
.
flutterRoot
),
'packages'
,
'flutter_tools'
,
'schema'
,
'flutter_yaml.json'
);
Schema
schema
=
await
Schema
.
createSchemaFromUrl
(
'file://
$schemaPath
'
);
...
...
packages/flutter_tools/lib/src/ios/mac.dart
View file @
32846de9
...
...
@@ -9,9 +9,9 @@ import 'dart:io';
import
'package:path/path.dart'
as
path
;
import
'../application_package.dart'
;
import
'../artifacts.dart'
;
import
'../base/context.dart'
;
import
'../base/process.dart'
;
import
'../cache.dart'
;
import
'../globals.dart'
;
import
'../services.dart'
;
import
'setup_xcodeproj.dart'
;
...
...
@@ -184,7 +184,7 @@ bool _checkXcodeVersion() {
}
bool
_validateEngineRevision
(
ApplicationPackage
app
)
{
String
skyRevision
=
ArtifactStor
e
.
engineRevision
;
String
skyRevision
=
Cach
e
.
engineRevision
;
String
iosRevision
=
_getIOSEngineRevision
(
app
);
if
(
iosRevision
!=
skyRevision
)
{
...
...
packages/flutter_tools/lib/src/ios/setup_xcodeproj.dart
View file @
32846de9
...
...
@@ -7,9 +7,9 @@ import 'dart:io';
import
'package:path/path.dart'
as
path
;
import
'../artifacts.dart'
;
import
'../base/process.dart'
;
import
'../build_info.dart'
;
import
'../cache.dart'
;
import
'../globals.dart'
;
import
'../runner/flutter_command_runner.dart'
;
...
...
@@ -85,7 +85,7 @@ bool xcodeProjectRequiresUpdate() {
return
true
;
}
if
(
revisionFile
.
readAsStringSync
()
!=
ArtifactStor
e
.
engineRevision
)
{
if
(
revisionFile
.
readAsStringSync
()
!=
Cach
e
.
engineRevision
)
{
printTrace
(
"The revision stamp and the Flutter engine revision differ. Project needs to be updated."
);
return
true
;
}
...
...
@@ -121,7 +121,7 @@ Future<int> setupXcodeProjectHarness(String flutterProjectPath) async {
// Step 4: Write the REVISION file
File
revisionFile
=
new
File
(
path
.
join
(
xcodeprojPath
,
'REVISION'
));
revisionFile
.
createSync
();
revisionFile
.
writeAsStringSync
(
ArtifactStor
e
.
engineRevision
);
revisionFile
.
writeAsStringSync
(
Cach
e
.
engineRevision
);
// Step 5: Tell the user the location of the generated project.
printStatus
(
'Xcode project created in
$iosFilesPath
/.'
);
...
...
packages/flutter_tools/lib/src/runner/flutter_command_runner.dart
View file @
32846de9
...
...
@@ -10,10 +10,10 @@ import 'package:args/command_runner.dart';
import
'package:path/path.dart'
as
path
;
import
'../android/android_sdk.dart'
;
import
'../artifacts.dart'
;
import
'../base/context.dart'
;
import
'../base/logger.dart'
;
import
'../base/process.dart'
;
import
'../cache.dart'
;
import
'../globals.dart'
;
import
'../package_map.dart'
;
import
'../toolchain.dart'
;
...
...
@@ -128,9 +128,9 @@ class FlutterCommandRunner extends CommandRunner {
if
(
globalResults
.
wasParsed
(
'color'
))
logger
.
supportsColor
=
globalResults
[
'color'
];
// we must set
ArtifactStor
e.flutterRoot early because other features use it
// we must set
Cach
e.flutterRoot early because other features use it
// (e.g. enginePath's initialiser uses it)
ArtifactStor
e
.
flutterRoot
=
path
.
normalize
(
path
.
absolute
(
globalResults
[
'flutter-root'
]));
Cach
e
.
flutterRoot
=
path
.
normalize
(
path
.
absolute
(
globalResults
[
'flutter-root'
]));
_checkFlutterCopy
();
...
...
@@ -159,7 +159,7 @@ class FlutterCommandRunner extends CommandRunner {
if
(
globalResults
[
'version'
])
{
flutterUsage
.
sendCommand
(
'version'
);
printStatus
(
FlutterVersion
.
getVersion
(
ArtifactStor
e
.
flutterRoot
).
toString
());
printStatus
(
FlutterVersion
.
getVersion
(
Cach
e
.
flutterRoot
).
toString
());
return
new
Future
<
int
>.
value
(
0
);
}
...
...
@@ -185,7 +185,7 @@ class FlutterCommandRunner extends CommandRunner {
}
on
FileSystemException
{
}
on
FormatException
{
}
if
(
engineSourcePath
==
null
)
engineSourcePath
=
_tryEnginePath
(
path
.
join
(
ArtifactStor
e
.
flutterRoot
,
'../engine/src'
));
engineSourcePath
=
_tryEnginePath
(
path
.
join
(
Cach
e
.
flutterRoot
,
'../engine/src'
));
if
(
engineSourcePath
==
null
)
{
printError
(
'Unable to detect local Flutter engine build directory.
\n
'
...
...
@@ -225,13 +225,13 @@ class FlutterCommandRunner extends CommandRunner {
}
static
void
initFlutterRoot
()
{
if
(
ArtifactStor
e
.
flutterRoot
==
null
)
ArtifactStor
e
.
flutterRoot
=
_defaultFlutterRoot
;
if
(
Cach
e
.
flutterRoot
==
null
)
Cach
e
.
flutterRoot
=
_defaultFlutterRoot
;
}
/// Get all pub packages in the Flutter repo.
List
<
Directory
>
getRepoPackages
()
{
return
_gatherProjectPaths
(
path
.
absolute
(
ArtifactStor
e
.
flutterRoot
))
return
_gatherProjectPaths
(
path
.
absolute
(
Cach
e
.
flutterRoot
))
.
map
((
String
dir
)
=>
new
Directory
(
dir
))
.
toList
();
}
...
...
@@ -258,10 +258,10 @@ class FlutterCommandRunner extends CommandRunner {
// Check if the cwd is a flutter dir.
while
(
directory
.
isNotEmpty
)
{
if
(
_isDirectoryFlutterRepo
(
directory
))
{
if
(
directory
!=
ArtifactStor
e
.
flutterRoot
)
{
if
(
directory
!=
Cach
e
.
flutterRoot
)
{
printError
(
'Warning: the active Flutter is not the one from the current directory.
\n
'
' Active Flutter :
${
ArtifactStor
e.flutterRoot}
\n
'
' Active Flutter :
${
Cach
e.flutterRoot}
\n
'
' Current directory:
$directory
\n
'
);
}
...
...
packages/flutter_tools/lib/src/template.dart
View file @
32846de9
...
...
@@ -7,7 +7,7 @@ import 'dart:io';
import
'package:mustache4dart/mustache4dart.dart'
as
mustache
;
import
'package:path/path.dart'
as
path
;
import
'
artifacts
.dart'
;
import
'
cache
.dart'
;
import
'globals.dart'
;
const
String
_kTemplateExtension
=
'.tmpl'
;
...
...
@@ -122,7 +122,7 @@ class Template {
}
Directory
_templateDirectoryInPackage
(
String
name
)
{
String
templatesDir
=
path
.
join
(
ArtifactStor
e
.
flutterRoot
,
String
templatesDir
=
path
.
join
(
Cach
e
.
flutterRoot
,
'packages'
,
'flutter_tools'
,
'templates'
);
return
new
Directory
(
path
.
join
(
templatesDir
,
name
));
}
packages/flutter_tools/lib/src/version.dart
View file @
32846de9
...
...
@@ -4,8 +4,8 @@
import
'dart:io'
;
import
'artifacts.dart'
;
import
'base/process.dart'
;
import
'cache.dart'
;
final
Set
<
String
>
kKnownBranchNames
=
new
Set
<
String
>.
from
(<
String
>[
'master'
,
...
...
@@ -48,7 +48,7 @@ class FlutterVersion {
String
_frameworkAge
;
String
get
frameworkAge
=>
_frameworkAge
;
String
get
engineRevision
=>
ArtifactStor
e
.
engineRevision
;
String
get
engineRevision
=>
Cach
e
.
engineRevision
;
String
get
engineRevisionShort
=>
_shortGitRevision
(
engineRevision
);
String
_runGit
(
String
command
)
=>
runSync
(
command
.
split
(
' '
),
workingDirectory:
flutterRoot
);
...
...
@@ -62,12 +62,12 @@ class FlutterVersion {
}
static
FlutterVersion
getVersion
([
String
flutterRoot
])
{
return
new
FlutterVersion
(
flutterRoot
!=
null
?
flutterRoot
:
ArtifactStor
e
.
flutterRoot
);
return
new
FlutterVersion
(
flutterRoot
!=
null
?
flutterRoot
:
Cach
e
.
flutterRoot
);
}
/// Return a short string for the version (`alpha/a76bc8e22b`).
static
String
getVersionString
({
bool
whitelistBranchName:
false
})
{
final
String
cwd
=
ArtifactStor
e
.
flutterRoot
;
final
String
cwd
=
Cach
e
.
flutterRoot
;
String
commit
=
_shortGitRevision
(
_runSync
(
'git'
,
<
String
>[
'rev-parse'
,
'HEAD'
],
cwd
));
commit
=
commit
.
isEmpty
?
'unknown'
:
commit
;
...
...
packages/flutter_tools/test/analytics_test.dart
View file @
32846de9
...
...
@@ -5,7 +5,7 @@
import
'dart:io'
;
import
'package:args/command_runner.dart'
;
import
'package:flutter_tools/src/
artifacts
.dart'
;
import
'package:flutter_tools/src/
cache
.dart'
;
import
'package:flutter_tools/src/commands/create.dart'
;
import
'package:flutter_tools/src/commands/config.dart'
;
import
'package:flutter_tools/src/commands/doctor.dart'
;
...
...
@@ -22,7 +22,7 @@ void main() {
bool
wasEnabled
;
setUp
(()
{
ArtifactStor
e
.
flutterRoot
=
'../..'
;
Cach
e
.
flutterRoot
=
'../..'
;
wasEnabled
=
flutterUsage
.
enabled
;
temp
=
Directory
.
systemTemp
.
createTempSync
(
'flutter_tools'
);
});
...
...
packages/flutter_tools/test/create_test.dart
View file @
32846de9
...
...
@@ -6,7 +6,7 @@ import 'dart:async';
import
'dart:io'
;
import
'package:args/command_runner.dart'
;
import
'package:flutter_tools/src/
artifacts
.dart'
;
import
'package:flutter_tools/src/
cache
.dart'
;
import
'package:flutter_tools/src/commands/create.dart'
;
import
'package:flutter_tools/src/dart/sdk.dart'
;
import
'package:path/path.dart'
as
path
;
...
...
@@ -38,7 +38,7 @@ void main() {
// Verify that we can regenerate over an existing project.
testUsingContext
(
'can re-gen over existing project'
,
()
async
{
ArtifactStor
e
.
flutterRoot
=
'../..'
;
Cach
e
.
flutterRoot
=
'../..'
;
CreateCommand
command
=
new
CreateCommand
();
CommandRunner
runner
=
createTestCommandRunner
(
command
);
...
...
@@ -52,7 +52,7 @@ void main() {
// Verify that we fail with an error code when the file exists.
testUsingContext
(
'fails when file exists'
,
()
async
{
ArtifactStor
e
.
flutterRoot
=
'../..'
;
Cach
e
.
flutterRoot
=
'../..'
;
CreateCommand
command
=
new
CreateCommand
();
CommandRunner
runner
=
createTestCommandRunner
(
command
);
File
existingFile
=
new
File
(
"
${temp.path.toString()}
/bad"
);
...
...
@@ -64,7 +64,7 @@ void main() {
}
Future
<
Null
>
_createAndAnalyzeProject
(
Directory
dir
,
List
<
String
>
createArgs
)
async
{
ArtifactStor
e
.
flutterRoot
=
'../..'
;
Cach
e
.
flutterRoot
=
'../..'
;
CreateCommand
command
=
new
CreateCommand
();
CommandRunner
runner
=
createTestCommandRunner
(
command
);
List
<
String
>
args
=
<
String
>[
'create'
];
...
...
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