Skip to content

Commit 1754a1a

Browse files
committed
This is the last R
1 parent 94bf2f5 commit 1754a1a

File tree

4 files changed

+38
-35
lines changed

4 files changed

+38
-35
lines changed

src/chsrc-main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343

4444
#include "framework/core.c"
4545

46+
#include "recipe/lang/rawstr4c.h"
47+
4648
#include "recipe/lang/Ruby/Ruby.c"
4749

4850
#include "recipe/lang/Python/common.h"

src/recipe/lang/Rust/Cargo.c

Lines changed: 17 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Contributors : Mikachu2333 <[email protected]>
66
* |
77
* Created On : <2023-08-30>
8-
* Last Modified : <2025-07-11>
8+
* Last Modified : <2025-07-22>
99
* ------------------------------------------------------------*/
1010

1111
static SourceProvider_t pl_rust_cargo_upstream =
@@ -21,44 +21,33 @@ static SourceProvider_t pl_rust_cargo_upstream =
2121
*
2222
* @note 以下都支持稀疏索引,我们换源时都将默认添加 `sparse+`
2323
* @note 链接末尾的 `/` 不能缺少
24-
*
25-
* @note 2025-06-17: 经验证,南京大学、华中科大的镜像同步失败,实际情况下多数包都不可用
2624
*/
2725
static Source_t pl_rust_cargo_sources[] =
2826
{
29-
{&pl_rust_cargo_upstream, "https://github.com/rust-lang/crates.io-index/",
30-
NULL},
27+
{&pl_rust_cargo_upstream, "https://github.com/rust-lang/crates.io-index/", DelegateToUpstream},
28+
29+
{&MirrorZ, "https://mirrors.cernet.edu.cn/crates.io-index/", DelegateToMirror},
30+
{&RsProxyCN, "https://rsproxy.cn/index/", DelegateToMirror},
3131

32-
{&MirrorZ, "https://mirrors.cernet.edu.cn/crates.io-index/",
33-
NULL},
34-
{&RsProxyCN, "https://rsproxy.cn/index/",
35-
NULL},
3632
{&Ali, "https://mirrors.aliyun.com/crates.io-index/",
3733
"https://mirrors.aliyun.com/crates/api/v1/crates/windows/0.58.0/download"},
3834

39-
{&Zju, "https://mirrors.zju.edu.cn/crates.io-index/",
40-
NULL},
41-
42-
// {&Nju, "https://mirror.nju.edu.cn/git/crates.io-index.git/",
43-
// NULL},
35+
{&Zju, "https://mirrors.zju.edu.cn/crates.io-index/", DelegateToMirror},
4436

45-
{&Sjtug_Zhiyuan, "https://mirrors.sjtug.sjtu.edu.cn/crates.io-index/",
46-
NULL},
37+
/* 注释原因: (2025-06-17) 镜像同步失败,多数包都不可用 */
38+
// {&Nju, "https://mirror.nju.edu.cn/git/crates.io-index.git/", DelegateToMirror},
4739

48-
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/crates.io-index/",
49-
NULL},
50-
51-
{&Bfsu, "https://mirrors.bfsu.edu.cn/crates.io-index/",
52-
NULL},
40+
{&Sjtug_Zhiyuan, "https://mirrors.sjtug.sjtu.edu.cn/crates.io-index/", DelegateToMirror},
41+
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/crates.io-index/", DelegateToMirror},
42+
{&Bfsu, "https://mirrors.bfsu.edu.cn/crates.io-index/", DelegateToMirror},
5343

5444
{&Ustc, "https://mirrors.ustc.edu.cn/crates.io-index/",
5545
"https://crates-io.proxy.ustclug.org/api/v1/crates/windows/0.58.0/download"},
5646

57-
// {&Hust, "https://mirrors.hust.edu.cn/crates.io-index/",
58-
// NULL},
47+
/* 注释原因: (2025-06-17) 镜像同步失败,多数包都不可用 */
48+
// {&Hust, "https://mirrors.hust.edu.cn/crates.io-index/", DelegateToMirror},
5949

