From dde25a1ca56846a5fa1c1d75cc5bb630ccf57f68 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Fri, 16 Aug 2024 04:38:46 +0800 Subject: [PATCH] Split nuget out --- include/source.h | 18 ++---------------- src/chsrc.c | 18 +----------------- src/recipe/catalog.c | 11 +++++------ src/recipe/lang/NuGet.c | 32 ++++++++++++++++++++++++++++++++ 4 files changed, 40 insertions(+), 39 deletions(-) create mode 100644 src/recipe/lang/NuGet.c diff --git a/include/source.h b/include/source.h index c43eeee..7a22793 100644 --- a/include/source.h +++ b/include/source.h @@ -126,33 +126,19 @@ typedef struct { -static SourceInfo /** * @time 2023-09-10 更新 * @note 不太好换,且用户可能不多,我们暂时只给用户提供文档 */ +static SourceInfo pl_clojure_sources[] = { {&Upstream, NULL}, {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/help/clojars/"}, {&Ustc, "https://mirrors.ustc.edu.cn/help/clojars.html"} -}, - - -/** - * @time 2024-04-18 更新 - * @note { - * 暂时未实现该换源功能,可参照 - * https://mirrors.huaweicloud.com/mirrorDetail/5ebf85de07b41baf6d0882ab?mirrorName=nuget&catalog=language - * } - */ -pl_dotnet_sources[] = { - {&Upstream, NULL}, - {&NugetOrg, "https://www.nuget.org/api/v2/"}, - {&Huawei, "https://mirrors.huaweicloud.com/repository/nuget/v3"} }; + #define def_sources_n(t) const size_t t##_sources_n = xy_arylen(t##_sources) def_sources_n(pl_clojure); -def_sources_n(pl_dotnet); diff --git a/src/chsrc.c b/src/chsrc.c index d69d08a..2a40f7c 100644 --- a/src/chsrc.c +++ b/src/chsrc.c @@ -36,23 +36,7 @@ #include "recipe/lang/ocaml.c" #include "recipe/lang/r.c" #include "recipe/lang/julia.c" - -void -pl_dotnet_getsrc (char *option) -{ - chsrc_error ("暂时无法查看NuGet源,若有需求,请您提交issue"); -} - -/** - * NuGet 换源 - */ -void -pl_dotnet_setsrc (char *option) -{ - chsrc_error ("暂时无法为NuGet换源,若有需求,请您提交issue"); -} - - +#include "recipe/lang/NuGet.c" void diff --git a/src/recipe/catalog.c b/src/recipe/catalog.c index 02419fd..cc3e750 100644 --- a/src/recipe/catalog.c +++ b/src/recipe/catalog.c @@ -9,7 +9,6 @@ /* Begin Target Matrix */ def_target_noget (pl_clojure); -def_target_noget (pl_dotnet); #define t(a) (const char*)(a) @@ -23,17 +22,17 @@ static const char *pl_go [] = {"go", "golang", "goproxy", NULL, t(&pl_go_target)} , *pl_rust [] = {"rust", "cargo", "crate", "crates", NULL, t(&pl_rust_target)}, *pl_java [] = {"java", "maven", "mvn", "gradle", NULL, t(&pl_java_target)}, -*pl_clojure[] ={"clojure","clojars","cloj", "lein", "leiningen", NULL, t(&pl_clojure_target)}, +*pl_clojure[]= {"clojure","clojars","cloj", "lein", "leiningen", NULL, t(&pl_clojure_target)}, *pl_dart [] = {"dart", "pub", "flutter", NULL, t(&pl_dart_target)}, -*pl_dotnet[] = {"nuget", "net", ".net", "dotnet", NULL, t(&pl_dotnet_target)}, -*pl_haskell[] ={"haskell", "cabal", "stack", "hackage", NULL, t(&pl_haskell_target)}, -*pl_ocaml[] = {"ocaml", "opam", NULL, t(&pl_ocaml_target)}, +*pl_nuget[] = {"nuget", "net", ".net", "dotnet", NULL, t(&pl_nuget_target)}, +*pl_haskell[]= {"haskell", "cabal", "stack", "hackage", NULL, t(&pl_haskell_target)}, +*pl_ocaml[] = {"ocaml", "opam", NULL, t(&pl_ocaml_target)}, *pl_r [] = {"cran", "r", NULL, t(&pl_r_target)}, *pl_julia [] = {"julia", NULL, t(&pl_julia_target)}, **pl_packagers[] = { pl_ruby, pl_python, pl_nodejs, pl_perl, pl_php, pl_lua, - pl_rust, pl_go, /*pl_dotnet,*/ pl_java, pl_clojure, pl_dart, + pl_rust, pl_go, /*pl_nuget,*/ pl_java, pl_clojure, pl_dart, pl_haskell, pl_ocaml, pl_r, pl_julia }; diff --git a/src/recipe/lang/NuGet.c b/src/recipe/lang/NuGet.c new file mode 100644 index 0000000..32a0d9a --- /dev/null +++ b/src/recipe/lang/NuGet.c @@ -0,0 +1,32 @@ +/** + * @time 2024-04-18 更新 + * @note { + * 暂时未实现该换源功能,可参照 + * https://mirrors.huaweicloud.com/mirrorDetail/5ebf85de07b41baf6d0882ab?mirrorName=nuget&catalog=language + * } + */ +static SourceInfo +pl_nuget_sources[] = { + {&Upstream, NULL}, + {&NugetOrg, "https://www.nuget.org/api/v2/"}, + {&Huawei, "https://mirrors.huaweicloud.com/repository/nuget/v3"} +}; +def_sources_n(pl_nuget); + +void +pl_nuget_getsrc (char *option) +{ + chsrc_error ("暂时无法查看NuGet源,若有需求,请您提交issue"); +} + +/** + * NuGet 换源 + */ +void +pl_nuget_setsrc (char *option) +{ + chsrc_error ("暂时无法为NuGet换源,若有需求,请您提交issue"); +} + + +def_target_noget (pl_nuget);