From a8411bb2f85199fd2a52219eb9cd9adb2a3027eb Mon Sep 17 00:00:00 2001 From: lihan Date: Mon, 5 Feb 2024 22:19:06 +0800 Subject: [PATCH] =?UTF-8?q?release=20v0.2.3=F0=9F=8E=89=F0=9F=8E=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README_CN.md | 17 +++++++++++++---- template.lua | 5 +++++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/README_CN.md b/README_CN.md index 5a002396..a4c32364 100644 --- a/README_CN.md +++ b/README_CN.md @@ -328,14 +328,18 @@ OS_TYPE = "" ARCH_TYPE = "" PLUGIN = { - --- 插件名称 + --- 插件名称, 即sdk名称 name = "java", --- 插件作者 author = "Lihan", --- 插件版本 version = "0.0.1", + --- 插件描述 + description = "xxx", -- 升级地址 updateUrl = "{URL}/sdk.lua", + -- 最先运行时的版本 >= + minRuntimeVersion = "0.2.2", } --- 根据ctx.version来返回对应版本的信息,包括版本、下载地址等 @@ -343,10 +347,12 @@ PLUGIN = { --- @field ctx.version string 用户输入的版本号 --- @return table 版本信息 function PLUGIN:PreInstall(ctx) + local runtimeVersion = ctx.runtimeVersion + local version = ctx.version return { - --- 版本号 + --- 版本号 必填 version = "xxx", - --- 下载地址 + --- 下载地址 [选填] url = "xxx", } end @@ -356,6 +362,7 @@ end function PLUGIN:PostInstall(ctx) --- ctx.rootPath SDK安装目录 local rootPath = ctx.rootPath + local runtimeVersion = ctx.runtimeVersion local sdkInfo = ctx.sdkInfo['sdk-name'] local path = sdkInfo.path local version = sdkInfo.version @@ -378,6 +385,7 @@ end --- } --- } function PLUGIN:Available(ctx) + local runtimeVersion = ctx.runtimeVersion return { { version = "xxxx", @@ -397,7 +405,8 @@ end --- @param ctx table 上下文信息 --- @field ctx.version_path string SDK安装目录 function PLUGIN:EnvKeys(ctx) - local mainPath = ctx.version_path + local mainPath = ctx.path + local runtimeVersion = ctx.runtimeVersion return { { key = "JAVA_HOME", diff --git a/template.lua b/template.lua index ae12f17c..d94aa981 100644 --- a/template.lua +++ b/template.lua @@ -31,6 +31,8 @@ PLUGIN = { --- @field ctx.version string User-input version --- @return table Version information function PLUGIN:PreInstall(ctx) + local version = ctx.version + local runtimeVersion = ctx.runtimeVersion return { --- Version number version = "xxx", @@ -70,6 +72,7 @@ end function PLUGIN:PostInstall(ctx) --- ctx.rootPath SDK installation directory local rootPath = ctx.rootPath + local runtimeVersion = ctx.runtimeVersion local sdkInfo = ctx.sdkInfo['sdk-name'] local path = sdkInfo.path local version = sdkInfo.version @@ -80,6 +83,7 @@ end --- @param ctx table Empty table used as context, for future extension --- @return table Descriptions of available versions and accompanying tool descriptions function PLUGIN:Available(ctx) + local runtimeVersion = ctx.runtimeVersion return { { version = "xxxx", @@ -102,6 +106,7 @@ end function PLUGIN:EnvKeys(ctx) --- this variable is same as ctx.sdkInfo['plugin-name'].path local mainPath = ctx.path + local runtimeVersion = ctx.runtimeVersion local sdkInfo = ctx.sdkInfo['sdk-name'] local path = sdkInfo.path local version = sdkInfo.version