Unverified Commit f3624196 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

make sure profile is forwarded through build web command (#39414)

parent 13f18d5a
...@@ -22,6 +22,7 @@ import '../artifacts.dart'; ...@@ -22,6 +22,7 @@ import '../artifacts.dart';
import '../base/file_system.dart'; import '../base/file_system.dart';
import '../base/logger.dart'; import '../base/logger.dart';
import '../base/platform.dart'; import '../base/platform.dart';
import '../build_info.dart';
import '../compile.dart'; import '../compile.dart';
import '../convert.dart'; import '../convert.dart';
import '../dart/package_map.dart'; import '../dart/package_map.dart';
...@@ -41,7 +42,7 @@ class BuildRunnerWebCompilationProxy extends WebCompilationProxy { ...@@ -41,7 +42,7 @@ class BuildRunnerWebCompilationProxy extends WebCompilationProxy {
Future<bool> initialize({ Future<bool> initialize({
Directory projectDirectory, Directory projectDirectory,
String testOutputDir, String testOutputDir,
bool release = false, BuildMode mode,
}) async { }) async {
// Create the .dart_tool directory if it doesn't exist. // Create the .dart_tool directory if it doesn't exist.
projectDirectory.childDirectory('.dart_tool').createSync(); projectDirectory.childDirectory('.dart_tool').createSync();
...@@ -92,7 +93,7 @@ class BuildRunnerWebCompilationProxy extends WebCompilationProxy { ...@@ -92,7 +93,7 @@ class BuildRunnerWebCompilationProxy extends WebCompilationProxy {
result = await _runBuilder( result = await _runBuilder(
buildEnvironment, buildEnvironment,
buildOptions, buildOptions,
release, mode,
buildDirs, buildDirs,
); );
return result.status == core.BuildStatus.success; return result.status == core.BuildStatus.success;
...@@ -101,7 +102,7 @@ class BuildRunnerWebCompilationProxy extends WebCompilationProxy { ...@@ -101,7 +102,7 @@ class BuildRunnerWebCompilationProxy extends WebCompilationProxy {
result = await _runBuilder( result = await _runBuilder(
buildEnvironment, buildEnvironment,
buildOptions, buildOptions,
release, mode,
buildDirs, buildDirs,
); );
return result.status == core.BuildStatus.success; return result.status == core.BuildStatus.success;
...@@ -110,7 +111,7 @@ class BuildRunnerWebCompilationProxy extends WebCompilationProxy { ...@@ -110,7 +111,7 @@ class BuildRunnerWebCompilationProxy extends WebCompilationProxy {
result = await _runBuilder( result = await _runBuilder(
buildEnvironment, buildEnvironment,
buildOptions, buildOptions,
release, mode,
buildDirs, buildDirs,
); );
return result.status == core.BuildStatus.success; return result.status == core.BuildStatus.success;
...@@ -135,7 +136,7 @@ class BuildRunnerWebCompilationProxy extends WebCompilationProxy { ...@@ -135,7 +136,7 @@ class BuildRunnerWebCompilationProxy extends WebCompilationProxy {
return result.status == core.BuildStatus.success; return result.status == core.BuildStatus.success;
} }
Future<core.BuildResult> _runBuilder(core.BuildEnvironment buildEnvironment, BuildOptions buildOptions, bool release, Set<core.BuildDirectory> buildDirs) async { Future<core.BuildResult> _runBuilder(core.BuildEnvironment buildEnvironment, BuildOptions buildOptions, BuildMode buildMode, Set<core.BuildDirectory> buildDirs) async {
_builder = await BuildImpl.create( _builder = await BuildImpl.create(
buildOptions, buildOptions,
buildEnvironment, buildEnvironment,
...@@ -145,11 +146,13 @@ class BuildRunnerWebCompilationProxy extends WebCompilationProxy { ...@@ -145,11 +146,13 @@ class BuildRunnerWebCompilationProxy extends WebCompilationProxy {
'flutterWebSdk': artifacts.getArtifactPath(Artifact.flutterWebSdk), 'flutterWebSdk': artifacts.getArtifactPath(Artifact.flutterWebSdk),
}, },
'flutter_tools:entrypoint': <String, dynamic>{ 'flutter_tools:entrypoint': <String, dynamic>{
'release': release, 'release': buildMode == BuildMode.release,
'flutterWebSdk': artifacts.getArtifactPath(Artifact.flutterWebSdk), 'flutterWebSdk': artifacts.getArtifactPath(Artifact.flutterWebSdk),
'profile': buildMode == BuildMode.profile,
}, },
'flutter_tools:test_entrypoint': <String, dynamic>{ 'flutter_tools:test_entrypoint': <String, dynamic>{
'release': release, 'release': buildMode == BuildMode.release,
'profile': buildMode == BuildMode.profile,
}, },
}, },
isReleaseBuild: false, isReleaseBuild: false,
......
...@@ -30,7 +30,7 @@ Future<void> buildWeb(FlutterProject flutterProject, String target, BuildInfo bu ...@@ -30,7 +30,7 @@ Future<void> buildWeb(FlutterProject flutterProject, String target, BuildInfo bu
try { try {
result = await webCompilationProxy.initialize( result = await webCompilationProxy.initialize(
projectDirectory: FlutterProject.current().directory, projectDirectory: FlutterProject.current().directory,
release: buildInfo.isRelease, mode: buildInfo.mode,
); );
if (result) { if (result) {
// Places assets adjacent to the web stuff. // Places assets adjacent to the web stuff.
...@@ -81,7 +81,7 @@ class WebCompilationProxy { ...@@ -81,7 +81,7 @@ class WebCompilationProxy {
Future<bool> initialize({ Future<bool> initialize({
@required Directory projectDirectory, @required Directory projectDirectory,
String testOutputDir, String testOutputDir,
bool release, BuildMode mode,
}) async { }) async {
throw UnimplementedError(); throw UnimplementedError();
} }
......
...@@ -41,7 +41,7 @@ void main() { ...@@ -41,7 +41,7 @@ void main() {
fs.file(fs.path.join('lib', 'main.dart')).createSync(recursive: true); fs.file(fs.path.join('lib', 'main.dart')).createSync(recursive: true);
when(mockWebCompilationProxy.initialize( when(mockWebCompilationProxy.initialize(
projectDirectory: anyNamed('projectDirectory'), projectDirectory: anyNamed('projectDirectory'),
release: anyNamed('release') mode: anyNamed('mode')
)).thenAnswer((Invocation invocation) { )).thenAnswer((Invocation invocation) {
final String path = fs.path.join('.dart_tool', 'build', 'flutter_web', 'foo', 'lib', 'main_web_entrypoint.dart.js'); final String path = fs.path.join('.dart_tool', 'build', 'flutter_web', 'foo', 'lib', 'main_web_entrypoint.dart.js');
fs.file(path).createSync(recursive: true); fs.file(path).createSync(recursive: true);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment