From a8857e64deb88f6f8a439eb898f42c2e229775b9 Mon Sep 17 00:00:00 2001 From: Jake Macdonald Date: Fri, 17 May 2024 21:20:51 +0000 Subject: [PATCH 1/2] support -D dart environment variables --- frontend_server_client/lib/src/frontend_server_client.dart | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/frontend_server_client/lib/src/frontend_server_client.dart b/frontend_server_client/lib/src/frontend_server_client.dart index 3a62274a4..3ab906d62 100644 --- a/frontend_server_client/lib/src/frontend_server_client.dart +++ b/frontend_server_client/lib/src/frontend_server_client.dart @@ -68,6 +68,8 @@ class FrontendServerClient { bool printIncrementalDependencies = true, List additionalSources = const [], String? nativeAssets, + // -D=key=value arguments for dart environment variables + Map? dartDefines, }) async { final commonArguments = [ '--sdk-root', @@ -97,6 +99,9 @@ class FrontendServerClient { '--native-assets', nativeAssets, ], + if (dartDefines != null) ...[ + for (var entry in dartDefines.entries) '-D=${entry.key}=${entry.value}', + ], ]; late final Process feServer; if (frontendServerPath != null) { From 81da8a96ddb68edc002d7a92d227df3965212d40 Mon Sep 17 00:00:00 2001 From: Jake Macdonald Date: Fri, 17 May 2024 21:28:46 +0000 Subject: [PATCH 2/2] quote the defines --- frontend_server_client/lib/src/frontend_server_client.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend_server_client/lib/src/frontend_server_client.dart b/frontend_server_client/lib/src/frontend_server_client.dart index 3ab906d62..58ef6df57 100644 --- a/frontend_server_client/lib/src/frontend_server_client.dart +++ b/frontend_server_client/lib/src/frontend_server_client.dart @@ -100,7 +100,8 @@ class FrontendServerClient { nativeAssets, ], if (dartDefines != null) ...[ - for (var entry in dartDefines.entries) '-D=${entry.key}=${entry.value}', + for (var entry in dartDefines.entries) + '-D="${entry.key}=${entry.value}"', ], ]; late final Process feServer;