Skip to content

Move logic to package:icu4x #993

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

Merged
merged 25 commits into from
Aug 21, 2025
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
2 changes: 0 additions & 2 deletions .gitattributes

This file was deleted.

3 changes: 0 additions & 3 deletions .github/workflows/health.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@ jobs:
health:
uses: dart-lang/ecosystem/.github/workflows/health.yaml@main
with:
coverage_web: true
checkout_submodules: true
sdk: main
ignore_license: "**.g.dart,pkgs/intl_translation/example/lib/generated/**,pkgs/intl_translation/test/generate_localized/**,pkgs/intl_translation/test/two_components/**"
ignore_coverage: "**.g.dart"
ignore_packages: "submodules"
permissions:
pull-requests: write
246 changes: 4 additions & 242 deletions .github/workflows/intl4x.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,44 +10,16 @@ on:
paths:
- ".github/workflows/intl4x.yml"
- "pkgs/intl4x/**"
- "submodules/**"
push:
branches: [main]
paths:
- ".github/workflows/intl4x.yml"
- "pkgs/intl4x/**"
- "submodules/**"
schedule:
- cron: "0 0 * * 0" # weekly

jobs:
# This job will determine if the 'skip-fetch' tag is present
check_skip_fetch:
runs-on: ubuntu-latest
outputs:
skip_fetch: ${{ steps.get-labels.outputs.skip_fetch }}
permissions:
pull-requests: read
if: github.event_name == 'pull_request'
steps:
- name: Get PR Labels
id: get-labels
run: |
labels="$(gh api repos/$OWNER/$REPO_NAME/pulls/$PULL_REQUEST_NUMBER --jq '.labels.[].name')"
echo "Found labels: $labels"
if echo "$labels" | grep -q "skip-fetch"; then
echo "skip_fetch=true" >> "$GITHUB_OUTPUT"
else
echo "skip_fetch=false" >> "$GITHUB_OUTPUT"
fi
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OWNER: ${{ github.repository_owner }}
REPO_NAME: ${{ github.event.repository.name }}
PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}

build_checkout:
build:
runs-on: ${{ matrix.os }}

defaults:
Expand All @@ -58,47 +30,13 @@ jobs:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
with:
submodules: true

- uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c
with:
sdk: main

- name: Install Rust toolchains
run: |
rustup toolchain install stable
rustup toolchain install nightly

- name: Show the selected Rust toolchain
run: rustup show

- name: Set up toolchain for Linux
if: matrix.os == 'ubuntu-latest'
run: |
rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu

- name: Set up toolchain for Mac
if: matrix.os == 'macos-latest'
run: |
rustup component add rust-src --toolchain nightly-aarch64-apple-darwin

- name: Set up toolchain for Windows
if: matrix.os == 'windows-latest'
run: |
rustup component add rust-src --toolchain nightly-x86_64-pc-windows-msvc

- run: dart pub get

- run: dart tool/write_option_file.dart pubspec.yaml checkout $(realpath ${{ github.workspace }}/submodules/icu4x)
if: matrix.os == 'ubuntu-latest'

- run: dart tool/write_option_file.dart pubspec.yaml checkout $(realpath ${{ github.workspace }}/submodules/icu4x)
if: matrix.os == 'macos-latest'

- run: dart tool/write_option_file.dart pubspec.yaml checkout (Get-Item ${{ github.workspace }}\submodules\icu4x).FullName -replace '/', '\'
if: matrix.os == 'windows-latest'

- run: dart analyze --fatal-infos

- run: dart format --output=none --set-exit-if-changed .
Expand All @@ -110,15 +48,6 @@ jobs:
- run: dart pub get
working-directory: pkgs/intl4x/example_native

- run: dart tool/write_option_file.dart example_native/pubspec.yaml checkout $(realpath ${{ github.workspace }}/submodules/icu4x)
if: matrix.os == 'ubuntu-latest'

- run: dart tool/write_option_file.dart example_native/pubspec.yaml checkout $(realpath ${{ github.workspace }}/submodules/icu4x)
if: matrix.os == 'macos-latest'

