Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[monorepo] split out build-only web engine into its own builder #57178

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,31 @@ targets:
timeout: 120
properties:
release_build: "true"
config_name: linux_web_engine_build
# Do not remove(https://github.com/flutter/flutter/issues/144644)
# Scheduler will fail to get the platform
drone_dimensions:
- os=Linux
dimensions:
# This is needed so that orchestrators that only spawn subbuilds are not
# assigned to the large 32 core workers when doing release builds.
# For more details see the issue
# at https://github.com/flutter/flutter/issues/152186.
cores: "8"
runIf:
- DEPS
- .ci.yaml
- lib/web_ui/**
- web_sdk/**
- tools/**
- ci/**
- flutter_frontend_server/**

- name: Linux linux_web_engine_build
bringup: true
recipe: engine_v2/engine_v2
timeout: 120
properties:
config_name: linux_web_engine
# Do not remove(https://github.com/flutter/flutter/issues/144644)
# Scheduler will fail to get the platform
Expand Down
11 changes: 0 additions & 11 deletions ci/builders/linux_web_engine.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,6 @@
"flutter/web_sdk:flutter_web_sdk_archive"
]
},
"archives": [
{
"name": "wasm_release",
"base_path": "out/wasm_release/zip_archives/",
"type": "gcs",
"include_paths": [
"out/wasm_release/zip_archives/flutter-web-sdk.zip"
],
"realm": "production"
}
],
"generators": {
"tasks": [
{
Expand Down
55 changes: 55 additions & 0 deletions ci/builders/linux_web_engine_build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"_comment": "THIS IS A GENERATED FILE. Do not edit this file directly.",
"_comment2": "See `generate_builder_json.dart` for the generator code",
"builds": [
{
"name": "web_tests/artifacts",
"drone_dimensions": [
"device_type=none",
"os=Linux",
"cores=32"
],
"gclient_variables": {
"download_android_deps": false,
"download_jdk": false,
"download_emsdk": true
},
"gn": [
"--web",
"--runtime-mode=release",
"--no-goma"
],
"ninja": {
"config": "wasm_release",
"targets": [
"flutter/web_sdk:flutter_web_sdk_archive"
]
},
"archives": [
{
"name": "wasm_release",
"base_path": "out/wasm_release/zip_archives/",
"type": "gcs",
"include_paths": [
"out/wasm_release/zip_archives/flutter-web-sdk.zip"
],
"realm": "production"
}
],
"generators": {
"tasks": [
{
"name": "copy artifacts for web tests",
"parameters": [
"test",
"--copy-artifacts"
],
"scripts": [
"flutter/lib/web_ui/dev/felt"
]
}
]
}
}
]
}
99 changes: 66 additions & 33 deletions lib/web_ui/dev/generate_builder_json.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,32 +28,63 @@ class GenerateBuilderJsonCommand extends Command<bool> {
final FeltConfig config = FeltConfig.fromFile(
path.join(environment.webUiTestDir.path, 'felt_config.yaml')
);
final String configString = generate(config, packageLock);
final io.File configFile = io.File(path.join(

// Generate the config that only builds the engine, but does not run tests.
// This allows starting framework as soon as the engine is built, without
// waiting for the engine tests. This is also used to skip tests entirely
// when running in the merge queue.
final String buildConfigString = generateBuildConfig(config, packageLock);
final io.File buildConfigFile = io.File(path.join(
environment.flutterDirectory.path,
'ci',
'builders',
'linux_web_engine_build.json',
));
buildConfigFile.writeAsStringSync('$buildConfigString\n');

// Generate the config for the full build that includes both the engine
// build and tests.
final String buildAndTestConfigString = generate(config, packageLock);
final io.File buildAndTestConfigFile = io.File(path.join(
environment.flutterDirectory.path,
'ci',
'builders',
'linux_web_engine.json',
));
configFile.writeAsStringSync('$configString\n');
buildAndTestConfigFile.writeAsStringSync('$buildAndTestConfigString\n');

return true;
}

String generateBuildConfig(FeltConfig config, PackageLock packageLock) {
final Map<String, dynamic> outputJson = <String, dynamic>{
'_comment': 'THIS IS A GENERATED FILE. Do not edit this file directly.',
'_comment2': 'See `generate_builder_json.dart` for the generator code',
'builds': <dynamic>[
_getArtifactBuildStep(forTesting: false),
],
};
return const JsonEncoder.withIndent(' ').convert(outputJson);
}

String generate(FeltConfig config, PackageLock packageLock) {
final Map<String, dynamic> outputJson = <String, dynamic>{
'_comment': 'THIS IS A GENERATED FILE. Do not edit this file directly.',
'_comment2': 'See `generate_builder_json.dart` for the generator code',
'builds': <dynamic>[
_getArtifactBuildStep(),
for (final TestBundle bundle in config.testBundles)
_getBundleBuildStep(bundle),
_getArtifactBuildStep(forTesting: true),
if (true)
for (final TestBundle bundle in config.testBundles)
_getBundleBuildStep(bundle),
],
'tests': _getAllTestSteps(config.testSuites, packageLock)
};
return const JsonEncoder.withIndent(' ').convert(outputJson);
}

Map<String, dynamic> _getArtifactBuildStep() {
Map<String, dynamic> _getArtifactBuildStep({
required bool forTesting,
}) {
return <String, dynamic>{
'name': 'web_tests/artifacts',
'drone_dimensions': <String>[
Expand All @@ -77,34 +108,36 @@ class GenerateBuilderJsonCommand extends Command<bool> {
'flutter/web_sdk:flutter_web_sdk_archive'
]
},
'archives': <dynamic>[
<String, dynamic>{
'name': 'wasm_release',
'base_path': 'out/wasm_release/zip_archives/',
'type': 'gcs',
'include_paths': <String>[
'out/wasm_release/zip_archives/flutter-web-sdk.zip'
],
'realm': 'production',
}
],
'generators': <String, dynamic>{
'tasks': <dynamic>[
if (!forTesting)
'archives': <dynamic>[
<String, dynamic>{
'name': 'check licenses',
'parameters': <String>[
'check-licenses'
'name': 'wasm_release',
'base_path': 'out/wasm_release/zip_archives/',
'type': 'gcs',
'include_paths': <String>[
'out/wasm_release/zip_archives/flutter-web-sdk.zip'
],
'scripts': <String>[ 'flutter/lib/web_ui/dev/felt' ],

},
<String, dynamic>{
'name': 'web engine analysis',
'parameters': <String>[
'analyze'
],
'scripts': <String>[ 'flutter/lib/web_ui/dev/felt' ],
},
'realm': 'production',
}
],
'generators': <String, dynamic>{
'tasks': <dynamic>[
if (forTesting)
<String, dynamic>{
'name': 'check licenses',
'parameters': <String>[
'check-licenses'
],
'scripts': <String>[ 'flutter/lib/web_ui/dev/felt' ],
},
if (forTesting)
<String, dynamic>{
'name': 'web engine analysis',
'parameters': <String>[
'analyze'
],
'scripts': <String>[ 'flutter/lib/web_ui/dev/felt' ],
},
<String, dynamic>{
'name': 'copy artifacts for web tests',
'parameters': <String>[
Expand Down
Loading