60-
{&Cqu, "https://mirrors.cqu.edu.cn/crates.io-index/",
61-
NULL}
50+
{&Cqu, "https://mirrors.cqu.edu.cn/crates.io-index/", DelegateToMirror}
6251
};
6352
def_sources_n(pl_rust_cargo);
6453

@@ -84,19 +73,12 @@ pl_rust_cargo_setsrc (char *option)
8473
{
8574
chsrc_yield_source_and_confirm (pl_rust_cargo);
8675

87-
const char *file =
88-
R"toml(
89-
[source.crates-io]
90-
replace-with = 'mirror'
91-
92-
[source.mirror]
93-
registry = "sparse+@url@"
94-
)toml";
76+
char *content = RAWSTR_pl_rust_cargo_config;
9577

96-
file = xy_str_gsub (file, "@url@", source.url);
78+
content = xy_str_gsub (content, "@url@", source.url);
9779

9880
chsrc_note2 (xy_strjoin (3, "请手动写入以下内容到 ", xy_normalize_path ("~/.cargo/config.toml"), " 文件中:"));
99-
println (file);
81+
print (content);
10082

10183
chsrc_determine_chgtype (ChgType_Auto);
10284
chsrc_conclude (&source);

src/recipe/lang/rawstr4c.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ char RAWSTR_pl_java_maven_config[] = "\074\155\151\162\162\157\162\076\012\040\0
88

99
char RAWSTR_pl_java_build_gradle[] = "\141\154\154\160\162\157\152\145\143\164\163\040\173\012\040\040\040\040\162\145\160\157\163\151\164\157\162\151\145\163\040\173\012\040\040\040\040\040\040\040\040\155\141\166\145\156\040\173\040\165\162\154\040\047\100\165\162\154\100\047\040\175\012\040\040\040\040\040\040\040\040\155\141\166\145\156\114\157\143\141\154\050\051\012\040\040\040\040\040\040\040\040\155\141\166\145\156\103\145\156\164\162\141\154\050\051\012\040\040\040\040\175\012\175\012";
1010

11+
char RAWSTR_pl_rust_cargo_config[] = "\133\163\157\165\162\143\145\056\143\162\141\164\145\163\055\151\157\135\012\162\145\160\154\141\143\145\055\167\151\164\150\040\075\040\047\155\151\162\162\157\162\047\012\012\133\163\157\165\162\143\145\056\155\151\162\162\157\162\135\012\162\145\147\151\163\164\162\171\040\075\040\042\163\160\141\162\163\145\053\100\165\162\154\100\042\012";
12+
1113
char RAWSTR_pl_haskell_cabal_config[] = "\162\145\160\157\163\151\164\157\162\171\040\155\151\162\162\157\162\012\040\040\165\162\154\072\040\100\165\162\154\100\012\040\040\163\145\143\165\162\145\072\040\124\162\165\145\012";
1214

