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
861fe0a2
Unverified
Commit
861fe0a2
authored
Oct 09, 2019
by
Jonah Williams
Committed by
GitHub
Oct 09, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure precache --web works on dev branch (#42289)
parent
3ff51c74
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
205 additions
and
142 deletions
+205
-142
cache.dart
packages/flutter_tools/lib/src/cache.dart
+10
-3
precache.dart
packages/flutter_tools/lib/src/commands/precache.dart
+4
-0
features.dart
packages/flutter_tools/lib/src/features.dart
+10
-8
precache_test.dart
...ter_tools/test/commands.shard/hermetic/precache_test.dart
+163
-130
cache_test.dart
packages/flutter_tools/test/general.shard/cache_test.dart
+1
-1
testbed.dart
packages/flutter_tools/test/src/testbed.dart
+17
-0
No files found.
packages/flutter_tools/lib/src/cache.dart
View file @
861fe0a2
...
...
@@ -16,21 +16,25 @@ import 'base/net.dart';
import
'base/os.dart'
;
import
'base/platform.dart'
;
import
'base/process.dart'
;
import
'features.dart'
;
import
'globals.dart'
;
/// A tag for a set of development artifacts that need to be cached.
class
DevelopmentArtifact
{
const
DevelopmentArtifact
.
_
(
this
.
name
,
{
this
.
unstable
=
false
});
const
DevelopmentArtifact
.
_
(
this
.
name
,
{
this
.
unstable
=
false
,
this
.
feature
});
/// The name of the artifact.
///
/// This should match the flag name in precache.dart
final
String
name
;
/// Whether this artifact should be unavailable on
stable branches
.
/// Whether this artifact should be unavailable on
master branch only
.
final
bool
unstable
;
/// A feature to control the visibility of this artifact.
final
Feature
feature
;
/// Artifacts required for Android development.
static
const
DevelopmentArtifact
androidGenSnapshot
=
DevelopmentArtifact
.
_
(
'android_gen_snapshot'
);
static
const
DevelopmentArtifact
androidMaven
=
DevelopmentArtifact
.
_
(
'android_maven'
);
...
...
@@ -41,7 +45,7 @@ class DevelopmentArtifact {
static
const
DevelopmentArtifact
iOS
=
DevelopmentArtifact
.
_
(
'ios'
);
/// Artifacts required for web development.
static
const
DevelopmentArtifact
web
=
DevelopmentArtifact
.
_
(
'web'
,
unstable:
tru
e
);
static
const
DevelopmentArtifact
web
=
DevelopmentArtifact
.
_
(
'web'
,
feature:
flutterWebFeatur
e
);
/// Artifacts required for desktop macOS.
static
const
DevelopmentArtifact
macOS
=
DevelopmentArtifact
.
_
(
'macos'
,
unstable:
true
);
...
...
@@ -75,6 +79,9 @@ class DevelopmentArtifact {
universal
,
flutterRunner
,
];
@override
String
toString
()
=>
'Artifact(
$name
,
$unstable
)'
;
}
/// A wrapper around the `bin/cache/` directory.
...
...
packages/flutter_tools/lib/src/commands/precache.dart
View file @
861fe0a2
...
...
@@ -5,6 +5,7 @@
import
'dart:async'
;
import
'../cache.dart'
;
import
'../features.dart'
;
import
'../globals.dart'
;
import
'../runner/flutter_command.dart'
;
import
'../version.dart'
;
...
...
@@ -65,6 +66,9 @@ class PrecacheCommand extends FlutterCommand {
if
(!
FlutterVersion
.
instance
.
isMaster
&&
artifact
.
unstable
)
{
continue
;
}
if
(
artifact
.
feature
!=
null
&&
!
featureFlags
.
isEnabled
(
artifact
.
feature
))
{
continue
;
}
if
(
argResults
[
artifact
.
name
])
{
requiredArtifacts
.
add
(
artifact
);
}
...
...
packages/flutter_tools/lib/src/features.dart
View file @
861fe0a2
...
...
@@ -17,7 +17,7 @@ FeatureFlags get featureFlags => context.get<FeatureFlags>();
/// The interface used to determine if a particular [Feature] is enabled.
///
/// The rest of the tools code should use this class instead of looking up
/// features directly. To faciliate rolls to google3 and other clients, all
/// features directly. To facili
t
ate rolls to google3 and other clients, all
/// flags should be provided with a default implementation here. Clients that
/// use this class should extent instead of implement, so that new flags are
/// picked up automatically.
...
...
@@ -25,22 +25,24 @@ class FeatureFlags {
const
FeatureFlags
();
/// Whether flutter desktop for linux is enabled.
bool
get
isLinuxEnabled
=>
_
isEnabled
(
flutterLinuxDesktopFeature
);
bool
get
isLinuxEnabled
=>
isEnabled
(
flutterLinuxDesktopFeature
);
/// Whether flutter desktop for macOS is enabled.
bool
get
isMacOSEnabled
=>
_
isEnabled
(
flutterMacOSDesktopFeature
);
bool
get
isMacOSEnabled
=>
isEnabled
(
flutterMacOSDesktopFeature
);
/// Whether flutter web is enabled.
bool
get
isWebEnabled
=>
_
isEnabled
(
flutterWebFeature
);
bool
get
isWebEnabled
=>
isEnabled
(
flutterWebFeature
);
/// Whether flutter desktop for Windows is enabled.
bool
get
isWindowsEnabled
=>
_
isEnabled
(
flutterWindowsDesktopFeature
);
bool
get
isWindowsEnabled
=>
isEnabled
(
flutterWindowsDesktopFeature
);
/// Whether the new Android embedding is enabled.
bool
get
isNewAndroidEmbeddingEnabled
=>
_
isEnabled
(
flutterNewAndroidEmbeddingFeature
);
bool
get
isNewAndroidEmbeddingEnabled
=>
isEnabled
(
flutterNewAndroidEmbeddingFeature
);
// Calculate whether a particular feature is enabled for the current channel.
static
bool
_isEnabled
(
Feature
feature
)
{
/// Whether a particular feature is enabled for the current channel.
///
/// Prefer using one of the specific getters above instead of this API.
bool
isEnabled
(
Feature
feature
)
{
final
String
currentChannel
=
FlutterVersion
.
instance
.
channel
;
final
FeatureChannelSetting
featureSetting
=
feature
.
getSettingForChannel
(
currentChannel
);
if
(!
featureSetting
.
available
)
{
...
...
packages/flutter_tools/test/commands.shard/hermetic/precache_test.dart
View file @
861fe0a2
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/general.shard/cache_test.dart
View file @
861fe0a2
...
...
@@ -209,7 +209,7 @@ void main() {
});
test
(
'Unstable artifacts'
,
()
{
expect
(
DevelopmentArtifact
.
web
.
unstable
,
tru
e
);
expect
(
DevelopmentArtifact
.
web
.
unstable
,
fals
e
);
expect
(
DevelopmentArtifact
.
linux
.
unstable
,
true
);
expect
(
DevelopmentArtifact
.
macOS
.
unstable
,
true
);
expect
(
DevelopmentArtifact
.
windows
.
unstable
,
true
);
...
...
packages/flutter_tools/test/src/testbed.dart
View file @
861fe0a2
...
...
@@ -712,6 +712,23 @@ class TestFeatureFlags implements FeatureFlags {
@override
final
bool
isNewAndroidEmbeddingEnabled
;
@override
bool
isEnabled
(
Feature
feature
)
{
switch
(
feature
)
{
case
flutterWebFeature:
return
isWebEnabled
;
case
flutterLinuxDesktopFeature:
return
isLinuxEnabled
;
case
flutterMacOSDesktopFeature:
return
isMacOSEnabled
;
case
flutterWindowsDesktopFeature:
return
isWindowsEnabled
;
case
flutterNewAndroidEmbeddingFeature:
return
isNewAndroidEmbeddingEnabled
;
}
return
false
;
}
}
class
ThrowingPub
implements
Pub
{
...
...
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