Split php out

This commit is contained in:
Aoran Zeng 2024-08-09 02:55:15 +08:00
parent 182bed75d6
commit 2219cd3a7d
No known key found for this signature in database
GPG Key ID: 8F8BA8488E10ED98
3 changed files with 64 additions and 57 deletions

View File

@ -127,19 +127,6 @@ typedef struct {
static SourceInfo static SourceInfo
/**
* @time 2024-04-18
* @note
*/
pl_php_sources[] = {
{&Upstream, NULL},
{&Ali, "https://mirrors.aliyun.com/composer/"},
{&Tencent, "https://mirrors.tencent.com/composer/"},
{&Huawei, "https://mirrors.huaweicloud.com/repository/php/"}
},
/** /**
* @time 2024-05-24 * @time 2024-05-24
* @note `sparse+` * @note `sparse+`
@ -770,7 +757,6 @@ wr_tex_sources[] = {
#define def_sources_n(t) const size_t t##_sources_n = xy_arylen(t##_sources) #define def_sources_n(t) const size_t t##_sources_n = xy_arylen(t##_sources)
def_sources_n(pl_php);
def_sources_n(pl_rust); def_sources_n(pl_rust);
def_sources_n(pl_java); def_sources_n(pl_clojure); def_sources_n(pl_java); def_sources_n(pl_clojure);
def_sources_n(pl_dotnet); def_sources_n(pl_dart); def_sources_n(pl_haskell); def_sources_n(pl_dotnet); def_sources_n(pl_dart); def_sources_n(pl_haskell);

View File

@ -26,48 +26,7 @@
#include "recipe/lang/python.c" #include "recipe/lang/python.c"
#include "recipe/lang/nodejs.c" #include "recipe/lang/nodejs.c"
#include "recipe/lang/perl.c" #include "recipe/lang/perl.c"
#include "recipe/lang/php.c"
void
pl_php_check_cmd ()
{
chsrc_ensure_program ("composer");
}
/**
* Windows上测试通过PHP用户确认
*/
void
pl_php_getsrc (char *option)
{
pl_php_check_cmd ();
chsrc_run ("composer config -g repositories", RunOpt_Default);
}
/**
* PHP https://developer.aliyun.com/composer
*/
void
pl_php_setsrc (char *option)
{
pl_php_check_cmd ();
SourceInfo source;
chsrc_yield_source (pl_php);
chsrc_confirm_source (&source);
char *where = " -g ";
if (CliOpt_Locally==true)
{
where = " ";
}
char *cmd = xy_strjoin (4, "composer config", where, "repo.packagist composer ", source.url);
chsrc_run (cmd, RunOpt_Default);
chsrc_say_lastly (&source, ChsrcTypeSemiAuto);
}
#include "recipe/lang/lua.c" #include "recipe/lang/lua.c"
#include "recipe/lang/go.c" #include "recipe/lang/go.c"
@ -1932,7 +1891,6 @@ wr_anaconda_setsrc (char *option)
/************************************** Begin Target Matrix ****************************************/ /************************************** Begin Target Matrix ****************************************/
def_target(pl_php);
def_target(pl_rust); def_target(pl_java); def_target(pl_dart); def_target(pl_ocaml); def_target(pl_rust); def_target(pl_java); def_target(pl_dart); def_target(pl_ocaml);
def_target(pl_r); def_target(pl_julia); def_target(pl_r); def_target(pl_julia);
def_target_noget (pl_clojure); def_target_noget (pl_clojure);

63
src/recipe/lang/php.c Normal file
View File

@ -0,0 +1,63 @@
/** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* Contributors : Aoran Zeng <ccmywish@qq.com>
* Created on : <2023-09-06>
* Last modified : <2024-08-09>
* ------------------------------------------------------------*/
/**
* @time 2024-04-18
* @note
*/
static SourceInfo
pl_php_sources[] = {
{&Upstream, NULL},
{&Ali, "https://mirrors.aliyun.com/composer/"},
{&Tencent, "https://mirrors.tencent.com/composer/"},
{&Huawei, "https://mirrors.huaweicloud.com/repository/php/"}
};
def_sources_n(pl_php);
void
pl_php_check_cmd ()
{
chsrc_ensure_program ("composer");
}
/**
* Windows上测试通过PHP用户确认
*/
void
pl_php_getsrc (char *option)
{
pl_php_check_cmd ();
chsrc_run ("composer config -g repositories", RunOpt_Default);
}
/**
* PHP https://developer.aliyun.com/composer
*/
void
pl_php_setsrc (char *option)
{
pl_php_check_cmd ();
SourceInfo source;
chsrc_yield_source (pl_php);
chsrc_confirm_source (&source);
char *where = " -g ";
if (CliOpt_Locally==true)
{
where = " ";
}
char *cmd = xy_strjoin (4, "composer config", where, "repo.packagist composer ", source.url);
chsrc_run (cmd, RunOpt_Default);
chsrc_say_lastly (&source, ChsrcTypeSemiAuto);
}
def_target(pl_php);