Merge remote-tracking branch 'dfhack/develop' into remote_reader
commit
5e95bd9cf2
@ -0,0 +1,350 @@
|
||||
{
|
||||
"environments": [
|
||||
{
|
||||
"environment": "msvc_2015_x86",
|
||||
"PATH": "${env.ProgramFiles(x86)}\\Microsoft Visual Studio 14.0\\VC\\BIN\\amd64_x86;${env.ProgramFiles(x86)}\\Microsoft Visual Studio 14.0\\VC\\BIN\\amd64;${env.ProgramFiles(x86)}\\Windows Kits\\10\\bin\\x86;${env.ProgramFiles(x86)}\\Windows Kits\\8.1\\bin\\x86;${env.PATH}",
|
||||
"VS140COMNTOOLS": "${env.ProgramFiles(x86)}\\Microsoft Visual Studio 14.0\\Common7\\Tools\\",
|
||||
"VCINSTALLDIR": "${env.ProgramFiles(x86)}\\Microsoft Visual Studio 14.0\\VC\\",
|
||||
"WindowsSdkDir": "${env.ProgramFiles(x86)}\\Windows Kits\\10\\",
|
||||
"UCRTVersion": "10.0.10240.0",
|
||||
"UniversalCRTSdkDir": "${env.ProgramFiles(x86)}\\Windows Kits\\10\\",
|
||||
"LIB": "${env.ProgramFiles(x86)}\\Microsoft Visual Studio 14.0\\VC\\LIB;${env.ProgramFiles(x86)}\\Windows Kits\\10\\lib\\10.0.10240.0\\ucrt\\x86;${env.ProgramFiles(x86)}\\Windows Kits\\10\\lib\\um\\x86;${env.ProgramFiles(x86)}\\Windows Kits\\8.1\\Lib\\winv6.3\\um\\x86",
|
||||
"INCLUDE": "${env.ProgramFiles(x86)}\\Microsoft Visual Studio 14.0\\VC\\INCLUDE;${env.ProgramFiles(x86)}\\Windows Kits\\10\\include\\10.0.10240.0\\ucrt;${env.ProgramFiles(x86)}\\Windows Kits\\10\\include\\shared;${env.ProgramFiles(x86)}\\Windows Kits\\10\\include\\um;${env.ProgramFiles(x86)}\\Windows Kits\\10\\include\\winrt;${env.ProgramFiles(x86)}\\Windows Kits\\8.1\\Include\\um;${env.ProgramFiles(x86)}\\Windows Kits\\8.1\\Include\\shared",
|
||||
"LIBPATH": "${env.ProgramFiles(x86)}\\Microsoft Visual Studio 14.0\\VC\\LIB"
|
||||
},
|
||||
{
|
||||
"environment": "msvc_2015_x64",
|
||||
"PATH": "${env.ProgramFiles(x86)}\\Microsoft Visual Studio 14.0\\VC\\BIN\\amd64;${env.ProgramFiles(x86)}\\Microsoft Visual Studio 14.0\\VC\\BIN;${env.ProgramFiles(x86)}\\Microsoft Visual Studio 14.0\\VC\\BIN\\1033;${env.ProgramFiles(x86)}\\Windows Kits\\bin\\x64;${env.ProgramFiles(x86)}\\Windows Kits\\8.1\\bin\\x64;${env.PATH}",
|
||||
"VS140COMNTOOLS": "${env.ProgramFiles(x86)}\\Microsoft Visual Studio 14.0\\Common7\\Tools\\",
|
||||
"VCINSTALLDIR": "${env.ProgramFiles(x86)}\\Microsoft Visual Studio 14.0\\VC\\",
|
||||
"WindowsSdkDir": "${env.ProgramFiles(x86)}\\Windows Kits\\10\\",
|
||||
"UCRTVersion": "10.0.10240.0",
|
||||
"UniversalCRTSdkDir": "${env.ProgramFiles(x86)}\\Windows Kits\\10\\",
|
||||
"LIB": "${env.ProgramFiles(x86)}\\Microsoft Visual Studio 14.0\\VC\\LIB\\amd64;${env.ProgramFiles(x86)}\\Windows Kits\\10\\lib\\10.0.10240.0\\ucrt\\x64;${env.ProgramFiles(x86)}\\Windows Kits\\10\\lib\\um\\x64;${env.ProgramFiles(x86)}\\Windows Kits\\8.1\\Lib\\winv6.3\\um\\x64",
|
||||
"INCLUDE": "${env.ProgramFiles(x86)}\\Microsoft Visual Studio 14.0\\VC\\INCLUDE;${env.ProgramFiles(x86)}\\Windows Kits\\10\\include\\10.0.10240.0\\ucrt;${env.ProgramFiles(x86)}\\Windows Kits\\10\\include\\shared;${env.ProgramFiles(x86)}\\Windows Kits\\10\\include\\um;${env.ProgramFiles(x86)}\\Windows Kits\\10\\include\\winrt;${env.ProgramFiles(x86)}\\Windows Kits\\8.1\\Include\\um;${env.ProgramFiles(x86)}\\Windows Kits\\8.1\\Include\\shared",
|
||||
"LIBPATH": "${env.ProgramFiles(x86)}\\Microsoft Visual Studio 14.0\\VC\\LIB\\amd64"
|
||||
}
|
||||
],
|
||||
"configurations": [
|
||||
{
|
||||
"name": "MSVC 32 Debug",
|
||||
"generator": "Ninja",
|
||||
"configurationType": "RelWithDebInfo",
|
||||
"inheritEnvironments": [ "msvc_x86_x64", "msvc_2015_x86" ],
|
||||
"variables": [
|
||||
{
|
||||
"name": "DFHACK_BUILD_ARCH",
|
||||
"value": "32"
|
||||
},
|
||||
{
|
||||
"name": "BUILD_STONESENSE",
|
||||
"value": "1"
|
||||
},
|
||||
{
|
||||
"name": "REMOVE_SYMBOLS_FROM_DF_STUBS",
|
||||
"value": "0"
|
||||
},
|
||||
{
|
||||
"name": "DFHACK_INCLUDE_CORE",
|
||||
"value": "1"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "MSVC 32 Release",
|
||||
"generator": "Ninja",
|
||||
"configurationType": "Release",
|
||||
"inheritEnvironments": [ "msvc_x86_x64", "msvc_2015_x86" ],
|
||||
"variables": [
|
||||
{
|
||||
"name": "DFHACK_BUILD_ARCH",
|
||||
"value": "32"
|
||||
},
|
||||
{
|
||||
"name": "BUILD_STONESENSE",
|
||||
"value": "1"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "MSVC 64 Debug",
|
||||
"generator": "Ninja",
|
||||
"configurationType": "RelWithDebInfo",
|
||||
"inheritEnvironments": [ "msvc_x64_x64", "msvc_2015_x64" ],
|
||||
"variables": [
|
||||
{
|
||||
"name": "DFHACK_BUILD_ARCH",
|
||||
"value": "64"
|
||||
},
|
||||
{
|
||||
"name": "BUILD_STONESENSE",
|
||||
"value": "1"
|
||||
},
|
||||
{
|
||||
"name": "REMOVE_SYMBOLS_FROM_DF_STUBS",
|
||||
"value": "0"
|
||||
},
|
||||
{
|
||||
"name": "DFHACK_INCLUDE_CORE",
|
||||
"value": "1"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "MSVC 64 Release",
|
||||
"generator": "Ninja",
|
||||
"configurationType": "Release",
|
||||
"inheritEnvironments": [ "msvc_x64_x64", "msvc_2015_x64" ],
|
||||
"variables": [
|
||||
{
|
||||
"name": "DFHACK_BUILD_ARCH",
|
||||
"value": "64"
|
||||
},
|
||||
{
|
||||
"name": "BUILD_STONESENSE",
|
||||
"value": "1"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "GCC 32 Debug",
|
||||
"remoteMachineName": "${defaultRemoteMachineName}",
|
||||
"remoteCMakeListsRoot": "/tmp/dfhack-${workspaceHash}/src",
|
||||
"remoteBuildRoot": "/tmp/dfhack-${workspaceHash}/debug-32",
|
||||
"rsyncCommandArgs": "--exclude=build --include=.git",
|
||||
"remoteCopySources": true,
|
||||
"cmakeExecutable": "$(which cmake)/..",
|
||||
"generator": "Ninja",
|
||||
"configurationType": "RelWithDebInfo",
|
||||
"intelliSenseMode": "linux-gcc-x86",
|
||||
"variables": [
|
||||
{
|
||||
"name": "DFHACK_BUILD_ARCH",
|
||||
"value": "32"
|
||||
},
|
||||
{
|
||||
"name": "BUILD_STONESENSE",
|
||||
"value": "1"
|
||||
},
|
||||
{
|
||||
"name": "REMOVE_SYMBOLS_FROM_DF_STUBS",
|
||||
"value": "0"
|
||||
},
|
||||
{
|
||||
"name": "DFHACK_INCLUDE_CORE",
|
||||
"value": "1"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "GCC 32 Release",
|
||||
"remoteMachineName": "${defaultRemoteMachineName}",
|
||||
"remoteCMakeListsRoot": "/tmp/dfhack-${workspaceHash}/src",
|
||||
"remoteBuildRoot": "/tmp/dfhack-${workspaceHash}/release-32",
|
||||
"rsyncCommandArgs": "--exclude=build --include=.git",
|
||||
"remoteCopySources": true,
|
||||
"cmakeExecutable": "$(which cmake)/..",
|
||||
"generator": "Ninja",
|
||||
"configurationType": "Release",
|
||||
"intelliSenseMode": "linux-gcc-x86",
|
||||
"variables": [
|
||||
{
|
||||
"name": "DFHACK_BUILD_ARCH",
|
||||
"value": "32"
|
||||
},
|
||||
{
|
||||
"name": "BUILD_STONESENSE",
|
||||
"value": "1"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "GCC 64 Debug",
|
||||
"remoteMachineName": "${defaultRemoteMachineName}",
|
||||
"remoteCMakeListsRoot": "/tmp/dfhack-${workspaceHash}/src",
|
||||
"remoteBuildRoot": "/tmp/dfhack-${workspaceHash}/debug-64",
|
||||
"rsyncCommandArgs": "--exclude=build --include=.git",
|
||||
"remoteCopySources": true,
|
||||
"cmakeExecutable": "$(which cmake)/..",
|
||||
"generator": "Ninja",
|
||||
"configurationType": "RelWithDebInfo",
|
||||
"intelliSenseMode": "linux-gcc-x64",
|
||||
"variables": [
|
||||
{
|
||||
"name": "DFHACK_BUILD_ARCH",
|
||||
"value": "64"
|
||||
},
|
||||
{
|
||||
"name": "BUILD_STONESENSE",
|
||||
"value": "1"
|
||||
},
|
||||
{
|
||||
"name": "REMOVE_SYMBOLS_FROM_DF_STUBS",
|
||||
"value": "0"
|
||||
},
|
||||
{
|
||||
"name": "DFHACK_INCLUDE_CORE",
|
||||
"value": "1"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "GCC 64 Release",
|
||||
"remoteMachineName": "${defaultRemoteMachineName}",
|
||||
"remoteCMakeListsRoot": "/tmp/dfhack-${workspaceHash}/src",
|
||||
"remoteBuildRoot": "/tmp/dfhack-${workspaceHash}/release-64",
|
||||
"rsyncCommandArgs": "--exclude=build --include=.git",
|
||||
"remoteCopySources": true,
|
||||
"cmakeExecutable": "$(which cmake)/..",
|
||||
"generator": "Ninja",
|
||||
"configurationType": "Release",
|
||||
"intelliSenseMode": "linux-gcc-x64",
|
||||
"variables": [
|
||||
{
|
||||
"name": "DFHACK_BUILD_ARCH",
|
||||
"value": "64"
|
||||
},
|
||||
{
|
||||
"name": "BUILD_STONESENSE",
|
||||
"value": "1"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "GCC 4.8 32 Debug",
|
||||
"remoteMachineName": "${defaultRemoteMachineName}",
|
||||
"remoteCMakeListsRoot": "/tmp/dfhack-${workspaceHash}/src",
|
||||
"remoteBuildRoot": "/tmp/dfhack-${workspaceHash}/debug-32-48",
|
||||
"rsyncCommandArgs": "--exclude=build --include=.git",
|
||||
"remoteCopySources": true,
|
||||
"cmakeExecutable": "$(which cmake)/..",
|
||||
"generator": "Ninja",
|
||||
"configurationType": "RelWithDebInfo",
|
||||
"intelliSenseMode": "linux-gcc-x86",
|
||||
"variables": [
|
||||
{
|
||||
"name": "CMAKE_C_COMPILER",
|
||||
"value": "gcc-4.8"
|
||||
},
|
||||
{
|
||||
"name": "CMAKE_CXX_COMPILER",
|
||||
"value": "g++-4.8"
|
||||
},
|
||||
{
|
||||
"name": "DFHACK_BUILD_ARCH",
|
||||
"value": "32"
|
||||
},
|
||||
{
|
||||
"name": "BUILD_STONESENSE",
|
||||
"value": "1"
|
||||
},
|
||||
{
|
||||
"name": "REMOVE_SYMBOLS_FROM_DF_STUBS",
|
||||
"value": "0"
|
||||
},
|
||||
{
|
||||
"name": "DFHACK_INCLUDE_CORE",
|
||||
"value": "1"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "GCC 4.8 32 Release",
|
||||
"remoteMachineName": "${defaultRemoteMachineName}",
|
||||
"remoteCMakeListsRoot": "/tmp/dfhack-${workspaceHash}/src",
|
||||
"remoteBuildRoot": "/tmp/dfhack-${workspaceHash}/release-32-48",
|
||||
"rsyncCommandArgs": "--exclude=build --include=.git",
|
||||
"remoteCopySources": true,
|
||||
"cmakeExecutable": "$(which cmake)/..",
|
||||
"generator": "Ninja",
|
||||
"configurationType": "Release",
|
||||
"intelliSenseMode": "linux-gcc-x86",
|
||||
"variables": [
|
||||
{
|
||||
"name": "CMAKE_C_COMPILER",
|
||||
"value": "gcc-4.8"
|
||||
},
|
||||
{
|
||||
"name": "CMAKE_CXX_COMPILER",
|
||||
"value": "g++-4.8"
|
||||
},
|
||||
{
|
||||
"name": "DFHACK_BUILD_ARCH",
|
||||
"value": "32"
|
||||
},
|
||||
{
|
||||
"name": "BUILD_STONESENSE",
|
||||
"value": "1"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "GCC 4.8 64 Debug",
|
||||
"remoteMachineName": "${defaultRemoteMachineName}",
|
||||
"remoteCMakeListsRoot": "/tmp/dfhack-${workspaceHash}/src",
|
||||
"remoteBuildRoot": "/tmp/dfhack-${workspaceHash}/debug-64-48",
|
||||
"rsyncCommandArgs": "--exclude=build --include=.git",
|
||||
"remoteCopySources": true,
|
||||
"cmakeExecutable": "$(which cmake)/..",
|
||||
"generator": "Ninja",
|
||||
"configurationType": "RelWithDebInfo",
|
||||
"intelliSenseMode": "linux-gcc-x64",
|
||||
"variables": [
|
||||
{
|
||||
"name": "CMAKE_C_COMPILER",
|
||||
"value": "gcc-4.8"
|
||||
},
|
||||
{
|
||||
"name": "CMAKE_CXX_COMPILER",
|
||||
"value": "g++-4.8"
|
||||
},
|
||||
{
|
||||
"name": "DFHACK_BUILD_ARCH",
|
||||
"value": "64"
|
||||
},
|
||||
{
|
||||
"name": "BUILD_STONESENSE",
|
||||
"value": "1"
|
||||
},
|
||||
{
|
||||
"name": "REMOVE_SYMBOLS_FROM_DF_STUBS",
|
||||
"value": "0"
|
||||
},
|
||||
{
|
||||
"name": "DFHACK_INCLUDE_CORE",
|
||||
"value": "1"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "GCC 4.8 64 Release",
|
||||
"remoteMachineName": "${defaultRemoteMachineName}",
|
||||
"remoteCMakeListsRoot": "/tmp/dfhack-${workspaceHash}/src",
|
||||
"remoteBuildRoot": "/tmp/dfhack-${workspaceHash}/release-64-48",
|
||||
"rsyncCommandArgs": "--exclude=build --include=.git",
|
||||
"remoteCopySources": true,
|
||||
"cmakeExecutable": "$(which cmake)/..",
|
||||
"generator": "Ninja",
|
||||
"configurationType": "Release",
|
||||
"intelliSenseMode": "linux-gcc-x64",
|
||||
"variables": [
|
||||
{
|
||||
"name": "CMAKE_C_COMPILER",
|
||||
"value": "gcc-4.8"
|
||||
},
|
||||
{
|
||||
"name": "CMAKE_CXX_COMPILER",
|
||||
"value": "g++-4.8"
|
||||
},
|
||||
{
|
||||
"name": "DFHACK_BUILD_ARCH",
|
||||
"value": "64"
|
||||
},
|
||||
{
|
||||
"name": "BUILD_STONESENSE",
|
||||
"value": "1"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1 @@
|
||||
git-describe.cmake
|
@ -1,52 +0,0 @@
|
||||
if(NOT EXISTS ${dfhack_SOURCE_DIR}/.git/index OR NOT EXISTS ${dfhack_SOURCE_DIR}/.git/modules/library/xml/index)
|
||||
MESSAGE(FATAL_ERROR "Could not find git index file(s)")
|
||||
endif()
|
||||
|
||||
set(git_describe_tmp_h ${dfhack_SOURCE_DIR}/library/include/git-describe.tmp.h)
|
||||
set(git_describe_h ${dfhack_SOURCE_DIR}/library/include/git-describe.h)
|
||||
|
||||
if(EXISTS ${git_describe_tmp_h} AND
|
||||
NOT(${dfhack_SOURCE_DIR}/.git/index IS_NEWER_THAN ${git_describe_tmp_h}) AND
|
||||
NOT(${dfhack_SOURCE_DIR}/.git/modules/library/xml/index IS_NEWER_THAN ${git_describe_tmp_h}) AND
|
||||
NOT(${dfhack_SOURCE_DIR}/library/git-describe.cmake IS_NEWER_THAN ${git_describe_tmp_h}))
|
||||
return()
|
||||
endif()
|
||||
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} describe --tags --abbrev=8 --long
|
||||
WORKING_DIRECTORY "${dfhack_SOURCE_DIR}"
|
||||
OUTPUT_VARIABLE DFHACK_GIT_DESCRIPTION)
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
|
||||
WORKING_DIRECTORY "${dfhack_SOURCE_DIR}"
|
||||
OUTPUT_VARIABLE DFHACK_GIT_COMMIT)
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} describe --tags --abbrev=8 --exact-match
|
||||
WORKING_DIRECTORY "${dfhack_SOURCE_DIR}"
|
||||
RESULT_VARIABLE DFHACK_GIT_TAGGED_RESULT
|
||||
OUTPUT_QUIET ERROR_QUIET)
|
||||
|
||||
# Check library/xml for matching commits
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse HEAD:library/xml
|
||||
WORKING_DIRECTORY "${dfhack_SOURCE_DIR}"
|
||||
OUTPUT_VARIABLE DFHACK_GIT_XML_EXPECTED_COMMIT)
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
|
||||
WORKING_DIRECTORY "${dfhack_SOURCE_DIR}/library/xml"
|
||||
OUTPUT_VARIABLE DFHACK_GIT_XML_COMMIT)
|
||||
|
||||
file(WRITE ${git_describe_tmp_h} "")
|
||||
|
||||
macro(git_describe_definition var)
|
||||
string(STRIP "${${var}}" GIT_DEF_VALUE)
|
||||
file(APPEND ${git_describe_tmp_h} "#define ${var} \"${GIT_DEF_VALUE}\"\n")
|
||||
endmacro()
|
||||
|
||||
git_describe_definition(DFHACK_GIT_DESCRIPTION)
|
||||
git_describe_definition(DFHACK_GIT_COMMIT)
|
||||
git_describe_definition(DFHACK_GIT_XML_EXPECTED_COMMIT)
|
||||
git_describe_definition(DFHACK_GIT_XML_COMMIT)
|
||||
if(${DFHACK_GIT_TAGGED_RESULT} EQUAL 0)
|
||||
file(APPEND ${git_describe_tmp_h} "#define DFHACK_GIT_TAGGED\n")
|
||||
endif()
|
||||
if(${DFHACK_GIT_XML_COMMIT} STREQUAL ${DFHACK_GIT_XML_EXPECTED_COMMIT})
|
||||
file(APPEND ${git_describe_tmp_h} "#define DFHACK_GIT_XML_MATCH\n")
|
||||
endif()
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
${git_describe_tmp_h} ${git_describe_h})
|
@ -0,0 +1,39 @@
|
||||
# Generated from git-describe.cmake.in
|
||||
set(DFHACK_BUILD_ID "@DFHACK_BUILD_ID@")
|
||||
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} describe --tags --abbrev=8 --long
|
||||
WORKING_DIRECTORY "${dfhack_SOURCE_DIR}"
|
||||
OUTPUT_VARIABLE DFHACK_GIT_DESCRIPTION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
|
||||
WORKING_DIRECTORY "${dfhack_SOURCE_DIR}"
|
||||
OUTPUT_VARIABLE DFHACK_GIT_COMMIT
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} describe --tags --abbrev=8 --exact-match
|
||||
WORKING_DIRECTORY "${dfhack_SOURCE_DIR}"
|
||||
RESULT_VARIABLE DFHACK_GIT_TAGGED_RESULT
|
||||
OUTPUT_QUIET ERROR_QUIET)
|
||||
|
||||
# Check library/xml for matching commits
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse HEAD:library/xml
|
||||
WORKING_DIRECTORY "${dfhack_SOURCE_DIR}"
|
||||
OUTPUT_VARIABLE DFHACK_GIT_XML_EXPECTED_COMMIT
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
|
||||
WORKING_DIRECTORY "${dfhack_SOURCE_DIR}/library/xml"
|
||||
OUTPUT_VARIABLE DFHACK_GIT_XML_COMMIT
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
if(${DFHACK_GIT_TAGGED_RESULT} EQUAL 0)
|
||||
set(DFHACK_GIT_TAGGED TRUE)
|
||||
else()
|
||||
set(DFHACK_GIT_TAGGED FALSE)
|
||||
endif()
|
||||
|
||||
if(${DFHACK_GIT_XML_COMMIT} STREQUAL ${DFHACK_GIT_XML_EXPECTED_COMMIT})
|
||||
set(DFHACK_GIT_XML_MATCH TRUE)
|
||||
else()
|
||||
set(DFHACK_GIT_XML_MATCH FALSE)
|
||||
endif()
|
||||
|
||||
configure_file(${dfhack_SOURCE_DIR}/library/include/git-describe.h.in ${dfhack_SOURCE_DIR}/library/include/git-describe.h)
|
@ -1 +1 @@
|
||||
git-describe.*
|
||||
git-describe.h
|
||||
|
@ -0,0 +1,7 @@
|
||||
#cmakedefine DFHACK_GIT_DESCRIPTION "@DFHACK_GIT_DESCRIPTION@"
|
||||
#cmakedefine DFHACK_GIT_COMMIT "@DFHACK_GIT_COMMIT@"
|
||||
#cmakedefine DFHACK_GIT_XML_EXPECTED_COMMIT "@DFHACK_GIT_XML_EXPECTED_COMMIT@"
|
||||
#cmakedefine DFHACK_GIT_XML_COMMIT "@DFHACK_GIT_XML_COMMIT@"
|
||||
#define DFHACK_BUILD_ID "@DFHACK_BUILD_ID@"
|
||||
#cmakedefine DFHACK_GIT_TAGGED
|
||||
#cmakedefine DFHACK_GIT_XML_MATCH
|
@ -1 +1 @@
|
||||
Subproject commit 372993c58851153320f3390119cdd2d97caef9db
|
||||
Subproject commit 57928311390bb67fe0cd5deec14e2d4621b13a58
|
@ -1,3 +0,0 @@
|
||||
# You can add custom plugins here to avoid touching plugins/CMakeLists.txt,
|
||||
# This can be useful if you've made modifications to that file and try to
|
||||
# switch between branches that have also made modifications to it.
|
@ -1 +1 @@
|
||||
Subproject commit 6849148e8694f5da415cd6920dd9094c352110de
|
||||
Subproject commit 66b39d888e5f2d4f5c194ece08ba62ac7f110478
|
@ -0,0 +1,25 @@
|
||||
function test.getCurViewscreen()
|
||||
local scr = dfhack.gui.getCurViewscreen()
|
||||
local scr2 = df.global.gview.view
|
||||
for i = 1, 100 do
|
||||
if scr2.child then
|
||||
scr2 = scr2.child
|
||||
else
|
||||
break
|
||||
end
|
||||
end
|
||||
expect.eq(scr, scr2)
|
||||
end
|
||||
|
||||
function test.getViewscreenByType()
|
||||
local scr = dfhack.gui.getCurViewscreen()
|
||||
local scr2 = dfhack.gui.getViewscreenByType(scr._type)
|
||||
expect.eq(scr, scr2)
|
||||
|
||||
local bad_type = df.viewscreen_titlest
|
||||
if scr._type == bad_type then
|
||||
bad_type = df.viewscreen_optionst
|
||||
end
|
||||
local scr_bad = dfhack.gui.getViewscreenByType(bad_type)
|
||||
expect.eq(scr_bad, nil)
|
||||
end
|
@ -0,0 +1,15 @@
|
||||
local utils = require 'utils'
|
||||
|
||||
function test.OrderedTable()
|
||||
local t = utils.OrderedTable()
|
||||
local keys = {'a', 'c', 'e', 'd', 'b', 'q', 58, -1.2}
|
||||
for i = 1, #keys do
|
||||
t[keys[i]] = i
|
||||
end
|
||||
local i = 1
|
||||
for k, v in pairs(t) do
|
||||
expect.eq(k, keys[i], 'key order')
|
||||
expect.eq(v, i, 'correct value')
|
||||
i = i + 1
|
||||
end
|
||||
end
|
@ -1,10 +1,172 @@
|
||||
local script = require 'gui.script'
|
||||
local utils = require 'utils'
|
||||
|
||||
local args = {...}
|
||||
local done_command = args[1]
|
||||
|
||||
expect = {}
|
||||
function expect.true_(value, comment)
|
||||
return not not value, comment, 'expected true'
|
||||
end
|
||||
function expect.false_(value, comment)
|
||||
return not value, comment, 'expected false'
|
||||
end
|
||||
function expect.eq(a, b, comment)
|
||||
return a == b, comment, ('%s ~= %s'):format(a, b)
|
||||
end
|
||||
function expect.ne(a, b, comment)
|
||||
return a ~= b, comment, ('%s == %s'):format(a, b)
|
||||
end
|
||||
function expect.error(func, ...)
|
||||
local ok, ret = pcall(func, ...)
|
||||
if ok then
|
||||
return false, 'no error raised by function call'
|
||||
else
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
function delay(frames)
|
||||
frames = frames or 1
|
||||
script.sleep(frames, 'frames')
|
||||
end
|
||||
|
||||
function build_test_env()
|
||||
local env = {
|
||||
test = utils.OrderedTable(),
|
||||
expect = {},
|
||||
delay = delay,
|
||||
}
|
||||
local private = {
|
||||
checks = 0,
|
||||
checks_ok = 0,
|
||||
}
|
||||
for name, func in pairs(expect) do
|
||||
env.expect[name] = function(...)
|
||||
private.checks = private.checks + 1
|
||||
local ret = {func(...)}
|
||||
local ok = table.remove(ret, 1)
|
||||
local msg = ''
|
||||
for _, part in pairs(ret) do
|
||||
if part then
|
||||
msg = msg .. ': ' .. tostring(part)
|
||||
end
|
||||
end
|
||||
msg = msg:sub(3) -- strip leading ': '
|
||||
if ok then
|
||||
private.checks_ok = private.checks_ok + 1
|
||||
else
|
||||
dfhack.printerr('Check failed! ' .. (msg or '(no message)'))
|
||||
local info = debug.getinfo(2)
|
||||
dfhack.printerr((' at %s:%d'):format(info.short_src, info.currentline))
|
||||
print('')
|
||||
end
|
||||
end
|
||||
end
|
||||
setmetatable(env, {__index = _G})
|
||||
return env, private
|
||||
end
|
||||
|
||||
function get_test_files()
|
||||
local files = {}
|
||||
for _, entry in ipairs(dfhack.filesystem.listdir_recursive(dfhack.getHackPath() .. 'test')) do
|
||||
if not entry.isdir and not entry.path:match('main.lua') then
|
||||
table.insert(files, entry.path)
|
||||
end
|
||||
end
|
||||
table.sort(files)
|
||||
return files
|
||||
end
|
||||
|
||||
function set_test_stage(stage)
|
||||
local f = io.open('test_stage.txt', 'w')
|
||||
f:write(stage)
|
||||
f:close()
|
||||
end
|
||||
|
||||
print('running tests')
|
||||
function finish_tests(ok)
|
||||
if ok then
|
||||
print('Tests finished')
|
||||
else
|
||||
dfhack.printerr('Tests failed!')
|
||||
end
|
||||
if done_command then
|
||||
dfhack.run_command(done_command)
|
||||
end
|
||||
end
|
||||
|
||||
function main()
|
||||
local files = get_test_files()
|
||||
|
||||
local counts = {
|
||||
tests = 0,
|
||||
tests_ok = 0,
|
||||
checks = 0,
|
||||
checks_ok = 0,
|
||||
file_errors = 0,
|
||||
}
|
||||
local passed = true
|
||||
|
||||
print('Looking for title screen...')
|
||||
for i = 0, 100 do
|
||||
local scr = dfhack.gui.getCurViewscreen()
|
||||
if df.viewscreen_titlest:is_instance(scr) then
|
||||
print('Found title screen')
|
||||
break
|
||||
else
|
||||
scr:feed_key(df.interface_key.LEAVESCREEN)
|
||||
delay(10)
|
||||
end
|
||||
end
|
||||
if not df.viewscreen_titlest:is_instance(dfhack.gui.getCurViewscreen()) then
|
||||
qerror('Could not find title screen')
|
||||
end
|
||||
|
||||
print('Running tests')
|
||||
for _, file in ipairs(files) do
|
||||
print('Running file: ' .. file:sub(file:find('test'), -1))
|
||||
local env, env_private = build_test_env()
|
||||
local code, err = loadfile(file, 't', env)
|
||||
if not code then
|
||||
passed = false
|
||||
counts.file_errors = counts.file_errors + 1
|
||||
dfhack.printerr('Failed to load file: ' .. tostring(err))
|
||||
else
|
||||
local ok, err = pcall(code)
|
||||
if not ok then
|
||||
passed = false
|
||||
counts.file_errors = counts.file_errors + 1
|
||||
dfhack.printerr('Error when running file: ' .. tostring(err))
|
||||
else
|
||||
for name, test in pairs(env.test) do
|
||||
env_private.checks = 0
|
||||
env_private.checks_ok = 0
|
||||
counts.tests = counts.tests + 1
|
||||
local ok, err = pcall(test)
|
||||
if not ok then
|
||||
dfhack.printerr('test errored: ' .. name .. ': ' .. tostring(err))
|
||||
passed = false
|
||||
elseif env_private.checks ~= env_private.checks_ok then
|
||||
dfhack.printerr('test failed: ' .. name)
|
||||
passed = false
|
||||
else
|
||||
print('test passed: ' .. name)
|
||||
counts.tests_ok = counts.tests_ok + 1
|
||||
end
|
||||
counts.checks = counts.checks + (tonumber(env_private.checks) or 0)
|
||||
counts.checks_ok = counts.checks_ok + (tonumber(env_private.checks_ok) or 0)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
print('\nTest summary:')
|
||||
print(('%d/%d tests passed'):format(counts.tests_ok, counts.tests))
|
||||
print(('%d/%d checks passed'):format(counts.checks_ok, counts.checks))
|
||||
print(('%d test files failed to load'):format(counts.file_errors))
|
||||
|
||||
set_test_stage(passed and 'done' or 'fail')
|
||||
finish_tests(passed)
|
||||
end
|
||||
|
||||
set_test_stage('done')
|
||||
dfhack.run_command('die')
|
||||
script.start(main)
|
||||
|
@ -0,0 +1,109 @@
|
||||
import glob
|
||||
import sys
|
||||
|
||||
actual = {'': {}}
|
||||
|
||||
with open(sys.argv[1]) as f:
|
||||
plugin_name = ''
|
||||
for line in f:
|
||||
line = line.rstrip()
|
||||
if line.startswith('// Plugin: '):
|
||||
plugin_name = line.split(' ')[2]
|
||||
if plugin_name not in actual:
|
||||
actual[plugin_name] = {}
|
||||
elif line.startswith('// RPC '):
|
||||
parts = line.split(' ')
|
||||
actual[plugin_name][parts[2]] = (parts[4], parts[6])
|
||||
|
||||
expected = {'': {}}
|
||||
|
||||
for p in glob.iglob('library/proto/*.proto'):
|
||||
with open(p) as f:
|
||||
for line in f:
|
||||
line = line.rstrip()
|
||||
if line.startswith('// RPC '):
|
||||
parts = line.split(' ')
|
||||
expected[''][parts[2]] = (parts[4], parts[6])
|
||||
|
||||
for p in glob.iglob('plugins/proto/*.proto'):
|
||||
plugin_name = ''
|
||||
with open(p) as f:
|
||||
for line in f:
|
||||
line = line.rstrip()
|
||||
if line.startswith('// Plugin: '):
|
||||
plugin_name = line.split(' ')[2]
|
||||
if plugin_name not in expected:
|
||||
expected[plugin_name] = {}
|
||||
break
|
||||
|
||||
if plugin_name == '':
|
||||
continue
|
||||
|
||||
with open(p) as f:
|
||||
for line in f:
|
||||
line = line.rstrip()
|
||||
if line.startswith('// RPC '):
|
||||
parts = line.split(' ')
|
||||
expected[plugin_name][parts[2]] = (parts[4], parts[6])
|
||||
|
||||
error_count = 0
|
||||
|
||||
for plugin_name in actual:
|
||||
methods = actual[plugin_name]
|
||||
|
||||
if plugin_name not in expected:
|
||||
print('Missing documentation for plugin proto files: ' + plugin_name)
|
||||
print('Add the following lines:')
|
||||
print('// Plugin: ' + plugin_name)
|
||||
error_count += 1
|
||||
for m in methods:
|
||||
io = methods[m]
|
||||
print('// RPC ' + m + ' : ' + io[0] + ' -> ' + io[1])
|
||||
error_count += 1
|
||||
else:
|
||||
missing = []
|
||||
wrong = []
|
||||
for m in methods:
|
||||
io = methods[m]
|
||||
if m in expected[plugin_name]:
|
||||
if expected[plugin_name][m] != io:
|
||||
wrong.add('// RPC ' + m + ' : ' + io[0] + ' -> ' + io[1])
|
||||
else:
|
||||
missing.add('// RPC ' + m + ' : ' + io[0] + ' -> ' + io[1])
|
||||
|
||||
if len(missing) > 0:
|
||||
print('Incomplete documentation for ' + ('core' if plugin_name == '' else 'plugin "' + plugin_name + '"') + ' proto files. Add the following lines:')
|
||||
for m in missing:
|
||||
print(m)
|
||||
error_count += 1
|
||||
|
||||
if len(wrong) > 0:
|
||||
print('Incorrect documentation for ' + ('core' if plugin_name == '' else 'plugin "' + plugin_name + '"') + ' proto files. Replace the following comments:')
|
||||
for m in wrong:
|
||||
print(m)
|
||||
error_count += 1
|
||||
|
||||
for plugin_name in expected:
|
||||
methods = expected[plugin_name]
|
||||
|
||||
if plugin_name not in actual:
|
||||
print('Incorrect documentation for plugin proto files: ' + plugin_name)
|
||||
print('The following methods are documented, but the plugin does not provide any RPC methods:')
|
||||
for m in methods:
|
||||
io = methods[m]
|
||||
print('// RPC ' + m + ' : ' + io[0] + ' -> ' + io[1])
|
||||
error_count += 1
|
||||
else:
|
||||
missing = []
|
||||
for m in methods:
|
||||
io = methods[m]
|
||||
if m not in actual[plugin_name]:
|
||||
missing.add('// RPC ' + m + ' : ' + io[0] + ' -> ' + io[1])
|
||||
|
||||
if len(missing) > 0:
|
||||
print('Incorrect documentation for ' + ('core' if plugin_name == '' else 'plugin "' + plugin_name + '"') + ' proto files. Remove the following lines:')
|
||||
for m in missing:
|
||||
print(m)
|
||||
error_count += 1
|
||||
|
||||
sys.exit(min(100, error_count))
|
@ -1,2 +1,4 @@
|
||||
:lua dfhack.internal.addScriptPath(os.getenv('TRAVIS_BUILD_DIR'))
|
||||
test/main
|
||||
devel/dump-rpc dfhack-rpc.txt
|
||||
|
||||
:lua dfhack.internal.addScriptPath(dfhack.getHackPath())
|
||||
test/main die
|
||||
|
Loading…
Reference in New Issue