- run: dart tool/write_option_file.dart example_native/pubspec.yaml checkout (Get-Item ${{ github.workspace }}\submodules\icu4x).FullName -replace '/', '\'
if: matrix.os == 'windows-latest'

- run: dart --enable-experiment=record-use build cli bin/example_native.dart
working-directory: pkgs/intl4x/example_native

Expand All @@ -134,7 +63,7 @@ jobs:
working-directory: pkgs/intl4x/example_native
if: matrix.os == 'ubuntu-latest'
run: |
FILE_PATH="build/cli/linux_x64/bundle/lib/libintl4x.so"
FILE_PATH="build/cli/linux_x64/bundle/lib/libicu4x.so"
FILE_SIZE=$(stat -c %s "$FILE_PATH")
echo "Linux executable size: $FILE_SIZE bytes"
if [ "$FILE_SIZE" -gt 10485760 ]; then
Expand All @@ -151,7 +80,7 @@ jobs:
working-directory: pkgs/intl4x/example_native
if: matrix.os == 'macos-latest'
run: |
FILE_PATH="build/cli/macos_arm64/bundle/lib/libintl4x.dylib"
FILE_PATH="build/cli/macos_arm64/bundle/lib/libicu4x.dylib"
FILE_SIZE=$(stat -f %z "$FILE_PATH")
echo "macOS executable size: $FILE_SIZE bytes"
if [ "$FILE_SIZE" -gt 10485760 ]; then
Expand All @@ -167,177 +96,10 @@ jobs:
working-directory: pkgs/intl4x/example_native
if: matrix.os == 'windows-latest'
run: |
$filePath = ".\build\cli\windows_x64\bundle\lib\intl4x.dll"
$filePath = ".\build\cli\windows_x64\bundle\lib\icu4x.dll"
$fileSize = (Get-Item $filePath).Length
Write-Host "Windows executable size: $fileSize bytes"
if ($fileSize -gt 10485760) {
Write-Host "Error: Windows executable size ($fileSize bytes) exceeds 10MB limit (10485760 bytes)."
exit 1
}

build_fetch:
runs-on: ${{ matrix.os }}
needs: [check_skip_fetch]
# Only run if not PR, or if PR and skip_fetch is false
if: github.event_name != 'pull_request' || needs.check_skip_fetch.outputs.skip_fetch == 'false'

strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]

defaults:
run:
working-directory: pkgs/intl4x

steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
with:
submodules: true

- uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c
with:
sdk: main

- run: dart pub get

- run: |
dart tool/write_option_file.dart pubspec.yaml fetch
dart tool/write_option_file.dart example_native/pubspec.yaml fetch

- run: dart test

- run: dart pub get
working-directory: pkgs/intl4x/example_native

- run: dart --enable-experiment=record-use build cli bin/example_native.dart
working-directory: pkgs/intl4x/example_native

- name: Run example_native (Linux)
working-directory: pkgs/intl4x/example_native
if: matrix.os == 'ubuntu-latest'
run: ./build/cli/linux_x64/bundle/bin/example_native

- name: Print file size and check limit for example_native (Linux)
working-directory: pkgs/intl4x/example_native
if: matrix.os == 'ubuntu-latest'
run: |
FILE_PATH="build/cli/linux_x64/bundle/lib/libintl4x.so"
FILE_SIZE=$(stat -c %s "$FILE_PATH")
echo "Linux executable size: $FILE_SIZE bytes"
if [ "$FILE_SIZE" -gt 10485760 ]; then
echo "Error: Linux executable size ($FILE_SIZE bytes) exceeds 10MB limit (10485760 bytes)."
exit 1
fi

- name: Run example_native (Mac)
working-directory: pkgs/intl4x/example_native
if: matrix.os == 'macos-latest'
run: ./build/cli/macos_arm64/bundle/bin/example_native

