From e1a0462c08a0dd0e4c3162e9b49f5c0bfa826142 Mon Sep 17 00:00:00 2001 From: lihan Date: Thu, 7 Mar 2024 14:03:56 +0800 Subject: [PATCH 1/3] bugfix(plugin): following 9151cf2451d12c55c8324f337a235add8013e33f#r139483858 --- internal/plugin.go | 2 +- template.lua | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/plugin.go b/internal/plugin.go index d1bd94b1..3175aeaf 100644 --- a/internal/plugin.go +++ b/internal/plugin.go @@ -280,7 +280,7 @@ func (l *LuaPlugin) EnvKeys(sdkPackage *Package) (env.Envs, error) { mainInfo := sdkPackage.Main sdkArr := L.NewTable() sdkTable := l.createSdkInfoTable(mainInfo) - L.SetField(sdkArr, mainInfo.Name, sdkTable) + L.SetField(sdkArr, "main", sdkTable) for _, v := range sdkPackage.Additions { sdkTable := l.createSdkInfoTable(v) L.SetField(sdkArr, v.Name, sdkTable) diff --git a/template.lua b/template.lua index 5e8dde8b..ef0eba3c 100644 --- a/template.lua +++ b/template.lua @@ -106,6 +106,10 @@ function PLUGIN:EnvKeys(ctx) --- this variable is same as ctx.sdkInfo['plugin-name'].path local mainPath = ctx.path local runtimeVersion = ctx.runtimeVersion + local mainSdkInfo = ctx.main + local mpath = mainSdkInfo.path + local mversion = mainSdkInfo.version + local mname = mainSdkInfo.name local sdkInfo = ctx.sdkInfo['sdk-name'] local path = sdkInfo.path local version = sdkInfo.version From 1ec5bc08f562ca8b50bf66270ea6580139074422 Mon Sep 17 00:00:00 2001 From: lihan Date: Thu, 7 Mar 2024 14:04:48 +0800 Subject: [PATCH 2/3] bugfix(plugin): following 9151cf2451d12c55c8324f337a235add8013e33f#r139483858 --- internal/plugin.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/plugin.go b/internal/plugin.go index 3175aeaf..9522946c 100644 --- a/internal/plugin.go +++ b/internal/plugin.go @@ -280,12 +280,12 @@ func (l *LuaPlugin) EnvKeys(sdkPackage *Package) (env.Envs, error) { mainInfo := sdkPackage.Main sdkArr := L.NewTable() sdkTable := l.createSdkInfoTable(mainInfo) - L.SetField(sdkArr, "main", sdkTable) for _, v := range sdkPackage.Additions { sdkTable := l.createSdkInfoTable(v) L.SetField(sdkArr, v.Name, sdkTable) } ctxTable := L.NewTable() + L.SetField(ctxTable, "main", sdkTable) L.SetField(ctxTable, "sdkInfo", sdkArr) L.SetField(ctxTable, "runtimeVersion", lua.LString(RuntimeVersion)) // TODO Will be deprecated in future versions From 2956e3525f02ce446d147380f527cfe1d6852b78 Mon Sep 17 00:00:00 2001 From: lihan Date: Thu, 7 Mar 2024 14:05:13 +0800 Subject: [PATCH 3/3] bugfix(plugin): following 9151cf2451d12c55c8324f337a235add8013e33f#r139483858 --- internal/plugin.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/plugin.go b/internal/plugin.go index 9522946c..5290ad47 100644 --- a/internal/plugin.go +++ b/internal/plugin.go @@ -279,12 +279,12 @@ func (l *LuaPlugin) EnvKeys(sdkPackage *Package) (env.Envs, error) { L := l.state mainInfo := sdkPackage.Main sdkArr := L.NewTable() - sdkTable := l.createSdkInfoTable(mainInfo) for _, v := range sdkPackage.Additions { sdkTable := l.createSdkInfoTable(v) L.SetField(sdkArr, v.Name, sdkTable) } ctxTable := L.NewTable() + sdkTable := l.createSdkInfoTable(mainInfo) L.SetField(ctxTable, "main", sdkTable) L.SetField(ctxTable, "sdkInfo", sdkArr) L.SetField(ctxTable, "runtimeVersion", lua.LString(RuntimeVersion))