summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2016-10-25 18:49:42 +0200
committerMattes D <github@xoft.cz>2016-10-25 18:49:58 +0200
commit5552feafca3cd3d39a20074dbd0b85f0220f0140 (patch)
tree925e6808077ae1d32fe3017601274f2823e56d18
parentMerge pull request #3410 from cuberite/message_json (diff)
downloadcuberite-5552feafca3cd3d39a20074dbd0b85f0220f0140.tar
cuberite-5552feafca3cd3d39a20074dbd0b85f0220f0140.tar.gz
cuberite-5552feafca3cd3d39a20074dbd0b85f0220f0140.tar.bz2
cuberite-5552feafca3cd3d39a20074dbd0b85f0220f0140.tar.lz
cuberite-5552feafca3cd3d39a20074dbd0b85f0220f0140.tar.xz
cuberite-5552feafca3cd3d39a20074dbd0b85f0220f0140.tar.zst
cuberite-5552feafca3cd3d39a20074dbd0b85f0220f0140.zip
-rwxr-xr-xCIbuild.sh5
-rw-r--r--Server/Plugins/APIDump/main_APIDump.lua43
2 files changed, 26 insertions, 22 deletions
diff --git a/CIbuild.sh b/CIbuild.sh
index d652f1d36..93c238b4c 100755
--- a/CIbuild.sh
+++ b/CIbuild.sh
@@ -19,6 +19,7 @@ make -j 2 test ARGS="-V";
echo "Testing..."
cd Server/;
+touch apiCheckFailed.flag
if [ "$TRAVIS_CUBERITE_BUILD_TYPE" != "COVERAGE" ]; then
$CUBERITE_PATH << EOF
load APIDump
@@ -36,4 +37,8 @@ EOF
cat ./DuplicateDocs.txt
exit 1
fi
+ if [ -f ./apiCheckFailed.flag ]; then
+ echo "ERROR: API check has failed with an unknown error"
+ exit 1
+ fi
fi
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