- name: Print file size and check limit for example_native (Mac)
working-directory: pkgs/intl4x/example_native
if: matrix.os == 'macos-latest'
run: |
FILE_PATH="build/cli/macos_arm64/bundle/lib/libintl4x.dylib"
FILE_SIZE=$(stat -f %z "$FILE_PATH")
echo "macOS executable size: $FILE_SIZE bytes"
if [ "$FILE_SIZE" -gt 10485760 ]; then
echo "Error: macOS executable size ($FILE_SIZE bytes) exceeds 10MB limit (10485760 bytes)."
exit 1
fi

- name: Run example_native (Windows)
working-directory: pkgs/intl4x/example_native
if: matrix.os == 'windows-latest'
run: .\build\cli\windows_x64\bundle\bin\example_native.exe

- name: Print file size and check limit for example_native (Windows)
working-directory: pkgs/intl4x/example_native
if: matrix.os == 'windows-latest'
run: |
$filePath = ".\build\cli\windows_x64\bundle\lib\intl4x.dll"
$fileSize = (Get-Item $filePath).Length
Write-Host "Windows executable size: $fileSize bytes"
if ($fileSize -gt 10485760) {
Write-Host "Error: Windows executable size ($fileSize bytes) exceeds 10MB limit (10485760 bytes)."
exit 1
}

build_local:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
with:
submodules: true

- name: Install Rust toolchains
run: |
rustup toolchain install stable
rustup toolchain install nightly

- name: Show the selected Rust toolchain
run: rustup show

- uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c
with:
sdk: main

- name: Prep build
run: |
(cd pkgs/intl4x && dart pub get)

- name: Build Linux
if: matrix.os == 'ubuntu-latest'
run: |
rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu

dart pkgs/intl4x/lib/src/hook_helpers/build_libs.g.dart --working_directory submodules/icu4x --file submodules/icu4x/bin/linux_x64 --os linux --architecture x64 --compile_type dynamic --cargo_features collator,datetime,list,decimal,plurals,casemap,experimental,compiled_data

- name: Build Mac
if: matrix.os == 'macos-latest'
run: |
rustup component add rust-src --toolchain nightly-aarch64-apple-darwin

dart pkgs/intl4x/lib/src/hook_helpers/build_libs.g.dart --working_directory submodules/icu4x --file submodules/icu4x/bin/macos_arm64 --os macos --architecture arm64 --compile_type dynamic --cargo_features collator,datetime,list,decimal,plurals,casemap,experimental,compiled_data

- name: Build Windows
if: matrix.os == 'windows-latest'
run: |
rustup component add rust-src --toolchain nightly-x86_64-pc-windows-msvc

dart pkgs/intl4x/lib/src/hook_helpers/build_libs.g.dart --working_directory submodules/icu4x --file submodules/icu4x/bin/windows_x64 --os windows --architecture x64 --compile_type dynamic --cargo_features collator,datetime,list,decimal,plurals,casemap,experimental,compiled_data

- name: Run `dart pub get`
run: |
cd pkgs/intl4x
dart pub get

- run: dart pkgs/intl4x/tool/write_option_file.dart pkgs/intl4x/pubspec.yaml local $(realpath submodules/icu4x/bin/linux_x64)
if: matrix.os == 'ubuntu-latest'

- run: dart pkgs/intl4x/tool/write_option_file.dart pkgs/intl4x/pubspec.yaml local $(realpath submodules/icu4x/bin/macos_arm64)
if: matrix.os == 'macos-latest'

- run: dart pkgs/intl4x/tool/write_option_file.dart pkgs/intl4x/pubspec.yaml local (Get-Item submodules\icu4x\bin\windows_x64).FullName -replace '/', '\'
if: matrix.os == 'windows-latest'

- run: echo $LOCAL_ICU4X_BINARY

- name: Display structure of downloaded files
run: ls -R

- name: Run `dart test`
run: |
cd pkgs/intl4x
dart test

- run: dart pub get
working-directory: pkgs/intl4x/example_native

- run: dart --enable-experiment=record-use build cli
working-directory: pkgs/intl4x/example_native
Loading
Loading