From b75fe9358cd77f133cbf97dcf664744b18ae9155 Mon Sep 17 00:00:00 2001 From: Moritz Date: Mon, 17 Feb 2025 14:27:09 +0100 Subject: [PATCH] Update readme --- pkgs/intl4x/hook/build.dart | 30 +++++++++++-------- .../lib/src/hook_helpers/build_options.dart | 4 +-- pkgs/intl4x/pubspec.yaml | 2 -- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/pkgs/intl4x/hook/build.dart b/pkgs/intl4x/hook/build.dart index 292e1732..771e582d 100644 --- a/pkgs/intl4x/hook/build.dart +++ b/pkgs/intl4x/hook/build.dart @@ -22,26 +22,32 @@ void main(List args) async { if (buildOptions == null) { throw ArgumentError(''' -Unknown build mode for icu4x. Set the build mode with either `fetch`, `local`, or `checkout` by writing a config file at ~/intl4x.json: +Unknown build mode for icu4x. Set the build mode with either `fetch`, `local`, or `checkout` by writing into your pubspec: * fetch: Fetch the precompiled binary from a CDN. ``` -{ - "buildMode": "fetch" -} +... +hook: + intl4x: + buildMode: fetch +... ``` * local: Use a locally existing binary at the environment variable `LOCAL_ICU4X_BINARY`. ``` -{ - "buildMode": "local", - "localDylibPath": "path/to/dylib.so" -} +... +hook: + intl4x: + buildMode: local + localDylibPath: path/to/dylib.so +... ``` * checkout: Build a fresh library from a local git checkout of the icu4x repository. ``` -{ - "buildMode": "checkout", - "checkoutPath": "path/to/checkout" -} +... +hook: + intl4x: + buildMode: checkout + checkoutPath: path/to/checkout +... ``` '''); diff --git a/pkgs/intl4x/lib/src/hook_helpers/build_options.dart b/pkgs/intl4x/lib/src/hook_helpers/build_options.dart index 87ba1866..988294d0 100644 --- a/pkgs/intl4x/lib/src/hook_helpers/build_options.dart +++ b/pkgs/intl4x/lib/src/hook_helpers/build_options.dart @@ -50,8 +50,8 @@ class BuildOptions { Map toMap() { return { 'buildMode': buildMode.name, - 'localDylibPath': localDylibPath, - 'checkoutPath': checkoutPath, + if (localDylibPath != null) 'localDylibPath': localDylibPath, + if (checkoutPath != null) 'checkoutPath': checkoutPath, }; } diff --git a/pkgs/intl4x/pubspec.yaml b/pkgs/intl4x/pubspec.yaml index ce1c7837..f4a58915 100644 --- a/pkgs/intl4x/pubspec.yaml +++ b/pkgs/intl4x/pubspec.yaml @@ -40,5 +40,3 @@ dev_dependencies: hook: intl4x: buildMode: fetch - localDylibPath: null - checkoutPath: null