====== Dart 言語 ====== {{:android:dart_programming_language_logo_icon.svg?200|Dart programming language logo icon}} \\ \\ | {{:android:dash_the_mascot_of_the_dart_programming_language.png?100|}} | | Dart 言語がDashだった頃の\\ マスコット? Dash くん😅 | [[https://commons.wikimedia.org/wiki/File:Dart_programming_language_logo_icon.svg|File:Dart programming language logo icon.svg - Wikimedia Commons]]\\ [[https://commons.wikimedia.org/wiki/File:Dash,_the_mascot_of_the_Dart_programming_language.png|File:Dash, the mascot of the Dart programming language.png - Wikimedia Commons]]\\ 本家: [[https://dart.dev|Dart programming language - dart.dev]] ([[https://dart-dev.translate.goog/?_x_tr_sl=en&_x_tr_tl=ja&_x_tr_hl=ja&_x_tr_pto=sc|翻訳]])\\ ドキュメント: [[https://dart.dev/guides|Dart documentation - dart.dev]] ([[https://dart-dev.translate.goog/guides?_x_tr_sl=en&_x_tr_tl=ja&_x_tr_hl=ja&_x_tr_pto=sc|翻訳]])\\ ソースコード: [[git>dart-lang/sdk/|dart-lang/sdk: The Dart SDK, including the VM, dart2js, core libraries, and more.]] ([[https://github-com.translate.goog/dart-lang?_x_tr_sl=en&_x_tr_tl=ja&_x_tr_hl=ja&_x_tr_pto=sc|翻訳]])\\ **Dart** (ダートまたはダーツ。当初はDashと呼ばれていた) は、ウェブアプリやモバイルアプリのクライアント開発向けに設計されたプログラミング言語である。Googleによって開発された言語で、サーバーやデスクトップ向けアプリケーションの開発にも使用できる。\\ Dartはオブジェクト指向、クラスベース、ガベージコレクションを備えた、Cスタイルの構文(英語版)を持つ言語である。DartはネイティブコードまたはJavaScriptにコンパイルでき、インターフェイス(英語版)、Mixin、抽象クラス、reification(英語版)、ジェネリクス、型推論をサポートしている。\\ 2011年10月10日 - 12日に開催された デンマークのオーフスで開催された「GOTOカンファレンス」で公開された。この言語は、ウェブブラウザ組み込みのスクリプト言語であるJavaScriptの代替となることを目的に作られた。\\ [[wwjp>Dart|Wikiwand - Dart]] より\\ ===== システム要求 (System requirements) ===== 公式: [[https://dart.dev/get-dart#system-requirements|Get the Dart SDK#System requirements - dart.dev]] ([[https://dart-dev.translate.goog/get-dart?_x_tr_sl=en&_x_tr_tl=ja&_x_tr_hl=ja&_x_tr_pto=sc#system-requirements|翻訳]]) より (2023/03/27 現在)\\ Dart SDK は、Windows、Linux、および macOS でサポートされています。\\ Windows\\ **サポートされているバージョン:** Windows 10 および 11。\\ **サポートされているアーキテクチャ:** x64、IA32、ARM64。\\ ARM64 のサポートは実験的なものであり、dev チャネルでのみ利用できます。\\ Linux\\ **サポートされているバージョン:** Debian 安定版および標準サポートのUbuntu LTS 。\\ **サポートされているアーキテクチャ:** x64、IA32、ARM64、ARM、RISC-V (RV64GC)。\\ RISC-V のサポートはプレビュー段階であり、dev および beta チャネルでのみ利用できます。\\ **注:** ARM のサポートには、動的リンカーのバグ ([[https://sourceware.org/bugzilla/show_bug.cgi?id=14341|dynamic linker bug]]) により、glibc 2.23 以降が必要です。\\ macOS\\ **サポートされているバージョン:** 最新の 3 つのメジャー バージョン。Dart は、2022 年 11 月現在、次の macOS バージョンをサポートしています。\\ * macOS 11 (Big Sur) * macOS 12 (Monterey) * macOS 13 (Ventura) **サポートされているアーキテクチャ:** x64、ARM64。 ===== インストール ===== ==== ビルド ==== 公式: [[https://github.com/dart-lang/sdk/wiki/Building|Building · dart-lang/sdk Wiki]] ([[https://github-com.translate.goog/dart-lang/sdk/wiki/Building?_x_tr_sl=en&_x_tr_tl=ja&_x_tr_hl=ja&_x_tr_pto=sc|翻訳]])\\ 以下は Fedora での手順です🤔\\ === ビルド ツールのインストール ===
$ sudo install git python3 curl
Fedora 37 - x86_64 - Updates                                                  7.7 kB/s | 5.5 kB     00:00
Fedora Modular 37 - x86_64 - Updates                                           12 kB/s | 4.6 kB     00:00
パッケージ git-2.39.2-1.fc37.x86_64 は既にインストールされています。
パッケージ python3-3.11.2-1.fc37.x86_64 は既にインストールされています。
パッケージ curl-7.85.0-7.fc37.x86_64 は既にインストールされています。
依存関係が解決しました。
行うべきことはありません。
完了しました!
=== depot tools のインストール === Chromium の [[http://dev.chromium.org/developers/how-tos/install-depot-tools|depot tools]] をインストールする。\\
$ git clone --depth 1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
Cloning into 'depot_tools'...
remote: Finding sources: 100% (706/706)
remote: Total 706 (delta 87), reused 416 (delta 87)
Receiving objects: 100% (706/706), 1.09 MiB | 1.98 MiB/s, done.
Resolving deltas: 100% (87/87), done.
=== depot tools をパスに追加 ===
$ export PATH="$PATH:`pwd`/depot_tools"
=== dart のソースコードをチェックアウト ===
$ mkdir dart-sdk && cd dart-sdk
$ fetch dart
Running: gclient root
WARNING: Your metrics.cfg file was invalid or nonexistent. A new one will be created.
Running: gclient config --spec 'solutions = [
  {
    "name": "sdk",
    "url": "https://dart.googlesource.com/sdk.git",
    "deps_file": "DEPS",
    "managed": False,
    "custom_deps": {},
  },
]
'
Updating depot_tools...
using /run/user/1000/goma_tomoyan as tmpdir
INFO: creating cache dir (/run/user/1000/goma_tomoyan/goma_cache).
compiler_proxy is not running
Running: gclient sync
Updating depot_tools...
using /run/user/1000/goma_tomoyan as tmpdir
compiler_proxy is not running

________ running 'git -c core.deltaBaseCacheLimit=2g clone --no-checkout --progress https://dart.googlesource.com/sdk.git /home/tomoyan/development/dart-sdk/_gclient_sdk_yqywys0q' in '/home/tomoyan/development/dart-sdk'
Cloning into '/home/tomoyan/development/dart-sdk/_gclient_sdk_yqywys0q'...
remote: Finding sources: 100% (43/43)
error: RPC failed; curl 56 OpenSSL SSL_read: Connection reset by peer, errno 104
error: 10124 bytes of body are still expected
fetch-pack: unexpected disconnect while reading sideband packet
fatal: early EOF
fatal: fetch-pack: invalid index-pack output
1>WARNING: subprocess '"git" "-c" "core.deltaBaseCacheLimit=2g" "clone" "--no-checkout" "--progress" "https://dart.googlesource.com/sdk.git" "/home/tomoyan/development/dart-sdk/_gclient_sdk_yqywys0q"' in /home/tomoyan/development/dart-sdk failed; will retry after a short nap...

________ running 'git -c core.deltaBaseCacheLimit=2g clone --no-checkout --progress https://dart.googlesource.com/sdk.git /home/tomoyan/development/dart-sdk/_gclient_sdk_yqywys0q' in '/home/tomoyan/development/dart-sdk' attempt 2 / 2
Cloning into '/home/tomoyan/development/dart-sdk/_gclient_sdk_yqywys0q'...
remote: Finding sources: 100% (43/43)
remote: Total 1365521 (delta 1004396), reused 1365506 (delta 1004396)
Receiving objects: 100% (1365521/1365521), 1.38 GiB | 3.38 MiB/s, done.
Resolving deltas: 100% (1004396/1004396), done.
20>WARNING: subprocess '"git" "-c" "core.deltaBaseCacheLimit=2g" "clone" "--no-checkout" "--progress" "https://chromium.googlesource.com/external/github.com/WebAssembly/binaryen.git" "/home/tomoyan/development/dart-sdk/sdk/third_party/binaryen/_gclient_src_vp03y4sz"' in /home/tomoyan/development/dart-sdk failed; will retry after a short nap...
52>WARNING: subprocess '"git" "-c" "core.deltaBaseCacheLimit=2g" "clone" "--no-checkout" "--progress" "https://boringssl.googlesource.com/boringssl.git" "/home/tomoyan/development/dart-sdk/sdk/third_party/boringssl/_gclient_src_q2mz9uo9"' in /home/tomoyan/development/dart-sdk failed; will retry after a short nap...

[0:14:59] Still working on:
[0:14:59]   sdk/third_party/binaryen/src
[0:14:59]   sdk/third_party/icu
[0:14:59]   sdk/third_party/boringssl/src
[0:14:59]   sdk/third_party/pkg/webdev
[0:14:59]   sdk/third_party/protobuf

[0:15:05] Still working on:
[0:15:05]   sdk/third_party/binaryen/src
[0:15:05]   sdk/third_party/icu
[0:15:05]   sdk/third_party/boringssl/src
[0:15:05]   sdk/third_party/pkg/webdev
[0:15:05]   sdk/third_party/protobuf
Syncing projects:  98% (101/103) sdk/third_party/protobuf        
[0:16:25] Still working on:
[0:16:25]   sdk/third_party/icu
[0:16:25]   sdk/third_party/boringssl/src

[0:16:35] Still working on:
[0:16:35]   sdk/third_party/icu
[0:16:35]   sdk/third_party/boringssl/src

[0:16:45] Still working on:
[0:16:45]   sdk/third_party/icu
[0:16:45]   sdk/third_party/boringssl/src

[0:16:55] Still working on:
[0:16:55]   sdk/third_party/icu
[0:16:55]   sdk/third_party/boringssl/src

[0:17:05] Still working on:
[0:17:05]   sdk/third_party/icu
[0:17:05]   sdk/third_party/boringssl/src

[0:17:10] Still working on:
[0:17:10]   sdk/third_party/icu
[0:17:10]   sdk/third_party/boringssl/src
Syncing projects:  99% (102/103) sdk/third_party/boringssl/src
[0:18:10] Still working on:
[0:18:10]   sdk/third_party/icu

[0:18:20] Still working on:
[0:18:20]   sdk/third_party/icu

[0:18:30] Still working on:
[0:18:30]   sdk/third_party/icu

[0:18:40] Still working on:
[0:18:40]   sdk/third_party/icu

[0:18:50] Still working on:
[0:18:50]   sdk/third_party/icu

[0:18:51] Still working on:
[0:18:51]   sdk/third_party/icu
Syncing projects: 100% (103/103), done.                       
Running hooks:  30% ( 3/10) sysroot_arm         
________ running 'python3 sdk/build/linux/sysroot_scripts/install-sysroot.py --arch=arm' in '/home/tomoyan/development/dart-sdk'
Installing Debian stretch arm root image: /home/tomoyan/development/dart-sdk/sdk/build/linux/debian_stretch_arm-sysroot
Downloading https://commondatastorage.googleapis.com/chrome-linux-sysroot/toolchain/1126d9b629c97385a503debac7a1b59e60a3ab1b/debian_stretch_arm_sysroot.tar.xz
Hook 'python3 sdk/build/linux/sysroot_scripts/install-sysroot.py --arch=arm' took 21.20 secs
Running hooks:  40% ( 4/10) sysroot_arm64
________ running 'python3 sdk/build/linux/sysroot_scripts/install-sysroot.py --arch=arm64' in '/home/tomoyan/development/dart-sdk'
Installing Debian stretch arm64 root image: /home/tomoyan/development/dart-sdk/sdk/build/linux/debian_stretch_arm64-sysroot
Downloading https://commondatastorage.googleapis.com/chrome-linux-sysroot/toolchain/1126d9b629c97385a503debac7a1b59e60a3ab1b/debian_stretch_arm64_sysroot.tar.xz
Running hooks:  50% ( 5/10) sysroot_x86  
________ running 'python3 sdk/build/linux/sysroot_scripts/install-sysroot.py --arch=x86' in '/home/tomoyan/development/dart-sdk'
Installing Debian stretch i386 root image: /home/tomoyan/development/dart-sdk/sdk/build/linux/debian_stretch_i386-sysroot
Downloading https://commondatastorage.googleapis.com/chrome-linux-sysroot/toolchain/1126d9b629c97385a503debac7a1b59e60a3ab1b/debian_stretch_i386_sysroot.tar.xz
Hook 'python3 sdk/build/linux/sysroot_scripts/install-sysroot.py --arch=x86' took 22.42 secs
Running hooks:  60% ( 6/10) sysroot_x64
________ running 'python3 sdk/build/linux/sysroot_scripts/install-sysroot.py --arch=x64' in '/home/tomoyan/development/dart-sdk'
Installing Debian stretch amd64 root image: /home/tomoyan/development/dart-sdk/sdk/build/linux/debian_stretch_amd64-sysroot
Downloading https://commondatastorage.googleapis.com/chrome-linux-sysroot/toolchain/1126d9b629c97385a503debac7a1b59e60a3ab1b/debian_stretch_amd64_sysroot.tar.xz
Hook 'python3 sdk/build/linux/sysroot_scripts/install-sysroot.py --arch=x64' took 15.44 secs
Running hooks: 100% (10/10), done.             
Running: git submodule foreach 'git config -f $toplevel/.git/config submodule.$name.ignore all'
Running: git config --add remote.origin.fetch '+refs/tags/*:refs/tags/*'
Running: git config diff.ignoreSubmodules all
=== 64 ビット SDK をビルド === 公式: [[https://github.com/dart-lang/sdk/wiki/Building#building|Building#Building]]\\ Release ビルド (通常使用するものはこちらです)\\
$ cd sdk
$ ./tools/build.py --no-goma --mode release --arch x64 create_sdk
Done. Made 340 targets from 91 files in 1632ms
buildtools/ninja/ninja -C out/ReleaseX64 create_sdk
ninja: Entering directory `out/ReleaseX64'
[3746/3746] STAMP obj/create_sdk.stamp
The build took 4908.952 seconds
Debug ビルド ()\\
$ cd sdk
$ ./tools/build.py --no-goma --mode debug --arch x64 create_sdk
Done. Made 340 targets from 91 files in 1632ms
buildtools/ninja/ninja -C out/ReleaseX64 create_sdk
ninja: Entering directory `out/ReleaseX64'
[3746/3746] STAMP obj/create_sdk.stamp
The build took 4908.952 seconds
=== 32 ビット SDK をビルド ===
$ cd sdk
$ ./tools/build.py --no-goma --mode release --arch ia32 create_sdk
Done. Made 338 targets from 91 files in 1592ms
buildtools/ninja/ninja -C out/ReleaseIA32 create_sdk
ninja: Entering directory `out/ReleaseIA32'
[1964/1964] STAMP obj/create_sdk.stamp
The build took 2173.043 seconds
===== 言語機能の自動テスト ===== 公式: [[git>dart-lang/sdk/wiki/Building#testing|Building#testing · dart-lang/sdk Wiki]]\\
$ ./tools/test.py \
  --compiler dart2js \
  --runtime chrome \
  --progress color \
  --arch x64 \
  --mode release \
  --report \
  --time \
  --tasks 6 \
  language
No build targets found.
Test configuration:
    custom-configuration-1(architecture: x64, compiler: dart2js, mode: release, runtime: chrome, system: linux)
Suites tested: language
Total: 7478 tests
 * 340 tests will be skipped (304 skipped by design)
 * 0 tests are expected to be flaky but not crash
 * 0 tests are expected to flaky crash
 * 7138 tests are expected to pass
 * 0 tests are expected to fail that we won't fix
 * 0 tests are expected to fail that we should fix
 * 0 tests are expected to crash that we should fix
 * 0 tests are allowed to timeout
 * 0 could not be categorized or are in multiple categories


FAILED: dart2js-chrome release_x64 language/abstract/beats_arguments_test
Expected: Pass
Actual: Timeout

--- Command "dart2js" (took 01:00.000216s):
DART_CONFIGURATION=ReleaseX64 sdk/bin/dart2js -Dtest_runner.configuration=custom-configuration-1 --test-mode --packages=/home/tomoyan/development/dart-sdk/sdk/.dart_tool/package_config.json /home/tomoyan/development/dart-sdk/sdk/tests/language/abstract/beats_arguments_test.dart --out=/home/tomoyan/development/dart-sdk/sdk/out/ReleaseX64/generated_compilations/custom-configuration-1/tests_language_abstract_beats_arguments_test/beats_arguments_test.js

exit code:
1

--- To debug locally, run:
/home/tomoyan/development/dart-sdk/sdk/tools/sdks/dart-sdk/bin/dart /home/tomoyan/development/dart-sdk/sdk/pkg/test_runner/bin/http_server.dart -p 43623 -c 33479 --network 127.0.0.1 --build-directory=/home/tomoyan/development/dart-sdk/sdk/out/ReleaseX64/ --runtime=chrome --packages=/home/tomoyan/development/dart-sdk/sdk/.dart_tool/package_config.json

--- Re-run this test:
python3 tools/test.py -m release -c dart2js -r chrome -a x64 language/abstract/beats_arguments_test
↵
↵
[01:05 |   0% | +    0 | -    1]

FAILED: dart2js-chrome release_x64 language/abstract/equal_test
Expected: Pass
Actual: Timeout

--- Command "dart2js" (took 01:00.000219s):
DART_CONFIGURATION=ReleaseX64 sdk/bin/dart2js -Dtest_runner.configuration=custom-configuration-1 --test-mode --packages=/home/tomoyan/development/dart-sdk/sdk/.dart_tool/package_config.json /home/tomoyan/development/dart-sdk/sdk/tests/language/abstract/equal_test.dart --out=/home/tomoyan/development/dart-sdk/sdk/out/ReleaseX64/generated_compilations/custom-configuration-1/tests_language_abstract_equal_test/equal_test.js

exit code:
1

--- Re-run this test:
python3 tools/test.py -m release -c dart2js -r chrome -a x64 language/abstract/equal_test
↵
↵
[01:05 |   0% | +    0 | -    2]

FAILED: dart2js-chrome release_x64 language/abstract/getter2_test
Expected: Pass
Actual: Timeout

--- Command "dart2js" (took 01:00.000277s):
DART_CONFIGURATION=ReleaseX64 sdk/bin/dart2js -Dtest_runner.configuration=custom-configuration-1 --test-mode --packages=/home/tomoyan/development/dart-sdk/sdk/.dart_tool/package_config.json /home/tomoyan/development/dart-sdk/sdk/tests/language/abstract/getter2_test.dart --out=/home/tomoyan/development/dart-sdk/sdk/out/ReleaseX64/generated_compilations/custom-configuration-1/tests_language_abstract_getter2_test/getter2_test.js

exit code:
1
...
--- Re-run this test:
python3 tools/test.py -m release -c dart2js -r chrome -a x64 language/async_star/covariant_type_test
[45:21 |   3% | +    0 | -  269]]

FAILED: dart2js-chrome release_x64 language/async_star/dcall_type_test
Expected: Pass
Actual: Timeout

--- Command "dart2js" (took 01:00.000408s):
DART_CONFIGURATION=ReleaseX64 sdk/bin/dart2js -Dtest_runner.configuration=custom-configuration-1 --test-mode --packages=/home/tomoyan/development/dart-sdk/sdk/.dart_tool/package_config.json /home/tomoyan/development/dart-sdk/sdk/tests/language/async_star/dcall_type_test.dart --out=/home/tomoyan/development/dart-sdk/sdk/out/ReleaseX64/generated_compilations/custom-configuration-1/tests_language_async_star_dcall_type_test/dcall_type_test.js

exit code:
1

--- Re-run this test:
python3 tools/test.py -m release -c dart2js -r chrome -a x64 language/async_star/dcall_type_test
[45:21 |   3% | +    0 | -  270]^C
===== 参考文献 ===== ==== 付録 ==== [[tw>tomoyan596sp/status/1639944559332593664|じつは、これも原因が分かった😅FlutterをFedoraでやりたいけど…🤔Snap版の安定リリースもGitの最新ソースコードもFlutter CLIが応答無し😅原因はDart自体がFedoraで動かない不具合があるようだ😅💦Dartのソースコードを調べよぅ🤣]]\\ [[tw>tomoyan596sp/status/1640100912734801920|FedoraはDart公式のシステム要件に無い!!😅だからやるんだ!Dartのソースコードからビルドしてみてます🤔Fedoraでテストされていないと思われるので、動かないかもしてないけど、それなら原因を探る旅に出ます😅]]\\