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
79a985f9
Unverified
Commit
79a985f9
authored
Oct 23, 2019
by
Jonah Williams
Committed by
GitHub
Oct 23, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add compiler configuration to support dartdevc target (#43281)
parent
58c46a83
Changes
7
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
209 additions
and
81 deletions
+209
-81
artifacts.dart
packages/flutter_tools/lib/src/artifacts.dart
+8
-0
compile.dart
packages/flutter_tools/lib/src/compile.dart
+135
-80
features.dart
packages/flutter_tools/lib/src/features.dart
+14
-0
resident_runner.dart
packages/flutter_tools/lib/src/resident_runner.dart
+14
-1
compile_test.dart
packages/flutter_tools/test/general.shard/compile_test.dart
+4
-0
resident_runner_test.dart
...lutter_tools/test/general.shard/resident_runner_test.dart
+28
-0
testbed.dart
packages/flutter_tools/test/src/testbed.dart
+6
-0
No files found.
packages/flutter_tools/lib/src/artifacts.dart
View file @
79a985f9
...
...
@@ -40,6 +40,8 @@ enum Artifact {
kernelWorkerSnapshot
,
/// The root of the web implementation of the dart SDK.
flutterWebSdk
,
/// The summary dill for the dartdevc target.
webPlatformKernelDill
,
iosDeploy
,
ideviceinfo
,
ideviceId
,
...
...
@@ -126,6 +128,8 @@ String _artifactToFileName(Artifact artifact, [ TargetPlatform platform, BuildMo
return
'sky_engine'
;
case
Artifact
.
flutterMacOSPodspec
:
return
'FlutterMacOS.podspec'
;
case
Artifact
.
webPlatformKernelDill
:
return
'flutter_ddc_sdk.dill'
;
}
assert
(
false
,
'Invalid artifact
$artifact
.'
);
return
null
;
...
...
@@ -290,6 +294,8 @@ class CachedArtifacts extends Artifacts {
return
_getFlutterPatchedSdkPath
(
mode
);
case
Artifact
.
flutterWebSdk
:
return
_getFlutterWebSdkPath
();
case
Artifact
.
webPlatformKernelDill
:
return
fs
.
path
.
join
(
_getFlutterWebSdkPath
(),
'kernel'
,
_artifactToFileName
(
artifact
));
case
Artifact
.
dart2jsSnapshot
:
return
fs
.
path
.
join
(
dartSdkPath
,
'bin'
,
'snapshots'
,
_artifactToFileName
(
artifact
));
case
Artifact
.
dartdevcSnapshot
:
...
...
@@ -422,6 +428,8 @@ class LocalEngineArtifacts extends Artifacts {
return
fs
.
path
.
join
(
_hostEngineOutPath
,
'gen'
,
'dart-pkg'
,
artifactFileName
);
case
Artifact
.
flutterMacOSPodspec
:
return
fs
.
path
.
join
(
_hostEngineOutPath
,
_artifactToFileName
(
artifact
));
case
Artifact
.
webPlatformKernelDill
:
return
fs
.
path
.
join
(
_getFlutterWebSdkPath
(),
'kernel'
,
_artifactToFileName
(
artifact
));
}
assert
(
false
,
'Invalid artifact
$artifact
.'
);
return
null
;
...
...
packages/flutter_tools/lib/src/compile.dart
View file @
79a985f9
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/features.dart
View file @
79a985f9
...
...
@@ -39,6 +39,9 @@ class FeatureFlags {
/// Whether the Android embedding V2 is enabled.
bool
get
isAndroidEmbeddingV2Enabled
=>
isEnabled
(
flutterAndroidEmbeddingV2Feature
);
/// Whether the web incremental compiler is enabled.
bool
get
isWebIncrementalCompilerEnabled
=>
isEnabled
(
flutterWebIncrementalCompiler
);
/// Whether a particular feature is enabled for the current channel.
///
/// Prefer using one of the specific getters above instead of this API.
...
...
@@ -72,6 +75,7 @@ const List<Feature> allFeatures = <Feature>[
flutterWindowsDesktopFeature
,
flutterBuildPluginAsAarFeature
,
flutterAndroidEmbeddingV2Feature
,
flutterWebIncrementalCompiler
,
];
/// The [Feature] for flutter web.
...
...
@@ -143,6 +147,16 @@ const Feature flutterAndroidEmbeddingV2Feature = Feature(
),
);
/// The [Feature] for using the incremental compiler instead of build runner.
const
Feature
flutterWebIncrementalCompiler
=
Feature
(
name:
'Enable the incremental compiler for web builds'
,
configSetting:
'enable-web-incremental-compiler'
,
master:
FeatureChannelSetting
(
available:
true
,
enabledByDefault:
false
,
),
);
/// A [Feature] is a process for conditionally enabling tool features.
///
/// All settings are optional, and if not provided will generally default to
...
...
packages/flutter_tools/lib/src/resident_runner.dart
View file @
79a985f9
...
...
@@ -22,6 +22,7 @@ import 'compile.dart';
import
'dart/package_map.dart'
;
import
'devfs.dart'
;
import
'device.dart'
;
import
'features.dart'
;
import
'globals.dart'
;
import
'project.dart'
;
import
'run_cold.dart'
;
...
...
@@ -65,7 +66,19 @@ class FlutterDevice {
ResidentCompiler
generator
,
})
async
{
ResidentCompiler
generator
;
if
(
flutterProject
.
hasBuilders
)
{
if
(
featureFlags
.
isWebIncrementalCompilerEnabled
&&
await
device
.
targetPlatform
==
TargetPlatform
.
web_javascript
)
{
generator
=
ResidentCompiler
(
artifacts
.
getArtifactPath
(
Artifact
.
flutterWebSdk
,
mode:
buildMode
),
buildMode:
buildMode
,
trackWidgetCreation:
trackWidgetCreation
,
fileSystemRoots:
fileSystemRoots
,
fileSystemScheme:
fileSystemScheme
,
targetModel:
TargetModel
.
dartdevc
,
experimentalFlags:
experimentalFlags
,
platformDill:
artifacts
.
getArtifactPath
(
Artifact
.
webPlatformKernelDill
,
mode:
buildMode
),
);
}
else
if
(
flutterProject
.
hasBuilders
)
{
generator
=
await
CodeGeneratingResidentCompiler
.
create
(
buildMode:
buildMode
,
flutterProject:
flutterProject
,
...
...
packages/flutter_tools/test/general.shard/compile_test.dart
View file @
79a985f9
...
...
@@ -37,6 +37,10 @@ void main() {
expect
(
TargetModel
(
'flutter_runner'
),
TargetModel
.
flutterRunner
);
expect
(
TargetModel
.
flutterRunner
.
toString
(),
'flutter_runner'
);
expect
(
TargetModel
(
'dartdevc'
),
TargetModel
.
dartdevc
);
expect
(
TargetModel
.
dartdevc
.
toString
(),
'dartdevc'
);
expect
(()
=>
TargetModel
(
'foobar'
),
throwsA
(
isInstanceOf
<
AssertionError
>()));
});
}
packages/flutter_tools/test/general.shard/resident_runner_test.dart
View file @
79a985f9
...
...
@@ -5,14 +5,18 @@
import
'dart:async'
;
import
'package:file/memory.dart'
;
import
'package:flutter_tools/src/artifacts.dart'
;
import
'package:flutter_tools/src/base/common.dart'
;
import
'package:flutter_tools/src/base/context.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/logger.dart'
;
import
'package:flutter_tools/src/build_info.dart'
;
import
'package:flutter_tools/src/compile.dart'
;
import
'package:flutter_tools/src/devfs.dart'
;
import
'package:flutter_tools/src/device.dart'
;
import
'package:flutter_tools/src/features.dart'
;
import
'package:flutter_tools/src/globals.dart'
;
import
'package:flutter_tools/src/project.dart'
;
import
'package:flutter_tools/src/reporting/reporting.dart'
;
import
'package:flutter_tools/src/resident_runner.dart'
;
import
'package:flutter_tools/src/run_cold.dart'
;
...
...
@@ -599,6 +603,29 @@ void main() {
expect
(
await
fs
.
file
(
'foo'
).
readAsString
(),
testUri
.
toString
());
}));
test
(
'FlutterDevice uses dartdevc configuration when targeting web'
,
()
=>
testbed
.
run
(()
async
{
final
MockDevice
mockDevice
=
MockDevice
();
when
(
mockDevice
.
targetPlatform
).
thenAnswer
((
Invocation
invocation
)
async
{
return
TargetPlatform
.
web_javascript
;
});
final
DefaultResidentCompiler
residentCompiler
=
(
await
FlutterDevice
.
create
(
mockDevice
,
buildMode:
BuildMode
.
debug
,
flutterProject:
FlutterProject
.
current
(),
target:
null
,
trackWidgetCreation:
true
,
)).
generator
;
expect
(
residentCompiler
.
targetModel
,
TargetModel
.
dartdevc
);
expect
(
residentCompiler
.
sdkRoot
,
artifacts
.
getArtifactPath
(
Artifact
.
flutterWebSdk
,
mode:
BuildMode
.
debug
)
+
'/'
);
expect
(
residentCompiler
.
platformDill
,
artifacts
.
getArtifactPath
(
Artifact
.
webPlatformKernelDill
,
mode:
BuildMode
.
debug
));
},
overrides:
<
Type
,
Generator
>{
FeatureFlags:
()
=>
TestFeatureFlags
(
isWebIncrementalCompilerEnabled:
true
),
}));
}
class
MockFlutterDevice
extends
Mock
implements
FlutterDevice
{}
...
...
@@ -608,6 +635,7 @@ class MockDevFS extends Mock implements DevFS {}
class
MockIsolate
extends
Mock
implements
Isolate
{}
class
MockDevice
extends
Mock
implements
Device
{}
class
MockUsage
extends
Mock
implements
Usage
{}
class
MockProcessManager
extends
Mock
implements
ProcessManager
{}
class
MockServiceEvent
extends
Mock
implements
ServiceEvent
{}
class
TestFlutterDevice
extends
FlutterDevice
{
TestFlutterDevice
(
Device
device
,
this
.
views
)
...
...
packages/flutter_tools/test/src/testbed.dart
View file @
79a985f9
...
...
@@ -700,6 +700,7 @@ class TestFeatureFlags implements FeatureFlags {
this
.
isWebEnabled
=
false
,
this
.
isWindowsEnabled
=
false
,
this
.
isAndroidEmbeddingV2Enabled
=
false
,
this
.
isWebIncrementalCompilerEnabled
=
false
,
});
@override
...
...
@@ -717,6 +718,9 @@ class TestFeatureFlags implements FeatureFlags {
@override
final
bool
isAndroidEmbeddingV2Enabled
;
@override
final
bool
isWebIncrementalCompilerEnabled
;
@override
bool
isEnabled
(
Feature
feature
)
{
switch
(
feature
)
{
...
...
@@ -730,6 +734,8 @@ class TestFeatureFlags implements FeatureFlags {
return
isWindowsEnabled
;
case
flutterAndroidEmbeddingV2Feature:
return
isAndroidEmbeddingV2Enabled
;
case
flutterWebIncrementalCompiler:
return
isWebIncrementalCompilerEnabled
;
}
return
false
;
}
...
...
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