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
5228a785
Unverified
Commit
5228a785
authored
Apr 16, 2019
by
Jonah Williams
Committed by
GitHub
Apr 16, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fuchsia step 1: add SDK version file and artifact download (#31073)
parent
96e1fc9c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
86 additions
and
31 deletions
+86
-31
fuchsia.version
bin/internal/fuchsia.version
+1
-0
cache.dart
packages/flutter_tools/lib/src/cache.dart
+71
-10
precache.dart
packages/flutter_tools/lib/src/commands/precache.dart
+11
-19
precache_test.dart
packages/flutter_tools/test/commands/precache_test.dart
+3
-2
No files found.
bin/internal/fuchsia.version
0 → 100644
View file @
5228a785
Ow5Xdviq7OwKr7XNuf-Bw0nBMeAr849mFn7gc_RUpzUC
packages/flutter_tools/lib/src/cache.dart
View file @
5228a785
...
@@ -16,27 +16,53 @@ import 'base/platform.dart';
...
@@ -16,27 +16,53 @@ import 'base/platform.dart';
import
'globals.dart'
;
import
'globals.dart'
;
/// A tag for a set of development artifacts that need to be cached.
/// A tag for a set of development artifacts that need to be cached.
enum
DevelopmentArtifact
{
class
DevelopmentArtifact
{
const
DevelopmentArtifact
.
_
(
this
.
name
,
{
this
.
unstable
=
false
});
/// The name of the artifact.
///
/// This should match the flag name in precache.dart
final
String
name
;
/// Whether this artifact should not be usable on stable branches.
final
bool
unstable
;
/// Artifacts required for Android development.
/// Artifacts required for Android development.
android
,
static
const
DevelopmentArtifact
android
=
DevelopmentArtifact
.
_
(
'android'
);
/// Artifacts required for iOS development.
/// Artifacts required for iOS development.
iOS
,
static
const
DevelopmentArtifact
iOS
=
DevelopmentArtifact
.
_
(
'ios'
);
/// Artifacts required for web development,
/// Artifacts required for web development,
web
,
static
const
DevelopmentArtifact
web
=
DevelopmentArtifact
.
_
(
'web'
,
unstable:
true
);
/// Artifacts required for desktop macOS.
/// Artifacts required for desktop macOS.
macOS
,
static
const
DevelopmentArtifact
macOS
=
DevelopmentArtifact
.
_
(
'macos'
,
unstable:
true
);
/// Artifacts required for desktop Windows.
/// Artifacts required for desktop Windows.
windows
,
static
const
DevelopmentArtifact
windows
=
DevelopmentArtifact
.
_
(
'windows'
,
unstable:
true
);
/// Artifacts required for desktop linux.
/// Artifacts required for desktop linux.
linux
,
static
const
DevelopmentArtifact
linux
=
DevelopmentArtifact
.
_
(
'linux'
,
unstable:
true
);
/// Artifacts required for Fuchsia.
static
const
DevelopmentArtifact
fuchsia
=
DevelopmentArtifact
.
_
(
'fuchsia'
,
unstable:
true
);
/// Artifacts required by all developments.
/// Artifacts required by all developments.
universal
,
static
const
DevelopmentArtifact
universal
=
DevelopmentArtifact
.
_
(
'universal'
);
/// The vaulues of DevelopmentArtifacts.
static
final
List
<
DevelopmentArtifact
>
values
=
<
DevelopmentArtifact
>[
android
,
iOS
,
web
,
macOS
,
windows
,
linux
,
fuchsia
,
universal
,
];
}
}
/// A wrapper around the `bin/cache/` directory.
/// A wrapper around the `bin/cache/` directory.
...
@@ -54,6 +80,7 @@ class Cache {
...
@@ -54,6 +80,7 @@ class Cache {
_artifacts
.
add
(
WindowsEngineArtifacts
(
this
));
_artifacts
.
add
(
WindowsEngineArtifacts
(
this
));
_artifacts
.
add
(
MacOSEngineArtifacts
(
this
));
_artifacts
.
add
(
MacOSEngineArtifacts
(
this
));
_artifacts
.
add
(
LinuxEngineArtifacts
(
this
));
_artifacts
.
add
(
LinuxEngineArtifacts
(
this
));
_artifacts
.
add
(
FuchsiaCacheArtifacts
(
this
));
}
else
{
}
else
{
_artifacts
.
addAll
(
artifacts
);
_artifacts
.
addAll
(
artifacts
);
}
}
...
@@ -155,12 +182,19 @@ class Cache {
...
@@ -155,12 +182,19 @@ class Cache {
return
_dartSdkVersion
;
return
_dartSdkVersion
;
}
}
String
_engineRevision
;
/// The current version of the Flutter engine the flutter tool will download.
String
get
engineRevision
{
String
get
engineRevision
{
_engineRevision
??=
getVersionFor
(
'engine'
);
_engineRevision
??=
getVersionFor
(
'engine'
);
return
_engineRevision
;
return
_engineRevision
;
}
}
String
_engineRevision
;
/// The current version of the Fuchsia SDK the flutter tool will download.
String
get
fuchsiaRevision
{
_fuchsiaRevision
??=
getVersionFor
(
'fuchsia'
);
return
_fuchsiaRevision
;
}
String
_fuchsiaRevision
;
static
Cache
get
instance
=>
context
[
Cache
];
static
Cache
get
instance
=>
context
[
Cache
];
...
@@ -817,6 +851,33 @@ class GradleWrapper extends CachedArtifact {
...
@@ -817,6 +851,33 @@ class GradleWrapper extends CachedArtifact {
}
}
}
}
/// The Fuchsia core SDK.
class
FuchsiaCacheArtifacts
extends
CachedArtifact
{
FuchsiaCacheArtifacts
(
Cache
cache
)
:
super
(
'fuchsia'
,
cache
,
const
<
DevelopmentArtifact
>
{
DevelopmentArtifact
.
fuchsia
,
});
static
const
String
_cipdBaseUrl
=
'https://chrome-infra-packages.appspot.com/dl'
;
static
const
String
_macOSSdk
=
'fuchsia/sdk/core/mac-amd64'
;
static
const
String
_linuxSdk
=
'fuchsia/sdk/core/linux-amd64'
;
@override
Future
<
void
>
updateInner
()
async
{
// Step 1: Determine variant of Fuchsia SDK to download.
String
packageName
;
if
(
platform
.
isLinux
)
{
packageName
=
_linuxSdk
;
}
else
if
(
platform
.
isMacOS
)
{
packageName
=
_macOSSdk
;
}
else
{
// Unsupported.
return
;
}
final
String
url
=
'
$_cipdBaseUrl
/
$packageName
/+/
$version
'
;
await
_downloadZipArchive
(
'Downloading package fuchsia SDK...'
,
Uri
.
parse
(
url
),
location
);
}
}
// Many characters are problematic in filenames, especially on Windows.
// Many characters are problematic in filenames, especially on Windows.
final
Map
<
int
,
List
<
int
>>
_flattenNameSubstitutions
=
<
int
,
List
<
int
>>{
final
Map
<
int
,
List
<
int
>>
_flattenNameSubstitutions
=
<
int
,
List
<
int
>>{
r'@'
.
codeUnitAt
(
0
):
'@@'
.
codeUnits
,
r'@'
.
codeUnitAt
(
0
):
'@@'
.
codeUnits
,
...
...
packages/flutter_tools/lib/src/commands/precache.dart
View file @
5228a785
...
@@ -25,6 +25,10 @@ class PrecacheCommand extends FlutterCommand {
...
@@ -25,6 +25,10 @@ class PrecacheCommand extends FlutterCommand {
help:
'Precache artifacts for windows desktop development'
);
help:
'Precache artifacts for windows desktop development'
);
argParser
.
addFlag
(
'macos'
,
negatable:
true
,
defaultsTo:
false
,
argParser
.
addFlag
(
'macos'
,
negatable:
true
,
defaultsTo:
false
,
help:
'Precache artifacts for macOS desktop development'
);
help:
'Precache artifacts for macOS desktop development'
);
argParser
.
addFlag
(
'fuchsia'
,
negatable:
true
,
defaultsTo:
false
,
help:
'Precache artifacts for Fuchsia development'
);
argParser
.
addFlag
(
'universal'
,
negatable:
true
,
defaultsTo:
true
,
help:
'Precache artifacts required for all developments'
);
}
}
@override
@override
...
@@ -41,28 +45,16 @@ class PrecacheCommand extends FlutterCommand {
...
@@ -41,28 +45,16 @@ class PrecacheCommand extends FlutterCommand {
if
(
argResults
[
'all-platforms'
])
{
if
(
argResults
[
'all-platforms'
])
{
cache
.
includeAllPlatforms
=
true
;
cache
.
includeAllPlatforms
=
true
;
}
}
final
Set
<
DevelopmentArtifact
>
requiredArtifacts
=
<
DevelopmentArtifact
>{
DevelopmentArtifact
.
universal
};
final
Set
<
DevelopmentArtifact
>
requiredArtifacts
=
<
DevelopmentArtifact
>{};
if
(
argResults
[
'android'
])
{
for
(
DevelopmentArtifact
artifact
in
DevelopmentArtifact
.
values
)
{
requiredArtifacts
.
add
(
DevelopmentArtifact
.
android
);
// Don't include unstable artifacts on stable branches.
}
if
(
FlutterVersion
.
instance
.
isStable
&&
artifact
.
unstable
)
{
if
(
argResults
[
'ios'
])
{
continue
;
requiredArtifacts
.
add
(
DevelopmentArtifact
.
iOS
);
}
if
(!
FlutterVersion
.
instance
.
isStable
)
{
if
(
argResults
[
'web'
])
{
requiredArtifacts
.
add
(
DevelopmentArtifact
.
web
);
}
if
(
argResults
[
'linux'
])
{
requiredArtifacts
.
add
(
DevelopmentArtifact
.
linux
);
}
}
if
(
argResults
[
'windows'
])
{
if
(
argResults
[
artifact
.
name
])
{
requiredArtifacts
.
add
(
DevelopmentArtifact
.
windows
);
requiredArtifacts
.
add
(
artifact
);
}
if
(
argResults
[
'macos'
])
{
requiredArtifacts
.
add
(
DevelopmentArtifact
.
macOS
);
}
}
}
}
if
(
cache
.
isUpToDate
())
{
if
(
cache
.
isUpToDate
())
{
printStatus
(
'Already up-to-date.'
);
printStatus
(
'Already up-to-date.'
);
}
else
{
}
else
{
...
...
packages/flutter_tools/test/commands/precache_test.dart
View file @
5228a785
...
@@ -27,7 +27,7 @@ void main() {
...
@@ -27,7 +27,7 @@ void main() {
final
PrecacheCommand
command
=
PrecacheCommand
();
final
PrecacheCommand
command
=
PrecacheCommand
();
applyMocksToCommand
(
command
);
applyMocksToCommand
(
command
);
await
createTestCommandRunner
(
command
).
run
(
await
createTestCommandRunner
(
command
).
run
(
const
<
String
>[
'precache'
,
'--ios'
,
'--android'
,
'--web'
,
'--macos'
,
'--linux'
,
'--windows'
]
const
<
String
>[
'precache'
,
'--ios'
,
'--android'
,
'--web'
,
'--macos'
,
'--linux'
,
'--windows'
,
'--fuchsia'
]
);
);
expect
(
artifacts
,
unorderedEquals
(<
DevelopmentArtifact
>{
expect
(
artifacts
,
unorderedEquals
(<
DevelopmentArtifact
>{
DevelopmentArtifact
.
universal
,
DevelopmentArtifact
.
universal
,
...
@@ -37,6 +37,7 @@ void main() {
...
@@ -37,6 +37,7 @@ void main() {
DevelopmentArtifact
.
macOS
,
DevelopmentArtifact
.
macOS
,
DevelopmentArtifact
.
linux
,
DevelopmentArtifact
.
linux
,
DevelopmentArtifact
.
windows
,
DevelopmentArtifact
.
windows
,
DevelopmentArtifact
.
fuchsia
,
}));
}));
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
Cache:
()
=>
cache
,
Cache:
()
=>
cache
,
...
@@ -51,7 +52,7 @@ void main() {
...
@@ -51,7 +52,7 @@ void main() {
final
PrecacheCommand
command
=
PrecacheCommand
();
final
PrecacheCommand
command
=
PrecacheCommand
();
applyMocksToCommand
(
command
);
applyMocksToCommand
(
command
);
await
createTestCommandRunner
(
command
).
run
(
await
createTestCommandRunner
(
command
).
run
(
const
<
String
>[
'precache'
,
'--ios'
,
'--android'
,
'--web'
,
'--macos'
,
'--linux'
,
'--windows'
]
const
<
String
>[
'precache'
,
'--ios'
,
'--android'
,
'--web'
,
'--macos'
,
'--linux'
,
'--windows'
,
'--fuchsia'
]
);
);
expect
(
artifacts
,
unorderedEquals
(<
DevelopmentArtifact
>{
expect
(
artifacts
,
unorderedEquals
(<
DevelopmentArtifact
>{
DevelopmentArtifact
.
universal
,
DevelopmentArtifact
.
universal
,
...
...
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