Skip to content
Merged
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
18 changes: 18 additions & 0 deletions site/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,21 @@ builders:
- "lib/src/style_hash.dart"
auto_apply: root_package
build_to: source

targets:
$default:
builders:
build_web_compilers:entrypoint:
dev_options:
compilers:
dartdevc:
release_options:
# Use production compilers for release builds, and ensure
# kReleaseMode in jaspr is enabled.
compilers:
dart2js:
args: [-O4, -Djaspr.flags.release=true]
dart2wasm:
# Use -O2 to catch more potential runtime issues, it is not much
# slower than -O4: https://github.com/dart-lang/site-www/pull/6953#discussion_r2453318668
args: [-O2, -Djaspr.flags.release=true]
3 changes: 3 additions & 0 deletions tool/dash_site/lib/src/commands/build.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ final class BuildSiteCommand extends Command<int> {
'run',
'jaspr_cli:jaspr',
'build',
// Use build_web_compiler options specified in build.yaml instead of
// those specified by jaspr_cli.
'--no-managed-build-options',
'--sitemap-domain=https://dart.dev',
'--dart-define=PRODUCTION=$productionRelease',
],
Expand Down
13 changes: 13 additions & 0 deletions tool/dash_site/lib/src/commands/serve.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,17 @@ final class ServeSiteCommand extends Command<int> {
@override
String get name => 'serve';

ServeSiteCommand() {
argParser.addFlag(
'release',
defaultsTo: false,
help: 'Build with compilers used for release builds instead of dartdevc.',
);
}

@override
Future<int> run() async {
final release = argResults!.flag('release');
installJasprCliIfNecessary();

final process = await Process.start(
Expand All @@ -23,7 +32,11 @@ final class ServeSiteCommand extends Command<int> {
'run',
'jaspr_cli:jaspr',
'serve',
// Use build_web_compiler options specified in build.yaml instead of
// those specified by jaspr_cli.
'--no-managed-build-options',
'--dart-define=PRODUCTION=false',
if (release) '--release',
],
workingDirectory: 'site',
runInShell: true,
Expand Down