1315
char RAWSTR_pl_haskell_stackage_yaml[] = "\160\141\143\153\141\147\145\055\151\156\144\145\170\072\012\040\040\144\157\167\156\154\157\141\144\055\160\162\145\146\151\170\072\040\100\165\162\154\100\012\040\040\150\141\143\153\141\147\145\055\163\145\143\165\162\151\164\171\072\012\040\040\040\040\153\145\171\151\144\163\072\012\040\040\040\040\040\040\055\040\060\141\065\143\067\145\141\064\067\143\144\061\142\061\065\146\060\061\146\065\146\065\061\141\063\063\141\144\144\141\067\145\066\065\065\142\143\060\146\060\142\060\066\061\065\142\141\141\070\145\062\067\061\146\064\143\063\063\065\061\145\062\061\144\012\040\040\040\040\040\040\055\040\061\145\141\071\142\141\063\062\143\065\062\066\144\061\143\143\071\061\141\142\065\145\065\142\144\063\066\064\145\143\065\145\071\145\070\143\142\066\067\061\067\071\141\064\067\061\070\067\062\146\066\145\062\066\146\060\141\145\067\067\063\144\064\062\012\040\040\040\040\040\040\055\040\062\070\060\142\061\060\061\065\063\141\065\062\062\066\070\061\061\066\063\066\065\070\143\142\064\071\146\066\063\062\143\144\145\063\146\063\070\144\067\066\070\142\067\063\066\144\144\142\143\071\060\061\144\071\071\141\061\141\067\067\062\070\063\063\012\040\040\040\040\040\040\055\040\062\141\071\066\142\061\070\070\071\144\143\062\062\061\143\061\067\062\071\066\146\143\143\062\142\142\063\064\142\071\060\070\143\141\071\067\063\064\063\067\066\146\060\146\063\066\061\066\066\060\062\060\060\071\063\065\071\061\066\145\146\062\060\061\012\040\040\040\040\040\040\055\040\062\143\066\143\063\066\062\067\142\144\066\143\071\070\062\071\071\060\062\063\071\064\070\067\146\061\141\142\144\060\062\145\060\070\141\060\062\145\066\143\146\061\066\145\144\142\061\060\065\141\070\060\061\062\144\064\064\064\144\070\067\060\143\063\012\040\040\040\040\040\040\055\040\065\061\146\060\061\066\061\142\071\060\066\060\061\061\142\065\062\143\066\066\061\063\063\067\066\142\061\141\145\071\063\067\066\067\060\144\141\066\071\063\062\062\061\061\063\141\062\064\066\141\060\071\146\070\060\067\143\066\062\146\066\071\062\061\012\040\040\040\040\040\040\055\040\067\067\062\145\071\146\064\143\067\144\142\063\063\144\062\065\061\144\065\143\066\145\063\065\067\061\071\071\143\070\061\071\145\065\066\071\144\061\063\060\070\065\067\144\143\062\062\065\065\064\071\142\064\060\070\064\065\146\146\060\070\071\060\144\012\040\040\040\040\040\040\055\040\141\141\063\061\065\062\070\066\145\066\141\144\062\070\061\141\144\066\061\061\070\062\062\063\065\065\063\063\143\064\061\145\070\060\066\145\065\141\067\070\067\145\060\142\066\144\061\145\067\145\145\146\063\146\060\071\144\061\063\067\144\062\145\071\012\040\040\040\040\040\040\055\040\146\145\063\063\061\065\060\062\066\060\066\070\060\062\146\145\141\143\061\065\145\065\061\064\144\071\142\071\145\141\070\063\146\145\145\070\142\066\146\146\145\146\067\061\063\063\065\064\067\071\141\062\145\066\070\144\070\064\141\144\143\066\142\060\012\040\040\040\040\153\145\171\055\164\150\162\145\163\150\157\154\144\072\040\063\040\043\040\156\165\155\142\145\162\040\157\146\040\153\145\171\163\040\162\145\161\165\151\162\145\144\012\040\040\040\040\043\040\151\147\156\157\162\145\040\145\170\160\151\162\141\164\151\157\156\040\144\141\164\145\054\040\163\145\145\040\150\164\164\160\163\072\057\057\147\151\164\150\165\142\056\143\157\155\057\143\157\155\155\145\162\143\151\141\154\150\141\163\153\145\154\154\057\163\164\141\143\153\057\160\165\154\154\057\064\066\061\064\012\040\040\040\040\151\147\156\157\162\145\055\145\170\160\151\162\171\072\040\156\157\012";

src/recipe/lang/rawstr4c.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,23 @@ allprojects {
5151

5252

5353

54+
## Rust
55+
56+
- namespace = `rust`
57+
- name = `cargo_config`
58+
59+
```toml
60+
[source.crates-io]
61+
replace-with = 'mirror'
62+
63+
[source.mirror]
64+
registry = "sparse+@url@"
65+
```
66+
67+
<br>
68+
69+
70+
5471
## Haskell
5572

5673
- namespace = `haskell`

0 commit comments

Comments
 (0)