From 78001c002f15e0af8649aab21da7614d27dd04f7 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Tue, 15 Jul 2025 00:08:38 +0800 Subject: [PATCH] Rewrite `Java` recipe --- src/recipe/lang/Java.c | 25 +++++++------------------ src/recipe/lang/rawstr4c.h | 6 +++++- src/recipe/lang/rawstr4c.md | 31 ++++++++++++++++++++++++++++++- 3 files changed, 42 insertions(+), 20 deletions(-) diff --git a/src/recipe/lang/Java.c b/src/recipe/lang/Java.c index 22ed7f6..f8e3a77 100644 --- a/src/recipe/lang/Java.c +++ b/src/recipe/lang/Java.c @@ -8,6 +8,8 @@ * Last Modified : <2025-07-14> * ------------------------------------------------------------*/ +#include "rawstr4c.h" + static SourceProvider_t pl_java_upstream = { def_upstream, "https://mvnrepository.com/", @@ -74,14 +76,9 @@ pl_java_setsrc (char *option) if (maven_exist) { - const char *file = xy_strjoin (7, - "\n" - " ", source.mirror->code, "\n" - " *\n" - " ", source.mirror->name, "\n" - " ", source.url, "\n" - ""); - + char *file = xy_str_gsub (RAWSTR_pl_maven_config, "@1@", source.mirror->code); + file = xy_str_gsub (file, "@name@", source.mirror->name); + file = xy_str_gsub (file, "@url@", source.url); char *maven_config = pl_java_find_maven_config (); chsrc_note2 (xy_strjoin (3, "请在 maven 配置文件 ", maven_config, " 中添加:")); println (file); @@ -90,17 +87,9 @@ pl_java_setsrc (char *option) if (gradle_exist) { if (maven_exist) br(); - const char* file = xy_strjoin (3, - "allprojects {\n" - " repositories {\n" - " maven { url '", source.url, "' }\n" - " mavenLocal()\n" - " mavenCentral()\n" - " }\n" - "}"); - + char* file = xy_str_gsub (RAWSTR_pl_build_gradle, "@url@", source.url); chsrc_note2 ("请在 build.gradle 中添加:"); - p(file); + println (file); } chsrc_determine_chgtype (ChgType_Manual); diff --git a/src/recipe/lang/rawstr4c.h b/src/recipe/lang/rawstr4c.h index f43a367..89f558e 100644 --- a/src/recipe/lang/rawstr4c.h +++ b/src/recipe/lang/rawstr4c.h @@ -3,9 +3,13 @@ /** * Generated by rawstr4c v0.1.0.2-2025/07/14 * - * Date: 2025-07-14T23:55:13.381990+08:00 + * Date: 2025-07-15T00:04:26.964264+08:00 */ +char RAWSTR_pl_maven_config[] = "\074\155\151\162\162\157\162\076\012\040\040\040\040\074\151\144\076\100\061\100\074\057\151\144\076\012\040\040\040\040\074\155\151\162\162\157\162\117\146\076\052\074\057\155\151\162\162\157\162\117\146\076\012\040\040\040\040\074\156\141\155\145\076\100\156\141\155\145\100\074\057\156\141\155\145\076\012\040\040\040\040\074\165\162\154\076\100\165\162\154\100\074\057\165\162\154\076\012\074\057\155\151\162\162\157\162\076\012"; + +char RAWSTR_pl_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"; + char RAWSTR_pl_stackage[] = "\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"; char RAWSTR_pl_project_clj[] = "\050\144\145\146\160\162\157\152\145\143\164\040\155\171\141\160\160\040\042\061\056\060\056\060\042\012\040\040\040\072\144\145\163\143\162\151\160\164\151\157\156\040\042\115\171\040\101\160\160\154\151\143\141\164\151\157\156\042\012\040\040\040\072\144\145\160\145\156\144\145\156\143\151\145\163\040\133\133\154\151\142\061\040\042\061\056\060\056\060\042\135\012\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\133\154\151\142\062\040\042\062\056\060\056\060\042\135\012\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\133\154\151\142\063\040\042\063\056\060\056\060\042\135\135\012\040\040\040\072\155\151\162\162\157\162\163\040\173\042\143\154\157\152\141\162\163\042\040\173\072\156\141\155\145\040\042\155\151\162\162\157\162\042\012\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\072\165\162\154\040\042\100\165\162\154\100\042\175\175\012\040\040\040\072\155\141\151\156\040\154\145\151\156\151\156\147\145\156\056\167\145\142\051\012"; diff --git a/src/recipe/lang/rawstr4c.md b/src/recipe/lang/rawstr4c.md index 3fb429f..6e8a0fb 100644 --- a/src/recipe/lang/rawstr4c.md +++ b/src/recipe/lang/rawstr4c.md @@ -5,7 +5,7 @@ ! Config Authors: Aoran Zeng ! Contributors : Nil Null ! Created On : <2025-07-14> - ! Last Modified : <2025-07-14> + ! Last Modified : <2025-07-15> ! ---------------------------------------------------------- --> # rawstr4c input @@ -14,6 +14,35 @@ - output = `:global-variable-only-header` - translate = `:oct` + +## Java + +### maven config + +```xml + + @1@ + * + @name@ + @url@ + +``` + + +### build.gradle + +```groovy +allprojects { + repositories { + maven { url '@url@' } + mavenLocal() + mavenCentral() + } +} +``` + + + ## stackage ```yaml