From 5398a5d3d1a0d42df7d3c683eb2f8b9d9d63aae7 Mon Sep 17 00:00:00 2001 From: MadDogOwner Date: Tue, 15 Apr 2025 06:19:27 +0800 Subject: [PATCH 1/4] Use `setx` in Windows for Dart --- src/recipe/lang/Dart/Flutter.c | 15 +++++---------- src/recipe/lang/Dart/Pub.c | 15 +++++---------- 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/src/recipe/lang/Dart/Flutter.c b/src/recipe/lang/Dart/Flutter.c index 84c34b38..2ec165a2 100644 --- a/src/recipe/lang/Dart/Flutter.c +++ b/src/recipe/lang/Dart/Flutter.c @@ -3,10 +3,10 @@ * ------------------------------------------------------------- * File Authors : Aoran Zeng * Contributors : czyt - * | + * | * Created On : <2023-09-10> * Major Revision : 2 - * Last Modified : <2024-11-22> + * Last Modified : <2025-04-15> * * 2024-09-14: 不得不将Dart和Flutter拆分为两个Target, * 因为3家教育网镜像站给出的 Dart 和 Flutter 换源URL模式都不一样 @@ -57,16 +57,11 @@ pl_dart_flutter_setsrc (char *option) chsrc_yield_source_and_confirm (pl_dart_flutter); char *w = NULL; - + char *cmd = NULL; if (xy_on_windows) { - w = xy_strjoin (3, "$env:FLUTTER_STORAGE_BASE_URL = \"", source.url, "\"\n"); - - if (xy_file_exist (xy_win_powershell_profile)) - chsrc_append_to_file (w, xy_win_powershell_profile); - - if (xy_file_exist (xy_win_powershellv5_profile)) - chsrc_append_to_file (w, xy_win_powershellv5_profile); + cmd = xy_strjoin (3, "setx FLUTTER_STORAGE_BASE_URL \"", source.url, "\""); + chsrc_run (cmd, RunOpt_No_Last_New_Line); } else { diff --git a/src/recipe/lang/Dart/Pub.c b/src/recipe/lang/Dart/Pub.c index f12f7081..ffb3ac39 100644 --- a/src/recipe/lang/Dart/Pub.c +++ b/src/recipe/lang/Dart/Pub.c @@ -3,10 +3,10 @@ * ------------------------------------------------------------- * File Authors : Aoran Zeng * Contributors : czyt - * | + * | * Created On : <2023-09-10> * Major Revision : 3 - * Last Modified : <2024-10-31> + * Last Modified : <2025-04-15> * * Dart Pub 软件仓库 * ------------------------------------------------------------*/ @@ -52,16 +52,11 @@ pl_dart_setsrc (char *option) chsrc_yield_source_and_confirm (pl_dart); char *w = NULL; - + char *cmd = NULL; if (xy_on_windows) { - w = xy_strjoin (3, "$env:PUB_HOSTED_URL = \"", source.url, "\"\n"); - - if (xy_file_exist (xy_win_powershell_profile)) - chsrc_append_to_file (w, xy_win_powershell_profile); - - if (xy_file_exist (xy_win_powershellv5_profile)) - chsrc_append_to_file (w, xy_win_powershellv5_profile); + cmd = xy_strjoin (3, "setx PUB_HOSTED_URL \"", source.url, "\""); + chsrc_run (cmd, RunOpt_No_Last_New_Line); } else { From 7f5585cf29a45c94cf7c623bebdfcadd5ba5d4a4 Mon Sep 17 00:00:00 2001 From: MadDogOwner Date: Tue, 15 Apr 2025 07:23:58 +0800 Subject: [PATCH 2/4] Add CUFG (China Flutter User Group) --- src/chsrc-main.c | 1 + src/recipe/lang/Dart/Flutter.c | 17 ++++++++++++----- src/recipe/lang/Dart/Pub.c | 11 +++++++++-- src/recipe/lang/Dart/common.h | 16 ++++++++++++++++ src/recipe/menu.c | 2 +- 5 files changed, 39 insertions(+), 8 deletions(-) create mode 100644 src/recipe/lang/Dart/common.h diff --git a/src/chsrc-main.c b/src/chsrc-main.c index 3c8be807..53f2dbc3 100644 --- a/src/chsrc-main.c +++ b/src/chsrc-main.c @@ -66,6 +66,7 @@ #include "recipe/lang/Rust/rustup.c" #include "recipe/lang/Rust/Cargo.c" +#include "recipe/lang/Dart/common.h" #include "recipe/lang/Dart/Pub.c" #include "recipe/lang/Dart/Flutter.c" diff --git a/src/recipe/lang/Dart/Flutter.c b/src/recipe/lang/Dart/Flutter.c index 2ec165a2..d45bdf59 100644 --- a/src/recipe/lang/Dart/Flutter.c +++ b/src/recipe/lang/Dart/Flutter.c @@ -13,14 +13,21 @@ * ------------------------------------------------------------*/ /** - * @update 2024-10-31 + * @update 2025-04-15 */ +static SourceProvider_t pl_dart_flutter_upstream = +{ + def_upstream, "https://storage.googleapis.com", + {NotSkip, NA, NA, "https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_v1.0.0-stable.tar.xz"} // 231 MB +}; + static Source_t pl_dart_flutter_sources[] = { - {&UpstreamProvider, "https://storage.googleapis.com"}, - {&Sjtug_Zhiyuan, "https://mirror.sjtu.edu.cn"}, // 没有后缀,怀疑是否存在问题 - {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/git/flutter"}, // URL 带 git - {&Nju, "https://mirror.nju.edu.cn/flutter"} + {&pl_dart_flutter_upstream, "https://storage.googleapis.com"}, + {&FlutterCN, "https://storage.flutter-io.cn"}, + {&Sjtug_Zhiyuan, "https://mirror.sjtu.edu.cn"}, // 没有后缀,怀疑是否存在问题 + {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/flutter"}, + {&Nju, "https://mirror.nju.edu.cn/flutter"} }; def_sources_n(pl_dart_flutter); diff --git a/src/recipe/lang/Dart/Pub.c b/src/recipe/lang/Dart/Pub.c index ffb3ac39..1ee6c8c4 100644 --- a/src/recipe/lang/Dart/Pub.c +++ b/src/recipe/lang/Dart/Pub.c @@ -12,11 +12,18 @@ * ------------------------------------------------------------*/ /** - * @update 2024-10-31 + * @update 2025-04-15 */ + static SourceProvider_t pl_dart_upstream = +{ + def_upstream, "https://pub.dev", + {NotSkip, NA, NA, "https://pub.dev/packages/flutter_vision/versions/1.1.4.tar.gz"} // 37.05 MB +}; + static Source_t pl_dart_sources[] = { - {&UpstreamProvider, "https://pub.dev"}, + {&pl_dart_upstream, "https://pub.dev"}, + {&FlutterCN, "https://pub.flutter-io.cn"}, {&Sjtug_Zhiyuan, "https://mirror.sjtu.edu.cn/dart-pub"}, {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/dart-pub"}, {&Nju, "https://mirror.nju.edu.cn/dart-pub"} diff --git a/src/recipe/lang/Dart/common.h b/src/recipe/lang/Dart/common.h new file mode 100644 index 00000000..c7bd16cb --- /dev/null +++ b/src/recipe/lang/Dart/common.h @@ -0,0 +1,16 @@ +/** ------------------------------------------------------------ + * SPDX-License-Identifier: GPL-3.0-or-later + * ------------------------------------------------------------- + * File Authors : Aoran Zeng + * Contributors : czyt + * | + * Created On : <2025-04-15> + * Major Revision : 1 + * Last Modified : <2025-04-15> + * ------------------------------------------------------------*/ + +static MirrorSite_t FlutterCN = +{ + "cfug", "CFUG", "China Flutter User Group", "https://flutter.cn/", + {NotSkip, NA, NA, "https://storage.flutter-io.cn/flutter_infra_release/releases/stable/linux/flutter_linux_v1.0.0-stable.tar.xz"} // 231 MB +}; diff --git a/src/recipe/menu.c b/src/recipe/menu.c index 3194dbbd..811c8ad0 100644 --- a/src/recipe/menu.c +++ b/src/recipe/menu.c @@ -167,7 +167,7 @@ available_mirrors[] = { &Api7, &Fit2Cloud, &DaoCloud, /* 专用镜像站 */ - &RubyChina, &EmacsChina, &NpmMirror, &GoProxyIO, &GoProxyCN, &RsProxyCN, + &RubyChina, &EmacsChina, &NpmMirror, &GoProxyIO, &GoProxyCN, &RsProxyCN, &FlutterCN, // 暂不支持 &NugetOrg // 不要列出 &UpstreamProvider 和 &UserDefinedProvider From 1d93e462b2e92fbb2eb20facdc22e308cf1fe589 Mon Sep 17 00:00:00 2001 From: MadDogOwner Date: Tue, 15 Apr 2025 22:58:34 +0800 Subject: [PATCH 3/4] Update the file author information and modify the last modified date --- src/chsrc-main.c | 3 ++- src/recipe/lang/Dart/Flutter.c | 7 ++++--- src/recipe/lang/Dart/Pub.c | 7 ++++--- src/recipe/lang/Dart/common.h | 6 +++--- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/chsrc-main.c b/src/chsrc-main.c index 53f2dbc3..2730e9df 100644 --- a/src/chsrc-main.c +++ b/src/chsrc-main.c @@ -24,9 +24,10 @@ * | Jialin Lyu * | GitHub Copilot * | ccy + * | MadDogOwner * | * Created On : <2023-08-28> - * Last Modified : <2025-04-13> + * Last Modified : <2025-04-15> * * chsrc: Change Source —— 全平台通用命令行换源工具 * ------------------------------------------------------------*/ diff --git a/src/recipe/lang/Dart/Flutter.c b/src/recipe/lang/Dart/Flutter.c index d45bdf59..0b53f745 100644 --- a/src/recipe/lang/Dart/Flutter.c +++ b/src/recipe/lang/Dart/Flutter.c @@ -1,9 +1,10 @@ /** ------------------------------------------------------------ * SPDX-License-Identifier: GPL-3.0-or-later * ------------------------------------------------------------- - * File Authors : Aoran Zeng - * Contributors : czyt - * | + * File Authors : Aoran Zeng + * Contributors : czyt + * | MadDogOwner + * | * Created On : <2023-09-10> * Major Revision : 2 * Last Modified : <2025-04-15> diff --git a/src/recipe/lang/Dart/Pub.c b/src/recipe/lang/Dart/Pub.c index 1ee6c8c4..2419395d 100644 --- a/src/recipe/lang/Dart/Pub.c +++ b/src/recipe/lang/Dart/Pub.c @@ -1,9 +1,10 @@ /** ------------------------------------------------------------ * SPDX-License-Identifier: GPL-3.0-or-later * ------------------------------------------------------------- - * File Authors : Aoran Zeng - * Contributors : czyt - * | + * File Authors : Aoran Zeng + * Contributors : czyt + * | MadDogOwner + * | * Created On : <2023-09-10> * Major Revision : 3 * Last Modified : <2025-04-15> diff --git a/src/recipe/lang/Dart/common.h b/src/recipe/lang/Dart/common.h index c7bd16cb..10501bb8 100644 --- a/src/recipe/lang/Dart/common.h +++ b/src/recipe/lang/Dart/common.h @@ -1,9 +1,9 @@ /** ------------------------------------------------------------ * SPDX-License-Identifier: GPL-3.0-or-later * ------------------------------------------------------------- - * File Authors : Aoran Zeng - * Contributors : czyt - * | + * File Authors : MadDogOwner + * Contributors : Nil Null + * | * Created On : <2025-04-15> * Major Revision : 1 * Last Modified : <2025-04-15> From 282e1d5c9e41b95c4bf30c29ac34c1ff7ab32f4d Mon Sep 17 00:00:00 2001 From: MadDogOwner Date: Tue, 15 Apr 2025 22:59:17 +0800 Subject: [PATCH 4/4] Translate the China Flutter User Group name into Chinese --- src/recipe/lang/Dart/common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/recipe/lang/Dart/common.h b/src/recipe/lang/Dart/common.h index 10501bb8..6358240a 100644 --- a/src/recipe/lang/Dart/common.h +++ b/src/recipe/lang/Dart/common.h @@ -11,6 +11,6 @@ static MirrorSite_t FlutterCN = { - "cfug", "CFUG", "China Flutter User Group", "https://flutter.cn/", + "cfug", "CFUG", "Flutter 社区", "https://flutter.cn/", {NotSkip, NA, NA, "https://storage.flutter-io.cn/flutter_infra_release/releases/stable/linux/flutter_linux_v1.0.0-stable.tar.xz"} // 231 MB };