diff options
author | Mattes D <github@xoft.cz> | 2016-10-26 11:08:58 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-26 11:08:58 +0200 |
commit | 471ae7e47b0567e6af61add708805692ca89d681 (patch) | |
tree | 925e6808077ae1d32fe3017601274f2823e56d18 /Server/Plugins/APIDump | |
parent | Merge pull request #3410 from cuberite/message_json (diff) | |
parent | CI: API test defaults to failure, unless explicitly succeeded. (diff) | |
download | cuberite-471ae7e47b0567e6af61add708805692ca89d681.tar cuberite-471ae7e47b0567e6af61add708805692ca89d681.tar.gz cuberite-471ae7e47b0567e6af61add708805692ca89d681.tar.bz2 cuberite-471ae7e47b0567e6af61add708805692ca89d681.tar.lz cuberite-471ae7e47b0567e6af61add708805692ca89d681.tar.xz cuberite-471ae7e47b0567e6af61add708805692ca89d681.tar.zst cuberite-471ae7e47b0567e6af61add708805692ca89d681.zip |
Diffstat (limited to '')
-rw-r--r-- | Server/Plugins/APIDump/main_APIDump.lua | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/Server/Plugins/APIDump/main_APIDump.lua b/Server/Plugins/APIDump/main_APIDump.lua index c2d70734d..df2d933f8 100644 --- a/Server/Plugins/APIDump/main_APIDump.lua +++ b/Server/Plugins/APIDump/main_APIDump.lua @@ -26,29 +26,25 @@ local function LoadAPIFiles(a_Folder, a_DstTable) local FileName = Folder .. fnam; -- We only want .lua files from the folder: if (cFile:IsFile(FileName) and fnam:match(".*%.lua$")) then - local TablesFn, Err = loadfile(FileName); - if (type(TablesFn) ~= "function") then - LOGWARNING("Cannot load API descriptions from " .. FileName .. ", Lua error '" .. Err .. "'."); - else - local Tables = TablesFn(); - if (type(Tables) ~= "table") then - LOGWARNING("Cannot load API descriptions from " .. FileName .. ", returned object is not a table (" .. type(Tables) .. ")."); - break - end - for k, cls in pairs(Tables) do - if (a_DstTable[k]) then - -- The class is documented in two files, warn and store into a file (so that CIs can mark build as failure): - LOGWARNING(string.format( - "APIDump warning: class %s is documented at two places, the documentation in file %s will overwrite the previously loaded one!", - k, FileName - )) - local f = io.open("DuplicateDocs.txt", "a") - f:write(k, "\t", FileName) - f:close() - end - a_DstTable[k] = cls; + local TablesFn = assert(loadfile(FileName)) + local Tables = TablesFn() + if (type(Tables) ~= "table") then + error("Cannot load API descriptions from " .. FileName .. ", returned object is not a table (" .. type(Tables) .. ").") + break + end + for k, cls in pairs(Tables) do + if (a_DstTable[k]) then + -- The class is documented in two files, warn and store into a file (so that CIs can mark build as failure): + LOGWARNING(string.format( + "APIDump warning: class %s is documented at two places, the documentation in file %s will overwrite the previously loaded one!", + k, FileName + )) + local f = io.open("DuplicateDocs.txt", "a") + f:write(k, "\t", FileName) + f:close() end - end -- if (TablesFn) + a_DstTable[k] = cls + end end -- if (is lua file) end -- for fnam - Folder[] end @@ -2040,6 +2036,9 @@ local function HandleCmdApiCheck(a_Split, a_EntireCmd) return true, "Found new undocumented symbols:\n" .. table.concat(newUndocumented, "\n") end + -- The check completed successfully, remove the "test failed" flag from the filesystem: + cFile:DeleteFile("apiCheckFailed.flag") + return true, "API check completed successfully" end |